Forum Discussion

Steven_Thiakos_'s avatar
Steven_Thiakos_
Icon for Nimbostratus rankNimbostratus
Feb 19, 2011

Malformed Custom Chunked Client - Convert Request

Hi Experts,

 

 

I inherited a custom Client and Server solution that implemented chunked wrong (bad block headers).

 

 

The (short lifespan) client is baked into devices and we re-engineered the server on Windows 2K3 which enforces HTTP in the kernel (we can't touch it). So we're left with our LB to fix this mess.

 

 

Lastly, the client closes the connection after sending all it's data (will my server get the data?)

 

 

The rule we came up with below doesn't seem to work. Messages are small (< 10K).

 

 

I'm thinking to go with an entire tcp collection

 

search: "Transfer-encoding: chunked"

 

replace: "Content-Length: " length(first\r\n\r\n to last \r\n\r\n) - 4

 

 

Will my above alternate work fine if the client closes the connection after sending all the content? Any Events/Keywords I should consider? Does the below work but I'm missing one key part?

 

 

Lemme know,

 

 

Steve

 

 

rule payload-length {

 

when HTTP_REQUEST {

 

Gather the entire request for bad chunked

 

if {[ HTTP::header exists Transfer-Encoding]} {

 

HTTP::collect 104800

 

}

 

}

 

when HTTP_REQUEST_DATA {

 

Remove chunked and add Content-Length

 

if {[ HTTP::header exists Transfer-Encoding]} {

 

HTTP::header remove Transfer-Encoding

 

HTTP::header insert Content-Length [HTTP::payload length]

 

}

 

}

 

}

 

No RepliesBe the first to reply