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.
Commit
3d238187bb432a84ab9f512b3830ce6f5f1d4271413c2a3909baf3831cda9f5a
Parent
2a563d60bf1fd81…
1 file changed
+14
-5
+14
-5
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -437,10 +437,13 @@ | ||
| 437 | 437 | g.httpUseSSL ? "" : " --nossl", p->zOptions |
| 438 | 438 | ); |
| 439 | 439 | in = fossil_fopen(zReplyFName, "w+b"); |
| 440 | 440 | fflush(out); |
| 441 | 441 | fflush(aux); |
| 442 | + if( g.fHttpTrace ){ | |
| 443 | + fossil_print("%s\n", zCmd); | |
| 444 | + } | |
| 442 | 445 | fossil_system(zCmd); |
| 443 | 446 | if( in ){ |
| 444 | 447 | while( (got = fread(zBuf, 1, sizeof(zBuf), in))>0 ){ |
| 445 | 448 | if( sslConn ){ |
| 446 | 449 | #ifdef FOSSIL_ENABLE_SSL |
| @@ -465,13 +468,15 @@ | ||
| 465 | 468 | if( shutdown(p->s,1)==0 ) shutdown(p->s,0); |
| 466 | 469 | closesocket(p->s); |
| 467 | 470 | /* Make multiple attempts to delete the temporary files. Sometimes AV |
| 468 | 471 | ** software keeps the files open for a few seconds, preventing the file |
| 469 | 472 | ** 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 | + } | |
| 473 | 478 | fossil_free(p); |
| 474 | 479 | } |
| 475 | 480 | |
| 476 | 481 | /* |
| 477 | 482 | ** Process a single incoming SCGI request. |
| @@ -652,12 +657,16 @@ | ||
| 652 | 657 | } |
| 653 | 658 | } |
| 654 | 659 | if( !GetTempPathW(MAX_PATH, zTmpPath) ){ |
| 655 | 660 | fossil_panic("unable to get path to the temporary directory."); |
| 656 | 661 | } |
| 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 | + } | |
| 659 | 668 | fossil_print("Temporary files: %s*\n", zTempPrefix); |
| 660 | 669 | fossil_print("Listening for %s requests on TCP port %d\n", |
| 661 | 670 | (flags&HTTP_SERVER_SCGI)!=0 ? "SCGI" : |
| 662 | 671 | g.httpUseSSL ? "TLS-encrypted HTTPS" : "HTTP", iPort); |
| 663 | 672 | if( zBrowser ){ |
| 664 | 673 |
| --- 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 |