Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Limit to number of HTTP Response Headers?

 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a mixed-topic question (part HTTP, part Servlet, part J2ME) but I figured this forum is the best one to post in.

Anyhow, I have a MIDP app that regularly talks with a Servlet that is running on the Orion app server. Occasionally, information changes on the server, and that info needs to be synched in the MIDlet. So in such a situation, when the MIDlet pings the server, I pass a custom HTTP response header during the response to the MIDlet to tell it to change some internal value. Works like a champ.

In fact, this approach works so well that I want to expand its use, so that anytime a user makes a data entry/deletion/modification on the Web site (the Orion app server), that entry/deletion/modification gets sent as a header to the MIDlet. My concern is that, if the user decides to go hog-wild on the Web site in between MIDlet pings to the server, there could wind up being a lot of response headers that I need to send back to the MIDlet once it does ping. So my question: is there a hard limit to the number of HTTP headers that can be sent in an HTTP response? Or some theoretical limit? I'm looking online to see if I can find some limit defined either in the HTTP protocol, Servlet spec, or MIDP spec, but I can't find an answer either way.

Thanks in advance!
[ February 09, 2005: Message edited by: dave taubler ]
 
Rigel Kentaurus
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you are using HTTP 1.1, and doing several requests in the same connection.

HTTP does not define a limit, but your webserver does, for example apache in its configuration has something about how many requests could be made in the same connection, and how much idle time until he disconnects the client, I have not seen something similar in Orion.

Either way relying on this would be a bad idea since the webserver can change, it would be better if your midlet were smart enough to "reconnect" to the server in the event that his connection has been closed because of too many requests.
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I'm talking about a single request in this case, in which I would be adding multiple headers via

response.setHeader(key, value);

I'm just curious as to whether there is a max number of headers I can expect to successfully set in that manner.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you're going to run into a finite number of headers allowed but I think you might run into a limit in the overall size of the header.

A google search on HTTP HEADER SIZE brings up articles like this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;310156&sd=tech
which indicate a fixed buffer size for headers which can vary from server to server.

There may be something in the HTTP specs concerning a minumum size.
You'd have to poke around a bit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic