Fossil SCM

Reject if both HTTP 1.1 content-length and transfer-encoding headers set.

danshearer 2026-07-28 02:11 UTC trunk
Commit 63826bf8a4ce7300cf45ff16fe82bcd0b132fdb2a9dc561277776f6e72572828
1 file changed +6
+6
--- src/http.c
+++ src/http.c
@@ -755,10 +755,16 @@
755755
if( rc!=200 ){
756756
if( mHttpFlags & HTTP_QUIET ) goto write_err;
757757
fossil_warning("\"location:\" missing from %d redirect reply", rc);
758758
goto write_err;
759759
}
760
+
761
+ if( isChunked && iLength>=0 ){
762
+ /* RFC 7230 says to reject in this case */
763
+ fossil_warning("reply has both content-length and transfer-encoding");
764
+ goto write_err;
765
+ }
760766
761767
/*
762768
** Extract the reply payload that follows the header
763769
*/
764770
blob_zero(pReply);
765771
--- src/http.c
+++ src/http.c
@@ -755,10 +755,16 @@
755 if( rc!=200 ){
756 if( mHttpFlags & HTTP_QUIET ) goto write_err;
757 fossil_warning("\"location:\" missing from %d redirect reply", rc);
758 goto write_err;
759 }
 
 
 
 
 
 
760
761 /*
762 ** Extract the reply payload that follows the header
763 */
764 blob_zero(pReply);
765
--- src/http.c
+++ src/http.c
@@ -755,10 +755,16 @@
755 if( rc!=200 ){
756 if( mHttpFlags & HTTP_QUIET ) goto write_err;
757 fossil_warning("\"location:\" missing from %d redirect reply", rc);
758 goto write_err;
759 }
760
761 if( isChunked && iLength>=0 ){
762 /* RFC 7230 says to reject in this case */
763 fossil_warning("reply has both content-length and transfer-encoding");
764 goto write_err;
765 }
766
767 /*
768 ** Extract the reply payload that follows the header
769 */
770 blob_zero(pReply);
771

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button