pippo: Request hangs on GET with content length header

Whenever content-length is specified in request GET, request get blocked. https://github.com/decebals/pippo/blob/master/pippo-core/src/main/java/ro/pippo/core/Request.java#L405 - to get body. Call gets blocked at this line - https://github.com/decebals/pippo/blob/master/pippo-core/src/main/java/ro/pippo/core/Request.java#L405

on reader.read(buffer) - becoming blocking on IO calls. I was using undertow server and changed to jetty server to know if it is server issue.

I thought that since body is not allowed in GET, we return empty string whenever it is GET and you call getBody() but i tried for other methods also, whenever content-length is set and body is not specified then request becomes blocking Observed this behavior in 1.2+ pippo

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

I think that we can close this issue. What you say about this?

It’s too late in Pippo to do this verification because I don’t know the size of the body.

They are many posts on the internet that say that are big problems when the content-length is not in sync with the size of the body:

I think that to eliminate this problems the sender of the request must verify the content length.

The HTTP 1.1 RFC specifies:

When a Content-Length is given in a message where a message-body is allowed, its field value MUST exactly match the number of OCTETs in the message-body. HTTP/1.1 user agents MUST notify the user when an invalid length is received and detected.

See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4