Package: gwget
Version: 0.94-1
Severity: important
Tags: patch

Hi,

When I tried to use my machine's proxy, I got an "unknown error" message.
I captured wget's output:

  Error parsing proxy URL localhost:8080: Unsupported scheme.

I inspected the environment variables set for wget, and I got:

  http_proxy=localhost:8080

The correct setting would be:

  http_proxy=http://localhost:8080/

If the URL contains a dot, then wget won't complain, this is why this error
normally doesn't show up.

This is the line that sets http_proxy (reformatted for readability):

gwget_data.c:423: setenv("http_proxy",
                         g_strconcat(g_strdup_printf("%s", 
gwget_pref.http_proxy),
                                     ":",
                                     g_strdup_printf("%d", 
gwget_pref.http_proxy_port),
                                     NULL),
                         1);

The calls to g_strdup_printf (and probably g_strconcat too, I haven't checked
that) are leaking memory here and are just making the code complicated, this
line could simply be (with the http:// prefix added):

gwget_data.c:423: setenv("http_proxy",
                         g_strdup_printf("http://%s:%d/";,
                                         gwget_pref.http_proxy,
                                         gwget_pref.http_proxy_port),
                         1);

Thanks,

Zoltan

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (600, 'testing'), (50, 'experimental'), (50, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-5-k7
Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2)

Versions of packages gwget depends on:
ii  libart-2.0-2         2.3.17-1            Library of functions for 2D graphi
ii  libatk1.0-0          1.8.0-4             The ATK accessibility toolkit
ii  libbonobo2-0         2.8.1-2             Bonobo CORBA interfaces library
ii  libbonoboui2-0       2.8.1-2             The Bonobo UI library
ii  libc6                2.3.2.ds1-20        GNU C Library: Shared libraries an
ii  libgconf2-4          2.8.1-5             GNOME configuration database syste
ii  libglade2-0          1:2.4.2-2           library to load .glade files at ru
ii  libglib2.0-0         2.6.4-1             The GLib library of C routines
ii  libgnome2-0          2.8.1-2             The GNOME 2 library - runtime file
ii  libgnomecanvas2-0    2.8.0-1             A powerful object-oriented display
ii  libgnomeui-0         2.8.1-3             The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0       2.8.4-2             The GNOME virtual file-system libr
ii  libgtk2.0-0          2.6.2-4             The GTK+ graphical user interface
ii  libice6              4.3.0.dfsg.1-12.0.1 Inter-Client Exchange library
ii  liborbit2            1:2.12.1-1          libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0        1.8.1-1             Layout and rendering of internatio
ii  libpopt0             1.7-5               lib for parsing cmdline parameters
ii  libsm6               4.3.0.dfsg.1-12.0.1 X Window System Session Management
ii  libx11-6             4.3.0.dfsg.1-12.0.1 X Window System protocol client li
ii  libxml2              2.6.16-6            GNOME XML library
ii  xlibs                4.3.0.dfsg.1-12     X Keyboard Extension (XKB) configu
ii  zlib1g               1:1.2.2-3           compression library - runtime

-- no debconf information
diff -Naur gwget2-0.94.orig/src/gwget_data.c gwget2-0.94/src/gwget_data.c
--- gwget2-0.94.orig/src/gwget_data.c   2005-03-07 21:21:39.000000000 +0100
+++ gwget2-0.94/src/gwget_data.c        2005-04-19 11:15:02.733048328 +0200
@@ -420,14 +420,22 @@
                        if ( strcmp (gwget_pref.network_mode, "manual") == 0 && 
                             gwget_pref.http_proxy ) 
                        {
-                               
setenv("http_proxy",g_strconcat(g_strdup_printf("%s",gwget_pref.http_proxy),":",g_strdup_printf("%d",gwget_pref.http_proxy_port),NULL),1);
+                          setenv("http_proxy",
+                                 g_strdup_printf("http://%s:%d/";,
+                                                 gwget_pref.http_proxy,
+                                                 gwget_pref.http_proxy_port),
+                                 1);
                                argv[arg]="-Yon";
                                arg++;
                        }
                        
                        if ( strcmp (gwget_pref.network_mode, "default" ) == 0 
&& gwget_pref.gnome_http_proxy && gwget_pref.gnome_use_proxy) 
                        {
-                               
setenv("http_proxy",g_strconcat(g_strdup_printf("%s",gwget_pref.gnome_http_proxy),":",g_strdup_printf("%d",gwget_pref.gnome_http_proxy_port),NULL),1);
+                          setenv("http_proxy",
+                                 g_strdup_printf("http://%s:%d/";,
+                                                 gwget_pref.gnome_http_proxy,
+                                                 
gwget_pref.gnome_http_proxy_port),
+                                 1);
                                argv[arg]="-Yon";
                                arg++;
                        }

Reply via email to