Fossil SCM
Make sure stdin and stdout are set to binary mode in Windows for the "fossil http" command.
Commit
be1c4d47f9a28743e9197c65b038569d7a116304a4713718ffbb911b28824bb9
Parent
3d238187bb432a8…
1 file changed
+6
+6
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2729,17 +2729,23 @@ | ||
| 2729 | 2729 | backoffice_disable(); |
| 2730 | 2730 | g.httpIn = fossil_fopen(zInFile, "rb"); |
| 2731 | 2731 | if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile); |
| 2732 | 2732 | }else{ |
| 2733 | 2733 | g.httpIn = stdin; |
| 2734 | +#if defined(_WIN32) | |
| 2735 | + _setmode(_fileno(stdin), _O_BINARY); | |
| 2736 | +#endif | |
| 2734 | 2737 | } |
| 2735 | 2738 | zOutFile = find_option("out",0,1); |
| 2736 | 2739 | if( zOutFile ){ |
| 2737 | 2740 | g.httpOut = fossil_fopen(zOutFile, "wb"); |
| 2738 | 2741 | if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile); |
| 2739 | 2742 | }else{ |
| 2740 | 2743 | g.httpOut = stdout; |
| 2744 | +#if defined(_WIN32) | |
| 2745 | + _setmode(_fileno(stdout), _O_BINARY); | |
| 2746 | +#endif | |
| 2741 | 2747 | } |
| 2742 | 2748 | zIpAddr = find_option("ipaddr",0,1); |
| 2743 | 2749 | useSCGI = find_option("scgi", 0, 0)!=0; |
| 2744 | 2750 | zAltBase = find_option("baseurl", 0, 1); |
| 2745 | 2751 | if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay(); |
| 2746 | 2752 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2729,17 +2729,23 @@ | |
| 2729 | backoffice_disable(); |
| 2730 | g.httpIn = fossil_fopen(zInFile, "rb"); |
| 2731 | if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile); |
| 2732 | }else{ |
| 2733 | g.httpIn = stdin; |
| 2734 | } |
| 2735 | zOutFile = find_option("out",0,1); |
| 2736 | if( zOutFile ){ |
| 2737 | g.httpOut = fossil_fopen(zOutFile, "wb"); |
| 2738 | if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile); |
| 2739 | }else{ |
| 2740 | g.httpOut = stdout; |
| 2741 | } |
| 2742 | zIpAddr = find_option("ipaddr",0,1); |
| 2743 | useSCGI = find_option("scgi", 0, 0)!=0; |
| 2744 | zAltBase = find_option("baseurl", 0, 1); |
| 2745 | if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay(); |
| 2746 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2729,17 +2729,23 @@ | |
| 2729 | backoffice_disable(); |
| 2730 | g.httpIn = fossil_fopen(zInFile, "rb"); |
| 2731 | if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile); |
| 2732 | }else{ |
| 2733 | g.httpIn = stdin; |
| 2734 | #if defined(_WIN32) |
| 2735 | _setmode(_fileno(stdin), _O_BINARY); |
| 2736 | #endif |
| 2737 | } |
| 2738 | zOutFile = find_option("out",0,1); |
| 2739 | if( zOutFile ){ |
| 2740 | g.httpOut = fossil_fopen(zOutFile, "wb"); |
| 2741 | if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile); |
| 2742 | }else{ |
| 2743 | g.httpOut = stdout; |
| 2744 | #if defined(_WIN32) |
| 2745 | _setmode(_fileno(stdout), _O_BINARY); |
| 2746 | #endif |
| 2747 | } |
| 2748 | zIpAddr = find_option("ipaddr",0,1); |
| 2749 | useSCGI = find_option("scgi", 0, 0)!=0; |
| 2750 | zAltBase = find_option("baseurl", 0, 1); |
| 2751 | if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay(); |
| 2752 |