chocolatey / package-validator

Windows service to validate packages conform to package standards
Apache License 2.0
31 stars 29 forks source link

(503) Server Unavailable returned for valid URL's #202

Closed mkevenaar closed 4 years ago

mkevenaar commented 4 years ago

As suggested here: https://github.com/chocolatey/package-validator/issues/200#issuecomment-570184485

I think we might want to extend URL Validation to only fail on 4xx status codes.

1xx informational response – the request was received, continuing process 2xx successful – the request was successfully received, understood and accepted 3xx redirection – further action needs to be taken in order to complete the request 4xx client error – the request contains bad syntax or cannot be fulfilled 5xx server error – the server failed to fulfill an apparently valid request

(source: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes )

gep13 commented 4 years ago

Having done some investigation on this, it doesn't seem like it is possible to only return valid when not one of the 4xx error codes. For example, this URL:

https://github.com/philiparola/chocolatey-packages/tree/master/manual/opencv/master

Which is a 404, isn't returned as such.

In the case of the URL that is affected (which is why this issue was raised) https://trac.mpc-hc.org/, I am going to add special handling for the ProtocolError which is returned when this URL is requested. This is far from ideal, but it is the last of the known troublesome URL's in the system just now, and seems like the best approach for now. This can be revisited if required.

gep13 commented 4 years ago

The reason that a 503 is returned is due to the fact that Cloudflare is acting as DDOS protection for the site:

image

After a short delay, the site shows up correctly in the browser, but when making only a single request, you don't see the valid response from the site.