diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-09-08 12:02:03 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-09-08 12:02:03 +0200 |
commit | 6d8a0a5e9d778cb2408cfbb450db768b3135086a (patch) | |
tree | 3dbb13d3f2d9f1cd71c69d1a94044b7ca854d1ef /openvpn/src/openvpn/options.c | |
parent | d066e03e7d61477424b49742ce142780c698d750 (diff) |
Add custom http header support (closes issue #199)
People annoyed so much with this stupid feature that I implemented it
Diffstat (limited to 'openvpn/src/openvpn/options.c')
-rw-r--r-- | openvpn/src/openvpn/options.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c index e551c308..01960f23 100644 --- a/openvpn/src/openvpn/options.c +++ b/openvpn/src/openvpn/options.c @@ -4979,6 +4979,35 @@ add_option (struct options *options, { ho->user_agent = p[2]; } + else if ((streq (p[1], "EXT1") || streq(p[1], "EXT2") || streq(p[1], "CUSTOM-HEADER")) + && p[2]) + { + /* In the wild patched versions use both EXT1/2 and CUSTOM-HEADER with either two + * argument or one */ + struct http_custom_header *custom_header =NULL; + int i; + + + /* Find the first free header */ + for (i=0; i < MAX_CUSTOM_HTTP_HEADER; i++) { + if (!ho->custom_headers[i].name) { + custom_header = &ho->custom_headers[i]; + break; + } + } + if (!custom_header) + { + msg (msglevel, "Cannot use more than %d http-proxy-option CUSTOM-HEAER : '%s'", MAX_CUSTOM_HTTP_HEADER, p[1]); + } + else + { + /* We will save p[2] and p[3], the proxy code will detect if + * p[3] is NULL */ + custom_header->name = p[2]; + custom_header->content = p[3]; + } + + } else { msg (msglevel, "Bad http-proxy-option or missing parameter: '%s'", p[1]); |