mozilla-libproxy.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Thu, 29 Jul 2010 10:38:24 +0200
branchmozilla-1.9.2
changeset 119 8fea954c3b28
parent 113 04527a174eec
child 174 b3f909e83302
permissions -rw-r--r--
more minor changes to libproxy patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
From: Wolfgang Rosenauer <wr@rosenauer.org>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
Subject: Add the option to use libproxy for system proxy settings
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
References:
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
https://bugzilla.mozilla.org/show_bug.cgi?id=517655
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
--- a/config/autoconf.mk.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
+++ b/config/autoconf.mk.in
95
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
     9
@@ -542,16 +542,20 @@ FT2_CFLAGS             = @FT2_CFLAGS@
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 FT2_LIBS               = @FT2_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 MOZ_PANGO_CFLAGS        = @MOZ_PANGO_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 MOZ_PANGO_LIBS          = @MOZ_PANGO_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 MOZ_XIE_LIBS		= @MOZ_XIE_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 XT_LIBS			= @XT_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
+MOZ_LIBPROXY_CFLAGS     = @MOZ_LIBPROXY_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
+MOZ_LIBPROXY_LIBS       = @MOZ_LIBPROXY_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
+MOZ_ENABLE_LIBPROXY     = @MOZ_ENABLE_LIBPROXY@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 MOZ_LIBNOTIFY_CFLAGS	= @MOZ_LIBNOTIFY_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
 MOZ_LIBNOTIFY_LIBS	= @MOZ_LIBNOTIFY_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
 MOZ_ENABLE_LIBNOTIFY	= @MOZ_ENABLE_LIBNOTIFY@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
 GLIB_CFLAGS	= @GLIB_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
 GLIB_LIBS	= @GLIB_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
 GLIB_GMODULE_LIBS	= @GLIB_GMODULE_LIBS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
 LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
diff --git a/config/system-headers b/config/system-headers
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
--- a/config/system-headers
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
+++ b/config/system-headers
95
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    33
@@ -1013,11 +1013,14 @@ hunspell.hxx
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
 #if MOZ_NATIVE_BZ2==1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 bzlib.h
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
 #endif
59
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    37
 #if MOZ_PLATFORM_MAEMO==5
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    38
 hildon-uri.h
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    39
 hildon-mime.h
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    40
 libosso.h
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    41
 #endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
+#ifdef MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
+proxy.h
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
+#endif
95
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    45
 #if MOZ_NATIVE_LIBEVENT==1
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    46
 event.h
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    47
 #endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
diff --git a/configure.in b/configure.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
--- a/configure.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
+++ b/configure.in
95
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    51
@@ -5325,16 +5325,39 @@ then
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
         AC_DEFINE(MOZ_ENABLE_DBUS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
     fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
 fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 AC_SUBST(MOZ_ENABLE_DBUS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
 dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
+dnl = libproxy support
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
+dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
+if test "$MOZ_ENABLE_GTK2"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
+then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
+    MOZ_ENABLE_LIBPROXY=
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+    MOZ_ARG_ENABLE_BOOL(libproxy,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
+    [  --enable-libproxy         Enable libproxy support ],
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
+    MOZ_ENABLE_LIBPROXY=1,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
+    MOZ_ENABLE_LIBPROXY=)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
+    if test "$MOZ_ENABLE_LIBPROXY"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
+    then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
+        PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
+        AC_DEFINE(MOZ_ENABLE_LIBPROXY)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
+    fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
+fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
+AC_SUBST(MOZ_ENABLE_LIBPROXY)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
+AC_SUBST(MOZ_LIBPROXY_CFLAGS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
+AC_SUBST(MOZ_LIBPROXY_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
+dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
 dnl = libnotify support
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
 dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
 if test "$MOZ_ENABLE_GTK2"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
 then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
     MOZ_ENABLE_LIBNOTIFY=1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
     MOZ_ARG_DISABLE_BOOL(libnotify,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
--- a/toolkit/library/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
+++ b/toolkit/library/Makefile.in
59
604517bb16d8 Update to 1.9.2.2/3.6.2
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 0
diff changeset
    94
@@ -243,16 +243,20 @@ endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
 ifdef MOZ_TREE_FREETYPE
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
 EXTRA_DSO_LDOPTS += $(FT2_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
 ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
 EXTRA_DSO_LDOPTS += $(MOZ_STARTUP_NOTIFICATION_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
+ifdef MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
+EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
+endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
 ifeq ($(OS_ARCH),BeOS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
 EXTRA_DSO_LDOPTS += -lbe -ltracker
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
 ifeq ($(OS_ARCH),SunOS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
 EXTRA_DSO_LDOPTS += -lelf -ldemangle -lCstd
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
diff --git a/toolkit/system/unixproxy/Makefile.in b/toolkit/system/unixproxy/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
--- a/toolkit/system/unixproxy/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
+++ b/toolkit/system/unixproxy/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
@@ -15,16 +15,17 @@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
 # The Initial Developer of the Original Code is
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
 # IBM Corporation.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
 # Portions created by the Initial Developer are Copyright (C) 2004
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
 # the Initial Developer. All Rights Reserved.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
 # Contributor(s):
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
 #  Brian Ryner <bryner@brianryner.com>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
+#  Wolfgang Rosenauer <wr@rosenauer.org>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   128
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   129
 # Alternatively, the contents of this file may be used under the terms of
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
 # either the GNU General Public License Version 2 or later (the "GPL"), or
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
 # in which case the provisions of the GPL or the LGPL are applicable instead
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
 # of those above. If you wish to allow use of your version of this file only
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
 # under the terms of either the GPL or the LGPL, and not to allow others to
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
 # use your version of this file under the terms of the MPL, indicate your
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
@@ -53,15 +54,30 @@ LIBXUL_LIBRARY  = 1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
 REQUIRES = \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
         xpcom \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
         string \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
         necko \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
         mozgnome \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
         $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
-EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
+EXTRA_DSO_LDOPTS += \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
+               $(MOZ_LIBPROXY_LIBS) \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
+               $(MOZ_COMPONENT_LIBS) \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
+               $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
+ifdef MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
+CPPSRCS = \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
+       nsLibProxySettings.cpp \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+        $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
+CXXFLAGS += $(MOZ_LIBPROXY_CFLAGS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
+else # MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
 CPPSRCS = \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
         nsUnixSystemProxySettings.cpp \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
         $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
+endif # MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   167
 include $(topsrcdir)/config/rules.mk
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
diff --git a/toolkit/system/unixproxy/nsLibProxySettings.cpp b/toolkit/system/unixproxy/nsLibProxySettings.cpp
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
new file mode 100644
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
--- /dev/null
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
+++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   172
@@ -0,0 +1,167 @@
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
+/* ***** BEGIN LICENSE BLOCK *****
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   177
+ * The contents of this file are subject to the Mozilla Public License Version
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
+ * 1.1 (the "License"); you may not use this file except in compliance with
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
+ * the License. You may obtain a copy of the License at
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
+ * http://www.mozilla.org/MPL/
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
+ * Software distributed under the License is distributed on an "AS IS" basis,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
+ * for the specific language governing rights and limitations under the
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
+ * License.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
+ * The Original Code is Mozilla libproxy integration code.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
+ * The Initial Developer of the Original Code is
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
+ * Wolfgang Rosenauer <wr@rosenauer.org>.
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   191
+ * Portions created by the Initial Developer are Copyright (C) 2010
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
+ * the Initial Developer. All Rights Reserved.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
+ * Contributor(s):
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
+ * Alternatively, the contents of this file may be used under the terms of
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   197
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
+ * in which case the provisions of the GPL or the LGPL are applicable instead
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
+ * of those above. If you wish to allow use of your version of this file only
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
+ * under the terms of either the GPL or the LGPL, and not to allow others to
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
+ * use your version of this file under the terms of the MPL, indicate your
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
+ * decision by deleting the provisions above and replace them with the notice
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
+ * and other provisions required by the GPL or the LGPL. If you do not delete
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
+ * the provisions above, a recipient may use your version of this file under
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
+ * the terms of any one of the MPL, the GPL or the LGPL.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+ * ***** END LICENSE BLOCK ***** */
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
+#include "nsISystemProxySettings.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
+#include "nsIGenericFactory.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
+#include "nsIServiceManager.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
+#include "nsIIOService.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
+#include "nsIURI.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+#include "nsString.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+#include "nsNetUtil.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
+#include "nsCOMPtr.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
+#include "nspr.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+#include <proxy.h>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+class nsUnixSystemProxySettings : public nsISystemProxySettings {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+public:
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+  NS_DECL_ISUPPORTS
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+  NS_DECL_NSISYSTEMPROXYSETTINGS
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   227
+  nsUnixSystemProxySettings() { mProxyFactory = nsnull; }
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
+  nsresult Init();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
+private:
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
+  ~nsUnixSystemProxySettings() {
95
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   232
+    if (mProxyFactory)
37558f4844c0 update to 1.9.2.7/3.6.7
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   233
+      px_proxy_factory_free(mProxyFactory);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   234
+  }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   236
+  pxProxyFactory *mProxyFactory;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
+};
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   238
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
+NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
+nsUnixSystemProxySettings::Init()
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
+  return NS_OK;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
+}
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
+nsUnixSystemProxySettings::GetPACURI(nsACString& aResult)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
+  // Make sure we return an empty result.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
+  aResult.Truncate();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
+  return NS_OK;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
+}
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
+nsUnixSystemProxySettings::GetProxyForURI(nsIURI* aURI, nsACString& aResult)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   257
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
+  nsresult rv;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
+  if (!mProxyFactory) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
+    mProxyFactory = px_proxy_factory_new();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
+  }
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   263
+  NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_NOT_AVAILABLE);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
+
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   265
+  nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   266
+  NS_ENSURE_SUCCESS(rv, rv);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
+  nsCAutoString spec;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
+  rv = aURI->GetSpec(spec);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
+  NS_ENSURE_SUCCESS(rv, rv);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
+  char **proxyArray = nsnull;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
+  proxyArray = px_proxy_factory_get_proxies(mProxyFactory, (char*)(spec.get()));
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   274
+  NS_ENSURE_TRUE(proxyArray, NS_ERROR_NOT_AVAILABLE);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
+
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   276
+  // Translate libproxy's output to PAC string as expected
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   277
+  // libproxy returns an array of proxies in the format:
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   278
+  // <procotol>://[username:password@]proxy:port
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   279
+  // or
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   280
+  // direct://
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   281
+  //
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   282
+  // PAC format: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
+  int c = 0;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+  while (proxyArray[c] != NULL) {
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   285
+    if (!aResult.IsEmpty()) {
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+      aResult.AppendLiteral("; ");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+    PRBool isScheme = PR_FALSE;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+    nsXPIDLCString schemeString;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+    nsXPIDLCString hostPortString;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+    nsCOMPtr<nsIURI> proxyURI;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
+
113
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   294
+    rv = ios->NewURI(nsDependentCString(proxyArray[c]),
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   295
+                                        nsnull,
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   296
+                                        nsnull,
04527a174eec libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 95
diff changeset
   297
+                                        getter_AddRefs(proxyURI));
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   298
+    if (NS_FAILED(rv)) {
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   299
+      c++;
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   300
+      continue;
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   301
+    }
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+    proxyURI->GetScheme(schemeString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+    if (NS_SUCCEEDED(proxyURI->SchemeIs("http", &isScheme)) && isScheme) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+      schemeString.AssignLiteral("proxy");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+    aResult.Append(schemeString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+    if (NS_SUCCEEDED(proxyURI->SchemeIs("direct", &isScheme)) && !isScheme) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+      // Add the proxy URI only if it's not DIRECT
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+      proxyURI->GetHostPort(hostPortString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+      aResult.AppendLiteral(" ");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+      aResult.Append(hostPortString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+    c++;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
+  }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
+
119
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   318
+#ifdef DEBUG
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   319
+  printf("returned PAC proxy string: %s\n", PromiseFlatCString(aResult).get());
8fea954c3b28 more minor changes to libproxy patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 113
diff changeset
   320
+#endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+  PR_Free(proxyArray);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+  return NS_OK;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+}
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+#define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+     { 0x0fa3158c, 0xd5a7, 0x43de, \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+       {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
+static const nsModuleComponentInfo components[] = {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
+  { "Unix System Proxy Settings Service",
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+    NS_UNIXSYSTEMPROXYSERVICE_CID,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+    NS_SYSTEMPROXYSETTINGS_CONTRACTID,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+    nsUnixSystemProxySettingsConstructor }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
+};
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+NS_IMPL_NSGETMODULE(nsUnixProxyModule, components)