projects
/
m6w6
/
ext-ares
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
009456e
)
only c-ares does the htons() prt num conversion for us
author
Michael Wallner
<mike@php.net>
Fri, 8 Aug 2014 07:54:36 +0000
(09:54 +0200)
committer
Michael Wallner
<mike@php.net>
Fri, 8 Aug 2014 07:54:36 +0000
(09:54 +0200)
config.m4
patch
|
blob
|
history
php_ares.c
patch
|
blob
|
history
diff --git
a/config.m4
b/config.m4
index 06af4773cc2f5b5e8df7a0210d6ef4093e6cdb7c..3b1297a0aeaf05de02627d7371c4bfba53b64b32 100644
(file)
--- a/
config.m4
+++ b/
config.m4
@@
-61,6
+61,7
@@
if test "$PHP_ARES" != "no"; then
if test $PHP_ARES_LIB = "unknown"; then
AC_MSG_ERROR(could neither find libares nor libcares)
elif test $PHP_ARES_LIB = "cares"; then
if test $PHP_ARES_LIB = "unknown"; then
AC_MSG_ERROR(could neither find libares nor libcares)
elif test $PHP_ARES_LIB = "cares"; then
+ AC_DEFINE([PHP_ARES_CARES], [1], [ ])
AC_DEFINE_UNQUOTED([PHP_ARES_LIBNAME], "c-ares (CURL)", [ ])
AC_DEFINE([PHP_ARES_EXPAND_LEN_TYPE], [long], [ ])
else
AC_DEFINE_UNQUOTED([PHP_ARES_LIBNAME], "c-ares (CURL)", [ ])
AC_DEFINE([PHP_ARES_EXPAND_LEN_TYPE], [long], [ ])
else
diff --git
a/php_ares.c
b/php_ares.c
index 2ac6c35a3a979b6fa1af5d831ba84af2f2dc2aa0..9d5c8096b2d2baadc4d17c7c7df6dd0dd772b37c 100644
(file)
--- a/
php_ares.c
+++ b/
php_ares.c
@@
-553,11
+553,19
@@
local php_ares_options *php_ares_options_ctor(php_ares_options *options, HashTab
}
if ((SUCCESS == zend_hash_find(ht, "udp_port", sizeof("udp_port"), (void *) &opt)) && is_numeric(opt, &lval)) {
options->flags |= ARES_OPT_UDP_PORT;
}
if ((SUCCESS == zend_hash_find(ht, "udp_port", sizeof("udp_port"), (void *) &opt)) && is_numeric(opt, &lval)) {
options->flags |= ARES_OPT_UDP_PORT;
+#ifdef PHP_ARES_CARES
options->strct.udp_port = (unsigned short) lval;
options->strct.udp_port = (unsigned short) lval;
+#else
+ options->strct.udp_port = htons((unsigned short) lval);
+#endif
}
if ((SUCCESS == zend_hash_find(ht, "tcp_port", sizeof("tcp_port"), (void *) &opt)) && is_numeric(opt, &lval)) {
options->flags |= ARES_OPT_TCP_PORT;
}
if ((SUCCESS == zend_hash_find(ht, "tcp_port", sizeof("tcp_port"), (void *) &opt)) && is_numeric(opt, &lval)) {
options->flags |= ARES_OPT_TCP_PORT;
+#ifdef PHP_ARES_CARES
options->strct.tcp_port = (unsigned short) lval;
options->strct.tcp_port = (unsigned short) lval;
+#else
+ options->strct.tcp_port = htons((unsigned short) lval);
+#endif
}
if ((SUCCESS == zend_hash_find(ht, "servers", sizeof("servers"), (void *) &opt)) && (Z_TYPE_PP(opt) == IS_ARRAY) && (i = zend_hash_num_elements(Z_ARRVAL_PP(opt)))) {
options->strct.servers = ecalloc(i, sizeof(struct in_addr));
}
if ((SUCCESS == zend_hash_find(ht, "servers", sizeof("servers"), (void *) &opt)) && (Z_TYPE_PP(opt) == IS_ARRAY) && (i = zend_hash_num_elements(Z_ARRVAL_PP(opt)))) {
options->strct.servers = ecalloc(i, sizeof(struct in_addr));