[PATCH] add per-protocol override for HTTP User-Agent

Daniel Lenski dlenski at gmail.com
Sun Dec 17 12:21:38 PST 2017


Signed-off-by: Daniel Lenski <dlenski at gmail.com>
---
 http.c                 | 2 +-
 openconnect-internal.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/http.c b/http.c
index 5307d82..2960296 100644
--- a/http.c
+++ b/http.c
@@ -1472,7 +1472,7 @@ void http_common_headers(struct openconnect_info *vpninfo, struct oc_text_buf *b
 		buf_append(buf, "Host: %s\r\n", vpninfo->hostname);
 	else
 		buf_append(buf, "Host: %s:%d\r\n", vpninfo->hostname, vpninfo->port);
-	buf_append(buf, "User-Agent: %s\r\n", vpninfo->useragent);
+	buf_append(buf, "User-Agent: %s\r\n", vpninfo->proto->override_useragent ? : vpninfo->useragent);
 
 	if (vpninfo->cookies) {
 		buf_append(buf, "Cookie: ");
diff --git a/openconnect-internal.h b/openconnect-internal.h
index 0c0b7d4..a193151 100644
--- a/openconnect-internal.h
+++ b/openconnect-internal.h
@@ -263,6 +263,7 @@ struct vpn_proto {
 	const char *name;
 	const char *pretty_name;
 	const char *description;
+	const char *override_useragent;
 	unsigned int flags;
 	int (*vpn_close_session)(struct openconnect_info *vpninfo, const char *reason);
 
-- 
2.7.4




More information about the openconnect-devel mailing list