New upstream release, includes a new --proxy options and honours the
authorgregor herrmann <gregoa@debian.org>
Mon, 12 Jan 2009 21:41:27 +0000 (21:41 -0000)
committergregor herrmann <gregoa@debian.org>
Mon, 12 Jan 2009 21:41:27 +0000 (21:41 -0000)
http_proxy environment variable (closes: #511087).

ChangeLog
Makefile
RELEASE-NOTES
bti.c
bti.xml
debian/changelog

index 74674cb..1336d79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Summary of changes from v009 to v010
+============================================
+
+Greg Kroah-Hartman (3):
+      add --proxy support to command line
+      check in changes to bti.1 from previous xml changes
+      document the order that config options are handled
+
+gregor herrmann (2):
+      Fix up documentation of proxy option
+      use the http_proxy environment variable if it is present
+
+
 Summary of changes from v008 to v009
 ============================================
 
index 4cfa826..7fc3a7b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
 #
 #
 
-VERSION = 009
+VERSION = 010
 
 PROGRAM = bti
 
index 0d167b5..a268118 100644 (file)
@@ -1,3 +1,9 @@
+bti 010
+=============
+Fix up HTTP proxy support, thanks to gregor herrmann:
+  - command line option now works
+  - http_proxy environment variable is now handled
+
 bti 009
 =============
 Initial attempt for HTTP proxy support.
diff --git a/bti.c b/bti.c
index f3fc64c..a06c818 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -336,8 +336,11 @@ static void parse_configfile(struct session *session)
                        session->host = HOST_IDENTICA;
                free(host);
        }
-       if (proxy)
+       if (proxy) {
+               if (session->proxy)
+                       free(session->proxy);
                session->proxy = proxy;
+       }
 
        /* Free buffer and close file.  */
        free(line);
@@ -351,6 +354,7 @@ int main(int argc, char *argv[], char *envp[])
                { "account", 1, NULL, 'a' },
                { "password", 1, NULL, 'p' },
                { "host", 1, NULL, 'H' },
+               { "proxy", 1, NULL, 'P' },
                { "help", 0, NULL, 'h' },
                { "bash", 0, NULL, 'b' },
                { "version", 0, NULL, 'v' },
@@ -361,6 +365,7 @@ int main(int argc, char *argv[], char *envp[])
        char *tweet;
        int retval;
        int option;
+       char *http_proxy;
 #if 0
        char *home = getenv("HOME");
        char *pwd = getenv("PWD");
@@ -373,10 +378,21 @@ int main(int argc, char *argv[], char *envp[])
        }
 
        curl_global_init(CURL_GLOBAL_ALL);
+
+       /* Set environment variables first, before reading command line options
+        * or config file values. */
+       http_proxy = getenv("http_proxy");
+       if (http_proxy) {
+               if (session->proxy)
+                       free(session->proxy);
+               session->proxy = strdup(http_proxy);
+               dbg("http_proxy = %s\n", session->proxy);
+       }
+
        parse_configfile(session);
 
        while (1) {
-               option = getopt_long_only(argc, argv, "dqe:p:H:a:h",
+               option = getopt_long_only(argc, argv, "dqe:p:P:H:a:h",
                                          options, NULL);
                if (option == -1)
                        break;
@@ -396,6 +412,12 @@ int main(int argc, char *argv[], char *envp[])
                        session->password = strdup(optarg);
                        dbg("password = %s\n", session->password);
                        break;
+               case 'P':
+                       if (session->proxy)
+                               free(session->proxy);
+                       session->proxy = strdup(optarg);
+                       dbg("proxy = %s\n", session->proxy);
+                       break;
                case 'H':
                        if (strcasecmp(optarg, "twitter") == 0)
                                session->host = HOST_TWITTER;
diff --git a/bti.xml b/bti.xml
index d4d73fd..96f424a 100644 (file)
--- a/bti.xml
+++ b/bti.xml
@@ -81,7 +81,8 @@
                only needed by systems that are behind a http proxy.
               </para>
               <para>
-               If no host is specified, the default is to send to twitter.com.
+               If --proxy is not specified but the environment variable
+                'http_proxy' is set the latter will be used.
               </para>
             </listitem>
           </varlistentry>
            <filename>bti.example</filename> in the source tree that shows
            the structure of the file if you need an example to work off of.
          </para>
+         <para>
+           Configuration options have the following priority:
+        </para>
+         <variablelist>
+           <varlistentry>
+             <term></term>
+             <listitem><para>command line option</para></listitem>
+           </varlistentry>
+           <varlistentry>
+            <term></term>
+            <listitem><para>config file option</para></listitem>
+           </varlistentry>
+           <varlistentry>
+             <term></term>
+             <listitem><para>environment variables</para></listitem>
+           </varlistentry>
+         </variablelist>
+        <para>
+          For example, command line options always override any config file
+          option, or any environment variables.
+         </para>
        </refsect1>
 
        <refsect1><title>AUTHOR</title>
index 903228c..e9ef943 100644 (file)
@@ -1,6 +1,7 @@
-bti (009-1) UNRELEASED; urgency=low
+bti (010-1) UNRELEASED; urgency=low
 
-  * New upstream release.
+  * New upstream release, includes a new --proxy options and honours the
+    http_proxy environment variable (closes: #511087).
   * Refresh patch manpage-debian.patch.
 
  -- gregor herrmann <gregoa@debian.org>  Mon, 12 Jan 2009 16:57:03 +0100