Fossil

Check-in [f38866e749]
Login

Check-in [f38866e749]

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

Overview
Comment:Hack in Windows so that it shows the correct launch command in the log-menu.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f38866e7497b22af59d86882310636be1fc5fe1f13482de1b277e6a1d1339082
User & Date: drh 2025-02-14 17:04:38.338
Context
2025-02-14
17:36
Improvements to "fossil ui/server" on Windows. ... (check-in: f8e522e467 user: drh tags: trunk)
17:04
Hack in Windows so that it shows the correct launch command in the log-menu. ... (check-in: f38866e749 user: drh tags: trunk)
16:37
Fix typo (missing space) in the new log-menu page. ... (check-in: bd0d442259 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
2918
2919
2920
2921
2922
2923
2924













2925
2926
2927
2928
2929
2930
2931
  }else{
    g.httpOut = stdout;
#if defined(_WIN32)
   _setmode(_fileno(stdout), _O_BINARY);
#endif
  }
  zIpAddr = find_option("ipaddr",0,1);













  useSCGI = find_option("scgi", 0, 0)!=0;
  if( useSCGI ) g.zReqType = "SCGI";
  zAltBase = find_option("baseurl", 0, 1);
  if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
  if( zAltBase ) set_base_url(zAltBase);
  if( find_option("https",0,0)!=0 ){
    zIpAddr = fossil_getenv("REMOTE_HOST"); /* From stunnel */







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







2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
  }else{
    g.httpOut = stdout;
#if defined(_WIN32)
   _setmode(_fileno(stdout), _O_BINARY);
#endif
  }
  zIpAddr = find_option("ipaddr",0,1);
#if defined(_WIN32)
  /* The undocumented option "--as NAME" causes NAME to become
  ** the fake command name.  This only happens on Windows and only
  ** if preceded by --in, --out, and --ipaddr.  It is a work-around
  ** to get the original command-name down into the "http" command that
  ** is run in a subprocess to manage HTTP requests on Windows for
  ** commands like "fossil ui" and "fossil server".
  */
  if( zInFile && zOutFile && zIpAddr ){
    const char *z = find_option("as",0,1);
    if( z ) g.zCmdName = z;
  }
#endif
  useSCGI = find_option("scgi", 0, 0)!=0;
  if( useSCGI ) g.zReqType = "SCGI";
  zAltBase = find_option("baseurl", 0, 1);
  if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
  if( zAltBase ) set_base_url(zAltBase);
  if( find_option("https",0,0)!=0 ){
    zIpAddr = fossil_getenv("REMOTE_HOST"); /* From stunnel */
Changes to src/setup.c.
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
        "make an entry like \"errorlog: <i>FILENAME</i>\""
        " in the CGI script at %h",
        P("SCRIPT_FILENAME")
      );
    }else{
      blob_appendf(&desc,
        " add the \"--errorlog <i>FILENAME</i>\" option to the\n"
        "\"%h %h\" command that launched this server.",
        g.argv[0], g.zCmdName
      );
    }
    bErrLog = 0;
  }else{
    blob_appendf(&desc,"In this repository, the error log is the file "
       "named \"%s\".", g.zErrlog);







|







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
        "make an entry like \"errorlog: <i>FILENAME</i>\""
        " in the CGI script at %h",
        P("SCRIPT_FILENAME")
      );
    }else{
      blob_appendf(&desc,
        " add the \"--errorlog <i>FILENAME</i>\" option to the\n"
        "\"%h %h\" command that launched the server.",
        g.argv[0], g.zCmdName
      );
    }
    bErrLog = 0;
  }else{
    blob_appendf(&desc,"In this repository, the error log is the file "
       "named \"%s\".", g.zErrlog);
Changes to src/winhttp.c.
414
415
416
417
418
419
420
421

422

423
424
425

426
427
428
429
430
431
432
433
  ** The repository name is only needed if there was no open check-out.  This
  ** is designed to allow the open check-out for the interactive user to work
  ** with the local Fossil server started via the "ui" command.
  */
  zIp = SocketAddr_toString(&p->addr);
  if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
    assert( g.zRepositoryName && g.zRepositoryName[0] );
    sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s\n%s",

      get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zRepositoryName

    );
  }else{
    sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s",

      get_utf8_bom(0), zRequestFName, zReplyFName, zIp
    );
  }
  fossil_free(zIp);
  aux = fossil_fopen(zCmdFName, "wb");
  if( aux==0 ) goto end_request;
  fwrite(zCmd, 1, strlen(zCmd), aux);








|
>
|
>


|
>
|







414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
  ** The repository name is only needed if there was no open check-out.  This
  ** is designed to allow the open check-out for the interactive user to work
  ** with the local Fossil server started via the "ui" command.
  */
  zIp = SocketAddr_toString(&p->addr);
  if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
    assert( g.zRepositoryName && g.zRepositoryName[0] );
    sqlite3_snprintf(sizeof(zCmd), zCmd,
      "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n%s",
      get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName,
      g.zRepositoryName
    );
  }else{
    sqlite3_snprintf(sizeof(zCmd), zCmd,
      "%s--in %s\n--out %s\n--ipaddr %s\n--as %s\n",
      get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zCmdName
    );
  }
  fossil_free(zIp);
  aux = fossil_fopen(zCmdFName, "wb");
  if( aux==0 ) goto end_request;
  fwrite(zCmd, 1, strlen(zCmd), aux);