+/*
+ +--------------------------------------------------------------------+
+ | 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.h"
+
+#if PHP_HTTP_HAVE_NEON
+
#include "php_http_request.h"
#include <ext/date/php_date.h>
zval *zoption;
int range_req = 0;
php_http_neon_request_t *neon = h->ctx;
+ TSRMLS_FETCH_FROM_CTX(h->ts);
/* proxy */
if ((zoption = get_option(&neon->options.cache, options, ZEND_STRS("proxyhost"), IS_STRING))) {
if (PHP_HTTP_BUFFER_LEN(&rs)) {
/* ignore last comma */
- php_http_buffer_appendf(&neon->options.headers, "Range: bytes=%.*s" PHP_HTTP_CRLF, rs.used - 1, rs.data);
+ int used = rs.used > INT_MAX ? INT_MAX : rs.used;
+ php_http_buffer_appendf(&neon->options.headers, "Range: bytes=%.*s" PHP_HTTP_CRLF, used - 1, rs.data);
range_req = 1;
}
php_http_buffer_dtor(&rs);
/* check whether cookies should not be urlencoded; default is to urlencode them */
if ((!(urlenc_cookies = get_option(&neon->options.cache, options, ZEND_STRS("encodecookies"), IS_BOOL))) || Z_BVAL_P(urlenc_cookies)) {
- php_http_url_encode_hash_recursive(HASH_OF(zoption), &neon->options.headers, "; ", lenof("; "), NULL, 0 TSRMLS_CC);
+ php_http_url_encode_hash_ex(HASH_OF(zoption), &neon->options.headers, ZEND_STRS("; "), ZEND_STRS("="), NULL, 0 TSRMLS_CC);
} else {
HashPosition pos;
php_http_array_hashkey_t cookie_key = php_http_array_hashkey_init(0);
static void php_http_neon_request_dtor(php_http_request_t *h)
{
php_http_neon_request_t *ctx = h->ctx;
+ TSRMLS_FETCH_FROM_CTX(h->ts);
php_http_neon_request_reset(h);
php_http_buffer_dtor(&ctx->options.headers);
zend_hash_destroy(&ctx->options.cache);
- php_http_request_progress_dtor(&ctx->progress);
+ php_http_request_progress_dtor(&ctx->progress TSRMLS_CC);
efree(ctx);
h->ctx = NULL;
static STATUS php_http_neon_request_reset(php_http_request_t *h)
{
php_http_neon_request_t *neon = h->ctx;
+ TSRMLS_FETCH_FROM_CTX(h->ts);
php_http_buffer_reset(&neon->options.headers);
STR_SET(neon->options.useragent, NULL);
neon->options.timeout.read = 0;
neon->options.timeout.connect = 0;
- php_http_request_progress_dtor(&neon->progress);
+ php_http_request_progress_dtor(&neon->progress TSRMLS_CC);
return SUCCESS;
}
php_http_neon_request_t *neon = h->ctx;
TSRMLS_FETCH_FROM_CTX(h->ts);
- if (!(meth = php_http_request_method_name(meth_id))) {
+ if (!(meth = php_http_request_method_name(meth_id TSRMLS_CC))) {
php_http_error(HE_WARNING, PHP_HTTP_E_REQUEST_METHOD, "Unsupported request method: %d (%s)", meth, url);
return FAILURE;
}
purl->port = neon->options.port;
} else if (!purl->port) {
purl->port = 80;
- if (strncascmp(purl->scheme, "http", 4)) {
+ if (strncasecmp(purl->scheme, "http", 4)) {
#ifdef HAVE_GETSERVBYNAME
struct servent *se;
static STATUS php_http_neon_request_setopt(php_http_request_t *h, php_http_request_setopt_opt_t opt, void *arg)
{
php_http_neon_request_t *neon = h->ctx;
+ TSRMLS_FETCH_FROM_CTX(h->ts);
switch (opt) {
case PHP_HTTP_REQUEST_OPT_SETTINGS:
ne_sock_exit();
return SUCCESS;
}
+
+#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
+ */
+