remove custom header support (-H option) - hurl - Gopher/HTTP/HTTPS file grabber | |
git clone git://git.codemadness.org/hurl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e260518fff049888d3fcbc767f34a11a98f895d4 | |
parent 23ccf09d87db6c960b6fb6360ae306a91c8b16b5 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 17 Feb 2019 15:08:32 +0100 | |
remove custom header support (-H option) | |
Diffstat: | |
M hurl.1 | 3 --- | |
M hurl.c | 16 +++------------- | |
2 files changed, 3 insertions(+), 16 deletions(-) | |
--- | |
diff --git a/hurl.1 b/hurl.1 | |
@@ -6,7 +6,6 @@ | |
.Nd HTTP/HTTPS/Gopher file grabber | |
.Sh SYNOPSIS | |
.Nm | |
-.Op Fl H Ar header | |
.Op Fl m Ar filesize | |
.Op Fl t Ar timeout | |
.Ar url | |
@@ -18,8 +17,6 @@ supports the protocols: HTTP, HTTPS and Gopher. | |
.Pp | |
The options are as follows: | |
.Bl -tag -width Ds | |
-.It Fl H Ar header | |
-Add custom raw data to HTTP header (HTTP/HTTPS only). | |
.It Fl m Ar filesize | |
Maximum size of the data in bytes. | |
.It Fl t Ar timeout | |
diff --git a/hurl.c b/hurl.c | |
@@ -43,8 +43,6 @@ char *argv0; | |
static size_t config_maxresponsesiz = 0; | |
/* time-out in seconds */ | |
static time_t config_timeout = 10; | |
-/* custom HTTP header */ | |
-static char *config_custom; | |
/* parsed uri */ | |
static struct uri u; | |
/* raw command-line argument */ | |
@@ -209,8 +207,7 @@ https_request(void) | |
"GET %s HTTP/1.0\r\n" | |
"Host: %s\r\n" | |
"Connection: close\r\n" | |
- "%s" | |
- "\r\n", u.path, u.host, config_custom ? config_custom : ""); | |
+ "\r\n", u.path, u.host); | |
if ((r = tls_write(t, buf, strlen(buf))) < 0) { | |
fprintf(stderr, "tls_write: %s\n", tls_error(t)); | |
goto err; | |
@@ -314,8 +311,7 @@ http_request(void) | |
"GET %s HTTP/1.0\r\n" | |
"Host: %s\r\n" | |
"Connection: close\r\n" | |
- "%s" | |
- "\r\n", u.path, u.host, config_custom ? config_custom : ""); | |
+ "\r\n", u.path, u.host); | |
if ((r = write(fd, buf, strlen(buf))) == -1) { | |
fprintf(stderr, "write: %s\n", strerror(errno)); | |
goto err; | |
@@ -451,7 +447,7 @@ err: | |
void | |
usage(void) | |
{ | |
- fprintf(stderr, "usage: %s [-H header] [-m maxresponse] [-t timeout] u… | |
+ fprintf(stderr, "usage: %s [-m maxresponse] [-t timeout] url\n", | |
argv0); | |
exit(1); | |
} | |
@@ -464,9 +460,6 @@ main(int argc, char **argv) | |
long long l; | |
ARGBEGIN { | |
- case 'H': /* custom HTTP headers */ | |
- config_custom = EARGF(usage()); | |
- break; | |
case 'm': /* max filesize */ | |
errno = 0; | |
l = strtoll(EARGF(usage()), &end, 10); | |
@@ -511,9 +504,6 @@ main(int argc, char **argv) | |
memcpy(u.port, "80", 3); | |
statuscode = http_request(); | |
} else if (!strcmp(u.proto, "gopher")) { | |
- if (config_custom) | |
- errx(1, "no custom header supported with gopher protoc… | |
- | |
if (!u.port[0]) | |
memcpy(u.port, "70", 3); | |