Skip to content

Commit

Permalink
check for valid header key value pair
Browse files Browse the repository at this point in the history
  • Loading branch information
zamronypj committed May 4, 2021
1 parent 53b411e commit e50696b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/mod_pascal.pas
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ TPascalModuleCfg = record

if headerMarkerPos = 0 then
begin
//no header found
//no header section is found
exit;
end;

Expand All @@ -197,18 +197,21 @@ TPascalModuleCfg = record
for i:= 0 to Length(headers) - 1 do
begin
keyval := headers[i].split(':');
key := trim(keyval[0]);
val := trim(keyval[1]);
if sameText(key, 'Status') then
if (length(keyval) = 2) then
begin
result := strtoInt(val);
end else
if sameText(key, 'Content-Type') then
begin
ap_set_content_type(req, pchar(val));
end else
begin
apr_table_setn(req^.headers_out, pchar(key), pchar(val));
key := trim(keyval[0]);
val := trim(keyval[1]);
if sameText(key, 'Status') then
begin
result := strtoInt(val);
end else
if sameText(key, 'Content-Type') then
begin
ap_set_content_type(req, pchar(val));
end else
begin
apr_table_setn(req^.headers_out, pchar(key), pchar(val));
end;
end;
end;
//remove header part
Expand Down

0 comments on commit e50696b

Please sign in to comment.