Score:1

is "GET /" a valid HTTP request?

uz flag

I noticed that sending GET / (+CRLF) to some webservers (e.g. from a well-known search provider) results in a HTTP/1.0 200 OK message. Other webserver respond with a HTTP/1.0 400 error.

To my knowledge even HTTP/1.0 requires the version field. Is GET / (without protocol and Host) a standardized, valid shortened GET request?

After some digging I found HTTP/0.9 from 1991 defines the following:

  • This request consists of the word "GET", a space, the document address,[...].
  • The document address will consist of a single word (ie no spaces). If any further words are found on the request line, they MUST either be ignored, or else treated according to the full HTTP spec

With HTTP/0.9 the request seems possible. Some sources call it the one-line protocol. Not sure if this is common sense or not. I did not know nor have I seen this before. Are webservers meant to honor this HTTP/0.9 request?

Jaromanda X avatar
ru flag
have you ever opened a website like `https://www.example.com/` ... i.e. just protocol and domain? ... that does a `GET /` ... so, yes, it's perfectly valid, as long as the http server is configured to allow it
Richard avatar
uz flag
Sure. However the question was: Isn't the version field and host header mandatory? Some server correctyl request on GET /<CRLF>. Others do not.
Jaromanda X avatar
ru flag
the TITLE of your question is `is "GET /" a valid HTTP request?` not sure you noticed that
Score:4
in flag

A request with no version number is a HTTP/0.9 request, also known as a "simple-request". If supported, it will receive a much simpler response than a HTTP/1.0 or later request.

RFC 1945, (the HTTP/1.0 specification) includes the definition for such requests (see section 5) and requires servers to support them, but discourages their use by clients.

RFC 2068 and RFC 2616 (the original and first revised version of the HTTP/1.1 specification) no longer includes the definition for such requests. They say that "It is beyond the scope of a protocol specification to mandate compliance with previous versions." but that "at the time of composing this specification" they would expect "commercial web servers" to continue supporting http/0.9 and http/1.0.

When http/1.1 was again revised in 2014, it was split into a series of RFCs (RFC 7230 to 7235) rather than one large document. RFC 7230 reccomends that servers that support name based virtual hosting do not support http/0.9 requests.

Are webservers meant to honor this HTTP/0.9 request?

The internet is built on "rough consensus and running code". The IETF does it's best to document that consensus and make recommendations, but ultimately what level of backwards compatibility to offer is a judgement call for individual implementers.

Practically speaking, the modern web is heavily reliant on name based virtual hosting. Therefore even if the web server software understands such ancient requests there is a good chance it will not return the desired document,

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.