36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
** Bits of the mHttpFlags parameter to http_exchange()
*/
#define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */
#define HTTP_GENERIC 0x00002 /* Generic HTTP request */
#define HTTP_VERBOSE 0x00004 /* HTTP status messages */
#define HTTP_QUIET 0x00008 /* No surplus output */
#endif
/* Maximum number of HTTP Authorization attempts */
#define MAX_HTTP_AUTH 2
/* Keep track of HTTP Basic Authorization failures */
static int fSeenHttpAuth = 0;
|
>
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
** Bits of the mHttpFlags parameter to http_exchange()
*/
#define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */
#define HTTP_GENERIC 0x00002 /* Generic HTTP request */
#define HTTP_VERBOSE 0x00004 /* HTTP status messages */
#define HTTP_QUIET 0x00008 /* No surplus output */
#define HTTP_NOCOMPRESS 0x00010 /* Omit payload compression */
#endif
/* Maximum number of HTTP Authorization attempts */
#define MAX_HTTP_AUTH 2
/* Keep track of HTTP Basic Authorization failures */
static int fSeenHttpAuth = 0;
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
/* Construct the login card and prepare the complete payload */
if( blob_size(pSend)==0 ){
blob_zero(&payload);
}else{
blob_zero(&login);
if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
if( g.fHttpTrace ){
payload = login;
blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
}else{
blob_compress2(&login, pSend, &payload);
blob_reset(&login);
}
}
|
|
|
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
/* Construct the login card and prepare the complete payload */
if( blob_size(pSend)==0 ){
blob_zero(&payload);
}else{
blob_zero(&login);
if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
payload = login;
blob_append(&payload, blob_buffer(pSend), blob_size(pSend));
}else{
blob_compress2(&login, pSend, &payload);
blob_reset(&login);
}
}
|
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
|
** Send an HTTP message to URL and get the reply. PAYLOAD is a file containing
** the payload, or "-" to read payload from standard input. a POST message
** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted
** or is an empty file, then a GET message is sent.
**
** Options:
**
** --mimetype TYPE Mimetype of the payload
** --out FILE Store the reply in FILE
** -v Verbose output
*/
void test_wget_command(void){
const char *zMimetype;
const char *zInFile;
const char *zOutFile;
Blob in, out;
unsigned int mHttpFlags = HTTP_GENERIC;
zMimetype = find_option("mimetype",0,1);
zOutFile = find_option("out","o",1);
if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
if( g.argc!=3 && g.argc!=4 ){
usage("URL ?PAYLOAD?");
}
zInFile = g.argc==4 ? g.argv[3] : 0;
url_parse(g.argv[2], 0);
if( g.url.protocol[0]!='h' ){
fossil_fatal("the %s command supports only http: and https:", g.argv[1]);
|
>
|
>
|
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
** Send an HTTP message to URL and get the reply. PAYLOAD is a file containing
** the payload, or "-" to read payload from standard input. a POST message
** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted
** or is an empty file, then a GET message is sent.
**
** Options:
**
** --compress Use ZLIB compression on the payload
** --mimetype TYPE Mimetype of the payload
** --out FILE Store the reply in FILE
** -v Verbose output
*/
void test_wget_command(void){
const char *zMimetype;
const char *zInFile;
const char *zOutFile;
Blob in, out;
unsigned int mHttpFlags = HTTP_GENERIC|HTTP_NOCOMPRESS;
zMimetype = find_option("mimetype",0,1);
zOutFile = find_option("out","o",1);
if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE;
if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS;
if( g.argc!=3 && g.argc!=4 ){
usage("URL ?PAYLOAD?");
}
zInFile = g.argc==4 ? g.argv[3] : 0;
url_parse(g.argv[2], 0);
if( g.url.protocol[0]!='h' ){
fossil_fatal("the %s command supports only http: and https:", g.argv[1]);
|