Skip to content

How to configure Typhoeus

Garen Torikian edited this page Aug 27, 2020 · 5 revisions

Typhoeus is responsible for the HTTP connection. We can configure much of html-proofers' behavior by configuring Typhoeus. For all of these configurations you will need to call html-proofer from Ruby and you cannot do this using the command-line version of the program.

Read Typhoeus documentation here.

Simple html-proofer ruby example:

TODO MAKE THIS A REAL RUBY FILE

# Normal way to run
HTML::Proofer.new("out/").run

# How to run with Typhoeus changes
typhoeus_configuration = { 
  :timeout => 10,
  :verbose => true 
}
HTML::Proofer.new("out/", {:typhoeus => typhoeus_configuration}).run

TODO: Explain how someone who never used ruby before can get this to run.

TODO: Explain how someone like @ilg-ul can get this working on Travis, see https://github.com/gjtorikian/html-proofer/issues/376

Add request timeouts

This will log timeout failures and stop the connection attempt if no connection is made within 10 seconds.

typhoeus_configuration = { 
  :timeout => 10,
  :verbose => true 
}