Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327109

Summary: POST request with chunked encoding fails when AJP connector is used
Product: [RT] Jetty Reporter: Przemek Bruski <sesuvqrbasuvgg>
Component: otherAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gregw, mgorovoy
Version: unspecified   
Target Milestone: 7.1.x   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
a proposed patch none

Description Przemek Bruski CLA 2010-10-06 10:15:44 EDT
Build Identifier: 6.1.15

When processing chunks sent over AJP connector, the connector does not correctly interpret empty packets. Instead of accepting them as end of body message, it waits for a chunk with size of zero, which never happens.

According to AJP Protocol Reference:

"If there is no more data in the body (i.e. the servlet container is trying to read past the end of the body), the server will send back an "empty" packet, which is a body packet with a payload length of 0. (0x12,0x34,0x00,0x00)"

The code in Ajp13Parser waits for 6 bytes, which are never sent. I will attach a patch to this issue, I've tested it with 6.1.15, but it applies cleanly to latest AJP connector version from Jetty 8.

Reproducible: Always

Steps to Reproduce:
1. Just execute a POST method with chunked encoding. It won't finish.
Comment 1 Przemek Bruski CLA 2010-10-06 10:17:06 EDT
Created attachment 180333 [details]
a proposed patch
Comment 2 Przemek Bruski CLA 2010-10-06 15:11:04 EDT
> Steps to Reproduce:
> 1. Just execute a POST method with chunked encoding. It won't finish.

Clarification: you need to send data using chunked encoding, not receive it.
Comment 3 Greg Wilkins CLA 2010-10-06 20:18:56 EDT
thanks for the patch.

I've applied it to jetty-6 and will soon patch jetty-7.

I'll leave this open for a while, as I would like to ensure we give this some thorough testing.
Comment 4 Greg Wilkins CLA 2010-12-02 10:05:46 EST
in jetty-7.2.0.v20101020
Comment 5 Greg Wilkins CLA 2010-12-05 06:06:42 EST
Doh!

the patch is making every second request fail
Comment 6 Greg Wilkins CLA 2011-02-23 00:13:11 EST
jetty-7.2.2.v20101205