projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
b6f1f30
)
* use curl's error messages
author
Michael Wallner
<mike@php.net>
Thu, 3 Mar 2005 21:09:50 +0000
(21:09 +0000)
committer
Michael Wallner
<mike@php.net>
Thu, 3 Mar 2005 21:09:50 +0000
(21:09 +0000)
http_curl_api.c
patch
|
blob
|
history
diff --git
a/http_curl_api.c
b/http_curl_api.c
index b40b7218fb5cb1bc1f4d9e67833dee24995f3003..0669db4d22f6d9379f5f18872f9a288aa64b5879 100644
(file)
--- a/
http_curl_api.c
+++ b/
http_curl_api.c
@@
-62,6
+62,17
@@
ZEND_DECLARE_MODULE_GLOBALS(http)
http_curl_initbuf(); \
http_curl_setopts(ch, URL, options);
http_curl_initbuf(); \
http_curl_setopts(ch, URL, options);
+#define http_curl_perform(ch, clean_curl) \
+ { \
+ CURLcode result; \
+ if (CURLE_OK != (result = curl_easy_perform(ch))) { \
+ http_curl_cleanup(ch, clean_curl); \
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not perform request: %s", curl_easy_strerror(result)); \
+ return FAILURE; \
+ } \
+ }
+
+
#define http_curl_cleanup(ch, clean_curl) \
http_curl_freestr(); \
#define http_curl_cleanup(ch, clean_curl) \
http_curl_freestr(); \
@@
-482,13
+493,8
@@
PHP_HTTP_API STATUS _http_get_ex(CURL *ch, const char *URL, HashTable *options,
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_HTTPGET, 1);
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_HTTPGET, 1);
-
- if (CURLE_OK != curl_easy_perform(ch)) {
- http_curl_cleanup(ch, clean_curl);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not perform request");
- return FAILURE;
- }
-
+ http_curl_perform(ch, clean_curl);
+
if (info) {
http_curl_getinfo(ch, info);
}
if (info) {
http_curl_getinfo(ch, info);
}
@@
-507,12
+513,7
@@
PHP_HTTP_API STATUS _http_head_ex(CURL *ch, const char *URL, HashTable *options,
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_NOBODY, 1);
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_NOBODY, 1);
-
- if (CURLE_OK != curl_easy_perform(ch)) {
- http_curl_cleanup(ch, clean_curl);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not perform request");
- return FAILURE;
- }
+ http_curl_perform(ch, clean_curl);
if (info) {
http_curl_getinfo(ch, info);
if (info) {
http_curl_getinfo(ch, info);
@@
-535,12
+536,7
@@
PHP_HTTP_API STATUS _http_post_data_ex(CURL *ch, const char *URL, char *postdata
curl_easy_setopt(ch, CURLOPT_POST, 1);
curl_easy_setopt(ch, CURLOPT_POSTFIELDS, postdata);
curl_easy_setopt(ch, CURLOPT_POSTFIELDSIZE, postdata_len);
curl_easy_setopt(ch, CURLOPT_POST, 1);
curl_easy_setopt(ch, CURLOPT_POSTFIELDS, postdata);
curl_easy_setopt(ch, CURLOPT_POSTFIELDSIZE, postdata_len);
-
- if (CURLE_OK != curl_easy_perform(ch)) {
- http_curl_cleanup(ch, clean_curl);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not perform request");
- return FAILURE;
- }
+ http_curl_perform(ch, clean_curl);
if (info) {
http_curl_getinfo(ch, info);
if (info) {
http_curl_getinfo(ch, info);
@@
-591,12
+587,7
@@
PHP_HTTP_API STATUS _http_post_curldata_ex(CURL *ch, const char *URL,
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_POST, 1);
curl_easy_setopt(ch, CURLOPT_HTTPPOST, curldata);
http_curl_startup(ch, clean_curl, URL, options);
curl_easy_setopt(ch, CURLOPT_POST, 1);
curl_easy_setopt(ch, CURLOPT_HTTPPOST, curldata);
-
- if (CURLE_OK != curl_easy_perform(ch)) {
- http_curl_cleanup(ch, clean_curl);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not perform request");
- return FAILURE;
- }
+ http_curl_perform(ch, clean_curl);
if (info) {
http_curl_getinfo(ch, info);
if (info) {
http_curl_getinfo(ch, info);