/*
- +----------------------------------------------------------------------+
- | PECL :: http |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, that |
- | is bundled with this package in the file LICENSE, and is available |
- | through the world-wide-web at http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
- +----------------------------------------------------------------------+
+ +--------------------------------------------------------------------+
+ | 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-2005, Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-
#include "php.h"
+
+#include "SAPI.h"
#include "zend_ini.h"
#include "php_output.h"
#include "ext/standard/url.h"
-#include "SAPI.h"
-
-#include "phpstr/phpstr.h"
-
#include "php_http.h"
#include "php_http_api.h"
#include "php_http_url_api.h"
#include "php_http_std_defs.h"
+#include "phpstr/phpstr.h"
+
#ifdef PHP_WIN32
# include <winsock2.h>
#elif defined(HAVE_NETDB_H)
#if defined(PHP_WIN32) || defined(HAVE_NETDB_H)
struct servent *se;
#endif
- php_url *purl, furl = {NULL};
+ php_url *purl = NULL, furl;
size_t full_len = 0;
zval *zhost = NULL;
- char *scheme = NULL, *uri, *URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
+ char *scheme = NULL, *uri, *URL;
if ((!url || !url_len) && (
(!(url = SG(request_info).request_uri)) ||
(!(url_len = strlen(SG(request_info).request_uri))))) {
- http_error(E_WARNING, HTTP_E_PARAM, "Cannot build an absolute URI if supplied URL and REQUEST_URI is empty");
+ http_error(HE_WARNING, HTTP_E_RUNTIME, "Cannot build an absolute URI if supplied URL and REQUEST_URI is empty");
return NULL;
}
+ URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
uri = estrndup(url, url_len);
if (!(purl = php_url_parse(uri))) {
- http_error_ex(E_WARNING, HTTP_E_PARSE, "Could not parse supplied URL: %s", url);
+ http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse supplied URL: %s", url);
return NULL;
}
#define HTTP_URI_STRLCATL(URL, full_len, add_string) HTTP_URI_STRLCAT(URL, full_len, add_string, strlen(add_string))
#define HTTP_URI_STRLCAT(URL, full_len, add_string, add_len) \
if ((full_len += add_len) > HTTP_URI_MAXLEN) { \
- http_error_ex(E_NOTICE, HTTP_E_URL, \
+ http_error_ex(HE_NOTICE, HTTP_E_URL, \
"Absolute URI would have exceeded max URI length (%d bytes) - " \
"tried to add %d bytes ('%s')", \
HTTP_URI_MAXLEN, add_len, add_string); \
}
if (SUCCESS != http_urlencode_hash_implementation(hash, qstr, arg_sep)) {
- phpstr_free(qstr);
+ phpstr_free(&qstr);
return FAILURE;
}
phpstr_data(qstr, encoded_data, encoded_len);
- phpstr_free(qstr);
+ phpstr_free(&qstr);
return SUCCESS;
}
zval *type TSRMLS_DC)
{
char *key = NULL, *ekey, *newprefix, *p;
- int arg_sep_len, key_len, ekey_len, key_type, newprefix_len;
+ int arg_sep_len, ekey_len, key_type, newprefix_len;
+ uint key_len;
ulong idx;
zval **zdata = NULL, *copyzval;
if (!ht || !formstr) {
- http_error(E_WARNING, HTTP_E_PARAM, "Invalid parameters");
+ http_error(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid parameters");
return FAILURE;
}
#endif
if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) {
- http_error(E_WARNING, HTTP_E_ENCODE, "Error traversing form data array.");
+ http_error(HE_WARNING, HTTP_E_ENCODING, "Error traversing form data array.");
return FAILURE;
}
if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) {