projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- use a more iterative approach in inflate code (instead of a retry-style)
[m6w6/ext-http]
/
http_url_api.c
diff --git
a/http_url_api.c
b/http_url_api.c
index 5b618a3645bca1da82f9fc4b480eca41120f1aec..bdda91161088340f01a72cf38738f41eae50d5db 100644
(file)
--- a/
http_url_api.c
+++ b/
http_url_api.c
@@
-66,16
+66,22
@@
PHP_MINIT_FUNCTION(http_url)
PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC)
{
PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC)
{
- char *abs =
estrdup(url)
;
- php_url *purl =
php_url_parse(abs)
;
+ char *abs =
NULL
;
+ php_url *purl =
NULL
;
- STR_SET(abs, NULL);
+ if (url) {
+ purl = php_url_parse(abs = estrdup(url));
+ STR_SET(abs, NULL);
+ if (!purl) {
+ http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", url);
+ return NULL;
+ }
+ }
+
+ http_build_url(0, purl, NULL, NULL, &abs, NULL);
if (purl) {
if (purl) {
- http_build_url(0, purl, NULL, NULL, &abs, NULL);
php_url_free(purl);
php_url_free(purl);
- } else {
- http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", url);
}
return abs;
}
return abs;
@@
-276,9
+282,9
@@
PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
strlcat(*url_str, url->host, HTTP_URL_MAXLEN);
if (url->port) {
strlcat(*url_str, url->host, HTTP_URL_MAXLEN);
if (url->port) {
- char port_str[
6
] = {0};
+ char port_str[
8
] = {0};
- snprintf(port_str,
5
, "%d", (int) url->port);
+ snprintf(port_str,
lenof(port_str)
, "%d", (int) url->port);
strlcat(*url_str, ":", HTTP_URL_MAXLEN);
strlcat(*url_str, port_str, HTTP_URL_MAXLEN);
}
strlcat(*url_str, ":", HTTP_URL_MAXLEN);
strlcat(*url_str, port_str, HTTP_URL_MAXLEN);
}
@@
-385,14
+391,14
@@
PHP_HTTP_API STATUS _http_urlencode_hash_recursive(HashTable *ht, phpstr *str, c
phpstr_init(&new_prefix);
if (prefix && prefix_len) {
phpstr_append(&new_prefix, prefix, prefix_len);
phpstr_init(&new_prefix);
if (prefix && prefix_len) {
phpstr_append(&new_prefix, prefix, prefix_len);
- phpstr_appends(&new_prefix, "
[
");
+ phpstr_appends(&new_prefix, "
%5B
");
}
phpstr_append(&new_prefix, encoded_key, encoded_len);
efree(encoded_key);
if (prefix && prefix_len) {
}
phpstr_append(&new_prefix, encoded_key, encoded_len);
efree(encoded_key);
if (prefix && prefix_len) {
- phpstr_appends(&new_prefix, "
]
");
+ phpstr_appends(&new_prefix, "
%5D
");
}
phpstr_fix(&new_prefix);
}
}
phpstr_fix(&new_prefix);
}