L.Kaden
L.Kaden

Reputation: 27

HTTP Response Code 403, but reason is "OK"

I'm trying to download a file using wget.
My command looks like this:

wget https://example.com/feeder/example.xml

This is the output in the console:
German:

--2020-12-12 18:07:47--  https://example.com/feeder/example.xml
Auflösen des Hostnamens example.com (example.com) … 100.100.100.100 (Some ip)
Verbindungsaufbau zu example.com (example.com)|100.100.100.100|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 403 OK
2020-12-12 18:07:47 FEHLER 403: OK.

English:

--2020-12-12 18:07:47-- https://example.com/feeder/example.xml
Resolving the hostname example.com (example.com) ... 100.100.100.100 (Some ip)
Connecting to example.com (example.com)|100.100.100|:443 ... connected.
HTTP request sent, waiting for response ... 403 OK
2020-12-12 18:07:47 ERROR 403: OK.

If the response code is 403, I would expect an error like "forbidden", but I get "OK" instead.

Upvotes: 0

Views: 665

Answers (2)

Caius Jard
Caius Jard

Reputation: 74710

From the spec

6.1.1 Status Code and Reason Phrase

The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request. These codes are fully defined in section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code. The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason- Phrase.

The final sentence is the most telling; no (programmatic, and by inference human) reliance should be placed on the reason phrase accuracy/spelling/language/text at all. Given that the server can be coded to send anything, that it sends OK indicates a bug in the server but not one that would be problematic (in the "be liberal in what you accept" sense) - you should ignore it, or report it as a bug to the maintainer of the server code, if you're able to determine what server it is and that it is a current, unknown issue

Upvotes: 1

Gereon
Gereon

Reputation: 17882

HTTP responses only require the specific (numeric) codes to match the standard. Any accompanying text (called "reason phrase") is just for human consumption, and for whatever reason the server you're talking to decides not to send a text that actually matches the meaning of the code.

(See Section 6.1 of RFC 7231)

Upvotes: 1

Related Questions