bblimke / webmock

Library for stubbing and setting expectations on HTTP requests in Ruby.
MIT License
3.96k stars 556 forks source link

httpstat.us site used by many tests is defunct #1045

Open tmertens opened 9 months ago

tmertens commented 9 months ago

Many of the unit/acceptance tests make outbound HTTP requests to httpstat.us. This website is defunct and returns HTTP 503s for every request. The tests are not written in a way that fail due to this behavior; rather, they take a long time to run and pass, as the 503 response is generally very slow to return, and I've seen it sometimes fails to resolve the domain at all.

The tests should be updated to use a different domain, or preferably to use a locally running server to serve the requests, rather than making actual outbound network requests to a real service (which no longer exists).

HTTP

time curl http://httpstat.us/404 -v
*   Trying 20.40.202.3:80...
* Connected to httpstat.us (20.40.202.3) port 80 (#0)
> GET /404 HTTP/1.1
> Host: httpstat.us
> User-Agent: curl/8.1.2
> Accept: */*
> 
< HTTP/1.1 503 Service Unavailable
< Content-Length: 0
< Date: Tue, 05 Dec 2023 18:00:25 GMT
< Set-Cookie: ARRAffinity=fca8f86e2aee5216a9504a5ef5a82caeab7a80b1093c88842a262c639a933047;Path=/;HttpOnly;Domain=httpstat.us
< 
* Connection #0 to host httpstat.us left intact
curl http://httpstat.us/404 -v  0.01s user 0.02s system 0% cpu 24.878 total

HTTPS

time curl https://httpstat.us/404 -v
*   Trying 20.40.202.3:443...
* Connected to httpstat.us (20.40.202.3) port 443 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: CN=httpstat.us
*  start date: Nov  7 00:00:00 2023 GMT
*  expire date: May  7 23:59:59 2024 GMT
*  subjectAltName: host "httpstat.us" matched cert's "httpstat.us"
*  issuer: C=US; O=DigiCert, Inc.; CN=GeoTrust Global TLS RSA4096 SHA256 2022 CA1
*  SSL certificate verify ok.
* using HTTP/1.1
> GET /404 HTTP/1.1
> Host: httpstat.us
> User-Agent: curl/8.1.2
> Accept: */*
> 
< HTTP/1.1 503 Service Unavailable
< Content-Length: 0
< Date: Tue, 05 Dec 2023 18:01:39 GMT
< Set-Cookie: ARRAffinity=279e2686d6d985a92f0e5544b67f0addb363f77898a222be35d50034f8dfe4ba;Path=/;HttpOnly;Secure;Domain=httpstat.us
< Set-Cookie: ARRAffinitySameSite=279e2686d6d985a92f0e5544b67f0addb363f77898a222be35d50034f8dfe4ba;Path=/;HttpOnly;SameSite=None;Secure;Domain=httpstat.us
< 
* Connection #0 to host httpstat.us left intact
curl https://httpstat.us/404 -v  0.02s user 0.02s system 1% cpu 3.283 total
bblimke commented 7 months ago

@tmertens thank you for reporting. it looks like httpstat.us was just temporarily down, as it works fine now. I do agree it would be best to replace httpstat.us with a local http server.