Find the REAL POST Payload ...

Hey experts!

If I needed to find the actual payload of a POST, and not any of the embedded headers, I am currently finding the content, 3 characters after the end of the ‘Content-Type:’ header.

In the bits before the payload, I am extracting the filename, and ultimately creating a new content length value.

Please tell me there’s a less buttugly way to do this (which would also not get broken when some silly client messes with the header order…??

set delimit [string first -nocase “Content-Type:” [HTTP::payload]]

incr delimit [string first “\n” [string range [HTTP::payload] $delimit end]]

incr delimit 3

set headerz [string range [HTTP::payload] 0 $delimit]

set filename [findstr $headerz {filename} 10 {"}]

log local0. “--Filename: $filename”

set payloadz [string range [HTTP::payload] $delimit end]

set lengthz [string length $payloadz]

log local0. “---Payload: $payloadz”

Thanks

Jan