Check-in [d6e900a581]
Not logged in

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

Overview
Comment:Add the 'test-pid' web page.
Timelines: family | ancestors | descendants | both | testPid
Files: files | file ages | folders
SHA3-256: d6e900a58153bcd0da2c07d4fd621a34d71d41f97834935ef005c0ff220a1137
User & Date: mistachkin 2020-06-07 18:23:45.347
Context
2020-06-07
23:03
Fixes and enhancements to SEE integration on Windows. check-in: 584ac9ffc4 user: mistachkin tags: testPid
18:23
Add the 'test-pid' web page. check-in: d6e900a581 user: mistachkin tags: testPid
18:20
Update custom Makefile for MinGW. check-in: 81960e1faa user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
2343
2344
2345
2346
2347
2348
2349




























2350
2351
2352
2353
2354
2355
2356
  if( sscanf(zPidKey, "%lu:%p:%u", pProcessId, ppAddress, &nSize)==3 ){
    *pnSize = (SIZE_T)nSize;
  }else{
    fossil_fatal("failed to parse pid key");
  }
}
#endif





























/*
** COMMAND: http*
**
** Usage: %fossil http ?REPOSITORY? ?OPTIONS?
**
** Handle a single HTTP request appearing on stdin.  The resulting webpage







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
  if( sscanf(zPidKey, "%lu:%p:%u", pProcessId, ppAddress, &nSize)==3 ){
    *pnSize = (SIZE_T)nSize;
  }else{
    fossil_fatal("failed to parse pid key");
  }
}
#endif

/*
** WEBPAGE: test-pid
**
** Return the process identifier of the running Fossil server instance.
**
** Query parameters:
**
**   usepidkey           When present and available, also return the
**                       address and size, within this server process,
**                       of the saved database encryption key.  This
**                       is only supported when using SEE on Windows.
*/
void test_pid_page(void){
  login_check_credentials();
  if( !g.perm.Setup ){ login_needed(0); return; }
#if defined(_WIN32) && USE_SEE
  if( P("usepidkey")!=0 ){
    const char *zSavedKey = db_get_saved_encryption_key();
    size_t savedKeySize = db_get_saved_encryption_key_size();
    if( zSavedKey!=0 && savedKeySize>0 ){
      @ %lu(GetCurrentProcessId()):%p(zSavedKey):%u(savedKeySize)
      return;
    }
  }
#endif
  @ %d(GETPID())
}

/*
** COMMAND: http*
**
** Usage: %fossil http ?REPOSITORY? ?OPTIONS?
**
** Handle a single HTTP request appearing on stdin.  The resulting webpage