New upstream release.
authorgregor herrmann <gregoa@debian.org>
Mon, 12 Jan 2009 15:54:35 +0000 (15:54 -0000)
committergregor herrmann <gregoa@debian.org>
Mon, 12 Jan 2009 15:54:35 +0000 (15:54 -0000)
ChangeLog
Makefile
RELEASE-NOTES
bti.c
bti.example
bti.xml
debian/changelog

index 3f44e3d..74674cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Summary of changes from v008 to v009
+============================================
+
+Greg Kroah-Hartman (3):
+      initial cut at adding http proxy support
+      document proxy support
+      add example proxy value to the bti.example file
+
+
 Summary of changes from v007 to v008
 ============================================
 
index 77b62b9..4cfa826 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
 #
 #
 
-VERSION = 008
+VERSION = 009
 
 PROGRAM = bti
 
index 4315c42..0d167b5 100644 (file)
@@ -1,3 +1,7 @@
+bti 009
+=============
+Initial attempt for HTTP proxy support.
+
 bti 008
 =============
 Fix for twitter, due to their server not liking one of the http headers anymore.
diff --git a/bti.c b/bti.c
index feaab36..f3fc64c 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -49,6 +49,7 @@ struct session {
        char *password;
        char *account;
        char *tweet;
+       char *proxy;
        int bash;
        enum host host;
 };
@@ -67,6 +68,7 @@ static void display_help(void)
        fprintf(stdout, "options are:\n");
        fprintf(stdout, "  --account accountname\n");
        fprintf(stdout, "  --password password\n");
+       fprintf(stdout, "  --proxy PROXY:PORT\n");
        fprintf(stdout, "  --host HOST\n");
        fprintf(stdout, "  --bash\n");
        fprintf(stdout, "  --debug\n");
@@ -112,6 +114,7 @@ static void session_free(struct session *session)
        free(session->password);
        free(session->account);
        free(session->tweet);
+       free(session->proxy);
        free(session);
 }
 
@@ -233,12 +236,16 @@ static int send_tweet(struct session *session)
                break;
        }
 
+       if (session->proxy)
+               curl_easy_setopt(curl, CURLOPT_PROXY, session->proxy);
+
        if (debug)
                curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
        curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
 
        dbg("user_password = %s\n", user_password);
        dbg("data = %s\n", data);
+       dbg("proxy = %s\n", session->proxy);
 
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_callback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, curl_buf);
@@ -262,6 +269,7 @@ static void parse_configfile(struct session *session)
        char *account = NULL;
        char *password = NULL;
        char *host = NULL;
+       char *proxy = NULL;
        char *file;
        char *home = getenv("HOME");
 
@@ -309,6 +317,11 @@ static void parse_configfile(struct session *session)
                        c += 5;
                        if (c[0] != '\0')
                                host = strdup(c);
+               } else if (!strncasecmp(c, "proxy", 5) &&
+                          (c[5] == '=')) {
+                       c += 6;
+                       if (c[0] != '\0')
+                               proxy = strdup(c);
                }
        } while (!feof(config_file));
 
@@ -323,6 +336,8 @@ static void parse_configfile(struct session *session)
                        session->host = HOST_IDENTICA;
                free(host);
        }
+       if (proxy)
+               session->proxy = proxy;
 
        /* Free buffer and close file.  */
        free(line);
index 15ea6b2..580a9f4 100644 (file)
@@ -6,3 +6,4 @@
 account=twitmaster
 password=icanhascheezburger
 host=identica
+#proxy=http://localhost:8080
diff --git a/bti.xml b/bti.xml
index 0d7767e..d4d73fd 100644 (file)
--- a/bti.xml
+++ b/bti.xml
@@ -29,6 +29,7 @@
           <arg><option>--account account</option></arg>
           <arg><option>--password password</option></arg>
           <arg><option>--host HOST_NAME</option></arg>
+          <arg><option>--proxy PROXY:PORT</option></arg>
           <arg><option>--bash</option></arg>
           <arg><option>--debug</option></arg>
           <arg><option>--version</option></arg>
               </para>
             </listitem>
           </varlistentry>
+          <varlistentry>
+            <term><option>--proxy PROXY:PORT</option></term>
+            <listitem>
+              <para>
+               Specify a http proxy value.  This is not a required option, and
+               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.
+              </para>
+            </listitem>
+          </varlistentry>
           <varlistentry>
             <term><option>--debug</option></term>
             <listitem>
                </para>
              </listitem>
            </varlistentry>
+           <varlistentry>
+             <term><option>proxy</option></term>
+             <listitem>
+               <para>
+                The http proxy needed to send data out to the Internet.
+               </para>
+             </listitem>
+           </varlistentry>
          </variablelist>
          <para>
            There is an example config file called
index 1985a08..73b1cab 100644 (file)
@@ -1,3 +1,9 @@
+bti (009-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa@debian.org>  Mon, 12 Jan 2009 16:57:03 +0100
+
 bti (008-1) unstable; urgency=low
 
   * New upstream release (due to december twitter server change).