chiark / gitweb /
move http client setup to yarrglib.tcl
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 12 Dec 2009 13:17:03 +0000 (13:17 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 12 Dec 2009 13:17:03 +0000 (13:17 +0000)
yarrg/dictionary-manager
yarrg/yarrglib.tcl

index 83c7e548c29ff3873a9b4e0057ded05f1fdeb1f7..46a5902f9721e741b3b65f3683236a412b314609 100755 (executable)
@@ -510,13 +510,7 @@ proc upload_init {} {
     }
     if {$privacy_setting} {
        package require http
-       ::http::config -urlencoding utf-8
-       set ua [::http::config -useragent]
-       debug "USERAGENT OLD \"$ua\""
-       set ua [exec ./database-info-fetch useragentstringmap $ua \
-                   dictionary-manager 2>@ stderr]
-       ::http::config -useragent $ua
-       debug "USERAGENT NEW \"$ua\""
+       httpclientsetup dictionary-manager
     }
 }
 
index e1bf6e8b0fbe866d1d7cbd86a0b87c9d84278d87..a657537251ab29698fcb3e0f3e6fdfc5ce620c99 100644 (file)
@@ -6,3 +6,13 @@ proc manyset {list args} {
         set my $val
     }
 }
+
+proc httpclientsetup {program} {
+    ::http::config -urlencoding utf-8
+    set ua [::http::config -useragent]
+    debug "USERAGENT OLD \"$ua\""
+    set ua [exec ./database-info-fetch useragentstringmap $ua \
+                   $program 2>@ stderr]
+    ::http::config -useragent $ua
+    debug "USERAGENT NEW \"$ua\""
+}