Remove this. RC doesn't let you configure it, and no one has complained,
authorDan Winship <danw@src.gnome.org>
Tue, 19 Aug 2003 17:35:57 +0000 (17:35 +0000)
committerDan Winship <danw@src.gnome.org>
Tue, 19 Aug 2003 17:35:57 +0000 (17:35 +0000)
* libsoup/soup-socks.[ch]: Remove this. RC doesn't let you
configure it, and no one has complained, and it looks like the
SOCKS5 auth code doesn't actually work anyway...

* libsoup/soup-queue.c (proxy_connect): Remove SOCKS code.

* libsoup/soup-uri.h: Remove SOUP_PROTOCOL_SOCKS4 and
SOUP_PROTOCOL_SOCKS5

* libsoup/soup-misc.c: Remove a references to SOCKS in a comment

* libsoup/Makefile.am (libsoup_2_2_la_SOURCES): remove
soup-socks.[ch]

ChangeLog
libsoup/Makefile.am
libsoup/soup-misc.c
libsoup/soup-queue.c
libsoup/soup-socks.c [deleted file]
libsoup/soup-socks.h [deleted file]
libsoup/soup-uri.h

index 9804189..0dd77bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2003-08-19  Dan Winship  <danw@ximian.com>
 
+       * libsoup/soup-socks.[ch]: Remove this. RC doesn't let you
+       configure it anyway, and no one has complained, and it looks like
+       the SOCKS5 auth code doesn't actually work anyway...
+
+       * libsoup/soup-queue.c (proxy_connect): Remove SOCKS code.
+
+       * libsoup/soup-uri.h: Remove SOUP_PROTOCOL_SOCKS4 and
+       SOUP_PROTOCOL_SOCKS5
+
+       * libsoup/soup-misc.c: Remove a references to SOCKS in a comment
+
+       * libsoup/Makefile.am (libsoup_2_2_la_SOURCES): remove
+       soup-socks.[ch]
+
+2003-08-19  Dan Winship  <danw@ximian.com>
+
        * libsoup/soup-server.c: Make this a GObject. Remove
        SoupServerMessage code (to soup-server-message.c). Remove CGI
        server code (for now?)
index 2e6c922..4dbb738 100644 (file)
@@ -83,8 +83,6 @@ libsoup_2_2_la_SOURCES =      \
        soup-server-auth.c      \
        soup-server-message.c   \
        soup-socket.c           \
-       soup-socks.h            \
-       soup-socks.c            \
        soup-ssl.h              \
        soup-ssl.c              \
        soup-transfer.h         \
index ee89cb4..59a275f 100644 (file)
@@ -34,7 +34,7 @@ static SoupSecurityPolicy ssl_security_level = SOUP_SECURITY_DOMESTIC;
  * destination specified in a SoupMessage. Messages will be routed through the
  * proxy host on their way to the actual specified destination. The URL for this
  * context should be of the form:
- *     [http|https|socks4|socks5]://<USERNAME>:<PASSWORD>@<PROXYHOST>
+ *     [http|https]://<USERNAME>:<PASSWORD>@<PROXYHOST>
  */
 void
 soup_set_proxy (SoupContext *context)
index 53a6557..575b7fa 100644 (file)
@@ -26,7 +26,6 @@
 #include "soup-headers.h"
 #include "soup-misc.h"
 #include "soup-private.h"
-#include "soup-socks.h"
 #include "soup-ssl.h"
 #include "soup-transfer.h"
 
@@ -556,14 +555,6 @@ proxy_connect (SoupContext *ctx, SoupMessage *req, SoupConnection *conn)
        proto = soup_context_get_uri (ctx)->protocol;
        dest_proto = soup_context_get_uri (req->context)->protocol;
        
-       /* Handle SOCKS proxy negotiation */
-       if ((proto == SOUP_PROTOCOL_SOCKS4 || proto == SOUP_PROTOCOL_SOCKS5)) {
-               soup_connect_socks_proxy (conn, ctx, req->context, 
-                                         soup_queue_connect_cb,
-                                         req);
-               return TRUE;
-       } 
-       
        /* Handle HTTPS tunnel setup via proxy CONNECT request. */
        if (dest_proto == SOUP_PROTOCOL_HTTPS) {
                /* Syncronously send CONNECT request */
diff --git a/libsoup/soup-socks.c b/libsoup/soup-socks.c
deleted file mode 100644 (file)
index c461e0e..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * soup-queue.c: Asyncronous Callback-based HTTP Request Queue.
- *
- * Authors:
- *      Alex Graveley (alex@ximian.com)
- *
- * Copyright (C) 2000-2002, Ximian, Inc.
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include "soup-socks.h"
-#include "soup-context.h"
-#include "soup-socket.h"
-#include "soup-private.h"
-
-typedef struct {
-       SoupConnection        *src_conn;
-       SoupContext           *proxy_ctx;
-       
-       enum {
-               SOCKS_4_DEST_ADDR_LOOKUP,
-               SOCKS_4_SEND_DEST_ADDR,
-               SOCKS_4_VERIFY_SUCCESS,
-
-               SOCKS_5_SEND_INIT,
-               SOCKS_5_VERIFY_INIT,
-               SOCKS_5_SEND_AUTH,
-               SOCKS_5_VERIFY_AUTH,
-               SOCKS_5_SEND_DEST_ADDR,
-               SOCKS_5_VERIFY_SUCCESS  
-       } phase;
-
-       SoupAddress           *dest_addr;
-       SoupContext           *dest_ctx;
-       SoupConnectCallbackFn  cb;
-       gpointer               user_data;
-} SoupSocksData;
-
-static void
-socks_data_free (SoupSocksData *sd)
-{
-       if (sd->proxy_ctx)
-               g_object_unref (sd->proxy_ctx);
-
-       if (sd->dest_ctx)
-               g_object_unref (sd->dest_ctx);
-
-       if (sd->dest_addr)
-               g_object_unref (sd->dest_addr);
-
-       while (g_source_remove_by_user_data (sd))
-               continue;
-
-       g_free (sd);
-}
-
-static inline void
-WSTRING (char *buf, gint *len, gchar *str)
-{
-       gint l = strlen (str);
-       buf [(*len)++] = (guchar) l;
-       strncpy (&buf [*len], str, l);
-       *len += l;
-}
-
-static inline void
-WSHORT (char *buf, gint *len, gushort port)
-{
-       gushort np = htons (port);
-
-       memcpy (&buf [*len], &np, sizeof (np));
-       *len += sizeof (np);
-}
-
-static gboolean
-soup_socks_write (GIOChannel* iochannel, 
-                 GIOCondition condition, 
-                 SoupSocksData *sd)
-{
-       const SoupUri *dest_uri, *proxy_uri;
-       struct sockaddr *sa;
-       gboolean finished = FALSE;
-       guchar buf[128];
-       gint len = 0, sa_len;
-       gsize bytes_written;
-       GIOError error;
-
-       dest_uri = soup_context_get_uri (sd->dest_ctx);
-       proxy_uri = soup_context_get_uri (sd->proxy_ctx);
-
-       switch (sd->phase) {
-       case SOCKS_4_SEND_DEST_ADDR: 
-               /* FIXME: This won't work if dest_addr isn't IPv4 */
-
-               buf[len++] = 0x04;
-               buf[len++] = 0x01;
-               WSHORT (buf, &len, (gushort) dest_uri->port);
-               sa = soup_address_get_sockaddr (sd->dest_addr, &sa_len);
-               memcpy (&buf [len], 
-                       &((struct sockaddr_in *) sa)->sin_addr,
-                       4);
-               g_free (sa);
-               len += 4;
-               buf[8] = 0x00;
-               len = 9;
-               
-               sd->phase = SOCKS_4_VERIFY_SUCCESS;
-               finished = TRUE;
-               break;
-
-       case SOCKS_5_SEND_INIT:
-               if (proxy_uri->user) {
-                       buf[0] = 0x05;
-                       buf[1] = 0x02;
-                       buf[2] = 0x00;
-                       buf[3] = 0x02;
-                       len = 4;
-               } else {
-                       buf[0] = 0x05;
-                       buf[1] = 0x01;
-                       buf[2] = 0x00;
-                       len = 3;
-               }
-
-               sd->phase = SOCKS_5_VERIFY_INIT;
-               break;
-
-       case SOCKS_5_SEND_AUTH:
-               buf[len++] = 0x01;
-               WSTRING (buf, &len, proxy_uri->user);
-               WSTRING (buf, &len, proxy_uri->passwd);
-
-               sd->phase = SOCKS_5_VERIFY_AUTH;
-               break;
-
-       case SOCKS_5_SEND_DEST_ADDR:
-               buf[len++] = 0x05;
-               buf[len++] = 0x01;
-               buf[len++] = 0x00;
-               buf[len++] = 0x03;
-               WSTRING (buf, &len, dest_uri->host);
-               WSHORT (buf, &len, (gushort) dest_uri->port);
-
-               sd->phase = SOCKS_5_VERIFY_SUCCESS;
-               finished = TRUE;
-               break;
-
-       default:
-               return TRUE;
-       }
-
-       error = g_io_channel_write (iochannel, buf, len, &bytes_written);
-       
-       if (error == G_IO_ERROR_AGAIN) return TRUE;
-       if (error != G_IO_ERROR_NONE) goto CONNECT_ERROR;
-
-       return !finished;
-
- CONNECT_ERROR:
-       (*sd->cb) (sd->dest_ctx, SOUP_ERROR_CANT_CONNECT, NULL, sd->user_data);
-       socks_data_free (sd);
-       return FALSE;
-}
-
-static gboolean
-soup_socks_read (GIOChannel* iochannel, 
-                GIOCondition condition, 
-                SoupSocksData *sd)
-{
-       guchar buf[128];
-       gsize bytes_read;
-       GIOError error;
-
-       error = g_io_channel_read (iochannel, buf, sizeof (buf), &bytes_read);
-
-       if (error == G_IO_ERROR_AGAIN) return TRUE;
-       if (error != G_IO_ERROR_NONE || bytes_read == 0) goto CONNECT_ERROR;
-
-       switch (sd->phase) {
-       case SOCKS_4_VERIFY_SUCCESS:
-               if (bytes_read < 4 || buf[1] != 90) 
-                       goto CONNECT_ERROR;
-
-               goto CONNECT_OK;
-
-       case SOCKS_5_VERIFY_INIT:
-               if (bytes_read < 2 || buf [0] != 0x05 || buf [1] == 0xff)
-                       goto CONNECT_ERROR;
-
-               if (buf [1] == 0x02) 
-                       sd->phase = SOCKS_5_SEND_AUTH;
-               else 
-                       sd->phase = SOCKS_5_SEND_DEST_ADDR;
-               break;
-
-       case SOCKS_5_VERIFY_AUTH:
-               if (bytes_read < 2 || buf [0] != 0x01 || buf [1] != 0x00)
-                       goto CONNECT_ERROR;
-
-               sd->phase = SOCKS_5_SEND_DEST_ADDR;
-               break;
-
-       case SOCKS_5_VERIFY_SUCCESS:
-               if (bytes_read < 10 || buf[0] != 0x05 || buf[1] != 0x00) 
-                       goto CONNECT_ERROR;
-
-               goto CONNECT_OK;
-
-       default:
-               break;
-       }
-
-       return TRUE;
-
- CONNECT_OK:
-       (*sd->cb) (sd->dest_ctx, SOUP_ERROR_OK, sd->src_conn, sd->user_data);
-       socks_data_free (sd);
-       return FALSE;
-
- CONNECT_ERROR:
-       (*sd->cb) (sd->dest_ctx, SOUP_ERROR_CANT_CONNECT, NULL, sd->user_data);
-       socks_data_free (sd);
-       return FALSE;
-}
-
-static gboolean
-soup_socks_error (GIOChannel* iochannel, 
-                 GIOCondition condition, 
-                 SoupSocksData *sd)
-{
-       (*sd->cb) (sd->dest_ctx, SOUP_ERROR_CANT_CONNECT, NULL, sd->user_data);
-       socks_data_free (sd);
-       return FALSE;   
-}
-
-static void
-soup_lookup_dest_addr_cb (SoupAddress         *addr, 
-                         SoupKnownErrorCode   status, 
-                         gpointer             data)
-{
-       SoupSocksData *sd = data;
-       GIOChannel *channel;
-
-       if (status != SOUP_ERROR_OK) {
-               (*sd->cb) (sd->dest_ctx, status, NULL, sd->user_data); 
-               g_free (sd);
-               return;
-       }
-
-       sd->phase = SOCKS_4_SEND_DEST_ADDR;
-
-       channel = soup_connection_get_iochannel (sd->src_conn);
-       g_io_add_watch (channel, G_IO_OUT, (GIOFunc) soup_socks_write, sd);
-       g_io_add_watch (channel, G_IO_IN, (GIOFunc) soup_socks_read, sd);
-       g_io_add_watch (channel, 
-                       G_IO_ERR | G_IO_HUP | G_IO_NVAL, 
-                       (GIOFunc) soup_socks_error, 
-                       sd);            
-}
-
-void
-soup_connect_socks_proxy (SoupConnection        *conn, 
-                         SoupContext           *proxy_ctx, 
-                         SoupContext           *dest_ctx, 
-                         SoupConnectCallbackFn  cb,
-                         gpointer               user_data)
-{
-       SoupSocksData *sd = NULL;
-       const SoupUri *dest_uri, *proxy_uri;
-       GIOChannel *channel;
-
-       if (!soup_connection_is_new (conn)) goto CONNECT_SUCCESS;
-       
-       sd = g_new0 (SoupSocksData, 1);
-       sd->src_conn = conn;
-       sd->proxy_ctx = g_object_ref (proxy_ctx);
-       sd->dest_ctx = g_object_ref (dest_ctx);
-       sd->cb = cb;
-       sd->user_data = user_data;
-       
-       dest_uri = soup_context_get_uri (dest_ctx);
-       proxy_uri = soup_context_get_uri (proxy_ctx);
-
-       if (proxy_uri->protocol == SOUP_PROTOCOL_SOCKS4) {
-               sd->dest_addr = soup_address_new (dest_uri->host,
-                                                 dest_uri->port);
-               soup_address_resolve (sd->dest_addr, 
-                                     soup_lookup_dest_addr_cb,
-                                     sd);
-               sd->phase = SOCKS_4_DEST_ADDR_LOOKUP;
-       } else if (proxy_uri->protocol == SOUP_PROTOCOL_SOCKS5) {
-               channel = soup_connection_get_iochannel (conn);
-               g_io_add_watch (channel, 
-                               G_IO_OUT, 
-                               (GIOFunc) soup_socks_write, 
-                               sd);
-               g_io_add_watch (channel, 
-                               G_IO_IN, 
-                               (GIOFunc) soup_socks_read, 
-                               sd);
-               g_io_add_watch (channel, 
-                               G_IO_ERR | G_IO_HUP | G_IO_NVAL, 
-                               (GIOFunc) soup_socks_error, 
-                               sd);            
-
-               sd->phase = SOCKS_5_SEND_INIT;
-       } else
-               goto CONNECT_SUCCESS;
-
-       return;
-       
- CONNECT_SUCCESS:
-       (*cb) (dest_ctx, SOUP_ERROR_OK, conn, user_data); 
-       g_free (sd);
-}
diff --git a/libsoup/soup-socks.h b/libsoup/soup-socks.h
deleted file mode 100644 (file)
index 7cef445..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * soup-socks.h: Asyncronous Callback-based HTTP Request Queue.
- *
- * Authors:
- *      Alex Graveley (alex@ximian.com)
- *
- * Copyright (C) 2000-2002, Ximian, Inc.
- */
-
-#ifndef SOUP_SOCKS_H
-#define SOUP_SOCKS_H 1
-
-#include <glib.h>
-#include <libsoup/soup-context.h>
-
-void soup_connect_socks_proxy (SoupConnection        *conn, 
-                              SoupContext           *proxy_ctx, 
-                              SoupContext           *dest_ctx, 
-                              SoupConnectCallbackFn  cb,
-                              gpointer               user_data);
-
-#endif /*SOUP_SOCKS_H*/
index 0aa4bae..e768342 100644 (file)
@@ -14,8 +14,6 @@
 typedef GQuark SoupProtocol;
 #define SOUP_PROTOCOL_HTTP (g_quark_from_static_string ("http"))
 #define SOUP_PROTOCOL_HTTPS (g_quark_from_static_string ("https"))
-#define SOUP_PROTOCOL_SOCKS4 (g_quark_from_static_string ("socks4"))
-#define SOUP_PROTOCOL_SOCKS5 (g_quark_from_static_string ("socks5"))
 
 typedef struct {
        SoupProtocol  protocol;