pacparser 1.5.3.dev2__tar.gz → 1.5.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pacparser-1.5.3.dev2/pacparser.egg-info → pacparser-1.5.4}/PKG-INFO +1 -1
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser/__init__.py +2 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser.c +18 -19
- {pacparser-1.5.3.dev2 → pacparser-1.5.4/pacparser.egg-info}/PKG-INFO +1 -1
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser_py.c +4 -1
- pacparser-1.5.4/version.mk +1 -0
- pacparser-1.5.3.dev2/version.mk +0 -1
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/MANIFEST.in +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pac_utils.h +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser.egg-info/SOURCES.txt +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser.egg-info/dependency_links.txt +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser.egg-info/top_level.txt +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/pacparser.h +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/quickjs/quickjs.c +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/quickjs/quickjs.h +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/setup.cfg +0 -0
- {pacparser-1.5.3.dev2 → pacparser-1.5.4}/setup.py +0 -0
|
@@ -114,6 +114,8 @@ def just_find_proxy(pacfile, url, host=None):
|
|
|
114
114
|
def setmyip(ip_address):
|
|
115
115
|
"""
|
|
116
116
|
Set my ip address. This is the IP address returned by myIpAddress()
|
|
117
|
+
|
|
118
|
+
Raises ValueError if ip_address is too long to be an IP address.
|
|
117
119
|
"""
|
|
118
120
|
_pacparser.setmyip(ip_address)
|
|
119
121
|
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
# define UNUSED(x) UNUSED_ ## x
|
|
52
52
|
#endif
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// Client IP set via pacparser_setmyip(). Sized for the longest textual IP
|
|
55
|
+
// address (45 characters, an IPv6 address with an embedded IPv4 address) plus
|
|
56
|
+
// the terminating NUL. Not INET6_ADDRSTRLEN, which is larger on Windows.
|
|
57
|
+
static char my_ip_buf[46];
|
|
55
58
|
static int my_ip_set = 0;
|
|
56
59
|
|
|
57
60
|
// Default error printer function.
|
|
@@ -250,15 +253,13 @@ my_ip(JSContext *ctx, JSValueConst UNUSED(this_val), int UNUSED(argc), JSValueCo
|
|
|
250
253
|
char ipaddr[INET6_ADDRSTRLEN];
|
|
251
254
|
|
|
252
255
|
if (my_ip_set) // If my (client's) IP address is already set.
|
|
253
|
-
|
|
254
|
-
else {
|
|
255
|
-
char name[256];
|
|
256
|
-
gethostname(name, sizeof(name));
|
|
257
|
-
if (resolve_host(name, ipaddr, 1, AF_INET)) {
|
|
258
|
-
strcpy(ipaddr, "127.0.0.1");
|
|
259
|
-
}
|
|
260
|
-
}
|
|
256
|
+
return JS_NewString(ctx, my_ip_buf);
|
|
261
257
|
|
|
258
|
+
char name[256];
|
|
259
|
+
gethostname(name, sizeof(name));
|
|
260
|
+
if (resolve_host(name, ipaddr, 1, AF_INET)) {
|
|
261
|
+
strcpy(ipaddr, "127.0.0.1");
|
|
262
|
+
}
|
|
262
263
|
return JS_NewString(ctx, ipaddr);
|
|
263
264
|
}
|
|
264
265
|
|
|
@@ -270,15 +271,13 @@ my_ip_ex(JSContext *ctx, JSValueConst UNUSED(this_val), int UNUSED(argc), JSValu
|
|
|
270
271
|
char ipaddr[INET6_ADDRSTRLEN * MAX_IP_RESULTS + MAX_IP_RESULTS];
|
|
271
272
|
|
|
272
273
|
if (my_ip_set) // If my (client's) IP address is already set.
|
|
273
|
-
|
|
274
|
-
else {
|
|
275
|
-
char name[256];
|
|
276
|
-
gethostname(name, sizeof(name));
|
|
277
|
-
if (resolve_host(name, ipaddr, MAX_IP_RESULTS, AF_UNSPEC)) {
|
|
278
|
-
strcpy(ipaddr, "");
|
|
279
|
-
}
|
|
280
|
-
}
|
|
274
|
+
return JS_NewString(ctx, my_ip_buf);
|
|
281
275
|
|
|
276
|
+
char name[256];
|
|
277
|
+
gethostname(name, sizeof(name));
|
|
278
|
+
if (resolve_host(name, ipaddr, MAX_IP_RESULTS, AF_UNSPEC)) {
|
|
279
|
+
strcpy(ipaddr, "");
|
|
280
|
+
}
|
|
282
281
|
return JS_NewString(ctx, ipaddr);
|
|
283
282
|
}
|
|
284
283
|
|
|
@@ -292,8 +291,8 @@ static const char *proxy_result = NULL;
|
|
|
292
291
|
int
|
|
293
292
|
pacparser_setmyip(const char *ip)
|
|
294
293
|
{
|
|
295
|
-
if (strlen(ip)
|
|
296
|
-
|
|
294
|
+
if (strlen(ip) >= sizeof(my_ip_buf)) {
|
|
295
|
+
print_error("pacparser_setmyip: IP too long: %s\n", ip);
|
|
297
296
|
return 0;
|
|
298
297
|
}
|
|
299
298
|
|
|
@@ -128,7 +128,10 @@ py_pacparser_setmyip(PyObject *self, PyObject *args)
|
|
|
128
128
|
const char *ip;
|
|
129
129
|
if (!PyArg_ParseTuple(args, "s", &ip))
|
|
130
130
|
return NULL;
|
|
131
|
-
pacparser_setmyip(ip)
|
|
131
|
+
if (!pacparser_setmyip(ip)) {
|
|
132
|
+
PyErr_Format(PyExc_ValueError, "invalid IP address: %s", ip);
|
|
133
|
+
return NULL;
|
|
134
|
+
}
|
|
132
135
|
Py_RETURN_NONE;
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION=1.5.4
|
pacparser-1.5.3.dev2/version.mk
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION=1.5.3.dev2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|