X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=af42cd5e641cb68a785d72176a967899e78abd92;hp=48387837c4fd068ed13f87298389230d468feba6;hb=074b1d2872d6ce1c7e35fe365aee9cf39ecace24;hpb=80a2bc82ac2d080e407132d4ad0f5ff75133da1a diff --git a/http_api.c b/http_api.c index 4838783..af42cd5 100644 --- a/http_api.c +++ b/http_api.c @@ -23,7 +23,12 @@ #endif #include -#include + +#ifdef PHP_WIN32 +# include +#elif defined(HAVE_NETDB_H) +# include +#endif #include "php.h" #include "php_version.h" @@ -887,7 +892,7 @@ PHP_HTTP_API char *_http_absolute_uri_ex( const char *host, size_t host_len, unsigned port TSRMLS_DC) { -#ifdef ZEND_ENGINE_2 +#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) struct servent *se; #endif php_url *purl, furl = {NULL}; @@ -918,7 +923,7 @@ PHP_HTTP_API char *_http_absolute_uri_ex( furl.scheme = scheme = estrdup(proto); } else if (purl->scheme) { furl.scheme = purl->scheme; -#ifdef ZEND_ENGINE_2 +#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) } else if (port && (se = getservbyport(port, "tcp"))) { furl.scheme = (scheme = estrdup(se->s_name)); #endif @@ -931,7 +936,7 @@ PHP_HTTP_API char *_http_absolute_uri_ex( } else if (purl->port) { furl.port = purl->port; } else if (strncmp(furl.scheme, "http", 4)) { -#ifdef ZEND_ENGINE_2 +#if defined(PHP_WIN32) || defined(HAVE_NETDB_H) if (se = getservbyname(furl.scheme, "tcp")) { furl.port = se->s_port; } else