Fossil SCM

In cgi_handle_ssh_http_request(), keep a copy, never freed, of the Content-Length of later requests on one ssh connection, not a pointer into the line buffer. The body reader, /test_env and /ext see the value sent; a later request with none uses an earlier length, so such a GET may get a 400.

dmestas 2026-11-24 11:31 UTC small-fixes
Commit 9b13c41f07e313be2e38bb92d6618c82455c49be879d0c39d4498c2a903c7bdf
1 file changed +1 -1
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -2437,11 +2437,11 @@
24372437
}
24382438
if( fossil_strcmp(zFieldName,"content-length:")==0 ){
24392439
if( nCycles==0 ){
24402440
cgi_setenv("CONTENT_LENGTH", zVal);
24412441
}else{
2442
- cgi_replace_parameter("CONTENT_LENGTH", zVal);
2442
+ cgi_replace_parameter("CONTENT_LENGTH", fossil_strdup(zVal));
24432443
}
24442444
}else if( fossil_strcmp(zFieldName,"content-type:")==0 ){
24452445
if( nCycles==0 ){
24462446
cgi_setenv("CONTENT_TYPE", zVal);
24472447
}
24482448
--- src/cgi.c
+++ src/cgi.c
@@ -2437,11 +2437,11 @@
2437 }
2438 if( fossil_strcmp(zFieldName,"content-length:")==0 ){
2439 if( nCycles==0 ){
2440 cgi_setenv("CONTENT_LENGTH", zVal);
2441 }else{
2442 cgi_replace_parameter("CONTENT_LENGTH", zVal);
2443 }
2444 }else if( fossil_strcmp(zFieldName,"content-type:")==0 ){
2445 if( nCycles==0 ){
2446 cgi_setenv("CONTENT_TYPE", zVal);
2447 }
2448
--- src/cgi.c
+++ src/cgi.c
@@ -2437,11 +2437,11 @@
2437 }
2438 if( fossil_strcmp(zFieldName,"content-length:")==0 ){
2439 if( nCycles==0 ){
2440 cgi_setenv("CONTENT_LENGTH", zVal);
2441 }else{
2442 cgi_replace_parameter("CONTENT_LENGTH", fossil_strdup(zVal));
2443 }
2444 }else if( fossil_strcmp(zFieldName,"content-type:")==0 ){
2445 if( nCycles==0 ){
2446 cgi_setenv("CONTENT_TYPE", zVal);
2447 }
2448

Keyboard Shortcuts

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