mozilla-libproxy.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 02 Aug 2010 08:49:16 +0200
changeset 120 a535723d4453
parent 115 5e8354f0b873
permissions -rw-r--r--
Integrate latest review nits
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
94
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
     9
@@ -541,16 +541,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
 
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    26
 MOZ_ALSA_LIBS           = @MOZ_ALSA_LIBS@
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    27
 
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
 GLIB_CFLAGS	= @GLIB_CFLAGS@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
 GLIB_LIBS	= @GLIB_LIBS@
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
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    33
@@ -1028,8 +1028,12 @@ gio/gio.h
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    34
 #ifdef MOZ_ENABLE_LIBCONIC
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    35
 conic/conicconnection.h
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    36
 conic/conicconnectionevent.h
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    37
 conic/conicstatisticsevent.h
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
 #endif
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    39
 #if MOZ_NATIVE_LIBEVENT==1
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    40
 event.h
59
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
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    45
+
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
diff --git a/configure.in b/configure.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
--- a/configure.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
+++ b/configure.in
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
    49
@@ -5535,16 +5535,39 @@ then
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
     fi
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    51
 
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    52
     AC_SUBST(MOZ_ENABLE_GCONF)
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    53
     AC_SUBST(MOZ_GCONF_CFLAGS)
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    54
     AC_SUBST(MOZ_GCONF_LIBS)
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
 dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
+dnl = libproxy support
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
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
+if test "$MOZ_ENABLE_GTK2"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
+then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
+    MOZ_ENABLE_LIBPROXY=
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
+    MOZ_ARG_ENABLE_BOOL(libproxy,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
+    [  --enable-libproxy         Enable libproxy support ],
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+    MOZ_ENABLE_LIBPROXY=1,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
+    MOZ_ENABLE_LIBPROXY=)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
+    if test "$MOZ_ENABLE_LIBPROXY"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
+    then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
+        PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
+        AC_DEFINE(MOZ_ENABLE_LIBPROXY)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
+    fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
+fi
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
+AC_SUBST(MOZ_ENABLE_LIBPROXY)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
+AC_SUBST(MOZ_LIBPROXY_CFLAGS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
+AC_SUBST(MOZ_LIBPROXY_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
+dnl ========================================================
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
 dnl = libnotify support
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
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
 if test "$MOZ_ENABLE_GTK2"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
 then
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
     MOZ_ENABLE_LIBNOTIFY=1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
     MOZ_ARG_DISABLE_BOOL(libnotify,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
--- a/toolkit/library/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
+++ b/toolkit/library/Makefile.in
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
    92
@@ -222,16 +222,20 @@ endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
 ifdef MOZ_TREE_FREETYPE
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
 EXTRA_DSO_LDOPTS += $(FT2_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
 ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
 EXTRA_DSO_LDOPTS += $(MOZ_STARTUP_NOTIFICATION_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
+ifdef MOZ_ENABLE_LIBPROXY
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
+EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
+endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
 ifeq ($(OS_ARCH),BeOS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 EXTRA_DSO_LDOPTS += -lbe -ltracker
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
 ifeq ($(OS_ARCH),SunOS)
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   110
 EXTRA_DSO_LDOPTS += -lelf -ldemangle
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
 endif
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
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
   114
--- a/toolkit/system/unixproxy/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
+++ b/toolkit/system/unixproxy/Makefile.in
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
@@ -15,16 +15,17 @@
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
 # The Initial Developer of the Original Code is
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
 # IBM Corporation.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
 # Portions created by the Initial Developer are Copyright (C) 2004
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
 # the Initial Developer. All Rights Reserved.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
 # Contributor(s):
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
 #  Brian Ryner <bryner@brianryner.com>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
+#  Wolfgang Rosenauer <wr@rosenauer.org>
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
 #
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
 # 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
   128
 # 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
   129
 # 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
   130
 # 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
   131
 # 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
   132
 # 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
   133
 # use your version of this file under the terms of the MPL, indicate your
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   134
@@ -46,16 +47,30 @@ MODULE          = unixproxy
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   135
 LIBRARY_NAME    = unixproxy
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
 
77
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   137
 EXPORT_LIBRARY  = 1
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   138
 IS_COMPONENT    = 1
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   139
 MODULE_NAME     = nsUnixProxyModule
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   140
 GRE_MODULE      = 1
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   141
 LIBXUL_LIBRARY  = 1
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   142
 
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   143
+EXTRA_DSO_LDOPTS += \
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   144
+  $(MOZ_LIBPROXY_LIBS) \
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   145
+  $(MOZ_COMPONENT_LIBS) \
f2df98836e17 More 1.9.2->1.9.3 patch rebasing and version changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 74
diff changeset
   146
+  $(NULL)
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
-EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
+ifdef MOZ_ENABLE_LIBPROXY
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
+CPPSRCS = \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
+       nsLibProxySettings.cpp \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
+        $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+CXXFLAGS += $(MOZ_LIBPROXY_CFLAGS)
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
+else # MOZ_ENABLE_LIBPROXY
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
 CPPSRCS = \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
         nsUnixSystemProxySettings.cpp \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
         $(NULL)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
+endif # MOZ_ENABLE_LIBPROXY
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
 include $(topsrcdir)/config/rules.mk
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
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
   167
new file mode 100644
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
--- /dev/null
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
+++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   170
@@ -0,0 +1,178 @@
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
+/* -*- 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
   172
+/* ***** BEGIN LICENSE BLOCK *****
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
+ * 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
   176
+ * 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
   177
+ * the License. You may obtain a copy of the License at
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
+ * http://www.mozilla.org/MPL/
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
+ * Software distributed under the License is distributed on an "AS IS" basis,
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
+ * for the specific language governing rights and limitations under the
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
+ * License.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
+ * The Original Code is Mozilla libproxy integration code.
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 Initial Developer of the Original Code is
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
+ * Wolfgang Rosenauer <wr@rosenauer.org>.
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   189
+ * Portions created by the Initial Developer are Copyright (C) 2010
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
+ * the Initial Developer. All Rights Reserved.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
+ * Contributor(s):
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
+ * 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
   195
+ * 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
   196
+ * 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
   197
+ * 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
   198
+ * 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
   199
+ * 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
   200
+ * 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
   201
+ * decision by deleting the provisions above and replace them with the notice
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
+ * 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
   203
+ * 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
   204
+ * 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
   205
+ *
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
+ * ***** END LICENSE BLOCK ***** */
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
+#include "nsISystemProxySettings.h"
94
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   209
+#include "mozilla/ModuleUtils.h"
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
+#include "nsIServiceManager.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
+#include "nsIIOService.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
+#include "nsIURI.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
+#include "nsString.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
+#include "nsNetUtil.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+#include "nsCOMPtr.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+#include "nspr.h"
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
+#include <proxy.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
+class nsUnixSystemProxySettings : public nsISystemProxySettings {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
+public:
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+  NS_DECL_ISUPPORTS
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+  NS_DECL_NSISYSTEMPROXYSETTINGS
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   225
+  nsUnixSystemProxySettings() { mProxyFactory = nsnull; }
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+  nsresult Init();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
+private:
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
+  ~nsUnixSystemProxySettings() {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
+    if (mProxyFactory) 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
+      px_proxy_factory_free(mProxyFactory); 
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
+  }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   234
+  pxProxyFactory *mProxyFactory;
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
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
+NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
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
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
+nsUnixSystemProxySettings::Init()
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
+  return NS_OK;
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
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
+nsUnixSystemProxySettings::GetPACURI(nsACString& aResult)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
+  // Make sure we return an empty result.
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
+  aResult.Truncate();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
+  return NS_OK;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
+}
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
+nsresult
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
+nsUnixSystemProxySettings::GetProxyForURI(nsIURI* aURI, nsACString& aResult)
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
+{
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
+  nsresult rv;
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
+  if (!mProxyFactory) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
+    mProxyFactory = px_proxy_factory_new();
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
+  }
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   261
+  NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_NOT_AVAILABLE);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
+
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   263
+  nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   264
+  NS_ENSURE_SUCCESS(rv, rv);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+  nsCAutoString spec;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+  rv = aURI->GetSpec(spec);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
+  NS_ENSURE_SUCCESS(rv, rv);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
+  char **proxyArray = nsnull;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+  proxyArray = px_proxy_factory_get_proxies(mProxyFactory, (char*)(spec.get()));
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   272
+  NS_ENSURE_TRUE(proxyArray, NS_ERROR_NOT_AVAILABLE);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
+
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   274
+  // Translate libproxy's output to PAC string as expected
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   275
+  // libproxy returns an array of proxies in the format:
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   276
+  // <procotol>://[username:password@]proxy:port
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   277
+  // or
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   278
+  // direct://
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   279
+  //
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   280
+  // 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
   281
+  int c = 0;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
+  while (proxyArray[c] != NULL) {
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   283
+    if (!aResult.IsEmpty()) {
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+      aResult.AppendLiteral("; ");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+    PRBool isScheme = PR_FALSE;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+    nsXPIDLCString schemeString;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+    nsXPIDLCString hostPortString;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+    nsCOMPtr<nsIURI> proxyURI;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   292
+    rv = ios->NewURI(nsDependentCString(proxyArray[c]),
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   293
+                                        nsnull,
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   294
+                                        nsnull,
115
5e8354f0b873 libproxy polish
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 94
diff changeset
   295
+                                        getter_AddRefs(proxyURI));
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   296
+    if (NS_FAILED(rv)) {
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   297
+      c++;
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   298
+      continue;
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   299
+    }
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   301
+    proxyURI->GetScheme(schemeString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+    if (NS_SUCCEEDED(proxyURI->SchemeIs("http", &isScheme)) && isScheme) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+      schemeString.AssignLiteral("proxy");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+    aResult.Append(schemeString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+    if (NS_SUCCEEDED(proxyURI->SchemeIs("direct", &isScheme)) && !isScheme) {
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+      // Add the proxy URI only if it's not DIRECT
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+      proxyURI->GetHostPort(hostPortString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+      aResult.AppendLiteral(" ");
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+      aResult.Append(hostPortString);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+    }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+    c++;
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
+
120
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   316
+#ifdef DEBUG
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   317
+  printf("returned PAC proxy string: %s\n", PromiseFlatCString(aResult).get());
a535723d4453 Integrate latest review nits
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 115
diff changeset
   318
+#endif
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+  PR_Free(proxyArray);
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
+  return NS_OK;
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+}
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+#define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+     { 0x0fa3158c, 0xd5a7, 0x43de, \
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+       {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } }
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
94
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   329
+NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+
94
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   331
+static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   332
+  { &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, NULL, nsUnixSystemProxySettingsConstructor },
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   333
+  { NULL }
0
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+};
ad87c5e85a41 patch status 20091128
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+
94
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   336
+static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   337
+  { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID },
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   338
+  { NULL }
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   339
+};
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   340
+
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   341
+static const mozilla::Module kUnixProxyModule = {
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   342
+  mozilla::Module::kVersion,
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   343
+  kUnixProxyCIDs,
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   344
+  kUnixProxyContracts
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   345
+};
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   346
+        
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   347
+NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
7177cac23915 Update to snapshot 20100707
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 77
diff changeset
   348
+