"A lot of things can go wrong when requesting information over HTTP from a remote web server: requests timeout, servers fail, government operatives cut undersea cables. You get the picture."

Good reminder of how to identify and handle HTTP problems when writing an HTTP Client.


  • Account for DNS lookup failures
  • Set a connection and read timeout
  • Be sure to handle HTTP errors
  • Check that the response has the content type you expect
  • Limit the maximum response size
  • Ensure that private URLs are not requestable
  • Always. Be. SSLing.

Comments (0)

Sign in to post comments.