1

My question :

Is it safe to send HTTP 1.0 GET request to avoid chunked response ? Did all modern Apache/NGinx installation will handle well my HTTP 1.0 requests ?

Some context :

I'm working on a super simple Http client. This client is supposed to get super simple data from some given servers (1 to 10 characters as response).

I control the PHP script used to respond this simple datas, but not the server nor the site configuration.

I want to keep it as simple as possible and avoid the parsing of chunked response. (C based, on an Arduino system)

Thanks.

2
  • This question on SF seems to be related. Commented Nov 16, 2015 at 14:19
  • You can add the Host: server[:port] header to an HTTP 1.0 request to help with some of the issues raised in the comments below. Commented May 25, 2021 at 15:58

1 Answer 1

2

Really, the answer has nothing to do with if certain web servers support HTTP 1.0, it depends if websites do.

With HTTP 1.0 there are no headers, including the host header, and therefore no virtual host capability (one website per IP address).

So any website that has more than one domain/hostname on a single IP will NEED the HTTP/1.1 'host' header to work at all.

Therefore, if you want your client to work with arbitrary websites, no, you can't do it, it won't work with all websites.

If there are specific websites, then... well you can test those to see if they will honour the HTTP 1.0 request, and if it does or not will depend on the web server AND its configuration.

You have to accept that if you have a specific set of destination websites that work they could stop working later too remember.

Edit (following question edit):

Since you control the server side PHP you control the content, but still not the web servers behaviour as such. Your host MIGHT be providing only your web content / web site at the IP address pointed to by your host/domain name, and in that case HTTP 1.0 MIGHT work... but if there are multiple host/domain names hosted on a single IP by the web server then it almost certainly won't work, and if it does work in either case then it COULD stop working at a later time.

Sign up to request clarification or add additional context in comments.

5 Comments

Although your answer is correct, it doesn't answer OP's question that was specifically about chunked encoding...
Hmm, if I understood the OPs question, chunked encoding is irrelevant, except in so far as the OP wants to avoid implementing it, which they propose to do by using HTTP 1.0, and the actual question is therefore 'Is HTTP 1.0 ok to use?' I couldn't answer this since the OP hasn't declared if the destination websites are a known set or not, so I answered by explaining the possible reason HTTP 1.0 won't work, etc. Of course, if I have misunderstood the question, then I apologise...
see the question I referred to - per the relevant rfcs a server can perfectly answer using 1.1 even if the question was using 1.0 - although the comments seem to suggest that at least nginx will respond to a 1.0 request using 1.1 but without 1.1 specific features like chunking. Unfortunately, this behavior is not imposed and - as you correctly point out - by using 1.0 you loose the possibility to address name based virtual hosts.
@Michael : I have just edited the title and added some context.
@fvu Hah, interesting, I've not observed this behaviour before, but perhaps not surprising since how often do we make HTTP 1.0 requests these days? My quick scan of the RFC leads me to question if it is actually a HTTP 1.1 response though, it's more a 1.0 response with an invitation to the client to make 1.1 requests in the future if it can. However, I guess the OPs approach is still technically valid, the 1.0 request won't get a chunked response, and my answer is still fine too as far as I can see (just edited as per OPs question edit). Interesting though, thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.