author | Stefan Teleman <stefan.teleman@oracle.com> |
Tue, 17 Mar 2015 19:06:56 -0700 | |
changeset 3966 | cca72467a46d |
parent 394 | dffc35307ef2 |
permissions | -rw-r--r-- |
394
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
1 |
--- setup.py.orig Fri Aug 07 15:00:51 2009 -0700 |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
2 |
+++ setup.py Tue Sep 21 10:59:03 2010 -0700 |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
3 |
@@ -97,8 +97,7 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
4 |
else: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
5 |
extra_compile_args.append(e) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
6 |
libs = split_quoted( |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
7 |
- os.popen("'%s' --libs" % CURL_CONFIG).read()+\ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
8 |
- os.popen("'%s' --static-libs" % CURL_CONFIG).read()) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
9 |
+ os.popen("'%s' --libs" % CURL_CONFIG).read()) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
10 |
for e in libs: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
11 |
if e[:2] == "-l": |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
12 |
libraries.append(e[2:]) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
13 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
14 |
--- src/pycurl.c.orig Fri Aug 07 15:00:51 2009 -0700 |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
15 |
+++ src/pycurl.c Tue Sep 21 10:59:03 2010 -0700 |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
16 |
@@ -747,6 +747,59 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
17 |
return self; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
18 |
} |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
19 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
20 |
+/* initializer - used to intialize curl easy handles for use with pycurl */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
21 |
+static int |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
22 |
+util_curl_init(CurlObject *self) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
23 |
+{ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
24 |
+ int res; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
25 |
+ char *s = NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
26 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
27 |
+ /* Set curl error buffer and zero it */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
28 |
+ res = curl_easy_setopt(self->handle, CURLOPT_ERRORBUFFER, self->error); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
29 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
30 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
31 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
32 |
+ memset(self->error, 0, sizeof(self->error)); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
33 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
34 |
+ /* Set backreference */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
35 |
+ res = curl_easy_setopt(self->handle, CURLOPT_PRIVATE, (char *) self); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
36 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
37 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
38 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
39 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
40 |
+ /* Enable NOPROGRESS by default, i.e. no progress output */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
41 |
+ res = curl_easy_setopt(self->handle, CURLOPT_NOPROGRESS, (long)1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
42 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
43 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
44 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
45 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
46 |
+ /* Disable VERBOSE by default, i.e. no verbose output */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
47 |
+ res = curl_easy_setopt(self->handle, CURLOPT_VERBOSE, (long)0); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
48 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
49 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
50 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
51 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
52 |
+ /* Set FTP_ACCOUNT to NULL by default */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
53 |
+ res = curl_easy_setopt(self->handle, CURLOPT_FTP_ACCOUNT, NULL); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
54 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
55 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
56 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
57 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
58 |
+ /* Set default USERAGENT */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
59 |
+ s = (char *) malloc(7 + strlen(LIBCURL_VERSION) + 1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
60 |
+ if (s == NULL) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
61 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
62 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
63 |
+ strcpy(s, "PycURL/"); strcpy(s+7, LIBCURL_VERSION); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
64 |
+ res = curl_easy_setopt(self->handle, CURLOPT_USERAGENT, (char *) s); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
65 |
+ if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
66 |
+ free(s); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
67 |
+ return (-1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
68 |
+ } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
69 |
+ self->options[ OPT_INDEX(CURLOPT_USERAGENT) ] = s; s = NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
70 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
71 |
+ return (0); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
72 |
+} |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
73 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
74 |
/* constructor - this is a module-level function returning a new instance */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
75 |
static CurlObject * |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
76 |
@@ -754,7 +807,6 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
77 |
{ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
78 |
CurlObject *self = NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
79 |
int res; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
80 |
- char *s = NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
81 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
82 |
UNUSED(dummy); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
83 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
84 |
@@ -768,44 +820,9 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
85 |
if (self->handle == NULL) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
86 |
goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
87 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
88 |
- /* Set curl error buffer and zero it */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
89 |
- res = curl_easy_setopt(self->handle, CURLOPT_ERRORBUFFER, self->error); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
90 |
- if (res != CURLE_OK) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
91 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
92 |
- memset(self->error, 0, sizeof(self->error)); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
93 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
94 |
- /* Set backreference */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
95 |
- res = curl_easy_setopt(self->handle, CURLOPT_PRIVATE, (char *) self); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
96 |
- if (res != CURLE_OK) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
97 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
98 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
99 |
- /* Enable NOPROGRESS by default, i.e. no progress output */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
100 |
- res = curl_easy_setopt(self->handle, CURLOPT_NOPROGRESS, (long)1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
101 |
- if (res != CURLE_OK) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
102 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
103 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
104 |
- /* Disable VERBOSE by default, i.e. no verbose output */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
105 |
- res = curl_easy_setopt(self->handle, CURLOPT_VERBOSE, (long)0); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
106 |
- if (res != CURLE_OK) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
107 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
108 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
109 |
- /* Set FTP_ACCOUNT to NULL by default */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
110 |
- res = curl_easy_setopt(self->handle, CURLOPT_FTP_ACCOUNT, NULL); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
111 |
- if (res != CURLE_OK) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
112 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
113 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
114 |
- /* Set default USERAGENT */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
115 |
- s = (char *) malloc(7 + strlen(LIBCURL_VERSION) + 1); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
116 |
- if (s == NULL) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
117 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
118 |
- strcpy(s, "PycURL/"); strcpy(s+7, LIBCURL_VERSION); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
119 |
- res = curl_easy_setopt(self->handle, CURLOPT_USERAGENT, (char *) s); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
120 |
- if (res != CURLE_OK) { |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
121 |
- free(s); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
122 |
- goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
123 |
- } |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
124 |
- self->options[ OPT_INDEX(CURLOPT_USERAGENT) ] = s; s = NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
125 |
- |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
126 |
+ res = util_curl_init(self); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
127 |
+ if (res < 0) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
128 |
+ goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
129 |
/* Success - return new object */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
130 |
return self; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
131 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
132 |
@@ -1425,6 +1442,7 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
133 |
do_curl_reset(CurlObject *self) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
134 |
{ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
135 |
unsigned int i; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
136 |
+ int res; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
137 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
138 |
curl_easy_reset(self->handle); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
139 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
140 |
@@ -1452,7 +1470,17 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
141 |
} |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
142 |
} |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
143 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
144 |
+ res = util_curl_init(self); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
145 |
+ if (res < 0) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
146 |
+ goto error; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
147 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
148 |
+ Py_INCREF(Py_None); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
149 |
return Py_None; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
150 |
+ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
151 |
+error: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
152 |
+ Py_DECREF(self); /* this also closes self->handle */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
153 |
+ PyErr_SetString(ErrorObject, "resetting curl failed"); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
154 |
+ return NULL; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
155 |
} |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
156 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
157 |
/* --------------- unsetopt/setopt/getinfo --------------- */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
158 |
@@ -1501,6 +1529,8 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
159 |
case CURLOPT_RANDOM_FILE: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
160 |
case CURLOPT_SSL_CIPHER_LIST: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
161 |
case CURLOPT_USERPWD: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
162 |
+ case CURLOPT_PROXYUSERNAME: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
163 |
+ case CURLOPT_PROXYPASSWORD: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
164 |
SETOPT((char *) 0); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
165 |
opt_index = OPT_INDEX(option); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
166 |
break; |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
167 |
@@ -1627,6 +1657,9 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
168 |
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
169 |
case CURLOPT_CRLFILE: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
170 |
case CURLOPT_ISSUERCERT: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
171 |
+ case CURLOPT_NOPROXY: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
172 |
+ case CURLOPT_PROXYUSERNAME: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
173 |
+ case CURLOPT_PROXYPASSWORD: |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
174 |
/* FIXME: check if more of these options allow binary data */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
175 |
str = PyString_AsString_NoNUL(obj); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
176 |
if (str == NULL) |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
177 |
@@ -3561,6 +3594,9 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
178 |
insint_c(d, "PROXYTYPE_HTTP", CURLPROXY_HTTP); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
179 |
insint_c(d, "PROXYTYPE_SOCKS4", CURLPROXY_SOCKS4); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
180 |
insint_c(d, "PROXYTYPE_SOCKS5", CURLPROXY_SOCKS5); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
181 |
+ insint_c(d, "PROXYTYPE_HTTP_1_0", CURLPROXY_HTTP_1_0); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
182 |
+ insint_c(d, "PROXYTYPE_SOCKS4A", CURLPROXY_SOCKS4A); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
183 |
+ insint_c(d, "PROXYTYPE_SOCKS5_HOSTNAME", CURLPROXY_SOCKS5_HOSTNAME); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
184 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
185 |
/* curl_httpauth: constants for setopt(HTTPAUTH, x) */ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
186 |
insint_c(d, "HTTPAUTH_NONE", CURLAUTH_NONE); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
187 |
@@ -3735,6 +3771,9 @@ |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
188 |
insint_c(d, "CRLFILE", CURLOPT_CRLFILE); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
189 |
insint_c(d, "ISSUERCERT", CURLOPT_ISSUERCERT); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
190 |
insint_c(d, "ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
191 |
+ insint_c(d, "NOPROXY", CURLOPT_NOPROXY); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
192 |
+ insint_c(d, "PROXYUSERNAME", CURLOPT_PROXYUSERNAME); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
193 |
+ insint_c(d, "PROXYPASSWORD", CURLOPT_PROXYPASSWORD); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
194 |
|
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
195 |
insint_c(d, "M_TIMERFUNCTION", CURLMOPT_TIMERFUNCTION); |
dffc35307ef2
7051374 3rd party libraries in IPS gate should move to userland
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
diff
changeset
|
196 |
insint_c(d, "M_SOCKETFUNCTION", CURLMOPT_SOCKETFUNCTION); |