summaryrefslogtreecommitdiff
path: root/lib/custodian/protocoltest/http.rb
AgeCommit message (Collapse)Author
2017-09-20Added a User-Agent to our HTTP/HTTPS checks.Steve Kemp
2017-08-08Moved case statement outside timeout block.13-catch-bogus-dnsSteve Kemp
Also removed a redudant `begin`.
2017-08-08Use a case-statement for both kinds of IP-matching.Steve Kemp
2017-08-08Sanity-check DNS on a per-protocol basis.Steve Kemp
When a failure occurs in looking up IPv4 addresses we confirm that, similarly when/if IPv6 lookups fail we confirm that before raising the alert.
2017-08-08Updated to move ignore-dns-failure code into routine.Steve Kemp
That is then tested when resolve-errors are handled.
2017-08-08Ignore bogus DNS results.Steve Kemp
We've had a problem for the past few weeks (?) where we see false DNS errors when making http/https requests with `curb`/`libcurl`. To resolve these issues properly we're going to have to rewrite the code to avoid the current gem. However that is considerable work because of the hole we've back ourself into - wanting to test both IPv4 and IPv6 "properly". We'll have to duplicate that work if we use `net/http`, or even mroe so if we use `open3` and exec `curl -4|-6 ..` For the moment this commit changes how things are handled to deal with the issue we see - which doesn't solve the problem but will mask it. When custodian runs a test it will return a status-code: * Custodian::TestResult::TEST_FAILED * The test failed, such that an alert should be raised. * Custodian::TestResult::TEST_PASSED * The test succeeded, such that any previous alert should be cleared. * Custodian::TestResult::TEST_SKIPPED * Nothing should be done. As the failure we see is very very specific - an exception is thrown of the type `Curl::Err::HostResolutionError` - we can catch that and return `TEST_SKIPPED`. That means that there will be no (urgent) alert. Obviously the potential risk of swallowing all DNS-failures is that a domain might expire and we'd never know. So we'll do a little better than merely skipping the test if there are DNS failures: * If we see a DNS failure. * Then we try to lookup the host as an A & AAAA record. * If that succeeds we decide the issue was bogus. * If that fails then the host legitimately doesn't resolve so we raise an alert. To recap: * If a host fails normally - bogus status-code, or missing text - we behave as we did in the past. * Only in the case of a DNS-error from curb/curl do we go down this horrid path. * Where we try to confirm the error, and swallow it if false. This closes #13.
2017-07-13Alert in more detail on DNS failures.Steve Kemp
2017-07-11Updated to log the exact DNS error.13-log-dns-errorsSteve Kemp
This is part of #13.
2017-04-10Remove username/password prior to testing URL with curb.Steve Kemp
2017-04-10Use standard URL username/password holders.10-support-http-basic-authSteve Kemp
Rather than: with auth 'username:password' We use: http://user:pass@example.com/
2017-03-28Support HTTP BASIC-AUthentication.Steve Kemp
Supply this like so: http://example.com/ must run http with auth 'username:passw0rd' with status 200 otherwise 'failure'
2016-04-22More updates to silence rubocop style-guides.Steve Kemp
These warnings were largely whitespace-based.
2016-02-10Don't allow limiting protocl on HTTP/HTTPS tests.root
We cannot allow HTTP/HTTPS to be limited by protocol, such as IPv4-only or IPv6-only. Raise an error in the parser if this is attempted. Added test-case to confirm, and this closes #12488.
2016-02-10Adjusted greediness of regex in http with contentPatrick J Cherry
It should match the next occurrence of the opening quote type, not the last.
2016-02-10Adjusted http with content string parsing.Patrick J Cherry
It now matches "can't match" and 'he said "ha!"'. Added tests.
2016-01-11Allow expected-test to be double-quoted.Steve Kemp
This changes the parser from only allowing this: http://example.com/ must run http with content 'reserved'. To allowing both of these: http://example.com/ must run http with content "reservered". http://example.com/ must run http with content 'reserved'.
2015-08-26Catch "RecvErr" exceptions from curb.Steve Kemp
This prevents a slightly ugly backtrace instead of a genuinely useful report.
2015-04-16Updated test-handler for new API.Steve Kemp
This update consists of two changes: * No longer return "true" or "false" instead return "TEST_FAILED", or "TEST_SUCCEEDED". * Removed the testing of test-inversion from the class, now it lives in the base-class where it should have done all along.
2015-03-09Removed trailing whitespace from the codeSteve Kemp
2015-03-09Whitespace fixups.Steve Kemp
These were all identified and suggested by rubocop.
2015-03-09Removed spaces inside parenthesis.Steve Kemp
2015-03-09Prefer single-quotes when you don't need interpolation.Steve Kemp
So "foo" is less good than 'foo'.
2015-03-09 Prefer single-quoted strings inside interpolations.Steve Kemp
2015-03-09Avoid redudent returns.Steve Kemp
The last expression of a method is the return value. So: def foo; false ; end Is the same as: def foo; return false; end
2015-03-09Don't use parenthesis aroudn conditions in an if.Steve Kemp
2015-03-09Do not use parentheses for method calls with no arguments.Steve Kemp
This is neater. Flagged by rubocop
2015-03-09Minor indentation fixup.Steve Kemp
2015-03-09Avoid redundent ".to_s" methods.Steve Kemp
These are not required if the argument is string already, or has a _to_s method which will be automatically invoked by magic.
2014-12-02Added host header override to errors in HTTP testJames Hannah
2014-10-13Added support for overriding the HTTP Host headerJames Hannah
2014-05-16Fixed numerous typos in the http libraryPatrick J Cherry
2014-05-16Updated http protocoltest to connect over both IPv4 and 6.Patrick J Cherry
2013-10-15 We now allow "with cache busting", and "without cache busting".Steve Kemp
2013-10-08 Attempt to avoid caching artifacts on all URL-testing bySteve Kemp
appending ?ctime=XX to HTTP/HTTPS-requests.
2013-05-15 Honour the global timeout period.Steve Kemp
The global configuration file, /etc/custodian/custodian.cfg, has a timeout=XX setting in it. Until now we've ignored it and used a fixed timeout of 20/30 seconds. Now we fully honour the specified value.
2013-04-23 Updated the parser to allow the test to specify whether HTTP-redirectsSteve Kemp
are followed. Added test-cases to match.
2013-01-14 fixed comments.Steve Kemp
2012-12-24 Added reference to missing URI librarySteve Kemp
2012-12-20 It is a bug for a test to have a protocol not matching theSteve Kemp
scheme of the URL. e.g. This is wrong: https://example.com/ must run http .. ("https" != "http").
2012-12-17 Ensure our test fails if the content doesn't matchSteve Kemp
2012-12-07 When reporting on failure-types the HTTP/HTTPS test is often reported ↵Steve Kemp
incorrectly. Fixed this now, based on the URL and added a test case.
2012-11-26 New releaseSteve Kemp
2012-11-26 Show failing lines.Steve Kemp
2012-11-24 Updated to max 10 redirections; and handle excessive redirections cleanly.Steve Kemp
2012-11-24 The target of the test, the URL, should be saved.Steve Kemp
2012-11-24 Alert if SSL-validation fails.Steve Kemp
2012-11-23 Return "false" rather than nil. Just for neatness.Steve Kemp
2012-11-23 Increase max-redirections to 5Steve Kemp
2012-11-23 Use the curb rubygemSteve Kemp
2012-11-23 Added simple implementation - no test cases yet, no real testing carried out.Steve Kemp