projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
This commit was manufactured by cvs2svn to create tag 'RELEASE_1_2_1'.
[m6w6/ext-http]
/
http_request_object.c
diff --git
a/http_request_object.c
b/http_request_object.c
index 45625f0f777ab4dbf1fa0be4d5e229ed5818e591..b40ef8992457e8a9833cf8e23c6324676aa4682c 100644
(file)
--- a/
http_request_object.c
+++ b/
http_request_object.c
@@
-74,7
+74,9
@@
HTTP_END_ARGS;
HTTP_EMPTY_ARGS(enableCookies);
#if HTTP_CURL_VERSION(7,14,1)
HTTP_EMPTY_ARGS(enableCookies);
#if HTTP_CURL_VERSION(7,14,1)
-HTTP_EMPTY_ARGS(resetCookies);
+HTTP_BEGIN_ARGS(resetCookies, 0)
+ HTTP_ARG_VAL(session_only, 0)
+HTTP_END_ARGS;
#endif
HTTP_EMPTY_ARGS(getUrl);
#endif
HTTP_EMPTY_ARGS(getUrl);
@@
-232,10
+234,12
@@
HTTP_BEGIN_ARGS(methodExists, 1)
HTTP_ARG_VAL(method, 0)
HTTP_END_ARGS;
HTTP_ARG_VAL(method, 0)
HTTP_END_ARGS;
+#ifdef HAVE_CURL_GETFORMDATA
HTTP_BEGIN_ARGS(encodeBody, 2)
HTTP_ARG_VAL(fields, 0)
HTTP_ARG_VAL(files, 0)
HTTP_END_ARGS;
HTTP_BEGIN_ARGS(encodeBody, 2)
HTTP_ARG_VAL(fields, 0)
HTTP_ARG_VAL(files, 0)
HTTP_END_ARGS;
+#endif
#define OBJ_PROP_CE http_request_object_ce
zend_class_entry *http_request_object_ce;
#define OBJ_PROP_CE http_request_object_ce
zend_class_entry *http_request_object_ce;
@@
-321,9
+325,9
@@
zend_function_entry http_request_object_fe[] = {
HTTP_REQUEST_ALIAS(methodUnregister, http_request_method_unregister)
HTTP_REQUEST_ALIAS(methodName, http_request_method_name)
HTTP_REQUEST_ALIAS(methodExists, http_request_method_exists)
HTTP_REQUEST_ALIAS(methodUnregister, http_request_method_unregister)
HTTP_REQUEST_ALIAS(methodName, http_request_method_name)
HTTP_REQUEST_ALIAS(methodExists, http_request_method_exists)
-
+#ifdef HAVE_CURL_GETFORMDATA
HTTP_REQUEST_ALIAS(encodeBody, http_request_body_encode)
HTTP_REQUEST_ALIAS(encodeBody, http_request_body_encode)
-
+#endif
EMPTY_FUNCTION_ENTRY
};
static zend_object_handlers http_request_object_handlers;
EMPTY_FUNCTION_ENTRY
};
static zend_object_handlers http_request_object_handlers;
@@
-445,18
+449,16
@@
zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, ht
zend_object_value _http_request_object_clone_obj(zval *this_ptr TSRMLS_DC)
{
zend_object_value _http_request_object_clone_obj(zval *this_ptr TSRMLS_DC)
{
- zend_object *old_zo;
zend_object_value new_ov;
http_request_object *new_obj;
getObject(http_request_object, old_obj);
zend_object_value new_ov;
http_request_object *new_obj;
getObject(http_request_object, old_obj);
- old_zo = zend_objects_get_address(this_ptr TSRMLS_CC);
- new_ov = http_request_object_new_ex(old_zo->ce, NULL, &new_obj);
+ new_ov = http_request_object_new_ex(old_obj->zo.ce, NULL, &new_obj);
if (old_obj->request->ch) {
http_curl_init_ex(curl_easy_duphandle(old_obj->request->ch), new_obj->request);
}
if (old_obj->request->ch) {
http_curl_init_ex(curl_easy_duphandle(old_obj->request->ch), new_obj->request);
}
- zend_objects_clone_members(&new_obj->zo, new_ov,
old_
zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+ zend_objects_clone_members(&new_obj->zo, new_ov,
&old_obj->
zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
phpstr_append(&new_obj->request->conv.request, old_obj->request->conv.request.data, old_obj->request->conv.request.used);
phpstr_append(&new_obj->request->conv.response, old_obj->request->conv.response.data, old_obj->request->conv.response.used);
phpstr_append(&new_obj->request->conv.request, old_obj->request->conv.request.data, old_obj->request->conv.request.used);
phpstr_append(&new_obj->request->conv.response, old_obj->request->conv.response.data, old_obj->request->conv.response.used);
@@
-467,12
+469,8
@@
void _http_request_object_free(zend_object *object TSRMLS_DC)
{
http_request_object *o = (http_request_object *) object;
{
http_request_object *o = (http_request_object *) object;
- if (OBJ_PROP(o)) {
- zend_hash_destroy(OBJ_PROP(o));
- FREE_HASHTABLE(OBJ_PROP(o));
- }
http_request_free(&o->request);
http_request_free(&o->request);
-
efree
(o);
+
freeObject
(o);
}
#define http_request_object_check_request_content_type(t) _http_request_object_check_request_content_type((t) TSRMLS_CC)
}
#define http_request_object_check_request_content_type(t) _http_request_object_check_request_content_type((t) TSRMLS_CC)
@@
-881,8
+879,13
@@
PHP_METHOD(HttpRequest, setOptions)
#if HTTP_CURL_VERSION(7,14,1)
} else if (!strcmp(key, "resetcookies")) {
getObject(http_request_object, obj);
#if HTTP_CURL_VERSION(7,14,1)
} else if (!strcmp(key, "resetcookies")) {
getObject(http_request_object, obj);
- http_request_reset_cookies(obj->request);
+ http_request_reset_cookies(obj->request
, 0
);
#endif
#endif
+ } else if (!strcmp(key, "enablecookies")) {
+ getObject(http_request_object, obj);
+ http_request_enable_cookies(obj->request);
+ } else if (!strcasecmp(key, "recordHistory")) {
+ UPD_PROP(bool, recordHistory, 1);
} else {
ZVAL_ADDREF(*opt);
add_assoc_zval(add_opts, key, *opt);
} else {
ZVAL_ADDREF(*opt);
add_assoc_zval(add_opts, key, *opt);
@@
-1060,17
+1063,26
@@
PHP_METHOD(HttpRequest, enableCookies)
}
/* }}} */
}
/* }}} */
-/* {{{ proto bool HttpRequest::resetCookies()
+/* {{{ proto bool HttpRequest::resetCookies(
[bool session_only = FALSE]
)
*
* Reset all automatically received/sent cookies.
* Note that customly set cookies are not affected.
*
* Reset all automatically received/sent cookies.
* Note that customly set cookies are not affected.
+ *
+ * Accepts an optional bool parameter specifying
+ * whether only session cookies should be reset
+ * (needs libcurl >= v7.15.4, else libcurl >= v7.14.1).
+ *
+ * Returns TRUE on success, or FALSE on failure.
*/
PHP_METHOD(HttpRequest, resetCookies)
{
*/
PHP_METHOD(HttpRequest, resetCookies)
{
- NO_ARGS {
- getObject(http_request_object, obj);
- RETURN_SUCCESS(http_request_reset_cookies(obj->request));
+ zend_bool session_only = 0;
+ getObject(http_request_object, obj);
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &session_only)) {
+ RETURN_FALSE;
}
}
+ RETURN_SUCCESS(http_request_reset_cookies(obj->request, session_only));
}
/* }}} */
}
/* }}} */