0

When I send GET http requests to an EJB served by jetty, I often get a 401 response even though the auth parameters are correct.

When I look into jetty logs I see this :

2013-06-27 11:54:11.004:DBUG:oejs.Server:REQUEST /app/general/launch on AsyncHttpConnection@3adf0ddc,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=34,c=0},r=1
2013-06-27 11:54:11.021:DBUG:oejs.Server:RESPONSE /app/general/launch  401
2013-06-27 11:54:11.066:DBUG:oejs.Server:REQUEST /app/general/launch on AsyncHttpConnection@3adf0ddc,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=102,c=0},r=2

I suspect that the request is not fully read (too large request entity or too large headers?) as it is parsed twice for a single request. Is there a way to fix this ?

what does HttpParser{s=-5,l=34,c=0} and HttpParser{s=-5,l=102,c=0} mean ?

when I desactivate authentication (security constraints using simple jetty realm). the request is only parsed once.

Jerec TheSith
  • 1,932
  • 4
  • 32
  • 41

1 Answers1

0

401 means that the server requires authentication credentials that the client either has not sent or the ones sent by the client have not been authorized. Some client implementations will resend the request if they receive a 401 including the credentials. If your client is doing that, that would explain why you get the request twice on the server.

The HttpParser toString() method returns the current status of the HttpParser. Here's the code:

    return String.format("%s{s=%d,l=%d,c=%d}",
            getClass().getSimpleName(),
            _state,
            _length,
            _contentLength);

So s is the state. -5 is STATE_HEADER. And l and c represent the length and the contentLength.

Thomas Becker
  • 934
  • 8
  • 16