custHTTPSys Invalid Length Http reason string, know header length and unknown header length
Original Reporter info from Mantis: taufikrh @taufikrh
-
Reporter name: Taufik Rahmad Hidayanto
Original Reporter info from Mantis: taufikrh @taufikrh
- Reporter name: Taufik Rahmad Hidayanto
Description:
resp.ReasonLength not yet set, this will make httpsys send empty response string (only send Status Code)
the +1 in the following code make additional null terminated string in http header name and http header value
resp.Headers.KnownHeaders[Ord(headerid)].RawValueLength := Length(headerval) + 1;
unknownheadersarr[i].NameLength := Length(headerstr) + 1;
unknownheadersarr[i].RawValueLength := Length(headerval) + 1;
example output http header:
Content-Type: text/html[null][CRLF]
Status[null]: 200 OK[null][CRLF]
Steps to reproduce:
fix http reason string length
if CodeText <> '' then
begin
resp.pReason := PChar(CodeText);
resp.ReasonLength := Length(CodeText);
end;
fix http know header value length:
resp.Headers.KnownHeaders[Ord(headerid)].RawValueLength := Length(headerval);
fix http unknown header name length:
unknownheadersarr[i].NameLength := Length(headerstr);
fix http unknown header value length:
unknownheadersarr[i].RawValueLength := Length(headerval);
Additional information:
check file diff
Mantis conversion info:
- Mantis ID: 37448
- OS: Windows
- Platform: Windows
- Fixed in version: 3.3.1
- Fixed in revision: 45991 (#e5308038)