[Rabbit-dev] Request-URI Too Long

Robert Olofsson robert.olofsson at khelekore.org
Mon Jan 3 23:07:04 CET 2011


On Mon, 3 Jan 2011 18:38:02 +0000
Mindaugas Žakšauskas <mindas at gmail.com> wrote:

> > Ops, guess I forgot to remove that TODO when I actually made the
> > buffer grow.
> 
> So you're saying that buffer should be capable to grow indefinitely?

No, the buffer size is either small (4kB) or big  (128kB), it never grows
larger than that. Note that the header can actually be a lot bigger, 
but each entry in the header needs to fit in that. And if you say that 
you want a http header-line to be bigger than 128kB then I say that you
are crazy :-).

> I haven't debugged this, but is the exception not always thrown (in
> HttpHeaderReader::parseBuffer) if isUsingSmallBuffer(buffer) returns
> false?

Yes, that is one of the conditions needed to get the error. The buffer
marker must also be set to zero.

> What I could do is to add some debug code just before the exception is
> thrown so this would allow me to avoid logging all headers.
> I am just not sure if all necessary information is available at this
> point. Do you have any tips on what debugging code could be placed
> there?

The first thing to start with is to print "headerParser.getHeader()" that
will tell what we have parsed of the current header, then we want to see
what the buffer looks like and if possible the buffer contents as well.

Something like:
releaseBuffer();
logger.warning("RequestLineTooLongException: current header: " +
               headerParser.getHeader());
logger.warning("RequestLineTooLongException: current buffer: " + buffer);

If you care to write something that also logs the contents that will
be nice, but we can see what we get with this first.

It might be something simple like a (single/double)-quote typo in a cookie
or something like that.

> > It might make the problem occur less often though, so go ahead and try.
> > Switching up to 8kB buffers by default should not matter much.
> I'd rather leave it as it is and try to get down to the root of the problem.

Me too.

> I can see number 4096 being repeated at least three times in this
> class (methods: isLarge, putBuffer, getBuffer). I would assume all of
> these would need changing, right?

Correct and now I'll change that class to use constants instead.

/robo



More information about the Rabbit-dev mailing list