added error handling and tests to HTTP.pm