From: Michael Wallner Date: Wed, 30 May 2012 11:07:31 +0000 (+0000) Subject: exlcude the port from hostname X-Git-Tag: RELEASE_2_1_0_RC3~10^2^2~129 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f257ab645344a43d04c089a684a3ddfd3bf3fc48;p=m6w6%2Fext-http exlcude the port from hostname --- diff --git a/php_http_url.c b/php_http_url.c index 0432f32..efa9116 100644 --- a/php_http_url.c +++ b/php_http_url.c @@ -92,7 +92,9 @@ static php_url *php_http_url_from_env(php_url *url TSRMLS_DC) if ((((zhost = php_http_env_get_server_var(ZEND_STRL("HTTP_HOST"), 1 TSRMLS_CC)) || (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_NAME"), 1 TSRMLS_CC)) || (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_ADDR"), 1 TSRMLS_CC)))) && Z_STRLEN_P(zhost)) { - url->host = estrndup(Z_STRVAL_P(zhost), Z_STRLEN_P(zhost)); + size_t stop_at = strspn(Z_STRVAL_P(zhost), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-."); + + url->host = estrndup(Z_STRVAL_P(zhost), stop_at); } else { url->host = localhostname(); }