php_http_curl.c \
php_http_request_pool.c \
php_http_request_datashare.c \
- php_http_request_method.c \
php_http_strlist.c \
php_http_url.c \
php_http_version.c \
php_http_request.h \
php_http_request_factory.h \
php_http_curl.h \
- php_http_request_method.h \
php_http_request_pool.h \
php_http_strlist.h \
php_http_url.h \
- Renamed http\Env\Request::getPost() to ::getForm()
- Changed http\Env\Response::setContentDisposition() to take an http\Params like array as argument
- Removed http\Env\Response::CONTENT_DISPOSOTION_* constants
-- Removed http\Env\Request\Method class; request methods are now used as simple strings
+- Removed http\Request\Method class; request methods are now used as simple strings
]]></notes>
<contents>
<dir name="/">
<file role="src" name="php_http_request_factory.c"/>
<file role="src" name="php_http_request_factory.h"/>
<file role="src" name="php_http_request.h"/>
- <file role="src" name="php_http_request_method.c"/>
- <file role="src" name="php_http_request_method.h"/>
<file role="src" name="php_http_request_pool.c"/>
<file role="src" name="php_http_request_pool.h"/>
<file role="src" name="php_http_resource_factory.c"/>
#include "php_http_request.h"
#include "php_http_request_datashare.h"
#include "php_http_request_factory.h"
-#include "php_http_request_method.h"
#include "php_http_request_pool.h"
#include "php_http_serf.h"
#include "php_http_url.h"
HashTable cache;
struct curl_slist *headers;
+ struct curl_slist *resolve;
php_http_buffer_t cookies;
long redirects;
curl_easy_setopt(curl->handle, CURLOPT_URL, storage->url);
/* request method */
- switch (php_http_request_method_is(meth, 4, "GET", "HEAD", "POST", "PUT")) {
+ switch (php_http_select_str(meth, 4, "GET", "HEAD", "POST", "PUT")) {
case 0:
curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1L);
break;
if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("ipresolve"), IS_LONG)) && Z_LVAL_P(zoption)) {
curl_easy_setopt(ch, CURLOPT_IPRESOLVE, Z_LVAL_P(zoption));
}
+#if PHP_HTTP_CURL_VERSION(7,21,3)
+ if (curl->options.resolve) {
+ curl_slist_free_all(curl->options.resolve);
+ curl->options.resolve = NULL;
+ }
+ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("resolve"), IS_ARRAY))) {
+ php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+ HashPosition pos;
+ zval **data;
+
+ FOREACH_KEYVAL(pos, zoption, key, data) {
+ zval *cpy = php_http_ztyp(IS_STRING, *data);
+
+ curl->options.resolve = curl_slist_append(curl->options.resolve, Z_STRVAL_P(cpy));
+
+ zval_ptr_dtor(&cpy);
+ }
+ }
+#endif
+#if PHP_HTTP_CURL_VERSION(7,24,0)
+ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("dns_servers"), IS_STRING)) && Z_STRLEN_P(zoption)) {
+ curl_easy_setopt(ch, CURLOPT_DNS_SERVERS, Z_STRVAL_P(zoption));
+ }
+#endif
/* limits */
if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("low_speed_limit"), IS_LONG))) {
}
break;
+#if PHP_HTTP_CURL_VERSION(7,23,0)
+ case PHP_HTTP_REQUEST_DATASHARE_OPT_SSLSESSIONS:
+ if (CURLSHE_OK != (rc = curl_share_setopt(curl->handle, *((zend_bool *) arg) ? CURLSHOPT_SHARE : CURLSHOPT_UNSHARE, CURL_LOCK_DATA_SSL_SESSION))) {
+ TSRMLS_FETCH_FROM_CTX(h->ts);
+
+ php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_DATASHARE, "Could not %s sharing of SSL session data: %s", *((zend_bool *) arg) ? "enable" : "disable", curl_share_strerror(rc));
+ return FAILURE;
+ }
+ break;
+#endif
+
default:
return FAILURE;
}
curl_easy_setopt(ch, CURLOPT_HTTPPROXYTUNNEL, 0L);
curl_easy_setopt(ch, CURLOPT_DNS_CACHE_TIMEOUT, 60L);
curl_easy_setopt(ch, CURLOPT_IPRESOLVE, 0);
+#if PHP_HTTP_CURL_VERSION(7,21,3)
+ curl_easy_setopt(ch, CURLOPT_RESOLVE, NULL);
+#endif
+#if PHP_HTTP_CURL_VERSION(7,24,0)
+ curl_easy_setopt(ch, CURLOPT_DNS_SERVERS, NULL);
+#endif
curl_easy_setopt(ch, CURLOPT_LOW_SPEED_LIMIT, 0L);
curl_easy_setopt(ch, CURLOPT_LOW_SPEED_TIME, 0L);
/* LFS weirdance
return snprintf(buf, buf_len, "%15.15F", PHP_HTTP_G->env.request.time * php_combined_lcg(TSRMLS_C));
}
+int php_http_select_str(const char *cmp, int argc, ...)
+{
+ va_list argv;
+ int match = -1;
+
+ if (cmp && argc > 0) {
+ int i;
+
+ va_start(argv, argc);
+ for (i = 0; i < argc; ++i) {
+ const char *test = va_arg(argv, const char *);
+
+ if (!strcasecmp(cmp, test)) {
+ match = i;
+ break;
+ }
+ }
+ va_end(argv);
+ }
+
+ return match;
+}
+
+
/* ARRAYS */
int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
#define PHP_HTTP_MATCH_STRICT (PHP_HTTP_MATCH_CASE|PHP_HTTP_MATCH_FULL)
extern int php_http_match(const char *haystack, const char *needle, int flags);
-
extern char *php_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen);
extern size_t php_http_boundary(char *buf, size_t len TSRMLS_DC);
+extern int php_http_select_str(const char *cmp, int argc, ...);
static inline const char *php_http_locate_str(const char *h, size_t h_len, const char *n, size_t n_len)
{
#ifndef PHP_HTTP_REQUEST_H
#define PHP_HTTP_REQUEST_H
-#include "php_http_request_method.h"
#include "php_http_message_body.h"
#include "php_http_message_parser.h"
opt = PHP_HTTP_REQUEST_DATASHARE_OPT_COOKIES;
} else if (!strcmp(pi->name, "dns")) {
opt = PHP_HTTP_REQUEST_DATASHARE_OPT_RESOLVER;
+ } else if (!strcmp(pi->name, "ssl")) {
+ opt = PHP_HTTP_REQUEST_DATASHARE_OPT_SSLSESSIONS;
} else {
return;
}
zend_declare_property_bool(php_http_request_datashare_class_entry, ZEND_STRL("cookie"), 0, ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_bool(php_http_request_datashare_class_entry, ZEND_STRL("dns"), 0, ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_bool(php_http_request_datashare_class_entry, ZEND_STRL("ssl"), 0, ZEND_ACC_PUBLIC TSRMLS_CC);
return SUCCESS;
}
typedef enum php_http_request_datashare_setopt_opt {
PHP_HTTP_REQUEST_DATASHARE_OPT_COOKIES,
PHP_HTTP_REQUEST_DATASHARE_OPT_RESOLVER,
+ PHP_HTTP_REQUEST_DATASHARE_OPT_SSLSESSIONS,
} php_http_request_datashare_setopt_opt_t;
typedef struct php_http_request_datashare php_http_request_datashare_t;
+++ /dev/null
-/*
- +--------------------------------------------------------------------+
- | PECL :: http |
- +--------------------------------------------------------------------+
- | Redistribution and use in source and binary forms, with or without |
- | modification, are permitted provided that the conditions mentioned |
- | in the accompanying LICENSE file are met. |
- +--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
- +--------------------------------------------------------------------+
-*/
-
-#include "php_http_api.h"
-
-PHP_HTTP_API int php_http_request_method_is(const char *meth, int argc, ...)
-{
- va_list argv;
- int match = -1;
-
- if (argc > 0) {
- int i;
-
- va_start(argv, argc);
- for (i = 0; i < argc; ++i) {
- const char *test = va_arg(argv, const char *);
-
- if (!strcasecmp(meth, test)) {
- match = i;
- break;
- }
- }
- va_end(argv);
- }
-
- return match;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-
+++ /dev/null
-/*
- +--------------------------------------------------------------------+
- | PECL :: http |
- +--------------------------------------------------------------------+
- | Redistribution and use in source and binary forms, with or without |
- | modification, are permitted provided that the conditions mentioned |
- | in the accompanying LICENSE file are met. |
- +--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
- +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_HTTP_REQUEST_METHOD_H
-#define PHP_HTTP_REQUEST_METHOD_H
-
-PHP_HTTP_API int php_http_request_method_is(const char *meth, int argc, ...);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-