projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- don't copy static strings
[m6w6/ext-http]
/
http_url_api.c
diff --git
a/http_url_api.c
b/http_url_api.c
index 459b618b532f551ffbdb73790999b816d5644975..288abe445b1f88067777a33fa3dc90101923f2c1 100644
(file)
--- a/
http_url_api.c
+++ b/
http_url_api.c
@@
-19,12
+19,6
@@
# include "config.h"
#endif
# include "config.h"
#endif
-#ifdef PHP_WIN32
-# include <winsock2.h>
-#elif defined(HAVE_NETDB_H)
-# include <netdb.h>
-#endif
-
#include "php.h"
#include "zend_ini.h"
#include "php_output.h"
#include "php.h"
#include "zend_ini.h"
#include "php_output.h"
@@
-39,6
+33,12
@@
#include "php_http_url_api.h"
#include "php_http_std_defs.h"
#include "php_http_url_api.h"
#include "php_http_std_defs.h"
+#ifdef PHP_WIN32
+# include <winsock2.h>
+#elif defined(HAVE_NETDB_H)
+# include <netdb.h>
+#endif
+
ZEND_EXTERN_MODULE_GLOBALS(http);
/* {{{ char *http_absolute_url(char *) */
ZEND_EXTERN_MODULE_GLOBALS(http);
/* {{{ char *http_absolute_url(char *) */
@@
-54,7
+54,7
@@
PHP_HTTP_API char *_http_absolute_url_ex(
php_url *purl, furl = {NULL};
size_t full_len = 0;
zval *zhost = NULL;
php_url *purl, furl = {NULL};
size_t full_len = 0;
zval *zhost = NULL;
- char *scheme = NULL, *URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
+ char *scheme = NULL, *
uri, *
URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
if ((!url || !url_len) && (
(!(url = SG(request_info).request_uri)) ||
if ((!url || !url_len) && (
(!(url = SG(request_info).request_uri)) ||
@@
-63,7
+63,8
@@
PHP_HTTP_API char *_http_absolute_url_ex(
return NULL;
}
return NULL;
}
- if (!(purl = php_url_parse((char *) url))) {
+ 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);
return NULL;
}
http_error_ex(E_WARNING, HTTP_E_PARSE, "Could not parse supplied URL: %s", url);
return NULL;
}
@@
-123,6
+124,7
@@
PHP_HTTP_API char *_http_absolute_url_ex(
efree(scheme); \
} \
php_url_free(purl); \
efree(scheme); \
} \
php_url_free(purl); \
+ efree(uri); \
return URL; \
} else { \
strcat(URL, add_string); \
return URL; \
} else { \
strcat(URL, add_string); \
@@
-172,6
+174,7
@@
PHP_HTTP_API char *_http_absolute_url_ex(
efree(scheme);
}
php_url_free(purl);
efree(scheme);
}
php_url_free(purl);
+ efree(uri);
return URL;
}
return URL;
}