projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
e9221ae
)
* excluding getservby*() in PHP4 (??)
author
Michael Wallner
<mike@php.net>
Sun, 6 Mar 2005 11:30:35 +0000
(11:30 +0000)
committer
Michael Wallner
<mike@php.net>
Sun, 6 Mar 2005 11:30:35 +0000
(11:30 +0000)
http_api.c
patch
|
blob
|
history
diff --git
a/http_api.c
b/http_api.c
index 0e4e604f8ea3226913dd3e03cb3325ba3f18abcf..aee6785705e884759fde2c9ed3a975f8b706e4d1 100644
(file)
--- a/
http_api.c
+++ b/
http_api.c
@@
-886,8
+886,10
@@
PHP_HTTP_API char *_http_absolute_uri_ex(
const char *host, size_t host_len,
unsigned port TSRMLS_DC)
{
const char *host, size_t host_len,
unsigned port TSRMLS_DC)
{
- php_url *purl, furl = {NULL};
+#ifdef ZEND_ENGINE_2
struct servent *se;
struct servent *se;
+#endif
+ php_url *purl, furl = {NULL};
size_t full_len = 0;
zval *zhost = NULL;
char *scheme = NULL, *URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
size_t full_len = 0;
zval *zhost = NULL;
char *scheme = NULL, *URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
@@
-915,8
+917,10
@@
PHP_HTTP_API char *_http_absolute_uri_ex(
furl.scheme = scheme = estrdup(proto);
} else if (purl->scheme) {
furl.scheme = purl->scheme;
furl.scheme = scheme = estrdup(proto);
} else if (purl->scheme) {
furl.scheme = purl->scheme;
+#ifdef ZEND_ENGINE_2
} else if (port && (se = getservbyport(htons(port), "tcp"))) {
furl.scheme = (scheme = estrdup(se->s_name));
} else if (port && (se = getservbyport(htons(port), "tcp"))) {
furl.scheme = (scheme = estrdup(se->s_name));
+#endif
} else {
furl.scheme = "http";
}
} else {
furl.scheme = "http";
}
@@
-925,10
+929,15
@@
PHP_HTTP_API char *_http_absolute_uri_ex(
furl.port = port;
} else if (purl->port) {
furl.port = purl->port;
furl.port = port;
} else if (purl->port) {
furl.port = purl->port;
- } else if (strncmp(furl.scheme, "http", 4) && (se = getservbyname(furl.scheme, "tcp"))) {
- furl.port = ntohs(se->s_port);
+ } else if (strncmp(furl.scheme, "http", 4)) {
+#ifdef ZEND_ENGINE_2
+ if (se = getservbyname(furl.scheme, "tcp")) {
+ furl.port = ntohs(se->s_port);
+ } else
+#endif
+ furl.port = 80;
} else {
} else {
- furl.port =
furl.scheme[5]
? 443 : 80;
+ furl.port =
(furl.scheme[5] == 's')
? 443 : 80;
}
if (host) {
}
if (host) {
@@
-1469,7
+1478,7
@@
PHP_HTTP_API STATUS _http_split_response_ex(char *response,
/* }}} */
/* {{{ STATUS http_parse_headers(char *, long, zval *) */
/* }}} */
/* {{{ STATUS http_parse_headers(char *, long, zval *) */
-PHP_HTTP_API STATUS _http_parse_headers_ex(char *header, int header_len,
+PHP_HTTP_API STATUS _http_parse_headers_ex(char *header, int header_len,
HashTable *headers, zend_bool prettify TSRMLS_DC)
{
char *colon = NULL, *line = NULL, *begin = header;
HashTable *headers, zend_bool prettify TSRMLS_DC)
{
char *colon = NULL, *line = NULL, *begin = header;
@@
-1549,17
+1558,17
@@
PHP_HTTP_API void _http_get_request_headers_ex(HashTable *headers, zend_bool pre
char *key = NULL;
long idx = 0;
zval array;
char *key = NULL;
long idx = 0;
zval array;
-
+
Z_ARRVAL(array) = headers;
FOREACH_HASH_KEY(HTTP_SERVER_VARS, key, idx) {
if (key && !strncmp(key, "HTTP_", 5)) {
zval **header;
Z_ARRVAL(array) = headers;
FOREACH_HASH_KEY(HTTP_SERVER_VARS, key, idx) {
if (key && !strncmp(key, "HTTP_", 5)) {
zval **header;
-
+
if (prettify) {
key = pretty_key(key + 5, strlen(key) - 5, 1, 1);
}
if (prettify) {
key = pretty_key(key + 5, strlen(key) - 5, 1, 1);
}
-
+
zend_hash_get_current_data(HTTP_SERVER_VARS, (void **) &header);
add_assoc_stringl(&array, key, Z_STRVAL_PP(header), Z_STRLEN_PP(header), 1);
key = NULL;
zend_hash_get_current_data(HTTP_SERVER_VARS, (void **) &header);
add_assoc_stringl(&array, key, Z_STRVAL_PP(header), Z_STRLEN_PP(header), 1);
key = NULL;