projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- furl.scheme cannot be NULL at this stage
[m6w6/ext-http]
/
http_request_object.c
diff --git
a/http_request_object.c
b/http_request_object.c
index fbddcc6ec8e470e5f5254b19fe70d91f9ae86db2..925cd6d06b5bf84f3e3f3507c190fd04a8fa37bb 100644
(file)
--- a/
http_request_object.c
+++ b/
http_request_object.c
@@
-12,33
+12,25
@@
/* $Id$ */
/* $Id$ */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include "php.h"
+
+#define HTTP_WANT_CURL
+#include "php_http.h"
#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
#include "zend_interfaces.h"
#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
#include "zend_interfaces.h"
-#include "php_http_std_defs.h"
-#include "php_http_request_object.h"
-#include "php_http_request_api.h"
-#include "php_http_request_pool_api.h"
-#include "php_http.h"
#include "php_http_api.h"
#include "php_http_api.h"
-#include "php_http_
url_api
.h"
+#include "php_http_
exception_object
.h"
#include "php_http_message_api.h"
#include "php_http_message_object.h"
#include "php_http_message_api.h"
#include "php_http_message_object.h"
-#include "php_http_exception_object.h"
-
-#include "missing.h"
-
-#ifdef PHP_WIN32
-# include <winsock2.h>
-#endif
-#include <curl/curl.h>
+#include "php_http_request_api.h"
+#include "php_http_request_object.h"
+#include "php_http_request_pool_api.h"
+#include "php_http_url_api.h"
ZEND_EXTERN_MODULE_GLOBALS(http);
ZEND_EXTERN_MODULE_GLOBALS(http);
@@
-778,6
+770,7
@@
PHP_METHOD(HttpRequest, setOptions)
{
char *key = NULL;
ulong idx = 0;
{
char *key = NULL;
ulong idx = 0;
+ HashPosition pos;
zval *opts = NULL, *old_opts, **opt;
getObject(http_request_object, obj);
zval *opts = NULL, *old_opts, **opt;
getObject(http_request_object, obj);
@@
-795,7
+788,7
@@
PHP_METHOD(HttpRequest, setOptions)
}
/* some options need extra attention -- thus cannot use array_merge() directly */
}
/* some options need extra attention -- thus cannot use array_merge() directly */
- FOREACH_KEYVAL(opts, key, idx, opt) {
+ FOREACH_KEYVAL(
pos,
opts, key, idx, opt) {
if (key) {
if (!strcmp(key, "headers")) {
zval **headers;
if (key) {
if (!strcmp(key, "headers")) {
zval **headers;
@@
-1664,15
+1657,17
@@
PHP_METHOD(HttpRequest, getResponseCookie)
ulong idx = 0;
char *key = NULL;
zval **header = NULL;
ulong idx = 0;
char *key = NULL;
zval **header = NULL;
+ HashPosition pos1;
- convert_to_array
_ex(
headers);
- FOREACH_HASH_KEYVAL(Z_ARRVAL_PP(headers), key, idx, header) {
+ convert_to_array
(*
headers);
+ FOREACH_HASH_KEYVAL(
pos1,
Z_ARRVAL_PP(headers), key, idx, header) {
if (key && !strcasecmp(key, "Set-Cookie")) {
/* several cookies? */
if (Z_TYPE_PP(header) == IS_ARRAY) {
zval **cookie;
if (key && !strcasecmp(key, "Set-Cookie")) {
/* several cookies? */
if (Z_TYPE_PP(header) == IS_ARRAY) {
zval **cookie;
+ HashPosition pos2;
- FOREACH_HASH_VAL(Z_ARRVAL_PP(header), cookie) {
+ FOREACH_HASH_VAL(
pos2,
Z_ARRVAL_PP(header), cookie) {
zval *cookie_hash;
MAKE_STD_ZVAL(cookie_hash);
array_init(cookie_hash);
zval *cookie_hash;
MAKE_STD_ZVAL(cookie_hash);
array_init(cookie_hash);
@@
-1891,7
+1886,7
@@
PHP_METHOD(HttpRequest, getRequestMessage)
getObject(http_request_object, obj);
SET_EH_THROW_HTTP();
getObject(http_request_object, obj);
SET_EH_THROW_HTTP();
- if (
msg = http_message_parse(PHPSTR_VAL(&obj->request), PHPSTR_LEN(&obj->request
))) {
+ if (
(msg = http_message_parse(PHPSTR_VAL(&obj->request), PHPSTR_LEN(&obj->request)
))) {
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
}
SET_EH_NORMAL();
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
}
SET_EH_NORMAL();
@@
-1927,7
+1922,7
@@
PHP_METHOD(HttpRequest, getHistory)
getObject(http_request_object, obj);
SET_EH_THROW_HTTP();
getObject(http_request_object, obj);
SET_EH_THROW_HTTP();
- if (
msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history
))) {
+ if (
(msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history)
))) {
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
}
SET_EH_NORMAL();
ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL));
}
SET_EH_NORMAL();
@@
-1954,6
+1949,10
@@
PHP_METHOD(HttpRequest, clearHistory)
*
* Returns the received response as HttpMessage object.
*
*
* Returns the received response as HttpMessage object.
*
+ * NOTE: While an exception may be thrown, the transfer could have succeeded
+ * at least partially, so you might want to check the return values of various
+ * HttpRequest::getResponse*() methods.
+ *
* Throws HttpRuntimeException, HttpRequestException,
* HttpMalformedHeaderException, HttpEncodingException.
*
* Throws HttpRuntimeException, HttpRequestException,
* HttpMalformedHeaderException, HttpEncodingException.
*