Fossil SCM
The test-httpmsg command now sends the payload uncompressed unless the new --compress option is used.
Commit
c31ff76fe98d4b4902327b8eef436058d206d56d5243789d9b323733025bfed6
Parent
61fd10ecd1d1c9f…
1 file changed
+5
-2
+5
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -38,10 +38,11 @@ | ||
| 38 | 38 | */ |
| 39 | 39 | #define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */ |
| 40 | 40 | #define HTTP_GENERIC 0x00002 /* Generic HTTP request */ |
| 41 | 41 | #define HTTP_VERBOSE 0x00004 /* HTTP status messages */ |
| 42 | 42 | #define HTTP_QUIET 0x00008 /* No surplus output */ |
| 43 | +#define HTTP_NOCOMPRESS 0x00010 /* Omit payload compression */ | |
| 43 | 44 | #endif |
| 44 | 45 | |
| 45 | 46 | /* Maximum number of HTTP Authorization attempts */ |
| 46 | 47 | #define MAX_HTTP_AUTH 2 |
| 47 | 48 | |
| @@ -246,11 +247,11 @@ | ||
| 246 | 247 | if( blob_size(pSend)==0 ){ |
| 247 | 248 | blob_zero(&payload); |
| 248 | 249 | }else{ |
| 249 | 250 | blob_zero(&login); |
| 250 | 251 | if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login); |
| 251 | - if( g.fHttpTrace ){ | |
| 252 | + if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){ | |
| 252 | 253 | payload = login; |
| 253 | 254 | blob_append(&payload, blob_buffer(pSend), blob_size(pSend)); |
| 254 | 255 | }else{ |
| 255 | 256 | blob_compress2(&login, pSend, &payload); |
| 256 | 257 | blob_reset(&login); |
| @@ -478,24 +479,26 @@ | ||
| 478 | 479 | ** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted |
| 479 | 480 | ** or is an empty file, then a GET message is sent. |
| 480 | 481 | ** |
| 481 | 482 | ** Options: |
| 482 | 483 | ** |
| 484 | +** --compress Use ZLIB compression on the payload | |
| 483 | 485 | ** --mimetype TYPE Mimetype of the payload |
| 484 | 486 | ** --out FILE Store the reply in FILE |
| 485 | 487 | ** -v Verbose output |
| 486 | 488 | */ |
| 487 | 489 | void test_wget_command(void){ |
| 488 | 490 | const char *zMimetype; |
| 489 | 491 | const char *zInFile; |
| 490 | 492 | const char *zOutFile; |
| 491 | 493 | Blob in, out; |
| 492 | - unsigned int mHttpFlags = HTTP_GENERIC; | |
| 494 | + unsigned int mHttpFlags = HTTP_GENERIC|HTTP_NOCOMPRESS; | |
| 493 | 495 | |
| 494 | 496 | zMimetype = find_option("mimetype",0,1); |
| 495 | 497 | zOutFile = find_option("out","o",1); |
| 496 | 498 | if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE; |
| 499 | + if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS; | |
| 497 | 500 | if( g.argc!=3 && g.argc!=4 ){ |
| 498 | 501 | usage("URL ?PAYLOAD?"); |
| 499 | 502 | } |
| 500 | 503 | zInFile = g.argc==4 ? g.argv[3] : 0; |
| 501 | 504 | url_parse(g.argv[2], 0); |
| 502 | 505 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | */ |
| 39 | #define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */ |
| 40 | #define HTTP_GENERIC 0x00002 /* Generic HTTP request */ |
| 41 | #define HTTP_VERBOSE 0x00004 /* HTTP status messages */ |
| 42 | #define HTTP_QUIET 0x00008 /* No surplus output */ |
| 43 | #endif |
| 44 | |
| 45 | /* Maximum number of HTTP Authorization attempts */ |
| 46 | #define MAX_HTTP_AUTH 2 |
| 47 | |
| @@ -246,11 +247,11 @@ | |
| 246 | if( blob_size(pSend)==0 ){ |
| 247 | blob_zero(&payload); |
| 248 | }else{ |
| 249 | blob_zero(&login); |
| 250 | if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login); |
| 251 | if( g.fHttpTrace ){ |
| 252 | payload = login; |
| 253 | blob_append(&payload, blob_buffer(pSend), blob_size(pSend)); |
| 254 | }else{ |
| 255 | blob_compress2(&login, pSend, &payload); |
| 256 | blob_reset(&login); |
| @@ -478,24 +479,26 @@ | |
| 478 | ** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted |
| 479 | ** or is an empty file, then a GET message is sent. |
| 480 | ** |
| 481 | ** Options: |
| 482 | ** |
| 483 | ** --mimetype TYPE Mimetype of the payload |
| 484 | ** --out FILE Store the reply in FILE |
| 485 | ** -v Verbose output |
| 486 | */ |
| 487 | void test_wget_command(void){ |
| 488 | const char *zMimetype; |
| 489 | const char *zInFile; |
| 490 | const char *zOutFile; |
| 491 | Blob in, out; |
| 492 | unsigned int mHttpFlags = HTTP_GENERIC; |
| 493 | |
| 494 | zMimetype = find_option("mimetype",0,1); |
| 495 | zOutFile = find_option("out","o",1); |
| 496 | if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE; |
| 497 | if( g.argc!=3 && g.argc!=4 ){ |
| 498 | usage("URL ?PAYLOAD?"); |
| 499 | } |
| 500 | zInFile = g.argc==4 ? g.argv[3] : 0; |
| 501 | url_parse(g.argv[2], 0); |
| 502 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | */ |
| 39 | #define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */ |
| 40 | #define HTTP_GENERIC 0x00002 /* Generic HTTP request */ |
| 41 | #define HTTP_VERBOSE 0x00004 /* HTTP status messages */ |
| 42 | #define HTTP_QUIET 0x00008 /* No surplus output */ |
| 43 | #define HTTP_NOCOMPRESS 0x00010 /* Omit payload compression */ |
| 44 | #endif |
| 45 | |
| 46 | /* Maximum number of HTTP Authorization attempts */ |
| 47 | #define MAX_HTTP_AUTH 2 |
| 48 | |
| @@ -246,11 +247,11 @@ | |
| 247 | if( blob_size(pSend)==0 ){ |
| 248 | blob_zero(&payload); |
| 249 | }else{ |
| 250 | blob_zero(&login); |
| 251 | if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login); |
| 252 | if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){ |
| 253 | payload = login; |
| 254 | blob_append(&payload, blob_buffer(pSend), blob_size(pSend)); |
| 255 | }else{ |
| 256 | blob_compress2(&login, pSend, &payload); |
| 257 | blob_reset(&login); |
| @@ -478,24 +479,26 @@ | |
| 479 | ** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted |
| 480 | ** or is an empty file, then a GET message is sent. |
| 481 | ** |
| 482 | ** Options: |
| 483 | ** |
| 484 | ** --compress Use ZLIB compression on the payload |
| 485 | ** --mimetype TYPE Mimetype of the payload |
| 486 | ** --out FILE Store the reply in FILE |
| 487 | ** -v Verbose output |
| 488 | */ |
| 489 | void test_wget_command(void){ |
| 490 | const char *zMimetype; |
| 491 | const char *zInFile; |
| 492 | const char *zOutFile; |
| 493 | Blob in, out; |
| 494 | unsigned int mHttpFlags = HTTP_GENERIC|HTTP_NOCOMPRESS; |
| 495 | |
| 496 | zMimetype = find_option("mimetype",0,1); |
| 497 | zOutFile = find_option("out","o",1); |
| 498 | if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE; |
| 499 | if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS; |
| 500 | if( g.argc!=3 && g.argc!=4 ){ |
| 501 | usage("URL ?PAYLOAD?"); |
| 502 | } |
| 503 | zInFile = g.argc==4 ? g.argv[3] : 0; |
| 504 | url_parse(g.argv[2], 0); |
| 505 |