projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
release 2.0.4
[m6w6/ext-http]
/
php_http_client_curl.c
diff --git
a/php_http_client_curl.c
b/php_http_client_curl.c
index 52e5e0278788af16cb082dbaaa4a7a4901f9693a..cc5e8104f83573d5294d02ad25f6077477b7b7ab 100644
(file)
--- a/
php_http_client_curl.c
+++ b/
php_http_client_curl.c
@@
-6,7
+6,7
@@
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-201
3
, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-201
4
, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
+--------------------------------------------------------------------+
*/
@@
-17,20
+17,20
@@
#if PHP_HTTP_HAVE_EVENT
# if !PHP_HTTP_HAVE_EVENT2 && /* just be really sure */ !(LIBEVENT_VERSION_NUMBER >= 0x02000000)
#if PHP_HTTP_HAVE_EVENT
# if !PHP_HTTP_HAVE_EVENT2 && /* just be really sure */ !(LIBEVENT_VERSION_NUMBER >= 0x02000000)
-# include <event.h>
+#
include <event.h>
# define event_base_new event_init
# define event_assign(e, b, s, a, cb, d) do {\
event_set(e, s, a, cb, d); \
event_base_set(b, e); \
} while(0)
# define event_base_new event_init
# define event_assign(e, b, s, a, cb, d) do {\
event_set(e, s, a, cb, d); \
event_base_set(b, e); \
} while(0)
-# else
-# if PHP_HTTP_HAVE_EVENT2
-# include <event2/event.h>
-# include <event2/event_struct.h>
-# else
-# error "libevent presence is unknown"
-# endif
-# endif
+#
else
+#
if PHP_HTTP_HAVE_EVENT2
+#
include <event2/event.h>
+#
include <event2/event_struct.h>
+#
else
+#
error "libevent presence is unknown"
+#
endif
+#
endif
# ifndef DBG_EVENTS
# define DBG_EVENTS 0
# endif
# ifndef DBG_EVENTS
# define DBG_EVENTS 0
# endif
@@
-176,9
+176,13
@@
static size_t php_http_curle_read_callback(void *data, size_t len, size_t n, voi
{
php_http_message_body_t *body = ctx;
{
php_http_message_body_t *body = ctx;
- if (body) {
- TSRMLS_FETCH_FROM_CTX(body->ts);
- return php_stream_read(php_http_message_body_stream(body), data, len * n);
+ if (body && body->stream_id) {
+ php_stream *s = php_http_message_body_stream(body);
+
+ if (s) {
+ TSRMLS_FETCH_FROM_CTX(body->ts);
+ return php_stream_read(s, data, len * n);
+ } else abort();
}
return 0;
}
}
return 0;
}
@@
-1504,6
+1508,11
@@
static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_
curl_easy_setopt(curl->handle, CURLOPT_READDATA, msg->body);
curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, body_size);
curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, body_size);
curl_easy_setopt(curl->handle, CURLOPT_READDATA, msg->body);
curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, body_size);
curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, body_size);
+ } else {
+ curl_easy_setopt(curl->handle, CURLOPT_IOCTLDATA, NULL);
+ curl_easy_setopt(curl->handle, CURLOPT_READDATA, NULL);
+ curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, 0L);
+ curl_easy_setopt(curl->handle, CURLOPT_POSTFIELDSIZE, 0L);
}
php_http_options_apply(&php_http_curle_options, enqueue->options, curl);
}
php_http_options_apply(&php_http_curle_options, enqueue->options, curl);
@@
-1980,7
+1989,11
@@
PHP_MINIT_FUNCTION(http_client_curl)
PHP_MSHUTDOWN_FUNCTION(http_client_curl)
{
PHP_MSHUTDOWN_FUNCTION(http_client_curl)
{
+ php_persistent_handle_cleanup(ZEND_STRL("http\\Client\\Curl"), NULL, 0 TSRMLS_CC);
+ php_persistent_handle_cleanup(ZEND_STRL("http\\Client\\Curl\\Request"), NULL, 0 TSRMLS_CC);
+
php_http_options_dtor(&php_http_curle_options);
php_http_options_dtor(&php_http_curle_options);
+
return SUCCESS;
}
return SUCCESS;
}