Content-Length vs. Chunking and 411 response

Asked by Choey

Hi. I'm seeing virgin requests that have content-length headers leave as adapted requests that have the content-length heading removed and replaced with the transfer-encoding: chunked header. This causes many servers to return 411 length required responses.

How can I ensure that requests that arrive without chunking are forwarded as modified adapted body requests also without chunking? Or how can I appropriately handle the 411 responses?

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Rousskov
Solved:
Last query:
Last reply:
Revision history for this message
Best Alex Rousskov (rousskov) said :
#1

I can imagine several possibilities, including:

1. The adapter clones the virgin message and then removes the Content-Length header. The adapter is responsible for the problems you are observing. Change the adapter to not remove the Content-Length header from non-chunked requests with bodies (or remove the old one and add a new one).

2. The adapter creates a new adapted message from scratch and does not add the Content-Length header. The adapter is responsible for the problems you are observing. Change the adapter to add the right Content-Length header to non-chunked requests with bodies.

3. The adapter does not alter the virgin message (i.e. calls useVirgin) but the host application removes the Content-Length header.
Contact your host application support. They are at fault.

Needless to say, adding the right Content-Length header may require buffering the entire message body. Pick your poison.

Revision history for this message
Choey (choey) said :
#2

This gave me the insight I needed to solve my problem - thanks a ton Alex.

Revision history for this message
Choey (choey) said :
#3

Thanks Alex Rousskov, that solved my question.