diff options
Diffstat (limited to 'web/attachments/450271-check_http.c.patch')
-rw-r--r-- | web/attachments/450271-check_http.c.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/web/attachments/450271-check_http.c.patch b/web/attachments/450271-check_http.c.patch new file mode 100644 index 0000000..aa0fd6d --- /dev/null +++ b/web/attachments/450271-check_http.c.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | --- check_http.c.orig 2010-07-27 16:47:16.000000000 -0400 | ||
2 | +++ check_http.c 2011-04-05 12:02:56.000000000 -0400 | ||
3 | @@ -94,6 +94,7 @@ | ||
4 | char server_type[6] = "http"; | ||
5 | char *server_address; | ||
6 | char *host_name; | ||
7 | +char *host_header; | ||
8 | char *server_url; | ||
9 | char *user_agent; | ||
10 | int server_url_length; | ||
11 | @@ -346,6 +347,13 @@ | ||
12 | case 'u': /* URL path */ | ||
13 | server_url = strdup (optarg); | ||
14 | server_url_length = strlen (server_url); | ||
15 | + // Also set HTTP host header | ||
16 | + char delim[] = "/"; | ||
17 | + if (!strncmp(optarg, "http://", 7) ) { | ||
18 | + host_header=strdup(strtok(optarg+7, delim)); | ||
19 | + } else if (!strncmp(optarg, "https://", 8) ) { | ||
20 | + host_header=strdup(strtok(optarg+8, delim)); | ||
21 | + } | ||
22 | break; | ||
23 | case 'p': /* Server port */ | ||
24 | if (!is_intnonneg (optarg)) | ||
25 | @@ -823,7 +831,10 @@ | ||
26 | asprintf (&buf, "%sConnection: close\r\n", buf); | ||
27 | |||
28 | /* optionally send the host header info */ | ||
29 | - if (host_name) { | ||
30 | + if (!host_header) { | ||
31 | + host_header=strdup(host_name); | ||
32 | + } | ||
33 | + if (host_header) { | ||
34 | /* | ||
35 | * Specify the port only if we're using a non-default port (see RFC 2616, | ||
36 | * 14.23). Some server applications/configurations cause trouble if the | ||
37 | @@ -831,9 +842,9 @@ | ||
38 | */ | ||
39 | if ((use_ssl == FALSE && server_port == HTTP_PORT) || | ||
40 | (use_ssl == TRUE && server_port == HTTPS_PORT)) | ||
41 | - asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
42 | + asprintf (&buf, "%sHost: %s\r\n", buf, host_header); | ||
43 | else | ||
44 | - asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
45 | + asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_header, server_port); | ||
46 | } | ||
47 | |||
48 | /* optionally send any other header tag */ | ||