Fossil

Diff
Login

Diff

Differences From Artifact [42b36191ca]:

To Artifact [fc7a9b5fe3]:


2288
2289
2290
2291
2292
2293
2294

2295
2296
2297
2298
2299
2300
2301
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302







+







**
** It is called in a loop so some variables will need to be replaced
*/
void cgi_handle_ssh_http_request(const char *zIpAddr){
  static int nCycles = 0;
  static char *zCmd = 0;
  char *z, *zToken;
  char *zMethod;
  int i;
  size_t n;
  char zLine[2000];     /* A single line of input. */

  assert( !g.httpUseSSL );
#ifdef FOSSIL_ENABLE_JSON
  if( nCycles==0 ){ json_bootstrap_early(); }
2338
2339
2340
2341
2342
2343
2344

2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361

2362
2363
2364
2365
2366
2367
2368
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371







+

















+







    cgi_trace(zLine);
    zToken = extract_token(zLine, &z);
    if( zToken==0 ){
      malformed_request("malformed HTTP header");
    }
  }

  zMethod = fossil_strdup(zToken);
  if( fossil_strcmp(zToken,"GET")!=0 && fossil_strcmp(zToken,"POST")!=0
      && fossil_strcmp(zToken,"HEAD")!=0 ){
    malformed_request("unsupported HTTP method");
  }

  if( nCycles==0 ){
    cgi_setenv("GATEWAY_INTERFACE","CGI/1.0");
    cgi_setenv("REQUEST_METHOD",zToken);
  }

  zToken = extract_token(z, &z);
  if( zToken==0 ){
    malformed_request("malformed URL in HTTP header");
  }
  n = strlen(g.zRepositoryName);
  if( fossil_strncmp(g.zRepositoryName, zToken, n)==0 
   && (zToken[n]=='/' || zToken[n]==0)
   && fossil_strcmp(zMethod,"GET")==0
  ){
    zToken += n;
  }
  if( zToken && strlen(zToken)==0 ){
    malformed_request("malformed URL in HTTP header");
  }
  if( nCycles==0 ){