X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=6567e6b487894dcf56ac163c2a97f4efd5bcbdfe;hp=48387837c4fd068ed13f87298389230d468feba6;hb=2d5d8aa343778897c7eedb25464a2cb0a789d748;hpb=7610da74c78e8de1ba61bc22cef6c445472ea424 diff --git a/http_api.c b/http_api.c index 4838783..6567e6b 100644 --- a/http_api.c +++ b/http_api.c @@ -15,15 +15,17 @@ /* $Id$ */ -#define _WINSOCKAPI_ -#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS - #ifdef HAVE_CONFIG_H # include "config.h" #endif #include -#include + +#ifdef PHP_WIN32 +# include +#elif defined(HAVE_NETDB_H) +# include +#endif #include "php.h" #include "php_version.h" @@ -887,7 +889,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 +920,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 +933,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