View | Details | Raw Unified | Return to bug 194623
Collapse All | Expand All

(-)net/libproxy/files/patch-libproxy_modules_config_envvar.cpp (+15 lines)
Line 0 Link Here
1
--- libproxy/modules/config_envvar.cpp.orig	2014-10-22 23:01:48.000000000 -0700
2
+++ libproxy/modules/config_envvar.cpp	2014-10-22 23:09:25.000000000 -0700
3
@@ -27,6 +27,12 @@ public:
4
 	url get_config(url url) throw (runtime_error) {
5
 		char *proxy = NULL;
6
 
7
+                if (!(proxy = getenv("auto_proxy")))
8
+                        proxy = getenv("AUTO_PROXY");
9
+                if (proxy) {
10
+                    return libproxy::url(string("pac+") + string(proxy));
11
+                }
12
+
13
 		// If the URL is an ftp url, try to read the ftp proxy
14
 		if (url.get_scheme() == "ftp") {
15
 			if (!(proxy = getenv("ftp_proxy")))
(-)net/libproxy/files/patch-libproxy_modules_pacrunner__webkit.cpp (-2 / +31 lines)
Lines 1-10 Link Here
1
--- libproxy/modules/pacrunner_webkit.cpp.orig	2010-09-01 20:23:34.000000000 +0000
1
--- libproxy/modules/pacrunner_webkit.cpp.orig	2010-09-01 20:23:34.000000000 +0000
2
+++ libproxy/modules/pacrunner_webkit.cpp
2
+++ libproxy/modules/pacrunner_webkit.cpp	2014-10-23 13:56:06.000000000 -0700
3
@@ -20,6 +20,7 @@
3
@@ -20,6 +20,9 @@
4
 #include "../extension_pacrunner.hpp"
4
 #include "../extension_pacrunner.hpp"
5
 using namespace libproxy;
5
 using namespace libproxy;
6
 
6
 
7
+#include <stdlib.h>
7
+#include <unistd.h>
8
+#include <unistd.h>
9
+#include <iostream>
8
 #ifdef __APPLE__
10
 #ifdef __APPLE__
9
 // JavaScriptCore.h requires CoreFoundation
11
 // JavaScriptCore.h requires CoreFoundation
10
 // This is only found on Mac OS X
12
 // This is only found on Mac OS X
13
@@ -126,8 +129,25 @@ public:
14
 		JSStringRelease(str);
15
 
16
 		// Add the PAC into the context
17
+		JSValueRef result;
18
 		str = JSStringCreateWithUTF8CString(pac.c_str());
19
-		if (!JSCheckScriptSyntax(this->jsctx, str, NULL, 0, NULL)) goto error;
20
+		if (!JSCheckScriptSyntax(this->jsctx, str, NULL, 0, &result)) {
21
+		if (getenv("_PX_DEBUG")){
22
+				JSStringRef valueAsString = JSValueToStringCopy(this->jsctx, result, NULL);
23
+				size_t errlen = JSStringGetMaximumUTF8CStringSize(valueAsString);
24
+				char *errmsg = (char*)calloc(1, errlen);
25
+				if (errmsg) {
26
+						JSStringGetUTF8CString(valueAsString, errmsg, errlen);
27
+						cerr << "PAC " << errmsg << "\n";
28
+						free(errmsg);
29
+				} else {
30
+						cerr << "PAC SyntaxError.\n";
31
+				}
32
+				JSStringRelease(valueAsString);
33
+				cerr << pac.c_str() << "\n";
34
+				}
35
+				goto error;
36
+		}
37
 		JSEvaluateScript(this->jsctx, str, NULL, NULL, 1, NULL);
38
 		JSStringRelease(str);
39
 		return;
(-)net/libproxy/files/patch-libproxy_url.cpp (-2 / +32 lines)
Lines 1-5 Link Here
1
--- libproxy/url.cpp~
1
--- libproxy/url.cpp.orig	2010-09-01 13:23:34.000000000 -0700
2
+++ libproxy/url.cpp
2
+++ libproxy/url.cpp	2014-10-26 23:11:56.000000000 -0700
3
@@ -27,6 +27,7 @@
3
@@ -27,6 +27,7 @@
4
 #define close _close
4
 #define close _close
5
 #endif
5
 #endif
Lines 8-10 Link Here
8
 #include <cstring> // For memcpy()
8
 #include <cstring> // For memcpy()
9
 #include <sstream> // For int/string conversion (using stringstream)
9
 #include <sstream> // For int/string conversion (using stringstream)
10
 #include <cstdio>  // For sscanf()
10
 #include <cstdio>  // For sscanf()
11
@@ -41,8 +42,12 @@
12
 #define read _read
13
 #define SHUT_RDWR SD_BOTH
14
 #else
15
+#ifdef __FreeBSD__
16
+#define pfsize(st) (st.st_size)
17
+#else
18
 #define pfsize(st) (st.st_blksize * st.st_blocks)
19
 #endif
20
+#endif
21
 
22
 #include "url.hpp"
23
 using namespace libproxy;
24
@@ -402,6 +407,7 @@ char* url::get_pac() {
25
 			return NULL;
26
 		if (!fstat(sock, &st) && pfsize(st) < PAC_MAX_SIZE) {
27
 			buffer = new char[pfsize(st)+1];
28
+			buffer[pfsize(st)] = '\0';
29
 			if (read(sock, buffer, pfsize(st)) == 0) {
30
 				delete buffer;
31
 				buffer = NULL;
32
@@ -437,7 +443,7 @@ char* url::get_pac() {
33
 	// Build the request string
34
 	request  = "GET " + m_path + " HTTP/1.1\r\n";
35
 	request += "Host: " + m_host + "\r\n";
36
-	request += "Accept: " + string(PAC_MIME_TYPE) + "\r\n";
37
+	request += "Accept: " + string(PAC_MIME_TYPE) + string(", ") + string(PAC_MIME_TYPE_FB) + "\r\n";
38
 	request += "Connection: close\r\n";
39
 	request += "\r\n";
40
 

Return to bug 194623