}
#if 0
-static inline void php_http_globals_init(zend_php_http_globals *G TSRMLS_DC)
+static inline void php_http_globals_init(zend_php_http_globals *G)
{
}
-static inline void php_http_globals_free(zend_php_http_globals *G TSRMLS_DC)
+static inline void php_http_globals_free(zend_php_http_globals *G)
{
}
#endif
static int php_http_curle_seek_callback(void *userdata, curl_off_t offset, int origin)
{
php_http_message_body_t *body = userdata;
- TSRMLS_FETCH_FROM_CTX(body->ts);
if (!body) {
return 1;
return handle == ((php_http_client_curl_handler_t *) e->opaque)->handle;
}
-static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_handler_t *h TSRMLS_DC)
+static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_handler_t *h)
{
php_http_message_t *response;
php_http_header_parser_t parser;
zval *zh;
- response = php_http_message_init(NULL, 0, h->response.body TSRMLS_CC);
- php_http_header_parser_init(&parser TSRMLS_CC);
+ response = php_http_message_init(NULL, 0, h->response.body);
+ php_http_header_parser_init(&parser);
while (h->response.headers.used) {
php_http_header_parser_state_t st = php_http_header_parser_parse(&parser,
&h->response.headers, PHP_HTTP_HEADER_PARSER_CLEANUP, &response->hdrs,
if ((enqueue = php_http_client_enqueued(context, msg->easy_handle, compare_queue))) {
php_http_client_curl_handler_t *handler = enqueue->opaque;
- php_http_message_t *response = php_http_curlm_responseparser(handler TSRMLS_CC);
+ php_http_message_t *response = php_http_curlm_responseparser(handler);
if (response) {
context->callback.response.func(context->callback.response.arg, context, &handler->queue, &response);
int i = 0;
do {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s; %s (%s)", curl_easy_strerror(err[i].errorcode), err[i].errorbuffer, STR_PTR(err[i].url));
+ php_error_docref(NULL, E_WARNING, "%s; %s (%s)", curl_easy_strerror(err[i].errorcode), err[i].errorbuffer, STR_PTR(err[i].url));
if (err[i].url) {
efree(err[i].url);
}
CURLM *ch = curl->handle;
HashTable tmp_ht;
char **bl = NULL;
- TSRMLS_FETCH_FROM_CTX(client->ts);
/* array of char *, ending with a NULL */
if (value && Z_TYPE_P(value) != IS_NULL) {
}
#endif
-static void php_http_curlm_options_init(php_http_options_t *registry TSRMLS_DC)
+static void php_http_curlm_options_init(php_http_options_t *registry)
{
php_http_option_t *opt;
}
if (rv != SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
+ php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
}
return rv;
}
curl_easy_setopt(curl->handle, CURLOPT_CUSTOMREQUEST, PHP_HTTP_INFO(msg).request.method);
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot use empty request method");
+ php_error_docref(NULL, E_WARNING, "Cannot use empty request method");
return FAILURE;
}
static ZEND_RESULT_CODE php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res)
{
php_http_client_enqueue_t *enqueue;
- TSRMLS_FETCH_FROM_CTX(h->ts);
switch (opt) {
case PHP_HTTP_CLIENT_OPT_PROGRESS_INFO:
break;
case PHP_HTTP_CLIENT_OPT_AVAILABLE_OPTIONS:
- zend_hash_apply_with_arguments(&php_http_curle_options.options TSRMLS_CC, apply_available_options, 1, *(HashTable **) res);
+ zend_hash_apply_with_arguments(&php_http_curle_options.options, apply_available_options, 1, *(HashTable **) res);
break;
case PHP_HTTP_CLIENT_OPT_AVAILABLE_CONFIGURATION:
- zend_hash_apply_with_arguments(&php_http_curlm_options.options TSRMLS_CC, apply_available_options, 1, *(HashTable **) res);
+ zend_hash_apply_with_arguments(&php_http_curlm_options.options, apply_available_options, 1, *(HashTable **) res);
break;
default:
return &new_obj->zo;
}
-void php_http_cookie_object_free(zend_object *object TSRMLS_DC)
+void php_http_cookie_object_free(zend_object *object)
{
php_http_cookie_object_t *obj = PHP_HTTP_OBJ(object, NULL);
long flags = 0;
php_http_cookie_object_t *obj;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags), invalid_arg, return);
obj = PHP_HTTP_OBJ(NULL, getThis());
php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone;
php_http_cookie_object_handlers.free_obj = php_http_cookie_object_free;
- zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW TSRMLS_CC);
- zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("HTTPONLY"), PHP_HTTP_COOKIE_HTTPONLY TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW);
+ zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE);
+ zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("HTTPONLY"), PHP_HTTP_COOKIE_HTTPONLY);
return SUCCESS;
}
zend_object *php_http_cookie_object_new(zend_class_entry *ce);
php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list);
zend_object *php_http_cookie_object_clone(zval *this_ptr);
-void php_http_cookie_object_free(zend_object *object TSRMLS_DC);
+void php_http_cookie_object_free(zend_object *object);
PHP_MINIT_FUNCTION(http_cookie);
/* if strtoul() stops at the beginning of the buffered data
there's something oddly wrong, i.e. bad input */
if (stop == ctx->buffer.data) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse chunk len from '%.*s'", (int) MIN(16, ctx->buffer.used), ctx->buffer.data);
+ php_error_docref(NULL, E_WARNING, "Failed to parse chunk len from '%.*s'", (int) MIN(16, ctx->buffer.used), ctx->buffer.data);
php_http_buffer_dtor(&tmp);
return FAILURE;
}
return SUCCESS;
}
-void php_http_env_get_request_headers(HashTable *headers TSRMLS_DC)
+void php_http_env_get_request_headers(HashTable *headers)
{
php_http_arrkey_t key;
zval *hsv, *header;
zend_long code;
const char *status;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l", &code)) {
return;
}
HashTable *supported;
zval *rs_array = NULL;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H|z", &supported, &rs_array)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "H|z", &supported, &rs_array)) {
return;
}
if (rs_array) {
char *value_str, *sep_str = NULL;
size_t value_len, sep_len = 0;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sH|s!z", &value_str, &value_len, &supported, &sep_str, &sep_len, &rs_array)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "sH|s!z", &value_str, &value_len, &supported, &sep_str, &sep_len, &rs_array)) {
return;
}
add_next_index_stringl(&mn, ZEND_STRL("get")); \
zend_fcall_info_init(&mn, 0, &fci, &fcc, NULL, NULL); \
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); \
- zend_fcall_info_argp(&fci TSRMLS_CC, ZEND_NUM_ARGS(), args); \
+ zend_fcall_info_argp(&fci, ZEND_NUM_ARGS(), args); \
zend_fcall_info_call(&fci, &fcc, &rv, NULL); \
zend_fcall_info_args_clear(&fci, 1); \
efree(args); \
php_stream_flush(ctx->stream);
if (ctx->chunked && ctx->chunked_filter) {
php_stream_filter_flush(ctx->chunked_filter, 1);
- ctx->chunked_filter = php_stream_filter_remove(ctx->chunked_filter, 1 TSRMLS_CC);
+ ctx->chunked_filter = php_stream_filter_remove(ctx->chunked_filter, 1);
}
ctx->finished = 1;
char *header_name_str = NULL;
size_t header_name_len = 0;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &header_name_str, &header_name_len)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &header_name_str, &header_name_len)) {
if (!header_name_str || !header_name_len) {
header_name_str = "If-None-Match";
header_name_len = lenof("If-None-Match");
php_http_header_parser_state_t rs;
if (!php_http_buffer_from_string_ex(&buf, header, length)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate buffer");
+ php_error_docref(NULL, E_WARNING, "Could not allocate buffer");
return FAILURE;
}
- if (!php_http_header_parser_init(&ctx TSRMLS_CC)) {
+ if (!php_http_header_parser_init(&ctx)) {
php_http_buffer_dtor(&buf);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not initialize header parser");
+ php_error_docref(NULL, E_WARNING, "Could not initialize header parser");
return FAILURE;
}
return rs == PHP_HTTP_HEADER_PARSER_STATE_FAILURE ? FAILURE : SUCCESS;
}
-void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC)
+void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg)
{
php_http_arrkey_t key;
zval *header, *single_header;
ZEND_HASH_FOREACH_END();
}
-void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC)
+void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers)
{
- php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str TSRMLS_CC);
+ php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str);
}
zend_string *php_http_header_value_array_to_string(zval *header)
char *serialized_str;
size_t serialized_len;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_str, &serialized_len)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized_str, &serialized_len)) {
HashTable ht;
zend_hash_init(&ht, 1, NULL, ZVAL_PTR_DTOR, 0);
zval_dtor(return_value);
RETURN_FALSE;
} else {
- if (ce && instanceof_function(ce, php_http_header_class_entry TSRMLS_CC)) {
+ if (ce && instanceof_function(ce, php_http_header_class_entry)) {
php_http_arrkey_t key;
zval *val;
#endif
switch (php_http_header_parser_state_pop(parser)) {
case PHP_HTTP_HEADER_PARSER_STATE_FAILURE:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse headers");
+ php_error_docref(NULL, E_WARNING, "Failed to parse headers");
return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
case PHP_HTTP_HEADER_PARSER_STATE_START: {
valid_len = strspn(parser->_key.str, PHP_HTTP_HEADER_NAME_CHARS);
if (valid_len != parser->_key.len) {
- php_http_header_parser_error(valid_len, parser->_key.str, parser->_key.len, eol_str TSRMLS_CC);
+ php_http_header_parser_error(valid_len, parser->_key.str, parser->_key.len, eol_str);
PTR_SET(parser->_key.str, NULL);
return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
}
} else if (eol_str || (flags & PHP_HTTP_HEADER_PARSER_CLEANUP)) {
/* neither reqeust/response line nor 'header:' string, or injected new line or NUL etc. */
php_http_buffer_fix(buffer);
- php_http_header_parser_error(strspn(buffer->data, PHP_HTTP_HEADER_NAME_CHARS), buffer->data, buffer->used, eol_str TSRMLS_CC);
+ php_http_header_parser_error(strspn(buffer->data, PHP_HTTP_HEADER_NAME_CHARS), buffer->data, buffer->used, eol_str);
return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
} else {
/* keep feeding */
/* check for truncation */
if (valid_len != parser->_val.len) {
- php_http_header_parser_error(valid_len, parser->_val.str, parser->_val.len, NULL TSRMLS_CC);
+ php_http_header_parser_error(valid_len, parser->_val.str, parser->_val.len, NULL);
PTR_SET(parser->_key.str, NULL);
PTR_SET(parser->_val.str, NULL);
php_http_header_parser_state_t php_http_header_parser_parse_stream(php_http_header_parser_t *parser, php_http_buffer_t *buf, php_stream *s, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg)
{
php_http_header_parser_state_t state = PHP_HTTP_HEADER_PARSER_STATE_START;
- TSRMLS_FETCH_FROM_CTX(parser->ts);
if (!buf->data) {
php_http_buffer_resize_ex(buf, 0x1000, 1, 0);
return NULL;
}
- info = php_http_info_init(info TSRMLS_CC);
+ info = php_http_info_init(info);
/* and nothing than SPACE or NUL after HTTP/X.x */
if (!php_http_version_parse(&info->http.version, http)
php_http_env_get_response_headers(&message->hdrs);
if (php_output_get_level()) {
if (php_output_get_status() & PHP_OUTPUT_SENT) {
- php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(TSRMLS_C), php_output_get_start_lineno(TSRMLS_C));
+ php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(), php_output_get_start_lineno());
goto error;
} else if (SUCCESS != php_output_get_contents(&tval)) {
php_error_docref(NULL, E_WARNING, "Could not fetch response body");
return o;
}
-zend_object *php_http_message_object_clone(zval *this_ptr TSRMLS_DC)
+zend_object *php_http_message_object_clone(zval *this_ptr)
{
php_http_message_object_t *new_obj = NULL;
php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr);
zend_bool strict = 1;
php_http_message_object_t *obj;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &code, &strict), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "l|b", &code, &strict), invalid_arg, return);
obj = PHP_HTTP_OBJ(NULL, getThis());
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
size_t status_len;
php_http_message_object_t *obj;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &status, &status_len), invalid_arg, return);
obj = PHP_HTTP_OBJ(NULL, getThis());
obj->message = msg;
} else {
obj->message = php_http_message_init(NULL, 0, NULL);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not unserialize http\\Message");
+ php_error_docref(NULL, E_ERROR, "Could not unserialize http\\Message");
}
}
}
{
zend_long count_mode = -1;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &count_mode)) {
php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
size_t data_len;
zend_long flags;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
parser_obj = PHP_HTTP_OBJ(NULL, getThis());
php_http_buffer_append(&parser_obj->buffer, data_str, data_len);
php_stream *s;
zend_long flags;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh);
php_stream_from_zval(s, zstream);
}
-size_t php_http_boundary(char *buf, size_t buf_len TSRMLS_DC)
+size_t php_http_boundary(char *buf, size_t buf_len)
{
- return snprintf(buf, buf_len, "%15.15F", sapi_get_request_time(TSRMLS_C) * php_combined_lcg(TSRMLS_C));
+ return snprintf(buf, buf_len, "%15.15F", sapi_get_request_time() * php_combined_lcg());
}
int php_http_select_str(const char *cmp, int argc, ...)
zval zdata;
ZVAL_STRINGL(&zdata, str, len);
- if (SUCCESS == zend_fcall_info_argn(&fcd->fci TSRMLS_CC, 2, &fcd->fcz, &zdata)) {
- zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL TSRMLS_CC);
+ if (SUCCESS == zend_fcall_info_argn(&fcd->fci, 2, &fcd->fcz, &zdata)) {
+ zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL);
zend_fcall_info_args_clear(&fcd->fci, 0);
}
zval_ptr_dtor(&zdata);
#include "php_http_api.h"
-static int php_http_negotiate_sort(const void *first, const void *second TSRMLS_DC)
+static int php_http_negotiate_sort(const void *first, const void *second)
{
zval result;
Bucket *b1 = (Bucket *) first, *b2 = (Bucket *) second;
return ZEND_HASH_APPLY_KEEP;
}
-HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len TSRMLS_DC)
+HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len)
{
HashTable *result = NULL;
php_http_params_opts_default_get(&opts);
opts.input.str = estrndup(value_str, value_len);
opts.input.len = value_len;
- php_http_params_parse(¶ms, &opts TSRMLS_CC);
+ php_http_params_parse(¶ms, &opts);
efree(opts.input.str);
array_init(&arr);
#define PHP_HTTP_DO_NEGOTIATE(type, supported, rs_array) \
{ \
HashTable *result; \
- if ((result = php_http_negotiate_ ##type(supported, NULL TSRMLS_CC))) { \
+ if ((result = php_http_negotiate_ ##type(supported, NULL))) { \
PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(result, supported, rs_array); \
} else { \
PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array); \
zend_object zo;
} php_http_object_t;
-zend_object *php_http_object_new(zend_class_entry *ce TSRMLS_DC);
+zend_object *php_http_object_new(zend_class_entry *ce);
php_http_object_t *php_http_object_new_ex(zend_class_entry *ce, void *nothing);
typedef void *(*php_http_new_t)(zend_class_entry *ce, void *);
}
}
-static inline void sanitize_rfc5988(char *str, size_t len, zval *zv TSRMLS_DC)
+static inline void sanitize_rfc5988(char *str, size_t len, zval *zv)
{
zend_string *zs = zend_string_init(str, len, 0);
zend_string_release(zs);
}
-static inline void prepare_rfc5988(zval *zv TSRMLS_DC)
+static inline void prepare_rfc5988(zval *zv)
{
if (Z_TYPE_P(zv) != IS_STRING) {
zval_dtor(zv);
zval tmp;
INIT_PZVAL_ARRAY(&tmp, params);
fprintf(stderr, "params = ");
- zend_print_zval_r(&tmp, 1 TSRMLS_CC);
+ zend_print_zval_r(&tmp, 1);
fprintf(stderr, "\n");
}
#endif
zend_string *name;
zval zparams_tmp, *zparam, *zparams, *nvalue;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &nvalue)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &nvalue)) {
return;
}
opts.val = vsepp;
opts.flags = PHP_HTTP_PARAMS_QUERY;
- if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0 TSRMLS_CC) && asi_len) {
+ if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0) && asi_len) {
zval arr;
array_init_size(&arr, asi_len);
zval *params = NULL;
zend_error_handling zeh;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶ms), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z", ¶ms), invalid_arg, return);
zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh);
php_http_querystring_set(getThis(), params, 0);
zend_string *offset;
zval *value, param, znull;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &offset, &value)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &offset, &value)) {
return;
}
zend_string *offset;
zval param, znull;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &offset)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
return;
}
#if defined(PHP_WIN32) || defined(HAVE_UIDNA_IDNTOASCII)
typedef size_t (*parse_mb_func)(unsigned *wc, const char *ptr, const char *end);
-static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len TSRMLS_DC)
+static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len)
{
size_t offset = 0, u8_len = strlen(u8);
{
char *idn = NULL;
int rv = -1;
- TSRMLS_FETCH_FROM_CTX(state->ts);
if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
rv = idn2_lookup_u8((const unsigned char *) state->url.host, (unsigned char **) &idn, IDN2_NFC_INPUT);
}
# endif
if (rv != IDN2_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse IDN; %s", idn2_strerror(rv));
+ php_error_docref(NULL, E_WARNING, "Failed to parse IDN; %s", idn2_strerror(rv));
return FAILURE;
} else {
size_t idnlen = strlen(idn);
uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr;
size_t uhost_len, ahost_len;
UErrorCode error = U_ZERO_ERROR;
- TSRMLS_FETCH_FROM_CTX(state->ts);
if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
- if (SUCCESS != to_utf16(parse_mb_utf8, state->url.host, &uhost_str, &uhost_len TSRMLS_CC)) {
+ if (SUCCESS != to_utf16(parse_mb_utf8, state->url.host, &uhost_str, &uhost_len)) {
return FAILURE;
}
#ifdef PHP_HTTP_HAVE_WCHAR
} else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) {
- if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len TSRMLS_CC)) {
+ if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len)) {
return FAILURE;
}
#endif
state->ptr = str;
state->flags = flags;
state->maxlen = maxlen;
- TSRMLS_SET_CTX(state->ts);
if (!(state->ptr = parse_authority(state))) {
efree(state);
}
if (state->ptr != state->end) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ php_error_docref(NULL, E_WARNING,
"Failed to parse URL authority, unexpected character at pos %u in '%s'",
(unsigned) (state->ptr - str), str);
efree(state);
separator = *ptr++;
if (separator) {
if (separator != '.' && separator != ',') {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Non-standard version separator '%c' in HTTP protocol version '%s'", separator, ptr - 2);
+ php_error_docref(NULL, E_NOTICE, "Non-standard version separator '%c' in HTTP protocol version '%s'", separator, ptr - 2);
}
minor = *ptr - '0';
if (minor >= 0 && minor <= 9) {
- return php_http_version_init(v, major, minor TSRMLS_CC);
+ return php_http_version_init(v, major, minor);
}
}
}
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not parse HTTP protocol version '%s'", str);
+ php_error_docref(NULL, E_WARNING, "Could not parse HTTP protocol version '%s'", str);
return NULL;
}
} php_http_version_t;
PHP_HTTP_API php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor);
-PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str TSRMLS_DC);
+PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str);
PHP_HTTP_API void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post);
PHP_HTTP_API void php_http_version_dtor(php_http_version_t *v);
PHP_HTTP_API void php_http_version_free(php_http_version_t **v);
<?php
include "helper/server.inc";
+include "helper/dump.inc";
echo "Test\n";
$request->setOptions(array("timeout" => 10, "expect_100_timeout" => 0));
$client->enqueue($request);
$client->send();
- var_dump($client->getResponse()->getHeaders());
+ dump_headers(null, $client->getResponse()->getHeaders());
});
?>
===DONE===
--EXPECTF--
Test
-array(5) {
- ["Accept-Ranges"]=>
- string(5) "bytes"
- ["Etag"]=>
- string(%d) "%s"
- ["Last-Modified"]=>
- string(%d) "%s"
- ["X-Original-Transfer-Encoding"]=>
- string(7) "chunked"
- ["Content-Length"]=>
- int(134217%d%d%d)
-}
-===DONE===
+Accept-Ranges: bytes
+Content-Length: 134217960
+Etag: "cc048f13"
+Last-Modified: Mon, 20 Jul 2015 12:55:36 GMT
+X-Original-Transfer-Encoding: chunked
+
+===DONE===
\ No newline at end of file
<?php
-function dump_message($stream, http\Message $msg, $parent = false) {
+function dump_headers($stream, array $headers) {
if (!is_resource($stream)) {
$stream = fopen("php://output", "w");
}
- fprintf($stream, "%s\n", $msg->getInfo());
- $headers = $msg->getHeaders();
ksort($headers);
foreach ($headers as $key => $val) {
fprintf($stream, "%s: %s\n", $key, $val);
}
fprintf($stream, "\n");
+}
+
+function dump_message($stream, http\Message $msg, $parent = false) {
+ if (!is_resource($stream)) {
+ $stream = fopen("php://output", "w");
+ }
+ fprintf($stream, "%s\n", $msg->getInfo());
+ dump_headers($stream, $msg->getHeaders());
$msg->getBody()->toStream($stream);
if ($parent && ($msg = $msg->getParentMessage())) {
define("PHP_BIN", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
}
+foreach (array("raphf", "propro", "http") as $ext) {
+ if (!extension_loaded($ext)) {
+ switch (PHP_SHLIB_SUFFIX) {
+ case "dll":
+ dl("php_$ext.dll");
+ break;
+ default:
+ dl($ext .".". PHP_SHLIB_SUFFIX);
+ }
+ }
+}
+
function serve($cb) {
/* stream_socket_server() automatically sets SO_REUSEADDR,
* which is, well, bad if the tests are run in parallel