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:
80a2bc8
)
* probably fixing getservby*() usage
author
Michael Wallner
<mike@php.net>
Mon, 7 Mar 2005 08:31:15 +0000
(08:31 +0000)
committer
Michael Wallner
<mike@php.net>
Mon, 7 Mar 2005 08:31:15 +0000
(08:31 +0000)
config.m4
patch
|
blob
|
history
http_api.c
patch
|
blob
|
history
diff --git
a/config.m4
b/config.m4
index 6c1e49e0e95d7e1a0614aa6b72b6cc24e770f6ed..f57308b27a460e333f4d7f30e02bd68b63b61c48 100644
(file)
--- a/
config.m4
+++ b/
config.m4
@@
-8,6
+8,18
@@
PHP_ARG_WITH([curl], [for CURL support],
if test "$PHP_HTTP" != "no"; then
if test "$PHP_HTTP" != "no"; then
+dnl -------
+dnl NETDB.H
+dnl -------
+
+ AC_MSG_CHECKING(for netdb.h)
+ if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
+ AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
+ AC_MSG_RESULT(found in default path)
+ else
+ AC_MSG_RESULT(not found in default path)
+ fi
+
dnl ----
dnl CURL
dnl ----
dnl ----
dnl CURL
dnl ----
diff --git
a/http_api.c
b/http_api.c
index 48387837c4fd068ed13f87298389230d468feba6..af42cd5e641cb68a785d72176a967899e78abd92 100644
(file)
--- a/
http_api.c
+++ b/
http_api.c
@@
-23,7
+23,12
@@
#endif
#include <ctype.h>
#endif
#include <ctype.h>
-#include <netdb.h>
+
+#ifdef PHP_WIN32
+# include <winsock2.h>
+#elif defined(HAVE_NETDB_H)
+# include <netdb.h>
+#endif
#include "php.h"
#include "php_version.h"
#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)
{
const char *host, size_t host_len,
unsigned port TSRMLS_DC)
{
-#if
def ZEND_ENGINE_2
+#if
defined(PHP_WIN32) || defined(HAVE_NETDB_H)
struct servent *se;
#endif
php_url *purl, furl = {NULL};
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;
furl.scheme = scheme = estrdup(proto);
} else if (purl->scheme) {
furl.scheme = purl->scheme;
-#if
def 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
} 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)) {
} else if (purl->port) {
furl.port = purl->port;
} else if (strncmp(furl.scheme, "http", 4)) {
-#if
def ZEND_ENGINE_2
+#if
defined(PHP_WIN32) || defined(HAVE_NETDB_H)
if (se = getservbyname(furl.scheme, "tcp")) {
furl.port = se->s_port;
} else
if (se = getservbyname(furl.scheme, "tcp")) {
furl.port = se->s_port;
} else