commit 671152207209a890f35f774ef938cff24cdc3b98
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Oct 10 15:28:09 2013 -0400
Make user-agent a configuration option
---
configure.ac | 10 ++++++++++
src/tlsdate-helper.c | 3 +--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f1a424f..99b81de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,16 @@ dnl Place we install our config file
TLSDATE_CONF_DIR="${sysconfdir}/$PACKAGE_NAME/"
AC_SUBST([TLSDATE_CONF_DIR])
+dnl HTTPS User-agent
+AC_ARG_WITH([https-user-agent],
+ [AS_HELP_STRING([--with-https-user-agent=AGENT],
+ [a User-Agent value to send when running in HTTPS mode])],
+ [],
+ [with_https_user_agent="TLSDate/1.0"])
+AC_DEFINE_UNQUOTED([HTTPS_USER_AGENT],
+ ["${with_https_user_agent}"],
+ [User-Agent value to send when running as an HTTPS client])
+
dnl check for PolarSSL
OPT_POLARSSL=yes
diff --git a/src/tlsdate-helper.c b/src/tlsdate-helper.c
index 4dce354..7813158 100644
--- a/src/tlsdate-helper.c
+++ b/src/tlsdate-helper.c
@@ -925,7 +925,6 @@ inspect_key (SSL *ssl, const char *hostname)
"User-Agent: %s\r\n" \
"Host: %s\r\n" \
"\r\n"
-#define HTTP_USER_AGENT "TLSDate/1.0"
#ifdef USE_POLARSSL
void
@@ -1214,7 +1213,7 @@ run_ssl (uint32_t *time_map, int time_is_an_illusion, int http)
char buf[1024];
verb("V: Starting HTTP\n");
if (snprintf(buf, sizeof(buf),
- HTTP_REQUEST, HTTP_USER_AGENT, hostname_to_verify) >= 1024)
+ HTTP_REQUEST, HTTPS_USER_AGENT, hostname_to_verify) >= 1024)
die("hostname too long");
buf[1023]='\0'; /* Unneeded. */
verb("V: Writing HTTP request\n");