Context: i maintain a kind of web service server, but with a particular implementation: all data sent by the web service are located in the http header. That means there is only http header in the response (no body part). The web service runs as a windows service. The consumer is my PHP code wich invoque the web service via CURL library. All this is in production since 3 years and work fine. I recently had to build a developpment environement.
1 - i have the web service on a windows 7 pro, as a windows service.
2 - i have my PHP consumer in another windows 7 pro (WAMP + CURL).
3 - my PHP code invoque the web service and displays the raw response.
4 - in this context the probleme occurs: if the response contains more than 1215 characters, i have an empty response (but no error message).
5 - i installed my PHP code (exactly the same) on a new linux ubuntu: i have the same problem.
6 - i installed my PHP code (exactly the same) on a new linux centos: I DON'T HAVE THE PROBLEM.
7 - i read a lot on internet about size limitation on http header, and i think today it's not the reason of the probleme.
8 - I examined all size limitation parameters on Apache, PHP, Curl but i didn't find somethig relevant.
If somenone has some information. All tracks are welcome.
Honestly, I have no idea besides the usual suspects that you already eliminated. What web servers were you using on the Linux distros?
I'm curious, what's the reason that the complete message is being sent in a header anyway? Why isn't the message body used the way it was intended?
posted 4 weeks ago
On my Ubuntu (wich has the problem): standard LAMP (apache 2.4.29, PHP 7.2.10, Curl 7.58.0)
On my Centos (wich has NOT the problem): standard LAMP (apache 2.4.6, PHP 7.2.13, Curl 7.29.0)
You can see there are light differences in the versions but i don't think it cause the problem.
I don't have developped this web service and i agree with you that it's a strange approach to put all data in the http header.
I just try to maintain this soft. fortunetely it works fine in production, so the problem should be only in my dev environnement.
It's not well-defined how large a header a client will accept nor how large a header a server may send. Or, for that matter, how large a URL a server will accept. Originally, 1024 was thought to be a good number, but different software implementers quickly upscaled that as large headers and URLs became common. Unfortunately, the amount to which they upscaled was never agreed on for a standard.
There is no virtue in sending general data in a header. HTTP is a text-based protocol consisting of a series of text lines. The only difference made between a header and the body is that you have 2 newlines (that is, a blank line) after the last header to indicate to the client that the remaining text is body. Of course, if the header section contains lines that don't look like headers, the client may choke on them, but that's secondary.
Even binary data such as images, videos and ZIP files are actually transmitted as text in the HTTP response. Binary data is MIME-encoded, which is a process that converts 8-bit binary bytes into printable characters by unpacking them 6 bits at a time (in ASCII and EBCDID, control codes are not printable and that's why bytes with those values have to be encoded).
An IDE is no substitute for an Intelligent Developer.
It sounds like to problem is encountered on the client side (PHP + cURL). Have you verified that the server side is always sending the complete set of headers, regardless of which client is making the request?
Does the client's webservice request proxy through Apache? If not Apache can be eliminated as part of the problem.
Is the 1215 character (byte?) limitation just for a single HTTP header, or is that the combined length of all headers?
posted 4 weeks ago
- I confirm that the server side is always sending the complete set of headers, regardless of which client is making the request.
- There is no request proxy through Apache.
- The 1215 bytes limitation is for the combined length of all headers.
I currently investigate on apache modules: centos has 82 modules activated and my Ubuntu only 21.