changeset 269:d62280f2a9c7

urllog: Make user agent string configurable.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 Jan 2015 10:50:21 +0200
parents 96310b1c88fa
children d3ba5847cbda
files config.urllog.example urllog.tcl
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/config.urllog.example	Fri Jan 23 10:25:51 2015 +0200
+++ b/config.urllog.example	Fri Jan 23 10:50:21 2015 +0200
@@ -21,6 +21,10 @@
 
 set http_tls_cadir "/usr/share/ca-certificates/mozilla"
 
+# Set 'user agent' string for HTTP. If empty or not set, default will be used.
+set http_user_agent ""
+
+
 
 ###
 ### General options
--- a/urllog.tcl	Fri Jan 23 10:25:51 2015 +0200
+++ b/urllog.tcl	Fri Jan 23 10:50:21 2015 +0200
@@ -64,7 +64,12 @@
 putlog "$urllog_message"
 
 ### HTTP module initialization
-::http::config -useragent "$urllog_name/$urllog_version"
+if {[info exists http_user_agent] && $http_user_agent != ""} {
+  ::http::config -useragent $http_user_agent
+} else {
+  ::http::config -useragent "$urllog_name/$urllog_version"
+}
+
 if {[info exists http_use_proxy] && $http_use_proxy != 0} {
   ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port
   putlog " (Using proxy $http_proxy_host:$http_proxy_port)"