- Update to 0.4.7 svn20110412

- Add support for webkitgtk3
- Add support for xulrunner 2.0
- fix #683015 - libproxy fails with autoconfiguration
- fix #683018 - libproxy needs BR: NetworkManager-glib-devel  (f14)
- Manually fix libproxy-1.0.pc version field - #664781 / #674854
This commit is contained in:
Nicolas Chauvet 2011-04-12 17:37:33 +02:00
parent cfb6864df2
commit 77a37a0b37
6 changed files with 63 additions and 274 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
libproxy-0.4.4.tar.gz
/libproxy-0.4.5.tar.gz
/libproxy-0.4.6.tar.gz
/libproxy-0.4.7svn20110412.tar.gz

View File

@ -1,19 +0,0 @@
diff -up libproxy-0.4.6/bindings/python/CMakeLists.txt.noarch libproxy-0.4.6/bindings/python/CMakeLists.txt
--- libproxy-0.4.6/bindings/python/CMakeLists.txt.noarch 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-0.4.6/bindings/python/CMakeLists.txt 2010-11-07 19:01:38.000000000 +0100
@@ -18,15 +18,11 @@ if(PYTHONINTERP_FOUND)
set(libdir "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
endif()
- if (IS_DIRECTORY "${libdir}/python${PYTHON_VERSION}/site-packages")
- set(PYTHON_SITEPKG_DIR "${libdir}/python${PYTHON_VERSION}/site-packages")
- else()
execute_process(COMMAND
${PYTHON_EXECUTABLE}
-c "import distutils.sysconfig ; print distutils.sysconfig.get_python_lib(plat_specific=0)"
OUTPUT_VARIABLE PYTHON_SITEPKG_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif()
endif()
message(STATUS "Using PYTHON_SITEPKG_DIR=${PYTHON_SITEPKG_DIR}")

View File

@ -0,0 +1,12 @@
diff -up libproxy-0.4.7/libproxy/cmake/modules/pacrunner_mozjs.cmk.xul libproxy-0.4.7/libproxy/cmake/modules/pacrunner_mozjs.cmk
--- libproxy-0.4.7/libproxy/cmake/modules/pacrunner_mozjs.cmk.xul 2011-03-22 23:54:22.000000000 +0100
+++ libproxy-0.4.7/libproxy/cmake/modules/pacrunner_mozjs.cmk 2011-04-12 15:28:55.235341002 +0200
@@ -11,7 +11,7 @@ elseif(NOT APPLE)
option(WITH_MOZJS "Search for MOZJS package" ON)
if (WITH_MOZJS)
foreach(MOZJSLIB ${MOZJS_SEARCH_ORDER})
- pkg_search_module(MOZJS ${MOZJSLIB}>=2.0b12)
+ pkg_search_module(MOZJS ${MOZJSLIB} >=2.0 )
if(MOZJS_FOUND)
include_directories(${MOZJS_INCLUDE_DIRS})
link_directories(${MOZJS_LIBRARY_DIRS})

View File

@ -1,240 +0,0 @@
diff -ur libproxy-0.4.6/libproxy/modules/config_gnome.cpp libproxy-trunk/libproxy/modules/config_gnome.cpp
--- libproxy-0.4.6/libproxy/modules/config_gnome.cpp 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-trunk/libproxy/modules/config_gnome.cpp 2011-03-29 12:12:10.920395004 +0200
@@ -102,10 +102,8 @@
if (dup2(rpipe[1], STDOUT_FILENO) != STDOUT_FILENO) _exit(2);
// Close unneeded fds
- close(rpipe[0]);
- close(rpipe[1]);
- close(wpipe[0]);
- close(wpipe[1]);
+ for (int i = 3; i < sysconf(_SC_OPEN_MAX); i++)
+ close(i);
// Exec
execl("/bin/sh", "sh", "-c", program, (char*) NULL);
@@ -194,8 +192,8 @@
else if (this->data[PROXY_MODE] == "manual") {
string type, host, port;
bool auth = this->data[PROXY_USE_AUTHENTICATION] == "true";
- string username = url::encode(this->data[PROXY_AUTH_USER], url::ALLOWED_IN_USERINFO_ELEMENT);
- string password = url::encode(this->data[PROXY_AUTH_PASSWORD], url::ALLOWED_IN_USERINFO_ELEMENT);
+ string username = url::encode(this->data[PROXY_AUTH_USER], URL_ALLOWED_IN_USERINFO_ELEMENT);
+ string password = url::encode(this->data[PROXY_AUTH_PASSWORD], URL_ALLOWED_IN_USERINFO_ELEMENT);
bool same_proxy = this->data[PROXY_SAME_FOR_ALL] == "true";
// If socks is set use it (except when same_proxy is set)
diff -ur libproxy-0.4.6/libproxy/modules/pacrunner_mozjs.cpp libproxy-trunk/libproxy/modules/pacrunner_mozjs.cpp
--- libproxy-0.4.6/libproxy/modules/pacrunner_mozjs.cpp 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-trunk/libproxy/modules/pacrunner_mozjs.cpp 2011-03-29 12:12:10.915395005 +0200
@@ -42,12 +42,12 @@
#define INET6_ADDRSTRLEN 46
#endif
-static JSBool dnsResolve(JSContext *cx, JSObject * /*obj*/, uintN /*argc*/, jsval *argv, jsval *rval) {
+static JSBool dnsResolve_(JSContext *cx, jsval hostname, jsval *vp) {
// Get hostname argument
- char *tmp = JS_strdup(cx, JS_GetStringBytes(JS_ValueToString(cx, argv[0])));
+ char *tmp = JS_EncodeString(cx, JS_ValueToString(cx, hostname));
// Set the default return value
- *rval = JSVAL_NULL;
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
// Look it up
struct addrinfo *info = NULL;
@@ -66,7 +66,7 @@
NI_NUMERICHOST)) goto out;
// We succeeded
- *rval = STRING_TO_JSVAL(JS_NewString(cx, tmp, strlen(tmp)));
+ JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, tmp, strlen(tmp))));
tmp = NULL;
out:
@@ -75,15 +75,20 @@
return true;
}
-static JSBool myIpAddress(JSContext *cx, JSObject *obj, uintN /*argc*/, jsval * /*argv*/, jsval *rval) {
+static JSBool dnsResolve(JSContext *cx, uintN /*argc*/, jsval *vp) {
+ jsval *argv = JS_ARGV(cx, vp);
+ return dnsResolve_(cx, argv[0], vp);
+}
+
+static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
char *hostname = (char *) JS_malloc(cx, 1024);
if (!gethostname(hostname, 1023)) {
- JSString *myhost = JS_NewString(cx, hostname, strlen(hostname));
+ JSString *myhost = JS_NewStringCopyN(cx, hostname, strlen(hostname));
jsval arg = STRING_TO_JSVAL(myhost);
- return dnsResolve(cx, obj, 1, &arg, rval);
+ return dnsResolve_(cx, 1, &arg);
}
JS_free(cx, hostname);
- *rval = JSVAL_NULL;
+ JS_SET_RVAL(cx, vp, JSVAL_NULL);
return true;
}
@@ -91,7 +96,7 @@
// This MUST be a static global
static JSClass cls = {
"global", JSCLASS_GLOBAL_FLAGS,
- JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
+ JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
@@ -111,7 +116,7 @@
//JS_SetOptions(this->jsctx, JSOPTION_VAROBJFIX);
//JS_SetVersion(this->jsctx, JSVERSION_LATEST);
//JS_SetErrorReporter(cx, reportError);
- if (!(this->jsglb = JS_NewObject(this->jsctx, &cls, NULL, NULL))) goto error;
+ if (!(this->jsglb = JS_NewCompartmentAndGlobalObject(this->jsctx, &cls, NULL))) goto error;
if (!JS_InitStandardClasses(this->jsctx, this->jsglb)) goto error;
// Define Javascript functions
@@ -147,15 +152,19 @@
throw bad_alloc();
}
jsval args[2] = {
- STRING_TO_JSVAL(JS_NewString(this->jsctx, tmpurl, strlen(tmpurl))),
- STRING_TO_JSVAL(JS_NewString(this->jsctx, tmphost, strlen(tmphost)))
+ STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmpurl, strlen(tmpurl))),
+ STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmphost, strlen(tmphost)))
};
// Find the proxy (call FindProxyForURL())
jsval rval;
JSBool result = JS_CallFunctionName(this->jsctx, this->jsglb, "FindProxyForURL", 2, args, &rval);
if (!result) return "";
- string answer = string(JS_GetStringBytes(JS_ValueToString(this->jsctx, rval)));
+
+ char * tmpanswer = JS_EncodeString(this->jsctx, JS_ValueToString(this->jsctx, rval));
+ string answer = string(tmpanswer);
+ JS_free(this->jsctx, tmpanswer);
+
if (answer == "undefined") return "";
return answer;
}
diff -ur libproxy-0.4.6/libproxy/url.cpp libproxy-trunk/libproxy/url.cpp
--- libproxy-0.4.6/libproxy/url.cpp 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-trunk/libproxy/url.cpp 2011-03-29 12:12:11.023395004 +0200
@@ -36,12 +36,9 @@
#ifdef WIN32
#include <io.h>
-#define pfsize(st) (st.st_size)
#define close _close
#define read _read
#define SHUT_RDWR SD_BOTH
-#else
-#define pfsize(st) (st.st_blksize * st.st_blocks)
#endif
#include "url.hpp"
@@ -56,13 +53,6 @@
// This is the maximum pac size (to avoid memory attacks)
#define PAC_MAX_SIZE 102400
-const string url::GENERIC_DELIMITERS(":/?#[]@");
-const string url::SUBCOMPONENT_DELIMITERS("!$&'()*+,;=");
-const string url::ALLOWED_IN_USERINFO_ELEMENT(url::SUBCOMPONENT_DELIMITERS);
-const string url::ALLOWED_IN_USERINFO(url::ALLOWED_IN_USERINFO_ELEMENT + ":");
-const string url::ALLOWED_IN_PATH_ELEMENT(url::SUBCOMPONENT_DELIMITERS + ":@");
-const string url::ALLOWED_IN_PATH(url::ALLOWED_IN_PATH_ELEMENT + "/");
-
static inline int get_default_port(string scheme) {
struct servent *serv;
size_t plus = scheme.find('+');
@@ -109,8 +99,8 @@
string url::encode(const string &data, const string &valid_reserved) {
ostringstream encoded;
- for (int i=0; data[i]; i++) {
- if (isalnum(data[i])
+ for (unsigned int i=0; i < data.size(); i++) {
+ if (isalnum((unsigned char)data[i])
|| valid_reserved.find(data[i]) != string::npos
|| string("-._~").find(data[i]) != string::npos)
encoded << data[i];
@@ -211,7 +201,8 @@
host_start = userinfo_end + 1;
/* Check for IPv6 IP */
- if (hier_part[host_start] == '[') {
+ if (host_start < hier_part.size()
+ && hier_part[host_start] == '[') {
host_end = hier_part.find(']', host_start);
if (host_end == string::npos)
throw parse_error("Invalid URL: " + url);
@@ -232,7 +223,7 @@
/* Get port */
m_port = get_default_port(m_scheme);
- if (host_end != hier_part.size()
+ if (host_end < hier_part.size()
&& hier_part[host_end] == ':') {
size_t port_start = host_end + 1;
m_port = atoi(hier_part.c_str() + port_start);
@@ -400,10 +391,12 @@
struct stat st;
if ((sock = ::open(m_path.c_str(), O_RDONLY)) < 0)
return NULL;
- if (!fstat(sock, &st) && pfsize(st) < PAC_MAX_SIZE) {
- buffer = new char[pfsize(st)+1];
- if (read(sock, buffer, pfsize(st)) == 0) {
- delete buffer;
+
+ if (!fstat(sock, &st) && st.st_size < PAC_MAX_SIZE) {
+ buffer = new char[st.st_size+1];
+ memset(buffer, 0, st.st_size+1);
+ if (read(sock, buffer, st.st_size) == 0) {
+ delete[] buffer;
buffer = NULL;
}
}
diff -ur libproxy-0.4.6/libproxy/url.hpp libproxy-trunk/libproxy/url.hpp
--- libproxy-0.4.6/libproxy/url.hpp 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-trunk/libproxy/url.hpp 2011-03-29 12:12:11.024395005 +0200
@@ -27,6 +27,13 @@
#include "config.hpp"
+#define URL_GENERIC_DELIMITERS ":/?#[]@"
+#define URL_SUBCOMPONENT_DELIMITERS "!$&'()*+,;="
+#define URL_ALLOWED_IN_USERINFO_ELEMENT URL_SUBCOMPONENT_DELIMITERS
+#define URL_ALLOWED_IN_USERINFO URL_ALLOWED_IN_USERINFO_ELEMENT ":"
+#define URL_ALLOWED_IN_PATH_ELEMENT URL_SUBCOMPONENT_DELIMITERS ":@"
+#define URL_ALLOWED_IN_PATH URL_ALLOWED_IN_PATH_ELEMENT "/"
+
namespace libproxy {
using namespace std;
@@ -38,13 +45,6 @@
class DLL_PUBLIC url {
public:
- static const string ALLOWED_IN_PATH;
- static const string ALLOWED_IN_PATH_ELEMENT;
- static const string ALLOWED_IN_USERINFO;
- static const string ALLOWED_IN_USERINFO_ELEMENT;
- static const string GENERIC_DELIMITERS;
- static const string SUBCOMPONENT_DELIMITERS;
-
static bool is_valid(const string url);
static string encode(const string &data, const string &valid_reserved = "");
diff -ur libproxy-0.4.6/NEWS libproxy-trunk/NEWS
--- libproxy-0.4.6/NEWS 2010-09-01 22:23:34.000000000 +0200
+++ libproxy-trunk/NEWS 2011-03-29 12:12:11.303395004 +0200
@@ -1,3 +1,7 @@
+New in version 0.4.7
+==============================
+* Support/require xulrunner 2.0+
+
New in version 0.4.6
==============================
* Fixed a crash in the URL parser

View File

@ -2,10 +2,13 @@
#0 to bootstrap libproxy circle dependencies - 1 normal case
%if 1
%if 0%{?fedora} < 15
%if 0%{?fedora} > 14
%global gecko_version 2.0
%global _with_webkitgtk3 1
%else
%global gecko_version 1.9.2
%global _with_webkit 1
%endif
%global gecko_version 2.0
%global _with_mozjs 1
%global _with_gnome 1
%global _with_kde 1
@ -13,21 +16,24 @@
%endif
%global _with_python 1
%global svn svn20110412
Name: libproxy
Version: 0.4.6
Release: 5%{?dist}
Version: 0.4.7
Release: 0.1%{?svn}%{?dist}
Summary: A library handling all the details of proxy configuration
Group: System Environment/Libraries
License: LGPLv2+
URL: http://code.google.com/p/libproxy/
Source0: http://libproxy.googlecode.com/files/libproxy-%{version}.tar.gz
Patch0: libproxy-0.4.6-python_noarch.patch
Patch1: libproxy-trunk.patch
Source0: http://libproxy.googlecode.com/files/libproxy-%{version}%{?svn}.tar.gz
Patch0: libproxy-0.4.7-xul2.0.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%{?_with_python:BuildRequires: python-devel}
%if 0%{?fedora} > 14
BuildRequires: libmodman-devel >= 2.0.1
%endif
BuildRequires: cmake >= 2.6.0
# gnome
@ -48,6 +54,8 @@ BuildRequires: dbus-devel
}
# webkit (gtk)
%{?_with_webkit:BuildRequires: WebKit-gtk-devel}
# webkit (gtk3)
%{?_with_webkitgtk3:BuildRequires: webkitgtk3-devel}
# kde
%{?_with_kde:BuildRequires: kdelibs-devel}
@ -60,6 +68,10 @@ Obsoletes: %{name}-mozjs < %{version}-%{release}
Provides: %{name}-webkit = %{version}-%{release}
Obsoletes: %{name}-webkit < %{version}-%{release}
}
%{!?_with_webkitgtk3:
Provides: %{name}-webkitgtk3 = %{version}-%{release}
Obsoletes: %{name}-webkitgtk3 < %{version}-%{release}
}
%description
@ -149,6 +161,19 @@ The %{name}-webkit package contains the %{name} plugin for
webkit.
}
%{?_with_webkitgtk3:
%package webkitgtk3
Summary: Plugin for %{name} and webkitgtk3
Group: System Environment/Libraries
Requires: %{name} = %{version}
Provides: %{name}-pac = %{version}-%{release}
%description webkitgtk3
The %{name}-webkit package contains the %{name} plugin for
webkitgtk3.
}
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
@ -161,15 +186,17 @@ developing applications that use %{name}.
%prep
%setup -q
%patch0 -p1 -b.pynoarch
%patch1 -p1 -b .trunk
%patch0 -p1 -b .xul2
#Fix version field in pkg-config
sed -i -e 's|@PROJECT_VERSION@|%{version}|' libproxy/libproxy-1.0.pc.in
%build
%{cmake} \
-DLIBEXEC_INSTALL_DIR=%{_libexecdir} \
-DMODULE_INSTALL_DIR=%{_libdir}/%{name}/%{version}/modules \
-DWITH_PERL=OFF \
%{?_with_webkitgtk3:-DWITH_WEBKIT3=ON}\
.
make VERBOSE=1 %{?_smp_mflags}
@ -242,6 +269,12 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/%{name}/%{version}/modules/pacrunner_webkit.so
}
%{?_with_webkitgtk3:
%files webkitgtk3
%defattr(-,root,root,-)
%{_libdir}/%{name}/%{version}/modules/pacrunner_webkit.so
}
%files devel
%defattr(-,root,root,-)
%{_includedir}/proxy.h
@ -251,11 +284,13 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Sat Apr 2 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.4.6-5
- Add support for xulrunner 2.0 from trunk
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Tue Apr 12 2011 Nicolas Chauvet <kwizart@gmail.com> - 0.4.7-0.1svn20110412
- Update to 0.4.7 svn20110412
- Add support for webkitgtk3
- Add support for xulrunner 2.0
- fix #683015 - libproxy fails with autoconfiguration
- fix #683018 - libproxy needs BR: NetworkManager-glib-devel (f14)
- Manually fix libproxy-1.0.pc version field - #664781 / #674854
* Wed Nov 24 2010 Nicolas Chauvet <kwizart@gmail.com> - 0.4.6-3
- Fix mozjs/webkit obsoletion - rhbz#656849

View File

@ -1 +1 @@
199c6b120baf1f7258a55f38d5ec74f5 libproxy-0.4.6.tar.gz
a7e0856a6310a9666b5d27b0a4503cec libproxy-0.4.7svn20110412.tar.gz