Fossil SCM

The test-httpmsg command now sends the payload uncompressed unless the new --compress option is used.

drh 2019-08-02 00:10 trunk
Commit c31ff76fe98d4b4902327b8eef436058d206d56d5243789d9b323733025bfed6
1 file changed +5 -2
+5 -2
--- src/http.c
+++ src/http.c
@@ -38,10 +38,11 @@
3838
*/
3939
#define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */
4040
#define HTTP_GENERIC 0x00002 /* Generic HTTP request */
4141
#define HTTP_VERBOSE 0x00004 /* HTTP status messages */
4242
#define HTTP_QUIET 0x00008 /* No surplus output */
43
+#define HTTP_NOCOMPRESS 0x00010 /* Omit payload compression */
4344
#endif
4445
4546
/* Maximum number of HTTP Authorization attempts */
4647
#define MAX_HTTP_AUTH 2
4748
@@ -246,11 +247,11 @@
246247
if( blob_size(pSend)==0 ){
247248
blob_zero(&payload);
248249
}else{
249250
blob_zero(&login);
250251
if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
251
- if( g.fHttpTrace ){
252
+ if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
252253
payload = login;
253254
blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
254255
}else{
255256
blob_compress2(&login, pSend, &payload);
256257
blob_reset(&login);
@@ -478,24 +479,26 @@
478479
** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted
479480
** or is an empty file, then a GET message is sent.
480481
**
481482
** Options:
482483
**
484
+** --compress Use ZLIB compression on the payload
483485
** --mimetype TYPE Mimetype of the payload
484486
** --out FILE Store the reply in FILE
485487
** -v Verbose output
486488
*/
487489
void test_wget_command(void){
488490
const char *zMimetype;
489491
const char *zInFile;
490492
const char *zOutFile;
491493
Blob in, out;
492
- unsigned int mHttpFlags = HTTP_GENERIC;
494
+ unsigned int mHttpFlags = HTTP_GENERIC|HTTP_NOCOMPRESS;
493495
494496
zMimetype = find_option("mimetype",0,1);
495497
zOutFile = find_option("out","o",1);
496498
if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
499
+ if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS;
497500
if( g.argc!=3 && g.argc!=4 ){
498501
usage("URL ?PAYLOAD?");
499502
}
500503
zInFile = g.argc==4 ? g.argv[3] : 0;
501504
url_parse(g.argv[2], 0);
502505
--- 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

Keyboard Shortcuts

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