Fossil SCM

Check-in [acffc8f7858254eb] was causing "CGI content-length mismatch" errors on the main Fossil website (xinet.d->althttpd->Fossil). This check-in attempts to resolve the problem.

drh 2022-01-26 14:00 trunk
Commit c5c7dd5ffbf424bd84a5973649c3cef071f0631a2d1151a311a8e834f6cf5585
1 file changed +10 -13
+10 -13
--- src/cgi.c
+++ src/cgi.c
@@ -1316,28 +1316,25 @@
13161316
}else{
13171317
g.zContentType = zType;
13181318
}
13191319
blob_zero(&g.cgiIn);
13201320
if( len>0 && zType ){
1321
+ if( blob_read_from_cgi(&g.cgiIn, len)<len ){
1322
+ char *zMsg = mprintf("CGI content-length mismatch: Wanted %d bytes"
1323
+ " but got only %d\n", len, blob_size(&g.cgiIn));
1324
+ malformed_request(zMsg);
1325
+ }
13211326
if( fossil_strcmp(zType, "application/x-fossil")==0 ){
1322
- if( blob_read_from_cgi(&g.cgiIn, len)!=len ){
1323
- malformed_request("CGI content-length mismatch");
1324
- }
13251327
blob_uncompress(&g.cgiIn, &g.cgiIn);
13261328
}
1327
- else{
1328
- if( blob_read_from_cgi(&g.cgiIn, len)!=len ){
1329
- malformed_request("CGI content-length mismatch");
1330
- }
13311329
#ifdef FOSSIL_ENABLE_JSON
1332
- if( noJson==0 && g.json.isJsonMode!=0
1333
- && json_can_consume_content_type(zType)!=0 ){
1334
- cgi_parse_POST_JSON(&g.cgiIn);
1335
- cgi_set_content_type(json_guess_content_type());
1336
- }
1337
-#endif /* FOSSIL_ENABLE_JSON */
1330
+ if( noJson==0 && g.json.isJsonMode!=0
1331
+ && json_can_consume_content_type(zType)!=0 ){
1332
+ cgi_parse_POST_JSON(&g.cgiIn);
1333
+ cgi_set_content_type(json_guess_content_type());
13381334
}
1335
+#endif /* FOSSIL_ENABLE_JSON */
13391336
}
13401337
}
13411338
13421339
/*
13431340
** Decode POST parameter information in the cgiIn content, if any.
13441341
--- src/cgi.c
+++ src/cgi.c
@@ -1316,28 +1316,25 @@
1316 }else{
1317 g.zContentType = zType;
1318 }
1319 blob_zero(&g.cgiIn);
1320 if( len>0 && zType ){
 
 
 
 
 
1321 if( fossil_strcmp(zType, "application/x-fossil")==0 ){
1322 if( blob_read_from_cgi(&g.cgiIn, len)!=len ){
1323 malformed_request("CGI content-length mismatch");
1324 }
1325 blob_uncompress(&g.cgiIn, &g.cgiIn);
1326 }
1327 else{
1328 if( blob_read_from_cgi(&g.cgiIn, len)!=len ){
1329 malformed_request("CGI content-length mismatch");
1330 }
1331 #ifdef FOSSIL_ENABLE_JSON
1332 if( noJson==0 && g.json.isJsonMode!=0
1333 && json_can_consume_content_type(zType)!=0 ){
1334 cgi_parse_POST_JSON(&g.cgiIn);
1335 cgi_set_content_type(json_guess_content_type());
1336 }
1337 #endif /* FOSSIL_ENABLE_JSON */
1338 }
 
1339 }
1340 }
1341
1342 /*
1343 ** Decode POST parameter information in the cgiIn content, if any.
1344
--- src/cgi.c
+++ src/cgi.c
@@ -1316,28 +1316,25 @@
1316 }else{
1317 g.zContentType = zType;
1318 }
1319 blob_zero(&g.cgiIn);
1320 if( len>0 && zType ){
1321 if( blob_read_from_cgi(&g.cgiIn, len)<len ){
1322 char *zMsg = mprintf("CGI content-length mismatch: Wanted %d bytes"
1323 " but got only %d\n", len, blob_size(&g.cgiIn));
1324 malformed_request(zMsg);
1325 }
1326 if( fossil_strcmp(zType, "application/x-fossil")==0 ){
 
 
 
1327 blob_uncompress(&g.cgiIn, &g.cgiIn);
1328 }
 
 
 
 
1329 #ifdef FOSSIL_ENABLE_JSON
1330 if( noJson==0 && g.json.isJsonMode!=0
1331 && json_can_consume_content_type(zType)!=0 ){
1332 cgi_parse_POST_JSON(&g.cgiIn);
1333 cgi_set_content_type(json_guess_content_type());
 
 
1334 }
1335 #endif /* FOSSIL_ENABLE_JSON */
1336 }
1337 }
1338
1339 /*
1340 ** Decode POST parameter information in the cgiIn content, if any.
1341

Keyboard Shortcuts

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