Fossil SCM

For Windows debugging, then "fossil ui" or "fossil server" is launched with the --httptrace option, the temporary files used to start subprocesses are stored in the working directory and are not deleted after each request.

drh 2022-01-26 17:28 trunk
Commit 3d238187bb432a84ab9f512b3830ce6f5f1d4271413c2a3909baf3831cda9f5a
1 file changed +14 -5
+14 -5
--- src/winhttp.c
+++ src/winhttp.c
@@ -437,10 +437,13 @@
437437
g.httpUseSSL ? "" : " --nossl", p->zOptions
438438
);
439439
in = fossil_fopen(zReplyFName, "w+b");
440440
fflush(out);
441441
fflush(aux);
442
+ if( g.fHttpTrace ){
443
+ fossil_print("%s\n", zCmd);
444
+ }
442445
fossil_system(zCmd);
443446
if( in ){
444447
while( (got = fread(zBuf, 1, sizeof(zBuf), in))>0 ){
445448
if( sslConn ){
446449
#ifdef FOSSIL_ENABLE_SSL
@@ -465,13 +468,15 @@
465468
if( shutdown(p->s,1)==0 ) shutdown(p->s,0);
466469
closesocket(p->s);
467470
/* Make multiple attempts to delete the temporary files. Sometimes AV
468471
** software keeps the files open for a few seconds, preventing the file
469472
** from being deleted on the first try. */
470
- for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
471
- for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
472
- for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
473
+ if( !g.fHttpTrace ){
474
+ for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
475
+ for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
476
+ for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
477
+ }
473478
fossil_free(p);
474479
}
475480
476481
/*
477482
** Process a single incoming SCGI request.
@@ -652,12 +657,16 @@
652657
}
653658
}
654659
if( !GetTempPathW(MAX_PATH, zTmpPath) ){
655660
fossil_panic("unable to get path to the temporary directory.");
656661
}
657
- zTempPrefix = mprintf("%sfossil_server_P%d",
658
- fossil_unicode_to_utf8(zTmpPath), iPort);
662
+ if( g.fHttpTrace ){
663
+ zTempPrefix = mprintf("httptrace");
664
+ }else{
665
+ zTempPrefix = mprintf("%sfossil_server_P%d",
666
+ fossil_unicode_to_utf8(zTmpPath), iPort);
667
+ }
659668
fossil_print("Temporary files: %s*\n", zTempPrefix);
660669
fossil_print("Listening for %s requests on TCP port %d\n",
661670
(flags&HTTP_SERVER_SCGI)!=0 ? "SCGI" :
662671
g.httpUseSSL ? "TLS-encrypted HTTPS" : "HTTP", iPort);
663672
if( zBrowser ){
664673
--- src/winhttp.c
+++ src/winhttp.c
@@ -437,10 +437,13 @@
437 g.httpUseSSL ? "" : " --nossl", p->zOptions
438 );
439 in = fossil_fopen(zReplyFName, "w+b");
440 fflush(out);
441 fflush(aux);
 
 
 
442 fossil_system(zCmd);
443 if( in ){
444 while( (got = fread(zBuf, 1, sizeof(zBuf), in))>0 ){
445 if( sslConn ){
446 #ifdef FOSSIL_ENABLE_SSL
@@ -465,13 +468,15 @@
465 if( shutdown(p->s,1)==0 ) shutdown(p->s,0);
466 closesocket(p->s);
467 /* Make multiple attempts to delete the temporary files. Sometimes AV
468 ** software keeps the files open for a few seconds, preventing the file
469 ** from being deleted on the first try. */
470 for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
471 for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
472 for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
 
 
473 fossil_free(p);
474 }
475
476 /*
477 ** Process a single incoming SCGI request.
@@ -652,12 +657,16 @@
652 }
653 }
654 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
655 fossil_panic("unable to get path to the temporary directory.");
656 }
657 zTempPrefix = mprintf("%sfossil_server_P%d",
658 fossil_unicode_to_utf8(zTmpPath), iPort);
 
 
 
 
659 fossil_print("Temporary files: %s*\n", zTempPrefix);
660 fossil_print("Listening for %s requests on TCP port %d\n",
661 (flags&HTTP_SERVER_SCGI)!=0 ? "SCGI" :
662 g.httpUseSSL ? "TLS-encrypted HTTPS" : "HTTP", iPort);
663 if( zBrowser ){
664
--- src/winhttp.c
+++ src/winhttp.c
@@ -437,10 +437,13 @@
437 g.httpUseSSL ? "" : " --nossl", p->zOptions
438 );
439 in = fossil_fopen(zReplyFName, "w+b");
440 fflush(out);
441 fflush(aux);
442 if( g.fHttpTrace ){
443 fossil_print("%s\n", zCmd);
444 }
445 fossil_system(zCmd);
446 if( in ){
447 while( (got = fread(zBuf, 1, sizeof(zBuf), in))>0 ){
448 if( sslConn ){
449 #ifdef FOSSIL_ENABLE_SSL
@@ -465,13 +468,15 @@
468 if( shutdown(p->s,1)==0 ) shutdown(p->s,0);
469 closesocket(p->s);
470 /* Make multiple attempts to delete the temporary files. Sometimes AV
471 ** software keeps the files open for a few seconds, preventing the file
472 ** from being deleted on the first try. */
473 if( !g.fHttpTrace ){
474 for(i=1; i<=10 && file_delete(zRequestFName); i++){ Sleep(1000*i); }
475 for(i=1; i<=10 && file_delete(zCmdFName); i++){ Sleep(1000*i); }
476 for(i=1; i<=10 && file_delete(zReplyFName); i++){ Sleep(1000*i); }
477 }
478 fossil_free(p);
479 }
480
481 /*
482 ** Process a single incoming SCGI request.
@@ -652,12 +657,16 @@
657 }
658 }
659 if( !GetTempPathW(MAX_PATH, zTmpPath) ){
660 fossil_panic("unable to get path to the temporary directory.");
661 }
662 if( g.fHttpTrace ){
663 zTempPrefix = mprintf("httptrace");
664 }else{
665 zTempPrefix = mprintf("%sfossil_server_P%d",
666 fossil_unicode_to_utf8(zTmpPath), iPort);
667 }
668 fossil_print("Temporary files: %s*\n", zTempPrefix);
669 fossil_print("Listening for %s requests on TCP port %d\n",
670 (flags&HTTP_SERVER_SCGI)!=0 ? "SCGI" :
671 g.httpUseSSL ? "TLS-encrypted HTTPS" : "HTTP", iPort);
672 if( zBrowser ){
673

Keyboard Shortcuts

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