Skip to content

Commit e50696b

Browse files
committed
check for valid header key value pair
1 parent 53b411e commit e50696b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/mod_pascal.pas

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ TPascalModuleCfg = record
188188

189189
if headerMarkerPos = 0 then
190190
begin
191-
//no header found
191+
//no header section is found
192192
exit;
193193
end;
194194

@@ -197,18 +197,21 @@ TPascalModuleCfg = record
197197
for i:= 0 to Length(headers) - 1 do
198198
begin
199199
keyval := headers[i].split(':');
200-
key := trim(keyval[0]);
201-
val := trim(keyval[1]);
202-
if sameText(key, 'Status') then
200+
if (length(keyval) = 2) then
203201
begin
204-
result := strtoInt(val);
205-
end else
206-
if sameText(key, 'Content-Type') then
207-
begin
208-
ap_set_content_type(req, pchar(val));
209-
end else
210-
begin
211-
apr_table_setn(req^.headers_out, pchar(key), pchar(val));
202+
key := trim(keyval[0]);
203+
val := trim(keyval[1]);
204+
if sameText(key, 'Status') then
205+
begin
206+
result := strtoInt(val);
207+
end else
208+
if sameText(key, 'Content-Type') then
209+
begin
210+
ap_set_content_type(req, pchar(val));
211+
end else
212+
begin
213+
apr_table_setn(req^.headers_out, pchar(key), pchar(val));
214+
end;
212215
end;
213216
end;
214217
//remove header part

0 commit comments

Comments
 (0)