Skip to content

Commit 364cdb6

Browse files
committed
reqs: prevent multiple content-lengths getting emitted
addressing point 2 of #609
1 parent 623bfc0 commit 364cdb6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/reqs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,11 @@ add_header_to_connection (pseudomap *hashofheaders, char *header, size_t len)
643643
/* Calculate the new length of just the data */
644644
len -= sep - header - 1;
645645

646+
/* prevent multiple content-length headers from being inserted */
647+
if (!strcasecmp(header, "content-length") &&
648+
pseudomap_find (hashofheaders, "content-length"))
649+
return 0;
650+
646651
return pseudomap_append (hashofheaders, header, sep);
647652
}
648653

0 commit comments

Comments
 (0)