Fossil

Check-in [c5c7dd5ffb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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. (Edit:) *Not!* The error is still occurring, though at least now we have a better error message. The problem might have been in althttpd and fixed at https://sqlite.org/althttpd/info/fded041a3e9ce9b0.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c5c7dd5ffbf424bd84a5973649c3cef071f0631a2d1151a311a8e834f6cf5585
User & Date: drh 2022-01-26 14:00:56.034
Original Comment: 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.
Context
2022-01-26
14:32
Fix "unused variable" compiler warnings when building without OpenSSL. ... (check-in: c1350c8a44 user: drh tags: trunk)
14:00
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. (Edit:) *Not!* The error is still occurring, though at least now we have a better error message. The problem might have been in althttpd and fixed at https://sqlite.org/althttpd/info/fded041a3e9ce9b0. ... (check-in: c5c7dd5ffb user: drh tags: trunk)
13:34
Improved help-page for the "http" command. ... (check-in: 42c4d045e1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cgi.c.
1314
1315
1316
1317
1318
1319
1320
1321
1322


1323
1324

1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
    g.zContentType = fossil_strndup(zType, (int)(zSemi-zType));
    zType = g.zContentType;
  }else{
    g.zContentType = zType;
  }
  blob_zero(&g.cgiIn);
  if( len>0 && zType ){
    if( fossil_strcmp(zType, "application/x-fossil")==0 ){
      if( blob_read_from_cgi(&g.cgiIn, len)!=len ){


        malformed_request("CGI content-length mismatch");
      }

      blob_uncompress(&g.cgiIn, &g.cgiIn);
    }
    else{
      if( blob_read_from_cgi(&g.cgiIn, len)!=len ){
        malformed_request("CGI content-length mismatch");
      }
#ifdef FOSSIL_ENABLE_JSON
      if( noJson==0 && g.json.isJsonMode!=0
          && json_can_consume_content_type(zType)!=0 ){
        cgi_parse_POST_JSON(&g.cgiIn);
        cgi_set_content_type(json_guess_content_type());
      }
#endif /* FOSSIL_ENABLE_JSON */
    }
  }
}

/*
** Decode POST parameter information in the cgiIn content, if any.
*/
void cgi_decode_post_parameters(void){







<
|
>
>
|
|
>


<
<
<
<

|
|
|
|
|

<







1314
1315
1316
1317
1318
1319
1320

1321
1322
1323
1324
1325
1326
1327
1328




1329
1330
1331
1332
1333
1334
1335

1336
1337
1338
1339
1340
1341
1342
    g.zContentType = fossil_strndup(zType, (int)(zSemi-zType));
    zType = g.zContentType;
  }else{
    g.zContentType = zType;
  }
  blob_zero(&g.cgiIn);
  if( len>0 && zType ){

    if( blob_read_from_cgi(&g.cgiIn, len)<len ){
      char *zMsg = mprintf("CGI content-length mismatch:  Wanted %d bytes"
                           " but got only %d\n", len, blob_size(&g.cgiIn));
      malformed_request(zMsg);
    }
    if( fossil_strcmp(zType, "application/x-fossil")==0 ){
      blob_uncompress(&g.cgiIn, &g.cgiIn);
    }




#ifdef FOSSIL_ENABLE_JSON
    if( noJson==0 && g.json.isJsonMode!=0
        && json_can_consume_content_type(zType)!=0 ){
      cgi_parse_POST_JSON(&g.cgiIn);
      cgi_set_content_type(json_guess_content_type());
    }
#endif /* FOSSIL_ENABLE_JSON */

  }
}

/*
** Decode POST parameter information in the cgiIn content, if any.
*/
void cgi_decode_post_parameters(void){