This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

A strange problem about size limit in http header.  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
Thanks
 
Saloon Keeper
Posts: 10002
208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

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?
 
maxime Eastwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stephan,
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.



 
Bartender
Posts: 20580
121
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Maxine!

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).
 
Saloon Keeper
Posts: 2476
317
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
maxime Eastwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Ron,
- 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.
 
Ron McLeod
Saloon Keeper
Posts: 2476
317
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

maxime Eastwood wrote:There is no request proxy through Apache.

maxime Eastwood wrote:I currently investigate on apache modules: centos has 82 modules activated and my Ubuntu only 21.


Does the request/response involve Apache is any way?
 
Tim Holloway
Bartender
Posts: 20580
121
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default limit for Apache http header size is 8192 characters. So I think we can rule that out.

On the other hand, the TCP/IP MTU is not allowed to be bigger than about 1500 bytes. And since your limit is on the sum total header size and not an individual header...

I'd recommend 2 things:

1. Raise the logging level on the offending server and check both access and error logs

2. Put a network sniffer on the line and see if any anomalies pop up there.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!