diff -Nru libmicrohttpd-0.9.44+dfsg/aclocal.m4 libmicrohttpd-0.9.55/aclocal.m4 --- libmicrohttpd-0.9.44+dfsg/aclocal.m4 2015-10-01 21:22:15.000000000 +0200 +++ libmicrohttpd-0.9.55/aclocal.m4 2017-05-28 22:34:00.000000000 +0200 @@ -20,221 +20,6 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])# PKG_CHECK_MODULES - - -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR - - -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR - - -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR - # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -1369,7 +1154,6 @@ m4_include([m4/ax_append_flag.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_link_flag.m4]) -m4_include([m4/ax_check_openssl.m4]) m4_include([m4/ax_count_cpus.m4]) m4_include([m4/ax_have_epoll.m4]) m4_include([m4/ax_pthread.m4]) @@ -1381,4 +1165,9 @@ m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) +m4_include([m4/mhd_shutdown_socket_trigger.m4]) +m4_include([m4/mhd_sys_extentions.m4]) +m4_include([m4/pkg.m4]) +m4_include([m4/search_h.m4]) +m4_include([m4/tsearch.m4]) m4_include([acinclude.m4]) diff -Nru libmicrohttpd-0.9.44+dfsg/AUTHORS libmicrohttpd-0.9.55/AUTHORS --- libmicrohttpd-0.9.44+dfsg/AUTHORS 2015-09-05 10:54:28.000000000 +0200 +++ libmicrohttpd-0.9.55/AUTHORS 2017-05-28 22:34:00.000000000 +0200 @@ -1,12 +1,12 @@ Primary developers: Christian Grothoff (maintainer) -Andrey Uzunov (maintainer for libmicrospdy) +Evgeny Grin (Karlson2k) (maintainer) +Andrey Uzunov (libmicrospdy experiment) Nils Durner (W32 port) Sagie Amir (TLS/SSL support using GNUtls) Richard Alimi (performance) Amr Ali (digest authentication) Matthieu Speder (basic authentication, client certificates) -Evgeny Grin (Karlson2k) (W32 port) Code contributions also came from: Chris GauthierDickey @@ -23,6 +23,7 @@ Colin Caughie David Carvalho David Reiss +Markus Doppelbauer Matt Holiday Michael Cronenworth Milan Straka @@ -55,7 +56,14 @@ Denis Dowling Louis Benoit Flavio Coelin +Silvio Clecio Documentation contributions also came from: Marco Maggi Sebastian Gerhardt + +Special thanks to: +Florian Weimer +Ramakrishnan Muthukrishnan +Gervasa Markham +Liz Steininger diff -Nru libmicrohttpd-0.9.44+dfsg/ChangeLog libmicrohttpd-0.9.55/ChangeLog --- libmicrohttpd-0.9.44+dfsg/ChangeLog 2015-10-01 21:22:26.000000000 +0200 +++ libmicrohttpd-0.9.55/ChangeLog 2017-05-28 22:34:00.000000000 +0200 @@ -1,8 +1,733 @@ +Sun May 28 23:26:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.55. -EG + +Sun May 21 18:48:00 MSK 2017 + Fixed build with disabled "UPGRADE". + Fixed possible null-dereference in HTTPS test. + Fixed compiler warning in process_request_body(), minor optimizations. + Do not allow suspend of "upgraded" connections. + Fixed returned value for MHD_CONNECTION_INFO_CONNECTION_SUSPENDED. + Fixed removal from timeout lists of non-existing connections in + cleanup_connection(). + Fixed double locking of mutex. -EG + +Sun May 14 15:05:00 MSK 2017 + Fixed resuming connections and closing upgraded connections in select() + mode with thread-per-connection. -EG + +Sun May 14 14:49:00 MSK 2017 + Removed extra call to resume connections in MHD_run(). + Handle resumed connection without delay in epoll mode. + Update states of resumed connection after resume in thread-per-connection + mode. + Fixed resuming connections and closing upgraded connections in poll() + mode with thread-per-connection. -EG + +Thu May 11 22:37:00 MSK 2017 + Faster start really processing data in resumed connections. -EG + +Thu May 11 14:24:00 MSK 2017 + Do not add any "Connection" headers for "upgrade" connections. -EG + +Wed May 10 23:09:00 MSK 2017 + Resume resuming connection before other processing in external polling + mode. -EG + +Tue May 9 23:16:00 MSK 2017 + Fixed: Do not add "Connection: Keep-Alive" header for "upgrade" + connections. -EG + +Tue May 9 21:01:00 MSK 2017 + Fixed: check all "Connection" headers of request for "Close" and "Upgrade" + tokens instead of using only first "Connection" header with full string + match. -EG + +Tue May 9 12:28:00 MSK 2017 + Revert: continue match footers in MHD_get_response_header() for backward + compatibility. -EG + +Mon May 8 19:30:00 MSK 2017 + Fixed: use case-insensitive matching for header name in + MHD_get_response_header(), match only headers (not footers). -EG + +Fri May 5 20:57:00 MSK 2017 + Fixed null dereference when connection has "Upgrade" request and + connection is not upgraded. -JB/EG + Better handle Keep-Alive/Close. -EG + +Tue May 2 18:37:53 CEST 2017 + Update manual. -CG + Add MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE. + Releasing GNU libmicrohttpd 0.9.54. -CG + +Thu Apr 27 22:31:00 CEST 2017 + Replaced flags MHD_USE_PEDANTIC_CHECKS and MHD_USE_PERMISSIVE_CHECKS by + single option MHD_OPTION_STRICT_FOR_CLIENT. Flag MHD_USE_PEDANTIC_CHECKS + is still supported. -EG + +Tue Apr 26 15:11:00 CEST 2017 + Fixed shift in HTTP reasons strings. + Added test for HTTP reasons strings. -EG + +Tue Apr 25 19:11:00 CEST 2017 + Allow flag MHD_USE_POLL with MHD_USE_THREAD_PER_CONNECTION and without + flag MHD_USE_INTERNAL_POLLING_THREAD for backward compatibility. -EG + +Mon Apr 24 17:29:45 CEST 2017 + Enforce RFC 7230's rule on no whitespace by default, + introduce new MHD_USE_PERMISSIVE_CHECKS to disable. -CG + +Sun Apr 23 20:05:44 CEST 2017 + Enforce RFC 7230's rule on no whitespace in HTTP header + field names if MHD_USE_PEDANTIC_CHECKS is set. -CG + +Sun Apr 23 19:20:33 CEST 2017 + Replace remaining occurences of sprintf() with + MHD_snprintf_(). Thanks to Ram for pointing this out. -CG + +Sat Apr 22 20:39:00 MSK 2017 + Fixed builds in Linux without epoll. + Check for invalid --with-thread= configure parameters. + Fixed support for old libgcrypt on W32 with W32 threads. -EG + +Tue Apr 11 22:17:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.53. -EG + +Mon Apr 10 19:50:20 MSK 2017 + HTTPS tests: skip tests instead of failing if HTTPS is not supported by + libcurl. + HTTPS tests: fixed return values so testsuite is able to correctly + interpret it. + Fixed ignored result of epoll test in test_https_get_select. -EG + +Thu Apr 06 23:02:07 MSK 2017 + Make zzuf tests compatible with *BSD platforms. -EG + +Thu Apr 06 22:14:22 MSK 2017 + Added warning for hypothetical extra large timeout. + Fixed incorrect timeout calculation under extra rare conditions. + Fixed accidental usage of IPv6 in testsuite in specific conditions. -EG + +Wed Apr 05 14:14:22 MSK 2017 + Updated autoinit_funcs.h to latest upstream version with proper support of + Oracle/Sun compiler. -EG + +Wed Apr 05 12:53:26 MSK 2017 + Fixed some compiler warnings. + Fixed error snprintf() errors detection in digestauth.c. + Converted many run-time 'strlen()' to compile-time calculations. -EG + +Sun Mar 26 13:49:01 MSK 2017 + Internal refactoring for simplification and unification. + Minor optimizations and minor fixes. + MHD_USE_ITC used again in thread pool mode. -EG + +Sat Mar 25 20:58:24 CET 2017 + Remove dead MHD_strx_to_sizet-functions and associated + test cases from code. -CG + +Sat Mar 25 20:40:10 CET 2017 + Allow chunk size > 16 MB (up to 2^64-1). Ignore + chunk extensions instead of triggering an error. + (fixes #4967). -CG + +Tue Mar 25 20:59:18 MSK 2017 + Check for invalid combinations of flags and options in + MHD_start_daemon(). -EG + +Tue Mar 21 13:51:04 CET 2017 + Use "-lrt" to link libmicrohttpd if we are using + clock_gettime() as needed by glibc < 2.17. -CG + +Tue Mar 21 13:42:07 CET 2017 + Allow chaining of suspend-resume calls withuot + the application processing data from the network. -CG + +Mon Mar 20 0:51:24 MSK 2017 + Added autoconf module for detection whatever shutdown of listening socket + trigger select. This is only reliable method to use such feature as some + platforms change behaviour from version to version. -EG + +Sun Mar 19 13:57:30 MSK 2017 + Rewritten logic of handling "upgraded" TLS connections in epoll mode: + used edge trigger instead of level trigger, + upgraded "ready" connection are stored in DL-list, + fixed handling of more than 128 ready connections, + fixed busy-waiting for idle "upgraded" TLS connections. -EG + +Fri Mar 17 10:45:31 MSK 2017 + If read buffer is full, MHD need to receive remote data and application + suspended connection, do not fail while connection is suspended and give + application one more chance to read data from buffer once connection is + resumed. -EG + +Thu Mar 16 23:45:29 MSK 2017 + Allow again to run MHD in external epoll mode by + MHD_run_from_select() - this allow unification of user code + and produce no harm for performance. Especially useful with + MHD_USE_AUTO flag. -EG + +Thu Mar 16 23:12:07 MSK 2017 + Idle connection should be disconnected *after* "timeout" number of + second, not *before* this number. -EG/VT + +Thu Mar 16 22:31:54 MSK 2017 + Unified update of last activity on connections. + Update last activity only if something is really transmitted. + Update last activity each time when something is transmitted. + Removed early duplicated check for timeout on HTTPS connections. + Removed update of last active time for connections without timeout. + Fixed reset of timeout timer on resumed connections. + Fixed never-expired timeouts on HTTPS connections. + Fixed thread-safety of MHD_set_connection_option(). -EG + +Thu Mar 16 21:05:08 MSK 2017 + Fixed minor bug resulted in slight slowdown of HTTPS connection + handshake. -EG + +Thu Mar 16 20:35:59 MSK 2017 + Improved thread-safety for DL-lists. -EG + +Thu Mar 16 17:55:01 MSK 2017 + Fixed thread-safety of MHD_get_daemon_info() for + MHD_DAEMON_INFO_CURRENT_CONNECTIONS. -EG + +Thu Mar 16 16:49:07 MSK 2017 + Added ability to get actual daemon flags via MHD_get_daemon_info(). + Fixed test_upgrade to work in request mode. + Fixed compiler warnings in test_upgrade. -EG + +Wed Mar 15 23:29:59 MSK 2017 + Prevented socket read/write if connection is suspended. + Added missing resets of 'connection->in_idle'. + Reworked handling of suspended connection: ensure that + connection is not disconnected by timeout, always + updated read/write states right after suspending. -EG + +Wed Mar 15 21:02:26 MSK 2017 + Added new enum value MHD_CONNECTION_INFO_CONNECTION_TIMEOUT + to get connection timeout by MHD_get_connection_info(). -EG + +Sat Mar 11 12:03:45 CET 2017 + Fix largepost example from tutorial to properly generate + error pages. -CG + Fix largepost example, must only queue replies either before upload + happens or after upload is done, not while upload is ongoing + +Fri Mar 10 16:37:12 CET 2017 + Fix hypothetical integer overflow for very, very large + timeout values. -CG + +Fri Mar 10 16:22:54 CET 2017 + Handle case that we do not listen at all more gracefully + in MHD_start_daemon() and not pass '-1' to helper functions + that expect a valid socket. -CG + +Tue Mar 7 12:11:44 BRT 2017 + Updates file `.gitignore`. + +Tue Mar 7 10:37:45 BRT 2017 + Updated the MHD_OPTION_URI_LOG_CALLBACK's documentation. + +Mon Mar 6 21:46:59 BRT 2017 + Added the i18n example fixing #4924. -SC + +Wed Mar 1 23:47:05 CET 2017 + Minor internal optimisations. + Changed closure connection monitoring logic: now all connections are + monitored for OOB data (which treated as error), connections are not + monitored any more for incoming data if incoming data is not required for + processing. except_fd_set is not optional now for MHD_get_fdset(), + MHD_get_fdset2() and MHD_run_from_select(). + Improved connection processing in epoll mode: now connection can process + both read and write each turn. + Updated HTTP response codes; updated and added all missing standard HTTP + headers names (and headers categories); updated and added all missing + standard and additional HTTP methods. Now MHD return status + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431) instead of old + MHD_HTTP_REQUEST_ENTITY_TOO_LARGE (413) for very long header. + Reworked handling of data pending in TLS buffers, resolved busy-waiting + if incoming data is pending in TLS buffers and connection is in + LOOP_INFO_WRITE mode. + Do not clear 'ready' flag in epoll mode if send()/recv() result is + EINTERRUPTED. + Better detection of unready connection state: used less number of calls of + recv()/send() in epoll mode. + Configure: do not run gcrypt and GnuTLS tests if HTTPS is disabled by + configure parameter. + Fixed wrong value returned by MHD_get_timeout(). + All double-linked lists now walked from tail to head. As new items are + added to head, this result in more uniform processing time. + Improved sockets errors handling in epoll mode. + OOB data on 'upgraded' sockets is treated as error. -EG + +Thu Feb 16 11:20:05 CET 2017 + Replace tsearch configure check with code from gnulib. -CG + +Wed Feb 15 13:35:36 CET 2017 + Fixing a few very rare race conditions for thread-pool or + thread-per-connection operations during shutdown. + Various minor cosmetic improvements. + Fixed #4884 and #4888 (solaris portability issues). -CG + +Wed Feb 08 22:33:10 MSK 2016 + Ported test_quiesce_stream to W32. + Improved precompiler flags selection of OpenBSD. + Fixed sending responses backed by files not supported by sendfile(). + Fixed thread safety for responses backed by file FD. + Updated fileserver_example. + Improved handling of 'upgraded' TLS forwarding in select() and poll() + modes. + Fixed processing of incoming TLS data in epoll mode if more than 128 + connections are active. + Fixed accepting more than 128 incoming connection in epoll mode. + Improved test_large_put, added poll() and epoll testing. + Added test_large_put_inc for testing of incremental buffer processing. + Rewritten epoll connection processing logic: handle all connection one + time per turn instead of trying to handle all active connection until all + pending data is dried. Result is more uniform connection processing + period. -EG + +Wed Nov 23 15:24:10 MSK 2016 + Used SO_REUSEADDR (on non-W32) alongside with SO_REUSEPORT if option + MHD_OPTION_LISTENING_ADDRESS_REUSE was set. -EG + +Wed Nov 23 12:48:23 MSK 2016 + Move all gettext-related staff to 'po' subdirectory. + Excluded gettext files generation from normal build. + Removed generated files from GIT. -EG + +Tue Nov 15 19:08:43 MSK 2016 + Fixed forwarding "upgraded" TLS connections for + chunks sizes larger than buffer size. -EG + +Mon Nov 14 22:18:30 MSK 2016 + Fixed unintentional usage of SO_REUSEADDR on W32. + Added support for SO_EXCLBIND on Solaris. + Fixed using MHD with MHD_OPTION_LISTENING_ADDRESS_REUSE + on Linux kernels before 3.9 (longterm 3.2 and 3.4 + are still supported). -EG + +Sun Nov 13 19:16:38 CET 2016 + Fixed a few race issues on suspend-resume in cases where the + application uses threads even though MHD did not (or at least + had no internal need for locking). Also fixed DLL handling of + the timeout list, avoiding manipulating it for suspended + connections. Finally, eliminated calling application logic + on suspended connections (which before could happen under + certain circumstances). -CG + +Thu Nov 11 20:49:23 MSK 2016 + Added support for various forms of + pthread_attr_setname_np() so thread names will be set + more efficiently on certain platforms (Solaris, NetBSD etc.) -EG + +Thu Nov 10 21:50:35 MSK 2016 + Added rejection in MHD_start_daemon() of invalid combinations + of daemon flags. + Added MHD_USE_AUTO and MHD_USE_AUTO_INTERNAL_THREAD for + automatic selection of polling function depending on + platform capabilities and requested mode. -EG + +Thu Nov 10 17:49:56 MSK 2016 + Ported "upgrade" tests to W32 and other platforms, used + "gnutls-cli" instead of "openssl" in tests, minor bugs + fixed, added verbose reporting if requested. + "Upgrade" processing - changed internal handling logic, improved + and refactored, bugs fixed, fixed sigpipe on Darwin, added + printing error to log, fixed compilation without HTTPS. + Added 'configure' parameter "--disable-httpupgrade" for building + minimal-sized MHD versions. + Added feature check "MHD_FEATURE_UPGRADE". + Responses destroyed (freed) earlier if possible. + Added many remarks in code comments about thread safety. + Some data races and other multithread-related issues are fixed, + including usage of closed sockets (may resulted in accidental closing + of wrong socket). + SO_NOSIGPIPE is used on all platform which support it, not only + on Darwin. + Added support for suspending connections in thread-per-connection + mode (itself almost useless, mostly to unify modes support). + Fixed Inter-Thread Communication channel usage in epoll modes. + Reworked daemon cleanups and handling MHD_stop_daemon(): resources + are freed only by specific threads, data races and other fixes. + Started usage of C99 standard 'bool' where supported with + fallback to 'int'. + Renamed many MHD flags. Now they are self-explainable and more + obvious, like MHD_USE_INTERNAL_POLLING_THREAD instead of + MHD_USE_SELECT_INTERNALLY. Old flag names are supported for + backward compatibility. + Improved processing of "fast" connections: now full sequence + "read request - send reply headers - send reply body" is processed + after single select()/poll(). If connection is slow, request is huge + or response in not immediately ready - connection will be processed + in "traditional" way. + Added usage of "calloc()" where supported. + Minor documentation fixes. + Minor improvements and fixes. -EG + "Upgrade" test fixes. + Documentation updated. + Added HTTP "Upgrade" example. -CG + +Mon Oct 17 19:08:18 CEST 2016 + Fixed misc. issues relating to upgrade. + Releasing experimental 0.9.52. -CG + +Wed Oct 12 14:26:20 CEST 2016 + Migrated repository from Subversion to Git. -CG + +Tue Oct 11 18:09:56 CEST 2016 + Deprecated MHD_USE_SSL, use MHD_USE_TLS instead. -CG + +Tue Oct 11 18:14:40 MSK 2016 + Code internal refactoring: 'pipes' renamed to 'inter-thread + communication (channels)/ITCs', as code can use different types + of communications. + Optimizations: ITCs now always created in non-blocking mode. + Added configure parameter to choose ITC type. + Updated documentation and comments. + Minor errors fixed (related to heavy load). -EG + +Thu Sep 22 17:51:04 CEST 2016 + Implementing support for eventfd() instead of pipe() for + signaling (on platforms that support it); fixing #3557. -CG + +Thu Sep 22 11:03:43 CEST 2016 + Simplify internal error handling logic by folding it into the + MHD_socket_close_, MHD_mutex_lock_, MHD_mutex_unlock_ and + MHD_mutex_destroy_ functions. -CG + +Tue Sep 13 22:20:26 MSK 2016 + Added autoconf macro to enable maximum platform + features. Fixed compiling on Solaris. -EG + +Wed Sep 7 12:57:57 CEST 2016 + Fixing #4641. -Hawk + +Wed Sep 7 00:28:59 CEST 2016 + Adding remaining "_"-markups for i18n (#4614). -CG + +Tue Sep 6 23:39:56 CEST 2016 + Allow out-of-order nonces for digest authentication (#4636). -CG + +Tue Sep 6 21:29:09 CEST 2016 + Martin was right, "socket_context" should be "void *" + in `union MHD_ConnectionInfo`. -MS + +Sun Sep 4 18:16:32 CEST 2016 + Fixing potential memory leak (#4634). -CG + +Sun Sep 4 17:25:45 CEST 2016 + Tests for "Upgrade" logic are now in place and passing. + However, still need to make sure code is portable. -CG + +Sat Sep 3 11:56:20 CEST 2016 + Adding logic for handling HTTP "Upgrade" in thread-per-connection + mode. Also still untested. -CG + +Sat Aug 27 21:01:43 CEST 2016 + Adding a few extra safety checks around HTTP "Upgrade" + (against wrong uses of API), and a testcase. -CG + +Sat Aug 27 20:07:53 CEST 2016 + Adding completely *untested* logic for HTTP "Upgrade" + handling. -CG + +Sat Aug 27 18:20:38 CEST 2016 + Releasing libmicrohttpd 0.9.51. -CG + +Tue Aug 23 22:54:07 MSK 2016 + Internal refactoring: W32 compatibility layer was finally + replaced with several specialized abstraction layers for + sockets, control pipes (inter-thread communication) and + generic functions. Now all major platform functions + (including threads and mutex) are implemented in thin + abstraction layers. + Improved performance on W32 due to eliminating + translation of error to POSIX codes and using W32 codes + directly (through macros). + Improved error reporting on all platforms. + Improved error handling and reporting on Darwin. + Minor fixes. -EG + +Tue Aug 16 15:14:30 MSK 2016 + Minor improvement for monotonic clock. + Minor configure fix for non-bash shells. -EG + +Mon Aug 15 13:06:52 CEST 2016 + Fixed possible crash due to write to read-only region of + memory given ill-formed HTTP request (write was otherwise + harmless, writing 0 to where there was already a 0). + Fixed issue with closed connection slots not immediately + being available again for new connections if we reached + our connection limit. + Avoid even accept()ing connections in certain thread modes + if we are at the connection limit and + MHD_USE_PIPE_FOR_SHUTDOWN is available. -CG + +Wed Aug 10 16:42:57 MSK 2016 + Moved threads, locks and mutex abstraction to separate files, + some minor errors fixed, added support for thread name functions + on various platforms, added configure flag for disable thread + naming. -EG + +Sat Jul 23 20:45:51 CEST 2016 + Added macro detection of speed/size compiler optimization. + Added different implementation of functions in mhd_str.c for + size optimization. Enabled automatically if compiler size + optimization is detected or MHD_FAVOR_SMALL_CODE is defined. + Added unit tests for all mhd_str.c functions. -EG + +Sat Jul 16 21:54:49 CEST 2016 + Warn user if they sent connection into blocking + state by not processing all POST data, not suspending, + and not running in external select mode. -CG + +Fri Jul 8 21:35:07 CEST 2016 + Fix FIXME in tutorial. -CG + +Fri Jul 8 15:57:06 CEST 2016 + Adding support for 308 status code. -CG + +Sat Jun 25 13:49:31 CEST 2016 + Use shutdown to trigger select on NetBSD. -EG + +Thu Jun 2 09:55:50 CEST 2016 + Releasing libmicrohttpd 0.9.50. -CG + +Wed Jun 1 21:59:34 CEST 2016 + Do not send "Content-Length" header for 1xx/204/304 status codes. -CG + +Tue May 17 13:32:21 CEST 2016 + Allow clients to determine whether a connection is suspended; + introduces MHD_CONNECTION_INFO_CONNECTION_SUSPENDED. -CG/FC + +Sun May 15 12:17:25 CEST 2016 + Fix handling system or process resource limit exhaustion upon + accept(). -CG/CP + +Thu May 12 08:42:19 CEST 2016 + Fix handling of partial writes in MHD_USE_EPOLL_LINUX_ONLY; only + consider sockets returning EAGAIN as unready. -CG/CP + +Mon May 2 06:08:26 CEST 2016 + Adding logic to help address FE performance issue as + discussed on the mailinglist with subject + "single-threaded daemon, multiple pending requests, responses batched". + The new logic is only enabled when MHD_USE_EPOLL_TURBO is set. + Note that some additional refactoring was also done to clean up + the code and avoid code duplication, which may have actually fixed + an unrelated issue with HTTPS and a POLL-style event loop. -CG + +Sat Apr 30 10:22:37 CEST 2016 + Added clarifications to manual based on questions on list. -CG + +Sat Apr 23 20:12:01 CET 2016 + Tests perf_get_concurrent and test_concurrent_stop ported to use + pthread instead of fork(). Added more error detections. -EG + +Sat Apr 23 16:06:30 CET 2016 + Improved test_quiesce test. -EG + +Sat Apr 23 15:39:38 CET 2016 + Notify other threads in MHD_quiesce_daemon() so listen socket FD + is removed from awaiting select() and poll(). -EG + +Sat Apr 23 14:17:15 CET 2016 + Revert "shutdown trigger select" on Darwin. Fixed daemon shutdown + on Darwin without "MHD_USE_PIPE_FOR_SHUTDOWN" option. -EG + +Fri Apr 22 14:29:28 CET 2016 + Fixed race conditions when stopping quiesced daemon with thread + pool. -EG + +Wed Apr 20 18:12:30 CET 2016 + Fixed macros in sysfdsetsize.c which could prevent compiling with + non-default FD_SETSIZE. + Fixed comments in mhd_str.c. + Updated test_post.c to not ignore specific error on W32 if libcurl + is built with workaround for WinSock bug. -EG + +Mon Apr 18 19:35:14 CET 2016 + Fixed data races leading to inability in rare situations to + resume suspended connection. -EG + +Tue Apr 13 21:46:01 CET 2016 + Removed unneeded locking for global timeout list in + MHD_USE_THREAD_PER_CONNECTION mode. + Added 'simplepost' and 'largepost' examples to VS projects. + Added strtoXX() locale-independent replacement functions. + Added more error checking and minor fixes in digest auth + functions - should improve security. + Ignored specific errors in 'test_post' test until libcurl + will implement workaround for WinSock bug. + Fixed handling of caller-supplied socket with + MHD_OPTION_LISTEN_SOCKET (regression in 0.9.49). + Minor fixes. + Various cosmetics and comments fixes. -EG + +Sat Apr 09 13:05:42 CET 2016 + Releasing libmicrohttpd 0.9.49. -EG + +Fri Apr 08 18:32:17 CET 2016 + Some minor internal fixes, addition error checking and + micro optimizations. + Reworked usage of sockets shutdown() - now work equally + on all platforms, disconnection should be "more graceful". -EG + +Tue Mar 15 21:52:27 CET 2016 + Do not crash if pthread_create() fails. -DD + +Tue Mar 15 20:29:34 CET 2016 + Do not use eready DLL data structure unless + we are actually using epoll(). -DD/CG + +Fri Feb 5 20:43:11 CET 2016 + Fixed testsuite compile warning on W32. + Added check test for triggering poll() on + listen socket. -EG + +Thu Feb 4 11:38:11 CET 2016 + Added some buffer overrun protection. + Fixed handling of misformed URI with spaces. -EG + +Wed Feb 3 15:41:57 CET 2016 + Make signal-pipe non-blocking and drain it. -CG + +Sat Jan 30 15:49:07 CET 2016 + Fix running select() with empty fdsets on W32. -EG + +Mon Jan 25 13:45:50 CET 2016 + Added check test for triggering select() on + listen socket. -EG + +Thu Jan 21 19:35:18 CET 2016 + Fixed old bug with making sockets non-blocking on + various platforms so now sockets are really + non-blocking on all supported platforms. + Reworked and fixed code for using SOCK_CLOEXEC, + SOCK_NONBLOCK and EPOLL_CLOEXEC resulting in + fewer used system calls. -EG + +Tue Jan 19 20:59:59 CET 2016 + Cleaned up and optimized with minor fixes code for + making sockets non-blocking non-inheritable. -EG + +Tue Jan 19 11:14:18 CET 2016 + Removed workaround for Cygwin non-blocking sockets: + handling non-blocking sockets were fixed in Cygwin + and libmicrohttpd how uses non-blocking sockets on + all platforms. -EG + +Mon Jan 18 23:54:45 CET 2016 + Cleaned up examples to avoid giving oversimplified code + that may lead to complications if adopted naively. -CG + +Sun Jan 17 11:18:55 CET 2016 + Do no refuse to send response if sendfile() failed with + EINVAL (common error for files located on SMB/CIF). -EG + +Sat Jan 16 19:14:39 CET 2016 + Use US-ASCII only (instead of user locale settings) when + performing caseless string comparison as required by + standard. -EG + +Tue Jan 12 16:10:09 CET 2016 + Fixed declaraion of MHD_get_reason_phrase_for(). -EG + +Mon Jan 11 19:58:50 CET 2016 + Configure.ac small fixes and refactoring. -EG + +Fri Dec 18 15:54:50 CET 2015 + Releasing libmicrohttpd 0.9.48. -CG + +Tue Dec 15 18:35:55 CET 2015 + Improved compatibility with VS2010 and other older + compilers. -EG + +Tue Dec 8 21:48:44 CET 2015 + Default backlog size for listen socket was changed from + 32 to SOMAXCONN, added new option MHD_OPTION_LISTEN_BACKLOG_SIZE + to override default backlog size. + If not all connections can be handled by MHD_select() than + at least some of connections will be processed instead of + failing without any processing. + Fixed redefenition of FD_SETSIZE on W32 so select() will + work with 2000 connections instead of 64. + Better handled redefenition of FD_SETSIZE on all + platforms. -EG + +Sat Dec 5 17:30:45 CET 2015 + Close sockets more aggressively in multi-threaded + mode (possibly relevant for idle servers). -CG + +Fri Dec 4 13:53:05 CET 2015 + Releasing libmicrohttpd 0.9.47. -CG + +Thu Dec 3 18:21:44 CET 2015 + Reworked VS project files. Used x64 build tools by + default, many optimizations, fixes. + Added project files for VS 2015. -EG + +Tue Dec 1 14:05:13 CET 2015 + SPDY is dead, killing experimental libmicrospdy. -CG + +Tue Dec 1 10:01:12 CET 2015 + New logic for controlling socket buffer modes. + Eliminated delay before last packet in response and before + "100 Continue" response on all platforms. Also response + header are pushed to client without waiting for response + body. -EG + +Wed Nov 25 17:02:53 CET 2015 + Remove 200ms delay observable with keep-alive on Darwin + and *BSD platfroms. -EG + +Tue Nov 10 15:25:48 CET 2015 + Fix issue with shutdown if connection was resumed just + before shutdown. -FC + +Fri Nov 6 22:54:38 CET 2015 + Fixing the buffer shrinkage issue, this time with test. -CG + Releasing libmicrohttpd 0.9.46. -CG + +Tue Nov 3 23:24:52 CET 2015 + Undoing change from Sun Oct 25 15:29:23 CET 2015 + as the original code was counter-intuitive but + correct, and the new code does break pipelining. + Ignore empty lines at the beginning of an HTTP + request (more tolerant implementation). -CG + +Sat Oct 31 15:52:52 CET 2015 + Releasing libmicrohttpd 0.9.45. -CG + +Tue Oct 27 12:08:02 CET 2015 + Rework deprecation maros: fix errors with old GCC versions, + improved support for old clang and new GCC. -EG + +Sun Oct 25 23:05:32 CET 2015 + Return correct header kind in MHD_get_connection_values() + even if a bitmask is used for the "kind" argument. -FC/CG + +Sun Oct 25 15:29:23 CET 2015 + Fixing transient resource leak affecting long-lived + connections with many keep-alives and HTTP request + pipelining under certain circumstances (which reduced + the receive window). + Fixed assertion failure triggered by a race in + thread-per-connection mode on shutdown in rare + circumstances. -CG + +Mon Oct 5 11:53:52 CEST 2015 + Deduplicate code between digestauth and connection + parsing logic for URI arguments, shared code moved + to new MHD_parse_arguments_ function in internal.c. -CG + Thu Oct 1 21:22:05 CEST 2015 Releasing libmicrohttpd 0.9.44. -CG Wed Sep 30 21:05:38 CEST 2015 - Various fixes for W32 VS project files. - EG + Various fixes for W32 VS project files. -EG Fri Sep 25 09:49:10 CEST 2015 Fix digest authentication with URL arguments where diff -Nru libmicrohttpd-0.9.44+dfsg/config.guess libmicrohttpd-0.9.55/config.guess --- libmicrohttpd-0.9.44+dfsg/config.guess 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/config.guess 2017-05-28 22:34:00.000000000 +0200 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff -Nru libmicrohttpd-0.9.44+dfsg/config.rpath libmicrohttpd-0.9.55/config.rpath --- libmicrohttpd-0.9.44+dfsg/config.rpath 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/config.rpath 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,684 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2016 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.[01]*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd[23].*) + library_names_spec='$libname$shrext$versuffix' + ;; + freebsd* | dragonfly*) + library_names_spec='$libname$shrext' + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,11 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -313,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -327,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -372,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -423,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -437,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -513,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -633,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -774,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -1009,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1019,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1365,18 +1388,18 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ @@ -1385,7 +1408,8 @@ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1517,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) diff -Nru libmicrohttpd-0.9.44+dfsg/configure libmicrohttpd-0.9.55/configure --- libmicrohttpd-0.9.44+dfsg/configure 2015-10-01 21:22:16.000000000 +0200 +++ libmicrohttpd-0.9.55/configure 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libmicrohttpd 0.9.44. +# Generated by GNU Autoconf 2.69 for GNU Libmicrohttpd 0.9.55. # # Report bugs to . # @@ -588,12 +588,12 @@ MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='libmicrohttpd' +PACKAGE_NAME='GNU Libmicrohttpd' PACKAGE_TARNAME='libmicrohttpd' -PACKAGE_VERSION='0.9.44' -PACKAGE_STRING='libmicrohttpd 0.9.44' +PACKAGE_VERSION='0.9.55' +PACKAGE_STRING='GNU Libmicrohttpd 0.9.55' PACKAGE_BUGREPORT='libmicrohttpd@gnu.org' -PACKAGE_URL='' +PACKAGE_URL='http://www.gnu.org/software/libmicrohttpd/' # Factoring default headers for most tests. ac_includes_default="\ @@ -636,31 +636,38 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -MHD_LIBDEPS +EMPTY_VAR +ac_configure_args MHD_LIBDEPS_PKGCFG MHD_REQ_PRIVATE +MHD_LIBDEPS MHD_LIB_LDFLAGS MHD_LIB_CFLAGS MHD_LIB_CPPFLAGS CPU_COUNT USE_COVERAGE_FALSE USE_COVERAGE_TRUE +HAVE_FORK_WAITPID_FALSE +HAVE_FORK_WAITPID_TRUE +ENABLE_UPGRADE_FALSE +ENABLE_UPGRADE_TRUE ENABLE_DAUTH_FALSE ENABLE_DAUTH_TRUE ENABLE_BAUTH_FALSE ENABLE_BAUTH_TRUE ENABLE_HTTPS_FALSE ENABLE_HTTPS_TRUE -GNUTLS_LDFLAGS -GNUTLS_CPPFLAGS HAVE_GNUTLS_SNI_FALSE HAVE_GNUTLS_SNI_TRUE HAVE_GNUTLS_FALSE HAVE_GNUTLS_TRUE +GNUTLS_LDFLAGS +GNUTLS_CPPFLAGS GNUTLS_LIBS GNUTLS_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH +PKG_CONFIG LIBGCRYPT_LIBS LIBGCRYPT_CFLAGS LIBGCRYPT_CONFIG @@ -672,20 +679,6 @@ have_zzuf HAVE_POSTPROCESSOR_FALSE HAVE_POSTPROCESSOR_TRUE -HAVE_SPDYLAY_FALSE -HAVE_SPDYLAY_TRUE -SPDY_LIBDEPS -SPDY_LIB_CPPFLAGS -SPDY_LIB_CFLAGS -SPDY_LIB_LDFLAGS -ENABLE_SPDY_FALSE -ENABLE_SPDY_TRUE -HAVE_OPENSSL_FALSE -HAVE_OPENSSL_TRUE -OPENSSL_LDFLAGS -OPENSSL_LIBS -OPENSSL_INCLUDES -PKG_CONFIG HAVE_MAGIC_FALSE HAVE_MAGIC_TRUE HAVE_CURL_FALSE @@ -694,8 +687,11 @@ LIBCURL_CPPFLAGS _libcurl_config HIDDEN_VISIBILITY_CFLAGS -HAVE_TSEARCH_FALSE -HAVE_TSEARCH_TRUE +MHD_HAVE_TSEARCH_FALSE +MHD_HAVE_TSEARCH_TRUE +REPLACE_TSEARCH +HAVE_TSEARCH +GNULIB_TSEARCH BUILD_EXAMPLES_FALSE BUILD_EXAMPLES_TRUE BUILD_DOC_FALSE @@ -708,6 +704,8 @@ HAVE_CURL_BINARY_FALSE HAVE_CURL_BINARY_TRUE HAVE_CURL_BINARY +HAVE_LISTEN_SHUTDOWN_FALSE +HAVE_LISTEN_SHUTDOWN_TRUE USE_MS_LIB_TOOL_FALSE USE_MS_LIB_TOOL_TRUE W32_SHARED_LIB_EXP_FALSE @@ -718,19 +716,19 @@ USE_W32_THREADS_TRUE USE_POSIX_THREADS_FALSE USE_POSIX_THREADS_TRUE -lt_cv_objdir -MS_LIB_TOOL HAVE_POSIX_THREADS_FALSE HAVE_POSIX_THREADS_TRUE PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC ax_pthread_config +lt_cv_objdir +MS_LIB_TOOL PACKAGE_VERSION_SUBMINOR PACKAGE_VERSION_MINOR PACKAGE_VERSION_MAJOR RC -CPP +LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO @@ -752,6 +750,7 @@ OBJDUMP DLLTOOL AS +CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -778,9 +777,6 @@ build_cpu build LN_S -LIBSPDY_VERSION_AGE -LIBSPDY_VERSION_REVISION -LIBSPDY_VERSION_CURRENT LIB_VERSION_AGE LIB_VERSION_REVISION LIB_VERSION_CURRENT @@ -830,6 +826,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -858,27 +855,28 @@ enable_static with_pic enable_fast_install +with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_threads +enable_thread_names enable_doc enable_examples enable_poll enable_epoll -enable_socketpair +enable_itc enable_curl with_libcurl -enable_spdy -with_openssl enable_largefile enable_messages enable_postprocessor +enable_https with_libgcrypt_prefix with_gnutls -enable_https enable_bauth enable_dauth +enable_httpupgrade enable_coverage ' ac_precious_vars='build_alias @@ -890,6 +888,7 @@ LIBS CPPFLAGS CPP +LT_SYS_LIBRARY_PATH PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR @@ -933,6 +932,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1185,6 +1185,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1322,7 +1331,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1435,7 +1444,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libmicrohttpd 0.9.44 to adapt to many kinds of systems. +\`configure' configures GNU Libmicrohttpd 0.9.55 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1475,6 +1484,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1505,7 +1515,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libmicrohttpd 0.9.44:";; + short | recursive ) echo "Configuration of GNU Libmicrohttpd 0.9.55:";; esac cat <<\_ACEOF @@ -1524,21 +1534,22 @@ --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --disable-thread-names auto + do not set names on MHD generated threads --disable-doc do not build any documentation --disable-examples do not build any examples --enable-poll[=ARG] enable poll support (yes, no, auto) [auto] --enable-epoll[=ARG] enable epoll support (yes, no, auto) [auto] - --enable-socketpair[=ARG] - disable internal singalling by pipes and use socket - pair instead (yes, no, try) [no] + --enable-itc=TYPE use TYPE of inter-thread communication (pipe, + socketpair, eventfd) [auto] --disable-curl disable cURL based testcases - --enable-spdy enable build libmicrospdy (yes, no, auto) [auto] --disable-largefile omit support for large files --disable-messages disable MHD error messages --disable-postprocessor disable MHD PostProcessor functionality --enable-https enable HTTPS support (yes, no, auto)[auto] --disable-bauth disable HTTP basic Auth support --disable-dauth disable HTTP basic and digest Auth support + --disable-httpupgrade disable HTTP "Upgrade" support --enable-coverage compile the library with code coverage support Optional Packages: @@ -1546,13 +1557,15 @@ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). --with-threads=LIB choose threading library (posix, w32, auto) [auto] --with-libcurl=PREFIX look for the curl library in PREFIX/lib and headers in PREFIX/include - --with-openssl=DIR root of the OpenSSL directory --with-libgcrypt-prefix=PFX prefix where LIBGCRYPT is installed (optional) --with-gnutls[=PFX] use GnuTLS for HTTPS support, optional PFX overrides @@ -1568,6 +1581,8 @@ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path @@ -1581,6 +1596,8 @@ it to find libraries and programs with nonstandard names/locations. Report bugs to . +GNU Libmicrohttpd home page: . +General help using GNU software: . _ACEOF ac_status=$? fi @@ -1643,7 +1660,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libmicrohttpd configure 0.9.44 +GNU Libmicrohttpd configure 0.9.55 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1695,6 +1712,43 @@ } # ac_fn_c_try_compile +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -1772,43 +1826,6 @@ } # ac_fn_c_check_header_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -1918,6 +1935,106 @@ } # ac_fn_c_check_func +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -2065,57 +2182,11 @@ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member - -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libmicrohttpd $as_me 0.9.44, which was +It was created by GNU Libmicrohttpd $as_me 0.9.55, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2395,8 +2466,58 @@ >$cache_file fi -as_fn_append ac_func_list " memmem" +mhd_undef_all_extensions=" +#ifdef _GNU_SOURCE +#undef _GNU_SOURCE +#endif +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif +#ifdef _XOPEN_SOURCE_EXTENDED +#undef _XOPEN_SOURCE_EXTENDED +#endif +#ifdef _XOPEN_VERSION +#undef _XOPEN_VERSION +#endif +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif +#ifdef _POSIX_SOURCE +#undef _POSIX_SOURCE +#endif +#ifdef _DEFAULT_SOURCE +#undef _DEFAULT_SOURCE +#endif +#ifdef _BSD_SOURCE +#undef _BSD_SOURCE +#endif +#ifdef _SVID_SOURCE +#undef _SVID_SOURCE +#endif +#ifdef __EXTENSIONS__ +#undef __EXTENSIONS__ +#endif +#ifdef _ALL_SOURCE +#undef _ALL_SOURCE +#endif +#ifdef _TANDEM_SOURCE +#undef _TANDEM_SOURCE +#endif +#ifdef _DARWIN_C_SOURCE +#undef _DARWIN_C_SOURCE +#endif +#ifdef __BSD_VISIBLE +#undef __BSD_VISIBLE +#endif +#ifdef _NETBSD_SOURCE +#undef _NETBSD_SOURCE +#endif +" + as_fn_append ac_func_list " accept4" +as_fn_append ac_func_list " gmtime_r" +as_fn_append ac_func_list " memmem" +as_fn_append ac_func_list " snprintf" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2980,7 +3101,7 @@ # Define the identity of the package. PACKAGE='libmicrohttpd' - VERSION='0.9.44' + VERSION='0.9.55' cat >>confdefs.h <<_ACEOF @@ -3077,18 +3198,9 @@ - -LIB_VERSION_CURRENT=44 +LIB_VERSION_CURRENT=55 LIB_VERSION_REVISION=0 -LIB_VERSION_AGE=34 - - - - -LIBSPDY_VERSION_CURRENT=0 -LIBSPDY_VERSION_REVISION=0 -LIBSPDY_VERSION_AGE=0 - +LIB_VERSION_AGE=43 @@ -4608,9 +4720,2834 @@ $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac -if test -n "$ac_cv_prog_cc_stdc" && test "x$ac_cv_prog_cc_stdc" != "xno"; then : - CFLAGS="$CFLAGS $ac_cv_prog_cc_stdc" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdio.h" >&5 +$as_echo_n "checking for presence of stdio.h... " >&6; } +if ${mhd_cv_header_stdio_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdio_h_present="yes" +else + mhd_cv_header_stdio_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdio_h_present" >&5 +$as_echo "$mhd_cv_header_stdio_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of wchar.h" >&5 +$as_echo_n "checking for presence of wchar.h... " >&6; } +if ${mhd_cv_header_wchar_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_wchar_h_present="yes" +else + mhd_cv_header_wchar_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_wchar_h_present" >&5 +$as_echo "$mhd_cv_header_wchar_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdlib.h" >&5 +$as_echo_n "checking for presence of stdlib.h... " >&6; } +if ${mhd_cv_header_stdlib_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdlib_h_present="yes" +else + mhd_cv_header_stdlib_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdlib_h_present" >&5 +$as_echo "$mhd_cv_header_stdlib_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of string.h" >&5 +$as_echo_n "checking for presence of string.h... " >&6; } +if ${mhd_cv_header_string_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_string_h_present="yes" +else + mhd_cv_header_string_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_string_h_present" >&5 +$as_echo "$mhd_cv_header_string_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of strings.h" >&5 +$as_echo_n "checking for presence of strings.h... " >&6; } +if ${mhd_cv_header_strings_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_strings_h_present="yes" +else + mhd_cv_header_strings_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_strings_h_present" >&5 +$as_echo "$mhd_cv_header_strings_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdint.h" >&5 +$as_echo_n "checking for presence of stdint.h... " >&6; } +if ${mhd_cv_header_stdint_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdint_h_present="yes" +else + mhd_cv_header_stdint_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdint_h_present" >&5 +$as_echo "$mhd_cv_header_stdint_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of fcntl.h" >&5 +$as_echo_n "checking for presence of fcntl.h... " >&6; } +if ${mhd_cv_header_fcntl_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_fcntl_h_present="yes" +else + mhd_cv_header_fcntl_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_fcntl_h_present" >&5 +$as_echo "$mhd_cv_header_fcntl_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of sys/types.h" >&5 +$as_echo_n "checking for presence of sys/types.h... " >&6; } +if ${mhd_cv_header_sys_types_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_sys_types_h_present="yes" +else + mhd_cv_header_sys_types_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_sys_types_h_present" >&5 +$as_echo "$mhd_cv_header_sys_types_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of time.h" >&5 +$as_echo_n "checking for presence of time.h... " >&6; } +if ${mhd_cv_header_time_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_time_h_present="yes" +else + mhd_cv_header_time_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_time_h_present" >&5 +$as_echo "$mhd_cv_header_time_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of unistd.h" >&5 +$as_echo_n "checking for presence of unistd.h... " >&6; } +if ${mhd_cv_header_unistd_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_unistd_h_present="yes" +else + mhd_cv_header_unistd_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_unistd_h_present" >&5 +$as_echo "$mhd_cv_header_unistd_h_present" >&6; } + + + + if test -z "$mhd_basic_headers_includes"; then : + if test "x$mhd_cv_header_stdio_h_present" = x"yes"; then : + mhd_basic_headers_includes="\ +#include +" +else + mhd_basic_headers_includes="" + +fi + if test "x$mhd_cv_header_sys_types_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_wchar_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_stdlib_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_string_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_strings_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_stdint_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_fcntl_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_time_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_unistd_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + mhd_mse_added_exts_flags="" + mhd_mse_added_prolog="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifndef _XOPEN_SOURCE +#error _XOPEN_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_defined="yes" +else + mhd_cv_macro__xopen_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether predefined value of _XOPEN_SOURCE is more or equal 500" >&5 +$as_echo_n "checking whether predefined value of _XOPEN_SOURCE is more or equal 500... " >&6; } +if ${mhd_cv_macro__xopen_source_def_fiveh+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if _XOPEN_SOURCE+0 < 500 +#error Value of _XOPEN_SOURCE is less than 500 +choke me now; +#endif + +int +main () +{ +int i = 0; i++ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_def_fiveh="yes" +else + mhd_cv_macro__xopen_source_def_fiveh="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_def_fiveh" >&5 +$as_echo "$mhd_cv_macro__xopen_source_def_fiveh" >&6; } + if test "x$mhd_cv_macro__xopen_source_def_fiveh" = x"no"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE_EXTENDED is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE_EXTENDED is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_extended_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _XOPEN_SOURCE_EXTENDED +#error _XOPEN_SOURCE_EXTENDED is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_extended_defined="yes" +else + mhd_cv_macro__xopen_source_extended_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_extended_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_extended_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_extended_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE_EXTENDED" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE_EXTENDED... " >&6; } +if ${mhd_cv_define__xopen_source_extended_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _XOPEN_SOURCE_EXTENDED 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_extended_accepted="yes" +else + mhd_cv_define__xopen_source_extended_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_extended_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_source_extended_accepted" >&6; } + if test "x$mhd_cv_define__xopen_source_extended_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE_EXTENDED" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE_EXTENDED 1 +" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_VERSION is already defined" >&5 +$as_echo_n "checking whether _XOPEN_VERSION is already defined... " >&6; } +if ${mhd_cv_macro__xopen_version_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _XOPEN_VERSION +#error _XOPEN_VERSION is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_version_defined="yes" +else + mhd_cv_macro__xopen_version_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_version_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_version_defined" >&6; } + if test "x$mhd_cv_macro__xopen_version_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for value of _XOPEN_VERSION accepted by headers" >&5 +$as_echo_n "checking for value of _XOPEN_VERSION accepted by headers... " >&6; } +if ${mhd_cv_define__xopen_version_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _XOPEN_VERSION 4 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="4" +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _XOPEN_VERSION 3 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="3" +else + mhd_cv_define__xopen_version_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_version_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_version_accepted" >&6; } + if test "x$mhd_cv_define__xopen_version_accepted" = x"no"; then : + : +else + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_VERSION=${mhd_cv_define__xopen_version_accepted}" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_VERSION ${mhd_cv_define__xopen_version_accepted} +" + + +fi + +fi + + +fi + +fi + + + +fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE with value 700" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE with value 700... " >&6; } +if ${mhd_cv_define__xopen_source_accepted_700+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 700 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_accepted_700="yes" +else + mhd_cv_define__xopen_source_accepted_700="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_accepted_700" >&5 +$as_echo "$mhd_cv_define__xopen_source_accepted_700" >&6; } + if test "x$mhd_cv_define__xopen_source_accepted_700" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE with value 700 really enable POSIX.1-2008/SUSv4 features" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE with value 700 really enable POSIX.1-2008/SUSv4 features... " >&6; } +if ${mhd_cv_define__xopen_source_sevenh_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + mhd_cxoe_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are avalable + * and failed if ANY feature is not avalable. */ +int main() +{ + +#ifndef stpncpy + (void) stpncpy; +#endif +#ifndef strnlen + (void) strnlen; +#endif + +#if !defined(__NetBSD__) && !defined(__OpenBSD__) +/* NetBSD and OpenBSD didn't implement wcsnlen() for some reason. */ +#ifndef wcsnlen + (void) wcsnlen; +#endif +#endif + +#ifdef __CYGWIN__ +/* The only depend function on Cygwin, but missing on some other platforms */ +#ifndef strndup + (void) strndup; +#endif +#endif + +#ifndef __sun +/* illumos forget to uncomment some _XPG7 macros. */ +#ifndef renameat + (void) renameat; +#endif + +#ifndef getline + (void) getline; +#endif +#endif /* ! __sun */ + +/* gmtime_r() becomes mandatory only in POSIX.1-2008. */ +#ifndef gmtime_r + (void) gmtime_r; +#endif + +/* unsetenv() actually defined in POSIX.1-2001 so it + * must be present with _XOPEN_SOURCE == 700 too. */ +#ifndef unsetenv + (void) unsetenv; +#endif + + return 0; +} + +" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +#define _XOPEN_SOURCE 700 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _XOPEN_SOURCE 700 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features does not work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 700 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 700 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=700" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 700 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=700" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_sevenh_works="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cv_define__xopen_source_sevenh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { mhd_cxoe_tmp_src_variable=; unset mhd_cxoe_tmp_src_variable;} + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_sevenh_works" >&5 +$as_echo "$mhd_cv_define__xopen_source_sevenh_works" >&6; } fi + + if test "x$mhd_cv_define__xopen_source_accepted_700" = "xyes" && + test "x$mhd_cv_define__xopen_source_sevenh_works" = "xyes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE=700" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE 700 +" + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE with value 600" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE with value 600... " >&6; } +if ${mhd_cv_define__xopen_source_accepted_600+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 600 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_accepted_600="yes" +else + mhd_cv_define__xopen_source_accepted_600="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_accepted_600" >&5 +$as_echo "$mhd_cv_define__xopen_source_accepted_600" >&6; } + if test "x$mhd_cv_define__xopen_source_accepted_600" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE with value 600 really enable POSIX.1-2001/SUSv3 features" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE with value 600 really enable POSIX.1-2001/SUSv3 features... " >&6; } +if ${mhd_cv_define__xopen_source_sixh_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + mhd_cxoe_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ + +#ifndef setenv + (void) setenv; +#endif + +#ifndef __NetBSD__ +#ifndef vsscanf + (void) vsscanf; +#endif +#endif + +/* Availability of next features varies, but they all must be present + * on platform with support for _XOPEN_SOURCE = 600. */ + +/* vsnprintf() should be available with _XOPEN_SOURCE >= 500, but some platforms + * provide it only with _POSIX_C_SOURCE >= 200112 (autodefined when + * _XOPEN_SOURCE >= 600) where specification of vsnprintf() is aligned with + * ISO C99 while others platforms defined it with even earlier standards. */ +#ifndef vsnprintf + (void) vsnprintf; +#endif + +/* On platforms that prefer POSIX over X/Open, fseeko() is available + * with _POSIX_C_SOURCE >= 200112 (autodefined when _XOPEN_SOURCE >= 600). + * On other platforms it should be available with _XOPEN_SOURCE >= 500. */ +#ifndef fseeko + (void) fseeko; +#endif + +/* F_GETOWN must be defined with _XOPEN_SOURCE >= 600, but some platforms + * define it with _XOPEN_SOURCE >= 500. */ +#ifndef F_GETOWN +#error F_GETOWN is not defined +choke me now; +#endif + return 0; +} + +" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +#define _XOPEN_SOURCE 600 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _XOPEN_SOURCE 600 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features does not work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 600 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 600 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=600" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 600 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=600" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_sixh_works="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cv_define__xopen_source_sixh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { mhd_cxoe_tmp_src_variable=; unset mhd_cxoe_tmp_src_variable;} + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_sixh_works" >&5 +$as_echo "$mhd_cv_define__xopen_source_sixh_works" >&6; } +fi + + if test "x$mhd_cv_define__xopen_source_accepted_600" = "xyes" && + test "x$mhd_cv_define__xopen_source_sixh_works" = "xyes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE=600" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE 600 +" + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE with value 500" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE with value 500... " >&6; } +if ${mhd_cv_define__xopen_source_accepted_500+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 500 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_accepted_500="yes" +else + mhd_cv_define__xopen_source_accepted_500="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_accepted_500" >&5 +$as_echo "$mhd_cv_define__xopen_source_accepted_500" >&6; } + if test "x$mhd_cv_define__xopen_source_accepted_500" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE with value 500 really enable SUSv2/XPG5 features" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE with value 500 really enable SUSv2/XPG5 features... " >&6; } +if ${mhd_cv_define__xopen_source_fiveh_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + mhd_cxoe_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ +/* It's not easy to write reliable test for _XOPEN_SOURCE = 500 as + * platforms not always precisely follow this standard and some + * functions are already deprecated in later standards. */ + +/* Availability of next features varies, but they all must be present + * on platform with correct support for _XOPEN_SOURCE = 500. */ + +/* Mandatory with _XOPEN_SOURCE >= 500 but as XSI extension available + * with much older standards. */ +#ifndef ftruncate + (void) ftruncate; +#endif + +/* Added with _XOPEN_SOURCE >= 500 but was available in some standards + * before. XSI extension. */ +#ifndef pread + (void) pread; +#endif + +#ifndef __APPLE__ +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. */ +#ifndef symlink + (void) symlink; +#endif + +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. XSI extension. */ +#ifndef strdup + (void) strdup; +#endif +#endif /* ! __APPLE__ */ + return 0; +} + +" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _ANSI_SOURCE 1 +#define _XOPEN_SOURCE 500 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _XOPEN_SOURCE 500 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features does not work with undefined all extensions and with _XOPEN_SOURCE=1" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 500 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _XOPEN_SOURCE 500 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="yes" + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=500" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 500 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=500" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 1 +$mhd_cxoe_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=1" >&5 + mhd_cv_define__xopen_source_fiveh_works="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features do not work with current extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cv_define__xopen_source_fiveh_works="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { mhd_cxoe_tmp_src_variable=; unset mhd_cxoe_tmp_src_variable;} + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_fiveh_works" >&5 +$as_echo "$mhd_cv_define__xopen_source_fiveh_works" >&6; } +fi + + if test "x$mhd_cv_define__xopen_source_accepted_500" = "xyes" && test "x$mhd_cv_define__xopen_source_fiveh_works" = "xyes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE=500" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE 500 +" + + +else + + # Earlier standards are widely supported, so just define macros to maximum value + # which do not break headers. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE_EXTENDED is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE_EXTENDED is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_extended_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 + +#ifndef _XOPEN_SOURCE_EXTENDED +#error _XOPEN_SOURCE_EXTENDED is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_extended_defined="yes" +else + mhd_cv_macro__xopen_source_extended_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_extended_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_extended_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_extended_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE_EXTENDED" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE_EXTENDED... " >&6; } +if ${mhd_cv_define__xopen_source_extended_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 + +#define _XOPEN_SOURCE_EXTENDED 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_extended_accepted="yes" +else + mhd_cv_define__xopen_source_extended_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_extended_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_source_extended_accepted" >&6; } + if test "x$mhd_cv_define__xopen_source_extended_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE_EXTENDED" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE_EXTENDED 1 +" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_VERSION is already defined" >&5 +$as_echo_n "checking whether _XOPEN_VERSION is already defined... " >&6; } +if ${mhd_cv_macro__xopen_version_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 + +#ifndef _XOPEN_VERSION +#error _XOPEN_VERSION is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_version_defined="yes" +else + mhd_cv_macro__xopen_version_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_version_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_version_defined" >&6; } + if test "x$mhd_cv_macro__xopen_version_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for value of _XOPEN_VERSION accepted by headers" >&5 +$as_echo_n "checking for value of _XOPEN_VERSION accepted by headers... " >&6; } +if ${mhd_cv_define__xopen_version_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 + +#define _XOPEN_VERSION 4 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="4" +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 + +#define _XOPEN_VERSION 3 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="3" +else + mhd_cv_define__xopen_version_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_version_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_version_accepted" >&6; } + if test "x$mhd_cv_define__xopen_version_accepted" = x"no"; then : + : +else + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_VERSION=${mhd_cv_define__xopen_version_accepted}" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_VERSION ${mhd_cv_define__xopen_version_accepted} +" + + +fi + +fi + + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE with value 1" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE with value 1... " >&6; } +if ${mhd_cv_define__xopen_source_accepted_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$mhd_cv_define__xopen_source_extended_accepted" = "xyes" || test "x$mhd_cv_define__xopen_version_accepted" = "xyes"; then : + mhd_cv_define__xopen_source_accepted_1="yes" +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #define _XOPEN_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_accepted_1="yes" +else + mhd_cv_define__xopen_source_accepted_1="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_accepted_1" >&5 +$as_echo "$mhd_cv_define__xopen_source_accepted_1" >&6; } + if test "x$mhd_cv_define__xopen_source_accepted_1" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _XOPEN_SOURCE=1" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _XOPEN_SOURCE 1 +" + + +fi + +fi + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _GNU_SOURCE is already defined" >&5 +$as_echo_n "checking whether _GNU_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__gnu_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _GNU_SOURCE +#error _GNU_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__gnu_source_defined="yes" +else + mhd_cv_macro__gnu_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__gnu_source_defined" >&5 +$as_echo "$mhd_cv_macro__gnu_source_defined" >&6; } + if test "x$mhd_cv_macro__gnu_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _GNU_SOURCE" >&5 +$as_echo_n "checking whether headers accept _GNU_SOURCE... " >&6; } +if ${mhd_cv_define__gnu_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _GNU_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__gnu_source_accepted="yes" +else + mhd_cv_define__gnu_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__gnu_source_accepted" >&5 +$as_echo "$mhd_cv_define__gnu_source_accepted" >&6; } + if test "x$mhd_cv_define__gnu_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _GNU_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _GNU_SOURCE 1 +" + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try __BSD_VISIBLE macro" >&5 +$as_echo_n "checking whether to try __BSD_VISIBLE macro... " >&6; } +if ${mhd_cv_macro_try___bsd_visible+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if !defined(__FreeBSD__) && !defined (__ANDROID__) +#error Target is not FreeBSD or Android +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_try___bsd_visible="yes" +else + mhd_cv_macro_try___bsd_visible="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_try___bsd_visible" >&5 +$as_echo "$mhd_cv_macro_try___bsd_visible" >&6; } + if test "x$mhd_cv_macro_try___bsd_visible" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __BSD_VISIBLE is already defined" >&5 +$as_echo_n "checking whether __BSD_VISIBLE is already defined... " >&6; } +if ${mhd_cv_macro___bsd_visible_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +/* Warning: test with inverted logic! */ +#ifdef __BSD_VISIBLE +#error __BSD_VISIBLE is defined +choke me now; +#endif +#ifdef __ANDROID__ +/* if __BSD_VISIBLE is not defined, Android usually defines it to 1 */ +#include +#if defined(__BSD_VISIBLE) && __BSD_VISIBLE == 1 +#error __BSD_VISIBLE is autodefined by headers to value 1 +choke me now; +#endif +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___bsd_visible_defined="no" +else + mhd_cv_macro___bsd_visible_defined="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___bsd_visible_defined" >&5 +$as_echo "$mhd_cv_macro___bsd_visible_defined" >&6; } + if test "x$mhd_cv_macro___bsd_visible_defined" = x"yes"; then : + : +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept __BSD_VISIBLE" >&5 +$as_echo_n "checking whether headers accept __BSD_VISIBLE... " >&6; } +if ${mhd_cv_define___bsd_visible_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define __BSD_VISIBLE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define___bsd_visible_accepted="yes" +else + mhd_cv_define___bsd_visible_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define___bsd_visible_accepted" >&5 +$as_echo "$mhd_cv_define___bsd_visible_accepted" >&6; } + if test "x$mhd_cv_define___bsd_visible_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags __BSD_VISIBLE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define __BSD_VISIBLE 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _DARWIN_C_SOURCE macro" >&5 +$as_echo_n "checking whether to try _DARWIN_C_SOURCE macro... " >&6; } +if ${mhd_cv_macro___apple___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __APPLE__ +#error __APPLE__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___apple___defined="yes" +else + mhd_cv_macro___apple___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___apple___defined" >&5 +$as_echo "$mhd_cv_macro___apple___defined" >&6; } + if test "x$mhd_cv_macro___apple___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _DARWIN_C_SOURCE is already defined" >&5 +$as_echo_n "checking whether _DARWIN_C_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__darwin_c_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _DARWIN_C_SOURCE +#error _DARWIN_C_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__darwin_c_source_defined="yes" +else + mhd_cv_macro__darwin_c_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__darwin_c_source_defined" >&5 +$as_echo "$mhd_cv_macro__darwin_c_source_defined" >&6; } + if test "x$mhd_cv_macro__darwin_c_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _DARWIN_C_SOURCE" >&5 +$as_echo_n "checking whether headers accept _DARWIN_C_SOURCE... " >&6; } +if ${mhd_cv_define__darwin_c_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _DARWIN_C_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__darwin_c_source_accepted="yes" +else + mhd_cv_define__darwin_c_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__darwin_c_source_accepted" >&5 +$as_echo "$mhd_cv_define__darwin_c_source_accepted" >&6; } + if test "x$mhd_cv_define__darwin_c_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _DARWIN_C_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _DARWIN_C_SOURCE 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try __EXTENSIONS__ macro" >&5 +$as_echo_n "checking whether to try __EXTENSIONS__ macro... " >&6; } +if ${mhd_cv_macro___sun_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __sun +#error __sun is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___sun_defined="yes" +else + mhd_cv_macro___sun_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___sun_defined" >&5 +$as_echo "$mhd_cv_macro___sun_defined" >&6; } + if test "x$mhd_cv_macro___sun_defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __EXTENSIONS__ is already defined" >&5 +$as_echo_n "checking whether __EXTENSIONS__ is already defined... " >&6; } +if ${mhd_cv_macro___extensions___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __EXTENSIONS__ +#error __EXTENSIONS__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___extensions___defined="yes" +else + mhd_cv_macro___extensions___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___extensions___defined" >&5 +$as_echo "$mhd_cv_macro___extensions___defined" >&6; } + if test "x$mhd_cv_macro___extensions___defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept __EXTENSIONS__" >&5 +$as_echo_n "checking whether headers accept __EXTENSIONS__... " >&6; } +if ${mhd_cv_define___extensions___accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define __EXTENSIONS__ 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define___extensions___accepted="yes" +else + mhd_cv_define___extensions___accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define___extensions___accepted" >&5 +$as_echo "$mhd_cv_define___extensions___accepted" >&6; } + if test "x$mhd_cv_define___extensions___accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags __EXTENSIONS__" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define __EXTENSIONS__ 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _NETBSD_SOURCE macro" >&5 +$as_echo_n "checking whether to try _NETBSD_SOURCE macro... " >&6; } +if ${mhd_cv_macro___netbsd___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __NetBSD__ +#error __NetBSD__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___netbsd___defined="yes" +else + mhd_cv_macro___netbsd___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___netbsd___defined" >&5 +$as_echo "$mhd_cv_macro___netbsd___defined" >&6; } + if test "x$mhd_cv_macro___netbsd___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _NETBSD_SOURCE is already defined" >&5 +$as_echo_n "checking whether _NETBSD_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__netbsd_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _NETBSD_SOURCE +#error _NETBSD_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__netbsd_source_defined="yes" +else + mhd_cv_macro__netbsd_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__netbsd_source_defined" >&5 +$as_echo "$mhd_cv_macro__netbsd_source_defined" >&6; } + if test "x$mhd_cv_macro__netbsd_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _NETBSD_SOURCE" >&5 +$as_echo_n "checking whether headers accept _NETBSD_SOURCE... " >&6; } +if ${mhd_cv_define__netbsd_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _NETBSD_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__netbsd_source_accepted="yes" +else + mhd_cv_define__netbsd_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__netbsd_source_accepted" >&5 +$as_echo "$mhd_cv_define__netbsd_source_accepted" >&6; } + if test "x$mhd_cv_define__netbsd_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _NETBSD_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _NETBSD_SOURCE 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _BSD_SOURCE macro" >&5 +$as_echo_n "checking whether to try _BSD_SOURCE macro... " >&6; } +if ${mhd_cv_macro___openbsd___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __OpenBSD__ +#error __OpenBSD__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___openbsd___defined="yes" +else + mhd_cv_macro___openbsd___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___openbsd___defined" >&5 +$as_echo "$mhd_cv_macro___openbsd___defined" >&6; } + if test "x$mhd_cv_macro___openbsd___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _BSD_SOURCE is already defined" >&5 +$as_echo_n "checking whether _BSD_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__bsd_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _BSD_SOURCE +#error _BSD_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__bsd_source_defined="yes" +else + mhd_cv_macro__bsd_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__bsd_source_defined" >&5 +$as_echo "$mhd_cv_macro__bsd_source_defined" >&6; } + if test "x$mhd_cv_macro__bsd_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _BSD_SOURCE" >&5 +$as_echo_n "checking whether headers accept _BSD_SOURCE... " >&6; } +if ${mhd_cv_define__bsd_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _BSD_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__bsd_source_accepted="yes" +else + mhd_cv_define__bsd_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__bsd_source_accepted" >&5 +$as_echo "$mhd_cv_define__bsd_source_accepted" >&6; } + if test "x$mhd_cv_define__bsd_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _BSD_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _BSD_SOURCE 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _TANDEM_SOURCE macro" >&5 +$as_echo_n "checking whether to try _TANDEM_SOURCE macro... " >&6; } +if ${mhd_cv_macro___tandem_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef __TANDEM +#error __TANDEM is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___tandem_defined="yes" +else + mhd_cv_macro___tandem_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___tandem_defined" >&5 +$as_echo "$mhd_cv_macro___tandem_defined" >&6; } + if test "x$mhd_cv_macro___tandem_defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _TANDEM_SOURCE is already defined" >&5 +$as_echo_n "checking whether _TANDEM_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__tandem_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _TANDEM_SOURCE +#error _TANDEM_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__tandem_source_defined="yes" +else + mhd_cv_macro__tandem_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__tandem_source_defined" >&5 +$as_echo "$mhd_cv_macro__tandem_source_defined" >&6; } + if test "x$mhd_cv_macro__tandem_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _TANDEM_SOURCE" >&5 +$as_echo_n "checking whether headers accept _TANDEM_SOURCE... " >&6; } +if ${mhd_cv_define__tandem_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _TANDEM_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__tandem_source_accepted="yes" +else + mhd_cv_define__tandem_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__tandem_source_accepted" >&5 +$as_echo "$mhd_cv_define__tandem_source_accepted" >&6; } + if test "x$mhd_cv_define__tandem_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _TANDEM_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _TANDEM_SOURCE 1 +" + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _ALL_SOURCE macro" >&5 +$as_echo_n "checking whether to try _ALL_SOURCE macro... " >&6; } +if ${mhd_cv_macro_try__all_source+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if !defined(__TOS_MVS__) && !defined (__INTERIX) +#error Target is not z/OS, AIX or Interix +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_try__all_source="yes" +else + mhd_cv_macro_try__all_source="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_try__all_source" >&5 +$as_echo "$mhd_cv_macro_try__all_source" >&6; } + if test "x$mhd_cv_macro_try__all_source" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _ALL_SOURCE is already defined" >&5 +$as_echo_n "checking whether _ALL_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__all_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#ifndef _ALL_SOURCE +#error _ALL_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__all_source_defined="yes" +else + mhd_cv_macro__all_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__all_source_defined" >&5 +$as_echo "$mhd_cv_macro__all_source_defined" >&6; } + if test "x$mhd_cv_macro__all_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _ALL_SOURCE" >&5 +$as_echo_n "checking whether headers accept _ALL_SOURCE... " >&6; } +if ${mhd_cv_define__all_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_added_prolog} +#define _ALL_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++ + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__all_source_accepted="yes" +else + mhd_cv_define__all_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__all_source_accepted" >&5 +$as_echo "$mhd_cv_define__all_source_accepted" >&6; } + if test "x$mhd_cv_define__all_source_accepted" = x"yes"; then : + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags _TANDEM_SOURCE" + mhd_mse_added_prolog="${mhd_mse_added_prolog}#define _TANDEM_SOURCE 1 +" + + +fi + +fi + +fi + + { mhd_mse_added_prolog=; unset mhd_mse_added_prolog;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for final set of defined symbols" >&5 +$as_echo_n "checking for final set of defined symbols... " >&6; } + + for mhd_mse_Flag in $mhd_mse_added_exts_flags + do + case $mhd_mse_Flag in #( + *=*) : + cat >>confdefs.h <<_ACEOF +#define `echo $mhd_mse_Flag | cut -f 1 -d =` `echo $mhd_mse_Flag | cut -f 2 -d = -s` +_ACEOF + + ;; #( + *) : + cat >>confdefs.h <<_ACEOF +#define $mhd_mse_Flag 1 +_ACEOF + + ;; +esac + + done + mhd_mse_result=`echo $mhd_mse_added_exts_flags` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_mse_result" >&5 +$as_echo "$mhd_mse_result" >&6; } + { mhd_mse_result=; unset mhd_mse_result;} + + { mhd_mse_added_exts_flags=; unset mhd_mse_added_exts_flags;} + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -4619,8 +7556,8 @@ -macro_version='2.4.2' -macro_revision='1.3337' +macro_version='2.4.6' +macro_revision='2.4.6' @@ -4634,7 +7571,7 @@ -ltmain="$ac_aux_dir/ltmain.sh" +ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. @@ -4683,7 +7620,7 @@ $ECHO "" } -case "$ECHO" in +case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 @@ -5006,19 +7943,19 @@ # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld -if test "$GCC" = yes; then +if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw + # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; @@ -5032,7 +7969,7 @@ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done - test -z "$LD" && LD="$ac_prog" + test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. @@ -5043,7 +7980,7 @@ with_gnu_ld=unknown ;; esac -elif test "$with_gnu_ld" = yes; then +elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else @@ -5054,32 +7991,32 @@ $as_echo_n "(cached) " >&6 else if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" + lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } @@ -5122,33 +8059,38 @@ else if test -n "$NM"; then # Let the user override the test. - lt_cv_path_NM="$NM" + lt_cv_path_NM=$NM else - lt_nm_to_check="${ac_tool_prefix}nm" + lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" - break + break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" - break + break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but @@ -5159,15 +8101,15 @@ esac fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : @@ -5273,9 +8215,9 @@ fi fi - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) - DUMPBIN="$DUMPBIN -symbols" + DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: @@ -5283,8 +8225,8 @@ esac fi - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" + if test : != "$DUMPBIN"; then + NM=$DUMPBIN fi fi test -z "$NM" && NM=nm @@ -5324,7 +8266,7 @@ $as_echo_n "(cached) " >&6 else i=0 - teststring="ABCD" + teststring=ABCD case $build_os in msdosdjgpp*) @@ -5364,7 +8306,7 @@ lt_cv_sys_max_cmd_len=8192; ;; - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -5415,22 +8357,22 @@ *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do + for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough + test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring @@ -5448,7 +8390,7 @@ fi -if test -n $lt_cv_sys_max_cmd_len ; then +if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else @@ -5466,30 +8408,6 @@ : ${MV="mv -f"} : ${RM="rm -f"} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else @@ -5612,13 +8530,13 @@ reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then + if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi @@ -5743,13 +8661,13 @@ # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. +# 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) @@ -5776,8 +8694,7 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -5873,8 +8790,8 @@ lt_cv_deplibs_check_method=pass_all ;; -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' @@ -5927,6 +8844,9 @@ tpf*) lt_cv_deplibs_check_method=pass_all ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -6081,8 +9001,8 @@ case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib @@ -6094,7 +9014,7 @@ ;; *) # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" + lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac @@ -6110,7 +9030,6 @@ - if test -n "$ac_tool_prefix"; then for ac_prog in ar do @@ -6249,7 +9168,7 @@ ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - if test "$ac_status" -eq 0; then + if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 @@ -6257,7 +9176,7 @@ ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - if test "$ac_status" -ne 0; then + if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi @@ -6270,7 +9189,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } -if test "x$lt_cv_ar_at_file" = xno; then +if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file @@ -6487,7 +9406,7 @@ if test -n "$RANLIB"; then case $host_os in - openbsd*) + bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) @@ -6577,7 +9496,7 @@ symcode='[ABCDGISTW]' ;; hpux*) - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; @@ -6610,14 +9529,44 @@ symcode='[ABCDGIRSTW]' ;; esac +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -6635,21 +9584,24 @@ # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" @@ -6697,11 +9649,11 @@ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST -#elif defined(__osf__) +#elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else @@ -6727,7 +9679,7 @@ { { "@PROGRAM@", (void *) 0 }, _LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; @@ -6747,13 +9699,13 @@ mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" + LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then + test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS @@ -6774,7 +9726,7 @@ rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then + if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= @@ -6827,6 +9779,16 @@ + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } @@ -6839,9 +9801,9 @@ lt_sysroot= -case ${with_sysroot} in #( +case $with_sysroot in #( yes) - if test "$GCC" = yes; then + if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( @@ -6851,8 +9813,8 @@ no|'') ;; #( *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +$as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac @@ -6864,18 +9826,99 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in dd; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes +test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -6884,24 +9927,25 @@ test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) - HPUX_IA64_MODE="32" + HPUX_IA64_MODE=32 ;; *ELF-64*) - HPUX_IA64_MODE="64" + HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then + if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" @@ -6930,9 +9974,50 @@ rm -rf conftest* ;; +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -6955,10 +10040,10 @@ ;; esac ;; - powerpc64le-*) + powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; - powerpc64-*) + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -6977,10 +10062,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*) + powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; - powerpc-*) + powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -6998,7 +10083,7 @@ *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" + SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } @@ -7038,13 +10123,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then + if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" + CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -7056,7 +10142,7 @@ case $lt_cv_prog_gnu_ld in yes*) case $host in - i?86-*-solaris*) + i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) @@ -7065,7 +10151,7 @@ esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" + LD=${LD-ld}_sol2 fi ;; *) @@ -7081,7 +10167,7 @@ ;; esac -need_locks="$enable_libtool_lock" +need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. @@ -7192,7 +10278,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then +if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi @@ -7695,7 +10781,7 @@ $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then + if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the @@ -7713,7 +10799,7 @@ cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 @@ -7752,7 +10838,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 @@ -7781,7 +10867,7 @@ _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 @@ -7794,32 +10880,32 @@ $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then + if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -7827,143 +10913,40 @@ ;; esac -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } @@ -8428,14 +11411,14 @@ *) enable_shared=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac else @@ -8459,14 +11442,14 @@ *) enable_static=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac else @@ -8490,14 +11473,14 @@ *) pic_mode=default # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac else @@ -8505,8 +11488,6 @@ fi -test -z "$pic_mode" && pic_mode=default - @@ -8522,14 +11503,14 @@ *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac else @@ -8543,11 +11524,63 @@ + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test "${with_aix_soname+set}" = set; then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + # This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" +LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' @@ -8596,7 +11629,7 @@ -if test -n "${ZSH_VERSION+set}" ; then +if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi @@ -8635,7 +11668,7 @@ # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then + if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -8646,14 +11679,14 @@ ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except MSVC, +# All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a -with_gnu_ld="$lt_cv_prog_gnu_ld" +with_gnu_ld=$lt_cv_prog_gnu_ld -old_CC="$CC" -old_CFLAGS="$CFLAGS" +old_CC=$CC +old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc @@ -8662,15 +11695,8 @@ test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +func_cc_basename $compiler +cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it @@ -8685,22 +11711,22 @@ else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -8723,13 +11749,13 @@ break fi done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } @@ -8751,22 +11777,22 @@ else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -8789,13 +11815,13 @@ break fi done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } @@ -8816,7 +11842,7 @@ # Use C for the default configuration in the libtool script -lt_save_CC="$CC" +lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8878,7 +11904,7 @@ lt_prog_compiler_no_builtin_flag= -if test "$GCC" = yes; then +if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; @@ -8894,7 +11920,7 @@ lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -8924,7 +11950,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : @@ -8942,17 +11968,18 @@ lt_prog_compiler_static= - if test "$GCC" = yes; then + if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi + lt_prog_compiler_pic='-fPIC' ;; amigaos*) @@ -8963,8 +11990,8 @@ ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -8980,6 +12007,11 @@ # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac ;; darwin* | rhapsody*) @@ -9050,7 +12082,7 @@ case $host_os in aix*) lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else @@ -9058,10 +12090,29 @@ fi ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac ;; hpux9* | hpux10* | hpux11*) @@ -9077,7 +12128,7 @@ ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' + lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) @@ -9088,7 +12139,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. + # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' @@ -9113,6 +12164,12 @@ lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -9210,7 +12267,7 @@ ;; sysv4*MP*) - if test -d /usr/nec ;then + if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi @@ -9239,7 +12296,7 @@ fi case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: + # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; @@ -9271,7 +12328,7 @@ lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -9301,7 +12358,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then +if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; @@ -9333,7 +12390,7 @@ $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -9352,13 +12409,13 @@ fi fi $RM -r conftest* - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } -if test x"$lt_cv_prog_compiler_static_works" = xyes; then +if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= @@ -9478,8 +12535,8 @@ -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } @@ -9491,9 +12548,9 @@ ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + if test no = "$hard_links"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -9536,9 +12593,9 @@ # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if @@ -9553,7 +12610,7 @@ # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. - if test "$GCC" != yes; then + if test yes != "$GCC"; then with_gnu_ld=no fi ;; @@ -9561,7 +12618,7 @@ # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; - openbsd*) + openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) @@ -9574,7 +12631,7 @@ # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility @@ -9596,24 +12653,24 @@ esac fi - if test "$lt_use_gnu_ld_interface" = yes; then + if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' + wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v 2>&1` in + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -9626,7 +12683,7 @@ case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then + if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 @@ -9645,7 +12702,7 @@ case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) @@ -9661,7 +12718,7 @@ allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi @@ -9671,7 +12728,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' + export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -9679,61 +12736,89 @@ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no - if test "$host_os" = linux-dietlibc; then + if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no + && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -9744,42 +12829,47 @@ lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then + if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then + if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -9793,8 +12883,8 @@ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -9812,8 +12902,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -9825,7 +12915,7 @@ ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify @@ -9840,9 +12930,9 @@ # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -9859,15 +12949,15 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac - if test "$ld_shlibs" = no; then + if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= @@ -9883,7 +12973,7 @@ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported @@ -9891,34 +12981,57 @@ ;; aix[4-9]*) - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag="" + no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi ;; esac @@ -9937,13 +13050,21 @@ hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes - file_list_spec='${wl}-f,' + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac - if test "$GCC" = yes; then + if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` + collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -9962,36 +13083,42 @@ ;; esac shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' fi - link_all_deplibs=no + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' else # not using gcc - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' else - shared_flag='${wl}-bM:SRE' + shared_flag='$wl-bM:SRE' fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' fi fi - export_dynamic_flag_spec='${wl}-bexpall' + export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then + if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : @@ -10026,7 +13153,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" + lt_cv_aix_libpath_=/usr/lib:/lib fi fi @@ -10034,17 +13161,17 @@ aix_libpath=$lt_cv_aix_libpath_ fi - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then + if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : @@ -10079,7 +13206,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" + lt_cv_aix_libpath_=/usr/lib:/lib fi fi @@ -10087,21 +13214,33 @@ aix_libpath=$lt_cv_aix_libpath_ fi - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; @@ -10110,7 +13249,7 @@ case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) @@ -10140,16 +13279,17 @@ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" + shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes @@ -10158,18 +13298,18 @@ # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # Assume MSVC wrapper @@ -10178,7 +13318,7 @@ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" + shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -10197,24 +13337,24 @@ hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" + allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; + ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac - if test "$_lt_dar_can_shared" = "yes"; then + if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no @@ -10256,33 +13396,33 @@ ;; hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' + export_dynamic_flag_spec='$wl-E' ;; hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' + export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes @@ -10290,25 +13430,25 @@ ;; hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then + if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) @@ -10320,7 +13460,7 @@ $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -10339,14 +13479,14 @@ fi fi $RM -r conftest* - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -10354,8 +13494,8 @@ ;; esac fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in @@ -10366,7 +13506,7 @@ *) hardcode_direct=yes hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' + export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. @@ -10377,8 +13517,8 @@ ;; irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. @@ -10388,8 +13528,8 @@ if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } @@ -10401,24 +13541,35 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + link_all_deplibs=no else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out @@ -10433,7 +13584,7 @@ newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; @@ -10441,27 +13592,19 @@ *nto* | *qnx*) ;; - openbsd*) + openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no @@ -10472,33 +13615,53 @@ hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes ;; osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -10509,24 +13672,24 @@ solaris*) no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi @@ -10536,11 +13699,11 @@ solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', + # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi @@ -10550,10 +13713,10 @@ ;; sunos4*) - if test "x$host_vendor" = xsequent; then + if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi @@ -10602,43 +13765,43 @@ ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' + no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not + # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' + export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; @@ -10653,10 +13816,10 @@ ;; esac - if test x$host_vendor = xsni; then + if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' + export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi @@ -10664,7 +13827,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no +test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -10690,7 +13853,7 @@ # Assume -lc should be added archive_cmds_need_lc=yes - if test "$enable_shared" = yes && test "$GCC" = yes; then + if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. @@ -10905,14 +14068,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } -if test "$GCC" = yes; then +if test yes = "$GCC"; then case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in @@ -10928,28 +14091,35 @@ ;; esac # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. + # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; + lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } @@ -10963,7 +14133,7 @@ # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else @@ -10972,7 +14142,7 @@ library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" +shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -10989,14 +14159,16 @@ # flags to be left without arguments need_version=unknown + + case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) @@ -11004,41 +14176,91 @@ need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac shlibpath_var=LIBPATH fi ;; @@ -11048,18 +14270,18 @@ powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -11067,8 +14289,8 @@ bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" @@ -11080,7 +14302,7 @@ cygwin* | mingw* | pw32* | cegcc*) version_type=windows - shrext_cmds=".dll" + shrext_cmds=.dll need_version=no need_lib_prefix=no @@ -11089,8 +14311,8 @@ # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ @@ -11106,17 +14328,17 @@ case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' @@ -11125,8 +14347,8 @@ *,cl*) # Native MSVC libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' case $build_os in mingw*) @@ -11153,7 +14375,7 @@ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) - sys_lib_search_path_spec="$LIB" + sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` @@ -11166,8 +14388,8 @@ esac # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' @@ -11180,7 +14402,7 @@ *) # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac @@ -11193,8 +14415,8 @@ version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' @@ -11207,8 +14429,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -11226,12 +14448,13 @@ version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac @@ -11261,10 +14484,10 @@ need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes + shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -11282,14 +14505,15 @@ dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -11297,8 +14521,8 @@ dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; @@ -11307,8 +14531,8 @@ dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... @@ -11321,8 +14545,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -11333,7 +14557,7 @@ case $host_os in nonstopux*) version_type=nonstopux ;; *) - if test "$lt_cv_prog_gnu_ld" = yes; then + if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix @@ -11341,8 +14565,8 @@ esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= @@ -11361,8 +14585,8 @@ esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; @@ -11371,13 +14595,33 @@ dynamic_linker=no ;; +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -11421,7 +14665,12 @@ # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -11453,12 +14702,12 @@ need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -11468,7 +14717,7 @@ newsos6) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -11477,58 +14726,68 @@ version_type=qnx need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; -openbsd*) +openbsd* | bitrig*) version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" + sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no else - shlibpath_overrides_runpath=yes + need_version=yes fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' - shrext_cmds=".dll" + version_type=windows + shrext_cmds=.dll + need_version=no need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) @@ -11539,8 +14798,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -11550,11 +14809,11 @@ sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes @@ -11562,8 +14821,8 @@ sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -11584,24 +14843,24 @@ ;; sysv4*MP*) - if test -d /usr/nec ;then + if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf + version_type=sco need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' @@ -11619,7 +14878,7 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes @@ -11627,8 +14886,8 @@ uts4*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -11638,20 +14897,35 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no +test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then +if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + @@ -11748,15 +15022,15 @@ hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then + test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && + if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else @@ -11771,12 +15045,12 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi @@ -11786,7 +15060,7 @@ - if test "x$enable_dlopen" != xyes; then + if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown @@ -11796,23 +15070,23 @@ case $host_os in beos*) - lt_cv_dlopen="load_add_on" + lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) - lt_cv_dlopen="dlopen" + lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) - # if libdl is installed we need to link against it + # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : @@ -11850,10 +15124,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else - lt_cv_dlopen="dyld" + lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes @@ -11861,10 +15135,18 @@ ;; + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" + lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } @@ -11903,11 +15185,11 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" + lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } @@ -11946,7 +15228,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } @@ -11985,7 +15267,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } @@ -12024,7 +15306,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi @@ -12045,21 +15327,21 @@ ;; esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else + if test no = "$lt_cv_dlopen"; then enable_dlopen=no + else + enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS="$LIBS" + save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 @@ -12067,7 +15349,7 @@ if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -12114,9 +15396,9 @@ # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated +/* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -12146,7 +15428,7 @@ (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -12166,14 +15448,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } - if test "x$lt_cv_dlopen_self" = xyes; then + if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : + if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -12220,9 +15502,9 @@ # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated +/* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -12252,7 +15534,7 @@ (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -12273,9 +15555,9 @@ $as_echo "$lt_cv_dlopen_self_static" >&6; } fi - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS ;; esac @@ -12319,7 +15601,7 @@ # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) - if test -n "$STRIP" ; then + if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -12347,7 +15629,7 @@ - # Report which library types will actually be built + # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 @@ -12355,13 +15637,13 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no + test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test "$enable_shared" = yes && enable_static=no + test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' @@ -12369,8 +15651,12 @@ ;; aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac fi ;; esac @@ -12380,7 +15666,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes + test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } @@ -12394,7 +15680,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -CC="$lt_save_CC" +CC=$lt_save_CC @@ -12524,7 +15810,7 @@ lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" +lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -12558,7 +15844,7 @@ # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= @@ -12566,15 +15852,8 @@ CFLAGS= compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +func_cc_basename $compiler +cc_basename=$func_cc_basename_result lt_cv_prog_compiler_c_o_RC=yes @@ -12596,9 +15875,9 @@ CFLAGS=$lt_save_CFLAGS -PACKAGE_VERSION_MAJOR=${PACKAGE_VERSION%.*.*} -PACKAGE_VERSION_MINOR=${PACKAGE_VERSION%.*}; PACKAGE_VERSION_MINOR=${PACKAGE_VERSION_MINOR#*.} -PACKAGE_VERSION_SUBMINOR=${PACKAGE_VERSION#*.*.} +PACKAGE_VERSION_MAJOR='0' +PACKAGE_VERSION_MINOR='9' +PACKAGE_VERSION_SUBMINOR='55' @@ -12608,9 +15887,651 @@ MHD_LIB_CPPFLAGS="" MHD_LIB_CFLAGS="" MHD_LIB_LDFLAGS="" -# for pkg-config MHD_LIBDEPS="" +# for pkg-config MHD_REQ_PRIVATE='' +MHD_LIBDEPS_PKGCFG='' + + + + +ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default + +" +if test "x$ac_cv_header_stdbool_h" = xyes; then : + + ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " +#include + + +" +if test "x$ac_cv_type_bool" = xyes; then : + + $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Header is present, but \"bool\" type cannot be detected. Check compiler flags." >&5 +$as_echo "$as_me: WARNING: Header is present, but \"bool\" type cannot be detected. Check compiler flags." >&2;} + $as_echo "#define bool int" >>confdefs.h + + +fi + + +else + + ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " + +" +if test "x$ac_cv_type_bool" = xyes; then : + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + +else + + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" " + +" +if test "x$ac_cv_type__Bool" = xyes; then : + + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + + $as_echo "#define bool _Bool" >>confdefs.h + + +else + + $as_echo "#define bool int" >>confdefs.h + + +fi + + +fi + + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"true\" is defined or builtin" >&5 +$as_echo_n "checking whether \"true\" is defined or builtin... " >&6; } +if ${mhd_cv_macro_true_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + +#if defined(true) + /* dummy */ +#else + (void)true; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_true_defined='yes' +else + mhd_cv_macro_true_defined='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_true_defined" >&5 +$as_echo "$mhd_cv_macro_true_defined" >&6; } +if test "x$mhd_cv_macro_true_defined" = x"yes"; then : + : +else + +$as_echo "#define true (!0)" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"false\" is defined or builtin" >&5 +$as_echo_n "checking whether \"false\" is defined or builtin... " >&6; } +if ${mhd_cv_macro_false_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + +#if !defined(false) + (void)false; +#else + /* dummy */ +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_false_defined='yes' +else + mhd_cv_macro_false_defined='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_false_defined" >&5 +$as_echo "$mhd_cv_macro_false_defined" >&6; } +if test "x$mhd_cv_macro_false_defined" = x"yes"; then : + : +else + +$as_echo "#define false 0" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"true\" and \"false\" could be used" >&5 +$as_echo_n "checking whether \"true\" and \"false\" could be used... " >&6; } +if ${mhd_cv_macro_true_false_valid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + + int var1[true ? 1 : -1] = { 1 }; + int var2[false ? -1 : 1] = { 2 }; + int var3[!true ? -1 : 1] = { 3 }; + int var4[!false ? 1 : -1] = { 4 }; + if (var1[0] == var2[0] || var3[0] == var4[0]) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_true_false_valid='yes' +else + mhd_cv_macro_true_false_valid='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_true_false_valid" >&5 +$as_echo "$mhd_cv_macro_true_false_valid" >&6; } +if test "x$mhd_cv_macro_true_false_valid" = x"yes"; then : + : +else + as_fn_error $? "Value of \"true\" or value of \"false\" is not valid. Check config.log for details." "$LINENO" 5 +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=attributes" >&5 +$as_echo_n "checking whether C compiler accepts -Werror=attributes... " >&6; } +if ${ax_cv_check_cflags___Werror_attributes+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Werror=attributes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___Werror_attributes=yes +else + ax_cv_check_cflags___Werror_attributes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_attributes" >&5 +$as_echo "$ax_cv_check_cflags___Werror_attributes" >&6; } +if test "x$ax_cv_check_cflags___Werror_attributes" = xyes; then : + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror=attributes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Werror=attributes actually works" >&5 +$as_echo_n "checking whether -Werror=attributes actually works... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;} +int +main () +{ +int r = SimpleFunc(); if (r) return r; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + errattr_CFLAGS="" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + errattr_CFLAGS="-Werror=attributes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +else + errattr_CFLAGS="" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for function inline keywords suppoted by $CC" >&5 +$as_echo_n "checking for function inline keywords suppoted by $CC... " >&6; } +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $errattr_CFLAGS" +inln_prfx="none" +# Prefer always inline functions +for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline; do + # Try to link to avoid "symbol undefined" problems at build time + if test "x$inln_prfx_chk" = "xInlineWithAttr"; then : + + if test "x$errattr_CFLAGS" = "x"; then : + # Skip test with attribute as negative result can't be detected + inln_prfx_chk="__forceinline" # use next value + +else + inln_prfx_chk="inline __attribute__((always_inline))" +fi + +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +#error This test is only for C. +choke me +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + static $inln_prfx_chk bool cmpfn(int x, int y) + { return x > y; } + static $inln_prfx_chk int sumfn(int x, int y) + { return x + y; } + +int +main () +{ + + int a = 1, b = 100, c; + if (cmpfn(a, b)) + c = sumfn(a, b); + else + c = 0 - sumfn(a, b); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + inln_prfx="$inln_prfx_chk" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test "x$inln_prfx" != "xnone" && break +done +if test "x$inln_prfx" != "xnone"; then : + + +$as_echo "#define INLINE_FUNC 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define _MHD_inline static $inln_prfx +_ACEOF + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $inln_prfx" >&5 +$as_echo "$inln_prfx" >&6; } +CFLAGS="$save_CFLAGS" + +# Check system type +shutdown_trig_select='no' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target host OS" >&5 +$as_echo_n "checking for target host OS... " >&6; } +case "$host_os" in +*darwin* | *rhapsody* | *macosx*) + +cat >>confdefs.h <<_ACEOF +#define OSX 1 +_ACEOF + + CFLAGS="-no-cpp-precomp -fno-common $CFLAGS" + mhd_host_os='Darwin' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +freebsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define FREEBSD 1 +_ACEOF + + mhd_host_os='FreeBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +openbsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define OPENBSD 1 +_ACEOF + + mhd_host_os='OpenBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +netbsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define NETBSD 1 +_ACEOF + + mhd_host_os='NetBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*solaris*) + +cat >>confdefs.h <<_ACEOF +#define SOLARIS 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define _REENTRANT 1 +_ACEOF + + mhd_host_os='Solaris' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 +$as_echo_n "checking for library containing gethostbyname... " >&6; } +if ${ac_cv_search_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_gethostbyname=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_gethostbyname+:} false; then : + break +fi +done +if ${ac_cv_search_gethostbyname+:} false; then : + +else + ac_cv_search_gethostbyname=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 +$as_echo "$ac_cv_search_gethostbyname" >&6; } +ac_res=$ac_cv_search_gethostbyname +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + ;; +*arm-linux*) + +cat >>confdefs.h <<_ACEOF +#define LINUX 1 +_ACEOF + + mhd_host_os='ARM Linux' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + CFLAGS="-fPIC -pipe $CFLAGS" + ;; +*linux*) + +cat >>confdefs.h <<_ACEOF +#define LINUX 1 +_ACEOF + + mhd_host_os='Linux' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*cygwin*) + +cat >>confdefs.h <<_ACEOF +#define CYGWIN 1 +_ACEOF + + mhd_host_os='Windows (Cygwin)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + os_is_windows=yes + ;; +*mingw*) + +cat >>confdefs.h <<_ACEOF +#define MINGW 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WINDOWS 1 +_ACEOF + + mhd_host_os='Windows (MinGW)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + LIBS="$LIBS -lws2_32" + for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "Winsock2 headers are required for W32" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MS lib utility" >&5 +$as_echo_n "checking for MS lib utility... " >&6; } +if ${ac_cv_use_ms_lib_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + mslibcheck=`lib 2>&1` + if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then + ac_cv_use_ms_lib_tool=yes + else + ac_cv_use_ms_lib_tool=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_use_ms_lib_tool" >&5 +$as_echo "$ac_cv_use_ms_lib_tool" >&6; } + if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then + MS_LIB_TOOL=lib + + fi + + os_is_windows=yes + os_is_native_w32=yes + ;; +*openedition*) + +cat >>confdefs.h <<_ACEOF +#define OS390 1 +_ACEOF + + mhd_host_os='OS/390' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*) + mhd_host_os='unrecognised OS' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unrecognised OS $host_os" >&5 +$as_echo "$as_me: WARNING: Unrecognised OS $host_os" >&2;} + +cat >>confdefs.h <<_ACEOF +#define OTHEROS 1 +_ACEOF + +# You might want to find out if your OS supports shutdown on listen sockets, +# and extend the switch statement; if we do not have 'HAVE_LISTEN_SHUTDOWN', +# pipes are used instead to signal 'select'. +# AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets]) +;; +esac # Check whether --with-threads was given. @@ -12620,10 +16541,26 @@ with_threads='auto' fi -test "x$with_threads" = "xwin32" && with_threads='w32' -test "x$with_threads" = "xpthreads" && with_threads='posix' +case $with_threads in #( + win32) : + with_threads='w32' ;; #( + pthreads) : + with_threads='posix' ;; #( + posix) : + : ;; #( + w32) : + : ;; #( + auto) : + : ;; #( + *) : + as_fn_error $? "incorrect parameter \"$with_threads\" specified for --with-threads" "$LINENO" 5 + ;; +esac + +# Check for posix threads support, regardless of configure parameters as +# testsuite use only posix threads. + -# Check for posix threads support ac_ext=c @@ -12635,19 +16572,23 @@ ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). +# requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x"; then : + CC="$PTHREAD_CC" +fi CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 -$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12673,12 +16614,13 @@ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } - if test x"$ax_pthread_ok" = xno; then + if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different @@ -12691,7 +16633,7 @@ # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: @@ -12700,82 +16642,257 @@ # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) -case ${host_os} in +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} +fi +rm -f conftest* + + ;; + solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" +if test "x$GCC" = "xyes"; then : + ax_pthread_flags="-pthread -pthreads $ax_pthread_flags" +fi + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" ;; - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" ;; esac +if test "x$ax_pthread_check_macro" = "x--"; then : + ax_pthread_check_cond=0 +else + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" +fi -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. +# Are we compiling with Clang? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5 -$as_echo_n "checking if compiler needs -Werror to reject unknown flags... " >&6; } -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +$as_echo_n "checking whether $CC is Clang... " >&6; } +if ${ax_cv_PTHREAD_CLANG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int foo(void); -int -main () -{ -foo() - ; - return 0; -} +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - ax_pthread_extra_flags= - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : + ax_cv_PTHREAD_CLANG=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$save_CFLAGS" +rm -f conftest* -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do + fi - case $flag in +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown"; then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x"; then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; + -mt,pthread) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5 +$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; } + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + -*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 -$as_echo_n "checking whether pthreads work with $flag... " >&6; } - PTHREAD_CFLAGS="$flag" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) @@ -12817,22 +16934,24 @@ fi - if test x"$ax_pthread_config" = xno; then continue; fi + if test "x$ax_pthread_config" = "xno"; then : + continue +fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 -$as_echo_n "checking for the pthreads library -l$flag... " >&6; } - PTHREAD_LIBS="-l$flag" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we @@ -12843,9 +16962,13 @@ # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; } int @@ -12867,14 +16990,14 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 $as_echo "$ax_pthread_ok" >&6; } - if test "x$ax_pthread_ok" = xyes; then - break; - fi + if test "x$ax_pthread_ok" = "xyes"; then : + break +fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" @@ -12882,72 +17005,80 @@ fi # Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -int attr = $attr; return attr /* ; */ +int attr = $ax_pthread_attr; return attr /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - attr_name=$attr; break + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 -$as_echo "$attr_name" >&6; } - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : cat >>confdefs.h <<_ACEOF -#define PTHREAD_CREATE_JOINABLE $attr_name +#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR _ACEOF - fi + ax_pthread_joinable_attr_defined=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 -$as_echo_n "checking if more special flags are required for pthreads... " >&6; } - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag" >&5 -$as_echo "$flag" >&6; } - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +$as_echo_n "checking whether more special flags are required for pthreads... " >&6; } +if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"; then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 $as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -12969,23 +17100,26 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 $as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } - if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : $as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + ax_pthread_prio_inherit_defined=yes + fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then + if test "x$GCC" != "xyes"; then case $host_os in aix*) case "x/$CC" in #( x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : #handle absolute path differently from PATH based program lookup - case "x$CC" in #( + case "x$CC" in #( x/*) : if as_fn_executable_p ${CC}_r; then : PTHREAD_CC="${CC}_r" @@ -13050,12 +17184,17 @@ # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then - HAVE_POSIX_THREADS='yes' +if test "x$ax_pthread_ok" = "xyes"; then + + mhd_have_posix_threads='yes' + +$as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h + + : else ax_pthread_ok=no - HAVE_POSIX_THREADS='no' + mhd_have_posix_threads='no' fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -13064,7 +17203,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$HAVE_POSIX_THREADS" = "xyes"; then + if test "x$mhd_have_posix_threads" = "xyes"; then HAVE_POSIX_THREADS_TRUE= HAVE_POSIX_THREADS_FALSE='#' else @@ -13072,12 +17211,14 @@ HAVE_POSIX_THREADS_FALSE= fi -# Simple check for W32 threads support -ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" -if test "x$ac_cv_header_windows_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CreateThread()" >&5 -$as_echo_n "checking for CreateThread()... " >&6; } +mhd_have_w32_threads='no' +if test "x$with_threads" = "xauto"; then : + + if test "x$os_is_windows" = "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for W32 threads" >&5 +$as_echo_n "checking for W32 threads... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -13088,407 +17229,466 @@ ; return 0; } + _ACEOF if ac_fn_c_try_link "$LINENO"; then : + mhd_have_w32_threads='yes' +else + mhd_have_w32_threads='no' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_W32_THREADS='yes' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_have_w32_threads" >&5 +$as_echo "$mhd_have_w32_threads" >&6; } + +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for threading lib to use with libmicrohttpd" >&5 +$as_echo_n "checking for threading lib to use with libmicrohttpd... " >&6; } +if test "x$with_threads" = "xposix"; then : + # forced posix threads + if test "x$mhd_have_posix_threads" = "xyes"; then : + USE_THREADS='posix' else + if test "x$os_is_windows" = "xyes" ; then : + as_fn_error $? "Posix threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 +else + as_fn_error $? "No threading lib is available. Consider installing pthreads" "$LINENO" 5 +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - HAVE_W32_THREADS='no' +fi +elif test "x$with_threads" = "xw32" ; then : + # forced w32 threads + if test "x$mhd_have_w32_threads" = "xyes"; then : + USE_THREADS='w32' +else + as_fn_error $? "W32 threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext else - HAVE_W32_THREADS='no' + # automatic threads lib selection + if test "x$os_is_native_w32" = "xyes" && test "x$mhd_have_w32_threads" = "xyes" ; then : + USE_THREADS='w32' +elif test "x$mhd_have_posix_threads" = "xyes" ; then : + USE_THREADS='posix' +elif test "x$mhd_have_w32_threads" = "xyes" ; then : + USE_THREADS='w32' +else + as_fn_error $? "No threading lib is available. Consider installing pthreads" "$LINENO" 5 + fi +fi +if test "x$USE_THREADS" = "xposix"; then + CC="$PTHREAD_CC" -# Check system type -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target host OS" >&5 -$as_echo_n "checking for target host OS... " >&6; } -case "$host_os" in -*darwin* | *rhapsody* | *macosx*) +$as_echo "#define MHD_USE_POSIX_THREADS 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define OSX 1 -_ACEOF + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS" + MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG" +elif test "x$USE_THREADS" = "xw32"; then - CFLAGS="-no-cpp-precomp -fno-common $CFLAGS" - mhd_host_os='Darwin' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -freebsd*) +$as_echo "#define MHD_USE_W32_THREADS 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SOMEBSD 1 -_ACEOF +fi + if test "x$USE_THREADS" = "xposix"; then + USE_POSIX_THREADS_TRUE= + USE_POSIX_THREADS_FALSE='#' +else + USE_POSIX_THREADS_TRUE='#' + USE_POSIX_THREADS_FALSE= +fi + if test "x$USE_THREADS" = "xw32"; then + USE_W32_THREADS_TRUE= + USE_W32_THREADS_FALSE='#' +else + USE_W32_THREADS_TRUE='#' + USE_W32_THREADS_FALSE= +fi -cat >>confdefs.h <<_ACEOF -#define FREEBSD 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_THREADS" >&5 +$as_echo "$USE_THREADS" >&6; } - mhd_host_os='FreeBSD' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -openbsd*) +# Check whether --enable-thread-names was given. +if test "${enable_thread_names+set}" = set; then : + enableval=$enable_thread_names; +else + enable_thread_names='auto' +fi -cat >>confdefs.h <<_ACEOF -#define SOMEBSD 1 -_ACEOF +if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then + # Check for thread name function + HAVE_THREAD_NAME_FUNC="no" + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + for ac_header in pthread_np.h +do : + ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" " +$ac_includes_default -cat >>confdefs.h <<_ACEOF -#define OPENBSD 1 -_ACEOF +#include - mhd_host_os='OpenBSD' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -netbsd*) -cat >>confdefs.h <<_ACEOF -#define SOMEBSD 1 +" +if test "x$ac_cv_header_pthread_np_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_NP_H 1 _ACEOF +fi -cat >>confdefs.h <<_ACEOF -#define NETBSD 1 -_ACEOF +done - mhd_host_os='NetBSD' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -*solaris*) -cat >>confdefs.h <<_ACEOF -#define SOLARIS 1 -_ACEOF + # Try to find how to set thread name by thread attributes. + # If pthread_attr_setname_np(3) is not declared, it's not possible to detect + # form of pthread_attr_setname_np(3) due to C "feature" "implicit declaration". + ac_fn_c_check_decl "$LINENO" "pthread_attr_setname_np" "ac_cv_have_decl_pthread_attr_setname_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +" +if test "x$ac_cv_have_decl_pthread_attr_setname_np" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define _REENTRANT 1 -_ACEOF +fi - mhd_host_os='Solaris' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 -$as_echo_n "checking for library containing gethostbyname... " >&6; } -if ${ac_cv_search_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + if test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setname_np(3) in NetBSD or OSF1 form" >&5 +$as_echo_n "checking for pthread_attr_setname_np(3) in NetBSD or OSF1 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#include +#ifdef HAVE_PTHREAD_NP_H +#include #endif -char gethostbyname (); + int main () { -return gethostbyname (); + + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name", 0); + pthread_attr_destroy(&thr_attr); + ; return 0; } _ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gethostbyname=$ac_res +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_gethostbyname+:} false; then : - break + conftest$ac_exeext conftest.$ac_ext + fi -done -if ${ac_cv_search_gethostbyname+:} false; then : + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setname_np(3) in IBM i form" >&5 +$as_echo_n "checking for pthread_attr_setname_np(3) in IBM i form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ + + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name"); + pthread_attr_destroy(&thr_attr); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - ac_cv_search_gethostbyname=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 -$as_echo "$ac_cv_search_gethostbyname" >&6; } -ac_res=$ac_cv_search_gethostbyname -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + # Try to find how to set thread name for started thread - less convinent + # than setting name by attributes. + # If pthread_setname_np(3) is not declared, it's not possible to detect + # form of pthread_setname_np(3) due to C "feature" "implicit declaration". + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes"; then : + ac_fn_c_check_decl "$LINENO" "pthread_setname_np" "ac_cv_have_decl_pthread_setname_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +" +if test "x$ac_cv_have_decl_pthread_setname_np" = xyes; then : fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 -$as_echo_n "checking for library containing socket... " >&6; } -if ${ac_cv_search_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in NetBSD or OSF1 form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in NetBSD or OSF1 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#include +#ifdef HAVE_PTHREAD_NP_H +#include #endif -char socket (); + int main () { -return socket (); +int res = pthread_setname_np(pthread_self(), "name", 0); ; return 0; } _ACEOF -for ac_lib in '' socket; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_socket=$ac_res +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_NETBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_socket+:} false; then : - break + conftest$ac_exeext conftest.$ac_ext + fi -done -if ${ac_cv_search_socket+:} false; then : + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in GNU/Linux form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in GNU/Linux form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ +int res = pthread_setname_np(pthread_self(), "name"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_GNU 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - ac_cv_search_socket=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 -$as_echo "$ac_cv_search_socket" >&6; } -ac_res=$ac_cv_search_socket -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext - ;; -*arm-linux*) +fi -cat >>confdefs.h <<_ACEOF -#define LINUX 1 -_ACEOF + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in Darwin form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in Darwin form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif -cat >>confdefs.h <<_ACEOF -#define HAVE_LISTEN_SHUTDOWN 1 +int +main () +{ +int res = pthread_setname_np("name"); + ; + return 0; +} _ACEOF +if ac_fn_c_try_link "$LINENO"; then : - mhd_host_os='ARM Linux' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - CFLAGS="-fPIC -pipe $CFLAGS" - ;; -*linux*) +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_DARWIN 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define LINUX 1 -_ACEOF + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -cat >>confdefs.h <<_ACEOF -#define HAVE_LISTEN_SHUTDOWN 1 -_ACEOF +fi - mhd_host_os='Linux' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -*cygwin*) + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes"; then : -cat >>confdefs.h <<_ACEOF -#define CYGWIN 1 -_ACEOF + ac_fn_c_check_decl "$LINENO" "pthread_set_name_np" "ac_cv_have_decl_pthread_set_name_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif - mhd_host_os='Windows (Cygwin)' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - os_is_windows=yes - ;; -*mingw*) -cat >>confdefs.h <<_ACEOF -#define MINGW 1 -_ACEOF +" +if test "x$ac_cv_have_decl_pthread_set_name_np" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np(3) in FreeBSD form" >&5 +$as_echo_n "checking for pthread_set_name_np(3) in FreeBSD form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -cat >>confdefs.h <<_ACEOF -#define WINDOWS 1 -_ACEOF +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif - mhd_host_os='Windows (MinGW)' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - LIBS="$LIBS -lws2_32" - for ac_header in winsock2.h ws2tcpip.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +int +main () +{ +pthread_set_name_np(pthread_self(), "name"); + ; + return 0; +} _ACEOF +if ac_fn_c_try_link "$LINENO"; then : +$as_echo "#define HAVE_PTHREAD_SET_NAME_NP_FREEBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - as_fn_error $? "Winsock2 headers are required for W32" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -done +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MS lib utility" >&5 -$as_echo_n "checking for MS lib utility... " >&6; } -if ${ac_cv_use_ms_lib_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - mslibcheck=`lib 2>&1` - if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then - ac_cv_use_ms_lib_tool=yes - else - ac_cv_use_ms_lib_tool=no - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_use_ms_lib_tool" >&5 -$as_echo "$ac_cv_use_ms_lib_tool" >&6; } - if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then - MS_LIB_TOOL=lib - fi + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" +fi - os_is_windows=yes - os_is_native_w32=yes - ;; -*openedition*) +if test "x$enable_thread_names" != "xno"; then : -cat >>confdefs.h <<_ACEOF -#define OS390 1 -_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable thread names" >&5 +$as_echo_n "checking whether to enable thread names... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - mhd_host_os='OS/390' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - ;; -*) - mhd_host_os='unrecognised OS' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 -$as_echo "$mhd_host_os" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unrecognised OS $host_os" >&5 -$as_echo "$as_me: WARNING: Unrecognised OS $host_os" >&2;} +int +main () +{ -cat >>confdefs.h <<_ACEOF -#define OTHEROS 1 -_ACEOF +#ifdef MHD_NO_THREAD_NAMES +#error Thread names are disabled. +choke me +#endif -# You might want to find out if your OS supports shutdown on listen sockets, -# and extend the switch statement; if we do not have 'HAVE_LISTEN_SHUTDOWN', -# pipes are used instead to signal 'select'. -# AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets]) -;; -esac +/* Keep in sync with mhd_threads.h */ +#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) || \ + defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || \ + defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) ) +int a = 1; +#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER) +int b = 2; +#else +#error No thread name function is available. +choke me +#endif -if test "x$with_threads" = "xposix"; then -# forced posix threads - if test "x$HAVE_POSIX_THREADS" = "xyes"; then - USE_THREADS='posix' - else - if test "x$HAVE_W32_THREADS" = "xyes"; then - as_fn_error $? "Posix threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 - else - as_fn_error $? "Posix threads are not available" "$LINENO" 5 - fi - fi -elif test "x$with_threads" = "xw32"; then -# forced w32 threads - if test "x$HAVE_W32_THREADS" = "xyes"; then - USE_THREADS='w32' - else - if test "x$HAVE_POSIX_THREADS" = "xyes"; then - as_fn_error $? "W32 threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 - else - as_fn_error $? "W32 threads are not available" "$LINENO" 5 - fi - fi -else -# automatic threads lib selection - if test "x$HAVE_POSIX_THREADS" = "xyes" && test "x$HAVE_W32_THREADS" = "xyes"; then - if test "x$os_is_native_w32" = "xyes"; then - USE_THREADS='w32' - else - USE_THREADS='posix' - fi - elif test "x$HAVE_POSIX_THREADS" = "xyes"; then - USE_THREADS='posix' - elif test "x$HAVE_W32_THREADS" = "xyes"; then - USE_THREADS='w32' - else - as_fn_error $? "No threading lib is available. Cosider installing pthreads" "$LINENO" 5 - fi -fi + ; + return 0; +} -if test "x$USE_THREADS" = "xposix"; then - CC="$PTHREAD_CC" +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : -$as_echo "#define MHD_USE_POSIX_THREADS 1" >>confdefs.h + enable_thread_names='yes' - MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS" - MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS" -elif test "x$USE_THREADS" = "xw32"; then +else -$as_echo "#define MHD_USE_W32_THREADS 1" >>confdefs.h + if test "x$enable_thread_names" = "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "thread names was explicitly requested, but thread name function is not available" "$LINENO" 5 fi - if test "x$USE_THREADS" = "xposix"; then - USE_POSIX_THREADS_TRUE= - USE_POSIX_THREADS_FALSE='#' -else - USE_POSIX_THREADS_TRUE='#' - USE_POSIX_THREADS_FALSE= + enable_thread_names='no' + fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_thread_names" >&5 +$as_echo "$enable_thread_names" >&6; } - if test "x$USE_THREADS" = "xw32"; then - USE_W32_THREADS_TRUE= - USE_W32_THREADS_FALSE='#' -else - USE_W32_THREADS_TRUE='#' - USE_W32_THREADS_FALSE= fi +if test "x$enable_thread_names" = "xno"; then : +$as_echo "#define MHD_NO_THREAD_NAMES 1" >>confdefs.h + +fi if test "x$os_is_native_w32" = "xyes"; then HAVE_W32_TRUE= @@ -13526,6 +17726,474 @@ fi + for ac_header in sys/time.h +do : + ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default +" +if test "x$ac_cv_header_sys_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_TIME_H 1 +_ACEOF + for ac_func in gettimeofday +do : + ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" +if test "x$ac_cv_func_gettimeofday" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETTIMEOFDAY 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in time.h +do : + ac_fn_c_check_header_compile "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default +" +if test "x$ac_cv_header_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIME_H 1 +_ACEOF + for ac_func in nanosleep +do : + ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" +if test "x$ac_cv_func_nanosleep" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NANOSLEEP 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in unistd.h +do : + ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default +" +if test "x$ac_cv_header_unistd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UNISTD_H 1 +_ACEOF + for ac_func in usleep +do : + ac_fn_c_check_func "$LINENO" "usleep" "ac_cv_func_usleep" +if test "x$ac_cv_func_usleep" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_USLEEP 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in string.h sys/types.h sys/socket.h netinet/in.h time.h sys/select.h netinet/tcp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether shutdown of listen socket trigger select()" >&5 +$as_echo_n "checking whether shutdown of listen socket trigger select()... " >&6; } +if ${mhd_cv_host_shtdwn_trgr_select+:} false; then : + $as_echo_n "(cached) " >&6 +else + # On Linux shutdown of listen socket always trigger select(). +# On Windows select() always ignore shutdown of listen socket. +# On other paltforms result may vary depending on platform version. + case $host_os in #( + linux | linux-* | *-linux | *-linux-*) : + mhd_cv_host_shtdwn_trgr_select='yes' ;; #( + mingw*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + cygwin* | msys*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + winnt* | interix*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + mks) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + uwin) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + *) : + mhd_cv_host_shtdwn_trgr_select='maybe' + ;; +esac + + + if test "x$mhd_cv_host_shtdwn_trgr_select" = x"maybe"; then : + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + MHD_CST_SAVE_CC="$CC" + MHD_CST_SAVE_CFLAGS="$CFLAGS" + MHD_CST_SAVE_LIBS="$LIBS" + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + if test "$cross_compiling" = yes; then : + mhd_cv_host_shtdwn_trgr_select='guessing no' +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_TIME_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# ifdef HAVE_NETINET_IN_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef HAVE_NETINET_TCP_H +# include +# endif + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# define MHD_POSIX_SOCKETS 1 +#else +# include +# include +# include + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# define MHD_WINSOCK_SOCKETS 1 +#endif + +#include + + #ifndef SHUT_RD +# define SHUT_RD 0 +#endif +#ifndef SHUT_WR +# define SHUT_WR 1 +#endif +#ifndef SHUT_RDWR +# define SHUT_RDWR 2 +#endif + +#ifndef NULL +# define NULL ((void*)0) +#endif + +#ifdef HAVE_GETTIMEOFDAY +# if defined(_WIN32) && !defined(__CYGWIN__) +# undef HAVE_GETTIMEOFDAY +# endif +#endif + + +#ifdef HAVE_NANOSLEEP +static const struct timespec sm_tmout = {0, 1000}; +# define short_sleep() nanosleep(&sm_tmout, NULL) +#elif defined(HAVE_USLEEP) +# define short_sleep() usleep(1) +#else +# define short_sleep() (void)0 +#endif + +static volatile int going_select = 0; +static volatile int select_ends = 0; +static volatile int gerror = 0; +static int timeout_mils; + +#ifndef HAVE_GETTIMEOFDAY +static volatile long long select_elapsed_time = 0; + +static long long time_chk(void) +{ + long long ret = time(NULL); + if (-1 == ret) + gerror = 4; + return ret; +} +#endif + + +static void* select_thrd_func(void* param) +{ +#ifndef HAVE_GETTIMEOFDAY + long long start, stop; +#endif + fd_set rs; + struct timeval tmot = {0, 0}; + MHD_socket fd = *((MHD_socket*)param); + + FD_ZERO(&rs); + FD_SET(fd, &rs); + tmot.tv_usec = timeout_mils * 1000; +#ifndef HAVE_GETTIMEOFDAY + start = time_chk(); +#endif + going_select = 1; + if (0 > select ((int)(fd) + 1, &rs, NULL, NULL, &tmot)) + gerror = 5; +#ifndef HAVE_GETTIMEOFDAY + stop = time_chk(); + select_elapsed_time = stop - start; +#endif + select_ends = 1; + return NULL; +} + + +static MHD_socket create_socket(void) +{ return socket (AF_INET, SOCK_STREAM, 0); } + +static void close_socket(MHD_socket fd) +{ +#ifdef MHD_POSIX_SOCKETS + close(fd); +#else + closesocket(fd); +#endif +} + +static MHD_socket +create_socket_listen(int port) +{ + MHD_socket fd; + struct sockaddr_in sock_addr; + fd = create_socket(); + if (MHD_INVALID_SOCKET == fd) + return fd; + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons(port); + sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind (fd, (const struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0 || + listen(fd, SOMAXCONN) < 0) + { + close_socket(fd); + return MHD_INVALID_SOCKET; + } + return fd; +} + +#ifdef HAVE_GETTIMEOFDAY +#define diff_time(tv1, tv2) ((long long)(tv1.tv_sec-tv2.tv_sec)*10000 + (long long)(tv1.tv_usec-tv2.tv_usec)/100) +#else +#define diff_time(tv1, tv2) ((long long)(tv1-tv2)) +#endif + +static long long test_run_select(int timeout_millsec, int use_shutdown, long long delay_before_shutdown) +{ + pthread_t select_thrd; + MHD_socket fd; +#ifdef HAVE_GETTIMEOFDAY + struct timeval start, stop; +#else + long long start; +#endif + + fd = create_socket_listen(0); + if (MHD_INVALID_SOCKET == fd) + return -7; + going_select = 0; + select_ends = 0; + gerror = 0; + timeout_mils = timeout_millsec; + if (0 != pthread_create (&select_thrd, NULL, select_thrd_func, (void*)&fd)) + return -8; + while (!going_select) {short_sleep();} +#ifdef HAVE_GETTIMEOFDAY + gettimeofday (&start, NULL); +#else + start = time_chk(); +#endif + if (use_shutdown) + { +#ifdef HAVE_GETTIMEOFDAY + struct timeval current; + do {short_sleep(); gettimeofday(¤t, NULL); } while (delay_before_shutdown > diff_time(current, start)); +#else + while (delay_before_shutdown > time_chk() - start) {short_sleep();} +#endif + shutdown(fd, SHUT_RDWR); + } +#ifdef HAVE_GETTIMEOFDAY + while (!select_ends) {short_sleep();} + gettimeofday (&stop, NULL); +#endif + if (0 != pthread_join(select_thrd, NULL)) + return -9; + close_socket(fd); + if (gerror) + return -10; +#ifdef HAVE_GETTIMEOFDAY + return (long long)diff_time(stop, start); +#else + return select_elapsed_time; +#endif +} + +static int test_it(void) +{ + long long duration2; +#ifdef HAVE_GETTIMEOFDAY + long long duration0, duration1; + duration0 = test_run_select(0, 0, 0); + if (0 > duration0) + return -duration0; + + duration1 = test_run_select(50, 0, 0); + if (0 > duration1) + return -duration1 + 20; + + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 40; + + if (duration1 * 2 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 60; + if (duration1 * 2 > duration2) + return 0; + } +#else + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 80; + + if (4 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 100; + if (4 > duration2) + return 0; + } +#endif + return 1; +} + + +static int init(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + { + WSACleanup(); + return 0; + } +#endif /* MHD_WINSOCK_SOCKETS */ + return 1; +} + +static void cleanup(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ +} + +int main(void) +{ + int res; + if (!init()) + return 19; + + res = test_it(); + + cleanup(); + if (gerror) + return gerror; + + return res; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mhd_cv_host_shtdwn_trgr_select='yes' +else + mhd_cv_host_shtdwn_trgr_select='no' +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CC="$MHD_CST_SAVE_CC" + CFLAGS="$MHD_CST_SAVE_CFLAGS" + LIBS="$MHD_CST_SAVE_LIBS" + { MHD_CST_SAVE_CC=; unset MHD_CST_SAVE_CC;} + { MHD_CST_SAVE_CFLAGS=; unset MHD_CST_SAVE_CFLAGS;} + { MHD_CST_SAVE_LIBS=; unset MHD_CST_SAVE_LIBS;} + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_host_shtdwn_trgr_select" >&5 +$as_echo "$mhd_cv_host_shtdwn_trgr_select" >&6; } + if test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"; then : + +$as_echo "#define HAVE_LISTEN_SHUTDOWN 1" >>confdefs.h + +elif test "x$mhd_cv_host_shtdwn_trgr_select" = "xno"; then : + +fi + + + if test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"; then + HAVE_LISTEN_SHUTDOWN_TRUE= + HAVE_LISTEN_SHUTDOWN_FALSE='#' +else + HAVE_LISTEN_SHUTDOWN_TRUE='#' + HAVE_LISTEN_SHUTDOWN_FALSE= +fi + + # set GCC options # use '-fno-strict-aliasing', but only if the compiler # and linker can take it @@ -13559,7 +18227,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fno_strict_aliasing" >&5 $as_echo "$ax_cv_check_ldflags___fno_strict_aliasing" >&6; } -if test x"$ax_cv_check_ldflags___fno_strict_aliasing" = xyes; then : +if test "x$ax_cv_check_ldflags___fno_strict_aliasing" = xyes; then : @@ -13596,27 +18264,37 @@ eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -if test x"`eval 'as_val=${'$as_CACHEVAR'};$as_echo "$as_val"'`" = xyes; then : - if ${CFLAGS+:} false; then : - case " $CFLAGS " in - *" $flag "*) - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 +if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + +if ${CFLAGS+:} false; then : + + case " $CFLAGS " in #( + *" $flag "*) : + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - ;; - *) - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$flag\""; } >&5 - (: CFLAGS="$CFLAGS $flag") 2>&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CFLAGS " $flag" + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - CFLAGS="$CFLAGS $flag" - ;; - esac + ;; +esac + else - CFLAGS="$flag" + + CFLAGS=$flag + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + fi else @@ -14004,7 +18682,8 @@ if test "$os_is_native_w32" != "yes"; then for ac_header in poll.h do : - ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default +" if test "x$ac_cv_header_poll_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_POLL_H 1 @@ -14134,9 +18813,6 @@ enable_epoll='yes' else - -$as_echo "#define EPOLL_SUPPORT 0" >>confdefs.h - if test "$enable_epoll" = "yes"; then as_fn_error $? "Support for epoll was explicitly requested but cannot be enabled on this platform." "$LINENO" 5 fi @@ -14183,46 +18859,12 @@ fi fi -if test "x$HAVE_POSIX_THREADS" = "xyes"; then - # Check for pthread_setname_np() - SAVE_LIBS="$LIBS" - SAVE_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np" >&5 -$as_echo_n "checking for pthread_setname_np... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ - pthread_setname_np(pthread_self(), "name") - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -$as_echo "#define HAVE_PTHREAD_SETNAME_NP 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$SAVE_LIBS" - CFLAGS="$SAVE_CFLAGS" -fi - # Check for headers that are ALWAYS required -for ac_header in fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h +for ac_header in fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -14236,10 +18878,15 @@ # Check for optional headers -for ac_header in sys/types.h sys/time.h sys/msg.h netdb.h netinet/in.h netinet/tcp.h time.h sys/socket.h sys/mman.h arpa/inet.h sys/select.h search.h endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h +for ac_header in sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \ + sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ + endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ + inttypes.h stddef.h unistd.h \ + sockLib.h inetLib.h net/if.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -14249,25 +18896,135 @@ done - if test "x$ac_cv_header_search_h" = "xyes"; then - HAVE_TSEARCH_TRUE= - HAVE_TSEARCH_FALSE='#' + + + GNULIB_TSEARCH=0; + HAVE_TSEARCH=1; + REPLACE_TSEARCH=0; + +ac_fn_c_check_header_compile "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default +" +if test "x$ac_cv_header_search_h" = xyes; then : + + + + for ac_func in tsearch +do : + ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" +if test "x$ac_cv_func_tsearch" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TSEARCH 1 +_ACEOF + +fi +done + + if test $ac_cv_func_tsearch = yes; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tdelete works" >&5 +$as_echo_n "checking whether tdelete works... " >&6; } +if ${gl_cv_func_tdelete_works+:} false; then : + $as_echo_n "(cached) " >&6 else - HAVE_TSEARCH_TRUE='#' - HAVE_TSEARCH_FALSE= + + if test "$cross_compiling" = yes; then : + case "$host_os" in + openbsd*) gl_cv_func_tdelete_works="guessing no";; + *) gl_cv_func_tdelete_works="guessing yes";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static int +cmp_fn (const void *a, const void *b) +{ + return *(const int *) a - *(const int *) b; +} +int +main () +{ + int result = 0; + int x = 0; + void *root = NULL; + if (!(tfind (&x, &root, cmp_fn) == NULL)) + result |= 1; + tsearch (&x, &root, cmp_fn); + if (!(tfind (&x, &root, cmp_fn) != NULL)) + result |= 2; + if (!(tdelete (&x, &root, cmp_fn) != NULL)) + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_tdelete_works=yes +else + gl_cv_func_tdelete_works=no fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_tdelete_works" >&5 +$as_echo "$gl_cv_func_tdelete_works" >&6; } + case "$gl_cv_func_tdelete_works" in + *no) + REPLACE_TSEARCH=1 + ;; + esac + else + HAVE_TSEARCH=0 + fi + + if test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"; then : + +$as_echo "#define HAVE_SEARCH_H 1" >>confdefs.h + +fi + +fi + + + + if test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"; then + MHD_HAVE_TSEARCH_TRUE= + MHD_HAVE_TSEARCH_FALSE='#' +else + MHD_HAVE_TSEARCH_TRUE='#' + MHD_HAVE_TSEARCH_FALSE= +fi + + +# Check for generic functions +for ac_func in rand random +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" " - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_NETINET_IN_H - #include - #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif " if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes; then : @@ -14279,44 +19036,143 @@ -# Check for pipe/socketpair signaling -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable signaling by socketpair" >&5 -$as_echo_n "checking whether to enable signaling by socketpair... " >&6; } +# Check for inter-thread signaling type +# Check whether --enable-itc was given. +if test "${enable_itc+set}" = set; then : + enableval=$enable_itc; +else + enable_itc='auto' + +fi + + +case $enable_itc in #( + pipe) : + : ;; #( + socketpair) : + : ;; #( + eventfd) : + : ;; #( + auto) : + if test "x$os_is_windows" = x"yes"; then : + enable_itc='socketpair' +fi ;; #( + eventFD) : + enable_itc='eventfd' ;; #( + socket) : + enable_itc='socketpair' ;; #( + no) : + as_fn_error $? "inter-thread communication cannot be disabled" "$LINENO" 5 ;; #( + *) : + as_fn_error $? "unrecognized type \"$enable_itc\" of inter-thread communication specified by \"--enable-itc=$enable_itc\"" "$LINENO" 5 + ;; +esac +# AS_UNSET([[use_itc]]) + +if test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : + +else + + for ac_header in sys/eventfd.h +do : + ac_fn_c_check_header_compile "$LINENO" "sys/eventfd.h" "ac_cv_header_sys_eventfd_h" "$ac_includes_default +" +if test "x$ac_cv_header_sys_eventfd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_EVENTFD_H 1 +_ACEOF + +fi + +done + + if test "x$ac_cv_header_sys_eventfd_h" = x"yes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether eventfd(2) is usable" >&5 +$as_echo_n "checking whether eventfd(2) is usable... " >&6; } +if ${mhd_cv_eventfd_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ +int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK) -# Check whether --enable-socketpair was given. -if test "${enable_socketpair+set}" = set; then : - enableval=$enable_socketpair; + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_eventfd_usable='yes' else - if test "x$os_is_windows" = "xyes"; then : - enable_socketpair=yes + mhd_cv_eventfd_usable='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_eventfd_usable" >&5 +$as_echo "$mhd_cv_eventfd_usable" >&6; } + +fi + +fi + if test "x$mhd_cv_eventfd_usable" = x"yes"; then : + + use_itc='eventfd' + enable_itc="$use_itc" + +$as_echo "#define _MHD_ITC_EVENTFD 1" >>confdefs.h + + else - enable_socketpair=no + + if test "x$enable_itc" = x"eventfd"; then : + as_fn_error $? "eventfd(2) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 +fi + fi fi +if test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : -if test "x$enable_socketpair" != "xno"; then : - if test "x$os_is_windows" = "xyes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced on W32" >&5 -$as_echo "yes, forced on W32" >&6; } else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pipe(3) is usable" >&5 +$as_echo_n "checking whether pipe(3) is usable... " >&6; } +if ${mhd_cv_pipe_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif + +$ac_includes_default +#ifdef HAVE_UNISTD_H +#include +#endif int main () { - int sv[2]; - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) != 0) return 1 + int arr[2]; + int res; + res = pipe(arr) ; return 0; @@ -14324,39 +19180,164 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, socketpair in available" >&5 -$as_echo "yes, socketpair in available" >&6; } + mhd_cv_pipe_usable='yes' else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, socketpair in not available" >&5 -$as_echo "no, socketpair in not available" >&6; } - if test "x$enable_socketpair" = "xyes"; then : - as_fn_error $? "socketpair signalling cannot be enabled." "$LINENO" 5 + mhd_cv_pipe_usable='no' fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_pipe_usable" >&5 +$as_echo "$mhd_cv_pipe_usable" >&6; } fi + if test "x$mhd_cv_pipe_usable" = x"yes"; then : + + use_itc='pipe' + enable_itc="$use_itc" + +$as_echo "#define _MHD_ITC_PIPE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pipe2(2) is usable" >&5 +$as_echo_n "checking whether pipe2(2) is usable... " >&6; } +if ${mhd_cv_pipe2_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +$ac_includes_default +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +int +main () +{ + + int arr[2]; + int res; + res = pipe2(arr, O_CLOEXEC | O_NONBLOCK) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_pipe2_usable='yes' +else + mhd_cv_pipe2_usable='no' +fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_pipe2_usable" >&5 +$as_echo "$mhd_cv_pipe2_usable" >&6; } + if test "x$mhd_cv_pipe2_usable" = x"yes"; then : + +$as_echo "#define HAVE_PIPE2_FUNC 1" >>confdefs.h fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "x$os_is_windows" = "xyes"; then : - as_fn_error $? "socketpair must be enabled on W32" "$LINENO" 5 + if test "x$enable_itc" = x"pipe"; then : + as_fn_error $? "pipe(3) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 +fi + +fi + +fi + +if test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : + mhd_cv_socketpair_usable='yes' +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether socketpair(3) is usable" >&5 +$as_echo_n "checking whether socketpair(3) is usable... " >&6; } +if ${mhd_cv_socketpair_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +$ac_includes_default +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +int +main () +{ + + int arr[2]; + int res; +#if defined(AF_LOCAL) + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr); +#elif defined(AF_UNIX) + res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr); +#else +#error AF_LOCAL and AF_UNIX are both undefined + choke me now; +#endif + if (res != 0) return 1 + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_socketpair_usable='yes' +else + mhd_cv_socketpair_usable='no' fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_socketpair_usable" >&5 +$as_echo "$mhd_cv_socketpair_usable" >&6; } fi -if test "x$enable_socketpair" = "xyes"; then + if test "x$mhd_cv_socketpair_usable" = x"yes"; then : + + use_itc='socketpair' + enable_itc="$use_itc" -$as_echo "#define MHD_DONT_USE_PIPES 1" >>confdefs.h +$as_echo "#define _MHD_ITC_SOCKETPAIR 1" >>confdefs.h + +else + + if test "x$enable_itc" = x"socketpair"; then : + as_fn_error $? "socketpair(3) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 fi +fi + +fi + +if test -z "$use_itc"; then : + as_fn_error $? "cannot find useable type of inter-thread communication" "$LINENO" 5 +fi + + @@ -14377,15 +19358,35 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmtime_s" >&5 -$as_echo_n "checking for gmtime_s... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + +ac_fn_c_check_decl "$LINENO" "gmtime_s" "ac_cv_have_decl_gmtime_s" "#define __STDC_WANT_LIB_EXT1__ 1 +#include +" +if test "x$ac_cv_have_decl_gmtime_s" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gmtime_s is in C11 form" >&5 +$as_echo_n "checking whether gmtime_s is in C11 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#ifdef __cplusplus +extern "C" +#endif + struct tm* gmtime_s(const time_t* time, struct tm* result); + int main () { -struct tm now; time_t t; time (&t); gmtime_s (&now, &t) + + struct tm res; + time_t t; + gmtime_s (&t, &res); + ; return 0; } @@ -14394,9 +19395,45 @@ if ac_fn_c_try_link "$LINENO"; then : -$as_echo "#define HAVE_GMTIME_S 1" >>confdefs.h +$as_echo "#define HAVE_C11_GMTIME_S 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gmtime_s is in W32 form" >&5 +$as_echo_n "checking whether gmtime_s is in W32 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __cplusplus +extern "C" +#endif +errno_t gmtime_s(struct tm* _tm, const time_t* time); + +int +main () +{ + + struct tm res; + time_t t; + gmtime_s (&res, &t); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_W32_GMTIME_S 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else @@ -14407,16 +19444,23 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + ac_fn_c_check_decl "$LINENO" "SOCK_NONBLOCK" "ac_cv_have_decl_SOCK_NONBLOCK" " - #if defined HAVE_SYS_TYPES_H - # include - #endif - #if defined HAVE_SYS_SOCKET_H - # include - #elif defined HAVE_WINSOCK2_H - # include - #endif +#if defined(HAVE_SYS_TYPES_H) +# include +#endif +#if defined(HAVE_SYS_SOCKET_H) +# include +#elif defined(HAVE_WINSOCK2_H) +# include +#endif " if test "x$ac_cv_have_decl_SOCK_NONBLOCK" = xyes; then : @@ -14436,7 +19480,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +ac_fn_c_check_decl "$LINENO" "clock_gettime" "ac_cv_have_decl_clock_gettime" "#include +" +if test "x$ac_cv_have_decl_clock_gettime" = xyes; then : + + SAVE_LIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 @@ -14465,7 +19514,7 @@ ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib $MHD_LIBDEPS $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_clock_gettime=$ac_res @@ -14493,6 +19542,18 @@ $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + if test "x$ac_cv_search_clock_gettime" = x"none required"; then : + +else + + MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" + +fi + +fi + + LIBS="$SAVE_LIBS" fi @@ -14502,8 +19563,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include +#include +#include int main () @@ -14540,7 +19601,16 @@ $as_echo_n "checking for gethrtime... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + +#ifdef HAVE_SYS_TIME_H +/* Solaris define gethrtime() in sys/time.h */ #include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX define gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ + int main () { @@ -14615,31 +19685,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_inet6" >&5 $as_echo "$have_inet6" >&6; } -# TCP_CORK and TCP_NOPUSH -ac_fn_c_check_decl "$LINENO" "TCP_CORK" "ac_cv_have_decl_TCP_CORK" "#include -" -if test "x$ac_cv_have_decl_TCP_CORK" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TCP_CORK $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "TCP_NOPUSH" "ac_cv_have_decl_TCP_NOPUSH" "#include -" -if test "x$ac_cv_have_decl_TCP_NOPUSH" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TCP_NOPUSH $ac_have_decl -_ACEOF - - HIDDEN_VISIBILITY_CFLAGS="" case "$host" in *-*-mingw*) @@ -14679,7 +19724,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fvisibility_hidden" >&5 $as_echo "$ax_cv_check_ldflags___fvisibility_hidden" >&6; } -if test x"$ax_cv_check_ldflags___fvisibility_hidden" = xyes; then : +if test "x$ax_cv_check_ldflags___fvisibility_hidden" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5 $as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; } if ${ax_cv_check_cflags___fvisibility_hidden+:} false; then : @@ -14709,7 +19754,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fvisibility_hidden" >&5 $as_echo "$ax_cv_check_cflags___fvisibility_hidden" >&6; } -if test x"$ax_cv_check_cflags___fvisibility_hidden" = xyes; then : +if test "x$ax_cv_check_cflags___fvisibility_hidden" = xyes; then : $as_echo "#define _MHD_EXTERN __attribute__((visibility(\"default\"))) extern" >>confdefs.h @@ -14996,11 +20041,11 @@ curl_easy_setopt(NULL,CURLOPT_URL,NULL); x=CURL_ERROR_SIZE; x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_FILE; +x=CURLOPT_WRITEDATA; x=CURLOPT_ERRORBUFFER; x=CURLOPT_STDERR; x=CURLOPT_VERBOSE; -if (x) ; +if (x) {;} ; return 0; @@ -15068,8 +20113,6 @@ # protocols are available _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - test -z "$_libcurl_version" && _libcurl_version=0 - if test x$libcurl_feature_SSL = xyes ; then _libcurl_protocols="$_libcurl_protocols HTTPS" @@ -15153,7 +20196,16 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for magic_open in -lmagic" >&5 +mhd_have_magic_open='no' +for ac_header in magic.h +do : + ac_fn_c_check_header_compile "$LINENO" "magic.h" "ac_cv_header_magic_h" "$ac_includes_default +" +if test "x$ac_cv_header_magic_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MAGIC_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for magic_open in -lmagic" >&5 $as_echo_n "checking for magic_open in -lmagic... " >&6; } if ${ac_cv_lib_magic_magic_open+:} false; then : $as_echo_n "(cached) " >&6 @@ -15190,36 +20242,15 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_magic_magic_open" >&5 $as_echo "$ac_cv_lib_magic_magic_open" >&6; } if test "x$ac_cv_lib_magic_magic_open" = xyes; then : - for ac_header in magic.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "magic.h" "ac_cv_header_magic_h" "$ac_includes_default" -if test "x$ac_cv_header_magic_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MAGIC_H 1 -_ACEOF - if true; then - HAVE_MAGIC_TRUE= - HAVE_MAGIC_FALSE='#' -else - HAVE_MAGIC_TRUE='#' - HAVE_MAGIC_FALSE= -fi - -else - if false; then - HAVE_MAGIC_TRUE= - HAVE_MAGIC_FALSE='#' -else - HAVE_MAGIC_TRUE='#' - HAVE_MAGIC_FALSE= + mhd_have_magic_open='yes' fi fi done -else - if false; then + + if test "x$mhd_have_magic_open" = "xyes"; then HAVE_MAGIC_TRUE= HAVE_MAGIC_FALSE='#' else @@ -15227,301 +20258,6 @@ HAVE_MAGIC_FALSE= fi -fi - - - -# optional: libmicrospdy support. Enabled by default if not on W32 -# Check whether --enable-spdy was given. -if test "${enable_spdy+set}" = set; then : - enableval=$enable_spdy; enable_spdy=${enableval} -else - if test "x$os_is_windows" = "xyes"; then : - enable_spdy=no -fi -fi - - -if test "$enable_spdy" != "no" -then - - found=false - -# Check whether --with-openssl was given. -if test "${with_openssl+set}" = set; then : - withval=$with_openssl; - case "$withval" in - "" | y | ye | yes | n | no) - as_fn_error $? "Invalid --with-openssl value" "$LINENO" 5 - ;; - *) ssldirs="$withval" - ;; - esac - -else - - # if pkg-config is installed and openssl has installed a .pc file, - # then use that information and don't search ssldirs - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test x"$PKG_CONFIG" != x""; then - OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` - if test $? = 0; then - OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null` - OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null` - found=true - fi - fi - - # no such luck; use some default ssldirs - if ! $found; then - ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" - fi - - -fi - - - - # note that we #include , so the OpenSSL headers have to be in - # an 'openssl' subdirectory - - if ! $found; then - OPENSSL_INCLUDES= - for ssldir in $ssldirs; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl/ssl.h in $ssldir" >&5 -$as_echo_n "checking for openssl/ssl.h in $ssldir... " >&6; } - if test -f "$ssldir/include/openssl/ssl.h"; then - OPENSSL_INCLUDES="-I$ssldir/include" - OPENSSL_LDFLAGS="-L$ssldir/lib" - OPENSSL_LIBS="-lssl -lcrypto" - found=true - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - break - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - done - - # if the file wasn't found, well, go ahead and try the link anyway -- maybe - # it will just work! - fi - - # try the preprocessor and linker with our new flags, - # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling and linking against OpenSSL works" >&5 -$as_echo_n "checking whether compiling and linking against OpenSSL works... " >&6; } - echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \ - "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&5 - - save_LIBS="$LIBS" - save_LDFLAGS="$LDFLAGS" - save_CPPFLAGS="$CPPFLAGS" - LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" - LIBS="$OPENSSL_LIBS $LIBS" - CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -SSL_new(NULL) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_openssl=yes - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - have_openssl=no - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - - - - - - if test "x$have_openssl" = "xyes" - then - # check OpenSSL headers - SAVE_CPP_FLAGS="$CPPFLAGS" - CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" - for ac_header in openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - have_openssl=yes -else - have_openssl=no -fi - -done - - if test "x$have_openssl" = "xyes" - then - # check OpenSSL libs - SAVE_LIBS="$LIBS" - SAVE_LD_FLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" - LIBS="$OPENSSL_LIBS $LIBS" - ac_fn_c_check_func "$LINENO" "SSL_CTX_set_next_protos_advertised_cb" "ac_cv_func_SSL_CTX_set_next_protos_advertised_cb" -if test "x$ac_cv_func_SSL_CTX_set_next_protos_advertised_cb" = xyes; then : - - ac_fn_c_check_func "$LINENO" "SSL_library_init" "ac_cv_func_SSL_library_init" -if test "x$ac_cv_func_SSL_library_init" = xyes; then : - have_openssl=yes -else - have_openssl=no -fi - - -else - have_openssl=no -fi - - LIBS="$SAVE_LIBS" - LDFLAGS="$SAVE_LD_FLAGS" - fi - CPPFLAGS="$SAVE_CPP_FLAGS" - fi - if test "x$have_openssl" = "xyes" - then - enable_spdy=yes - else - if test "x$enable_spdy" = "xyes" ; then : - as_fn_error $? "libmicrospdy cannot be enabled without OpenSSL." "$LINENO" 5 -fi - have_openssl=no - enable_spdy=no - fi -else - # OpenSSL is used only for libmicrospdy - have_openssl=no -fi - if test "x$have_openssl" = "xyes"; then - HAVE_OPENSSL_TRUE= - HAVE_OPENSSL_FALSE='#' -else - HAVE_OPENSSL_TRUE='#' - HAVE_OPENSSL_FALSE= -fi - - -if test "$enable_spdy" = "yes" -then - -$as_echo "#define SPDY_SUPPORT 1" >>confdefs.h - -else - -$as_echo "#define SPDY_SUPPORT 0" >>confdefs.h - -fi - if test "x$enable_spdy" != "xno"; then - ENABLE_SPDY_TRUE= - ENABLE_SPDY_FALSE='#' -else - ENABLE_SPDY_TRUE='#' - ENABLE_SPDY_FALSE= -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have OpenSSL and thus can support libmicrospdy" >&5 -$as_echo_n "checking whether we have OpenSSL and thus can support libmicrospdy... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_spdy" >&5 -$as_echo "$enable_spdy" >&6; } - -# for pkg-config -SPDY_LIBDEPS="$OPENSSL_LIBS" - -SPDY_LIB_LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" -SPDY_LIB_CFLAGS="$CFLAGS" -SPDY_LIB_CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" - - - -# for pkg-config - - -for ac_header in spdylay/spdylay.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "spdylay/spdylay.h" "ac_cv_header_spdylay_spdylay_h" "$ac_includes_default" -if test "x$ac_cv_header_spdylay_spdylay_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SPDYLAY_SPDYLAY_H 1 -_ACEOF - have_spdylay="yes" -else - have_spdylay="no" -fi - -done - - if test "x$have_spdylay" = "xyes"; then - HAVE_SPDYLAY_TRUE= - HAVE_SPDYLAY_FALSE='#' -else - HAVE_SPDYLAY_TRUE='#' - HAVE_SPDYLAY_FALSE= -fi - # large file support (> 4 GB) # Check whether --enable-largefile was given. @@ -15792,7 +20528,7 @@ fi -for ac_func in _lseeki64 lseek64 sendfile64 +for ac_func in lseek64 sendfile64 pread64 pread do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -15815,18 +20551,15 @@ enable_messages=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_messages" >&5 -$as_echo "$enable_messages" >&6; } -if test "$enable_messages" = "yes" -then +if test "x$enable_messages" = "xyes"; then : $as_echo "#define HAVE_MESSAGES 1" >>confdefs.h else - -$as_echo "#define HAVE_MESSAGES 0" >>confdefs.h - + enable_messages=no fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_messages" >&5 +$as_echo "$enable_messages" >&6; } # optional: have postprocessor? @@ -15839,9 +20572,12 @@ enable_postprocessor=yes fi -test "x$enable_postprocessor" = "xno" || enable_postprocessor=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_postprocessor" >&5 -$as_echo "$enable_postprocessor" >&6; } +if test "x$enable_postprocessor" != "xno"; then : + enable_postprocessor=yes + +$as_echo "#define HAVE_POSTPROCESSOR 1" >>confdefs.h + +fi if test "x$enable_postprocessor" != "xno"; then HAVE_POSTPROCESSOR_TRUE= HAVE_POSTPROCESSOR_FALSE='#' @@ -15850,12 +20586,8 @@ HAVE_POSTPROCESSOR_FALSE= fi -if test "x$enable_postprocessor" != "xno" -then - -$as_echo "#define HAVE_POSTPROCESSOR 1" >>confdefs.h - -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_postprocessor" >&5 +$as_echo "$enable_postprocessor" >&6; } # optional: have zzuf, socat? @@ -15952,10 +20684,25 @@ fi +GNUTLS_CPPFLAGS="" +GNUTLS_LDFLAGS="" +have_gnutls=no +have_gnutls_sni=no +have_gcrypt=no -# libgcrypt linkage: required for HTTPS support +# optional: HTTPS support. Enabled by default +# Check whether --enable-https was given. +if test "${enable_https+set}" = set; then : + enableval=$enable_https; enable_https=${enableval} +fi +if test "x$enable_https" != "xno" +then +# +# Next block is large unindented block +# +# libgcrypt linkage: required for HTTPS support # Check whether --with-libgcrypt-prefix was given. @@ -15965,15 +20712,28 @@ libgcrypt_config_prefix="" fi - if test x$libgcrypt_config_prefix != x ; then - if test x${LIBGCRYPT_CONFIG+set} != xset ; then - LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config + if test x"${LIBGCRYPT_CONFIG}" = x ; then + if test x"${libgcrypt_config_prefix}" != x ; then + LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5 +$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;} + ;; + esac fi fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}libgcrypt-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}libgcrypt-config; ac_word=$2 + # Extract the first word of "libgcrypt-config", so it can be a program name with args. +set dummy libgcrypt-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then : @@ -15999,6 +20759,7 @@ done IFS=$as_save_IFS + test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no" ;; esac fi @@ -16012,67 +20773,10 @@ fi -fi -if test -z "$ac_cv_path_LIBGCRYPT_CONFIG"; then - ac_pt_LIBGCRYPT_CONFIG=$LIBGCRYPT_CONFIG - # Extract the first word of "libgcrypt-config", so it can be a program name with args. -set dummy libgcrypt-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_LIBGCRYPT_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_LIBGCRYPT_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$ac_pt_LIBGCRYPT_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_LIBGCRYPT_CONFIG=$ac_cv_path_ac_pt_LIBGCRYPT_CONFIG -if test -n "$ac_pt_LIBGCRYPT_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_LIBGCRYPT_CONFIG" >&5 -$as_echo "$ac_pt_LIBGCRYPT_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_LIBGCRYPT_CONFIG" = x; then - LIBGCRYPT_CONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIBGCRYPT_CONFIG=$ac_pt_LIBGCRYPT_CONFIG - fi -else - LIBGCRYPT_CONFIG="$ac_cv_path_LIBGCRYPT_CONFIG" -fi - tmp=1.2.2 - if echo "$tmp" | $GREP ':' >/dev/null 2>/dev/null ; then - req_libgcrypt_api=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\1/'` - min_libgcrypt_version=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\2/'` + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_libgcrypt_api=0 min_libgcrypt_version="$tmp" @@ -16083,18 +20787,18 @@ ok=no if test "$LIBGCRYPT_CONFIG" != "no" ; then req_major=`echo $min_libgcrypt_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` req_minor=`echo $min_libgcrypt_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` req_micro=`echo $min_libgcrypt_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` major=`echo $libgcrypt_config_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` minor=`echo $libgcrypt_config_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` micro=`echo $libgcrypt_config_version | \ - $SED 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` if test "$major" -gt "$req_major"; then ok=yes else @@ -16150,7 +20854,7 @@ *** built for $libgcrypt_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libgcrypt-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***" >&5 $as_echo "$as_me: WARNING: *** @@ -16158,8 +20862,9 @@ *** built for $libgcrypt_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libgcrypt-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***" >&2;} + gpg_config_script_warn="$gpg_config_script_warn libgcrypt" fi fi else @@ -16179,7 +20884,8 @@ CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" for ac_header in gcrypt.h do : - ac_fn_c_check_header_mongrel "$LINENO" "gcrypt.h" "ac_cv_header_gcrypt_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "gcrypt.h" "ac_cv_header_gcrypt_h" "$ac_includes_default +" if test "x$ac_cv_header_gcrypt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GCRYPT_H 1 @@ -16196,10 +20902,6 @@ fi # gnutls -GNUTLS_CPPFLAGS="" -GNUTLS_LDFLAGS="" -have_gnutls=no -have_gnutls_sni=no have_gnutls_pkgcfg=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to find GnuTLS library" >&5 $as_echo_n "checking how to find GnuTLS library... " >&6; } @@ -16226,7 +20928,8 @@ have_gnutls_pkgcfg=no for ac_header in gnutls/gnutls.h do : - ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GNUTLS_GNUTLS_H 1 @@ -16498,8 +21201,8 @@ pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUTLS" >&5 -$as_echo_n "checking for GNUTLS... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls" >&5 +$as_echo_n "checking for gnutls... " >&6; } if test -n "$GNUTLS_CFLAGS"; then pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS" @@ -16539,7 +21242,7 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -16557,9 +21260,20 @@ have_gnutls_pkgcfg='no' + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + # Try to use libgcrypt search path + # as libgcrypt flags will be used + # anyway for HTTPs builds + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" for ac_header in gnutls/gnutls.h do : - ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GNUTLS_GNUTLS_H 1 @@ -16602,6 +21316,9 @@ $as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS" GNUTLS_LIBS="-lgnutls" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_load_file in -lgnutls" >&5 $as_echo_n "checking for gnutls_load_file in -lgnutls... " >&6; } @@ -16690,15 +21407,30 @@ done + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_gnutls_pkgcfg='no' + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + # Try to use libgcrypt search path + # as libgcrypt flags will be used + # anyway for HTTPs builds + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" for ac_header in gnutls/gnutls.h do : - ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GNUTLS_GNUTLS_H 1 @@ -16741,6 +21473,9 @@ $as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS" GNUTLS_LIBS="-lgnutls" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_load_file in -lgnutls" >&5 $as_echo_n "checking for gnutls_load_file in -lgnutls... " >&6; } @@ -16829,6 +21564,10 @@ done + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" else GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS @@ -16871,7 +21610,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_gnutls=yes - GNUTLS_CPPLAGS="$GNUTLS_CFLAGS" + GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS" GNUTLS_LDFLAGS="$GNUTLS_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_privkey_import_x509_raw()" >&5 $as_echo_n "checking for gnutls_privkey_import_x509_raw()... " >&6; } @@ -16930,78 +21669,77 @@ as_fn_error $? "can't find usable libgnutls" "$LINENO" 5 fi - if test "x$have_gnutls" = "xyes"; then - HAVE_GNUTLS_TRUE= - HAVE_GNUTLS_FALSE='#' -else - HAVE_GNUTLS_TRUE='#' - HAVE_GNUTLS_FALSE= -fi - if test "x$have_gnutls_sni" = "xyes"; then - HAVE_GNUTLS_SNI_TRUE= - HAVE_GNUTLS_SNI_FALSE='#' -else - HAVE_GNUTLS_SNI_TRUE='#' - HAVE_GNUTLS_SNI_FALSE= -fi - - - -# optional: HTTPS support. Enabled by default -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTPS" >&5 -$as_echo_n "checking whether to support HTTPS... " >&6; } -# Check whether --enable-https was given. -if test "${enable_https+set}" = set; then : - enableval=$enable_https; enable_https=${enableval} -fi - -if test "x$enable_https" != "xno" -then +# +# End of large unindented block +# if test "x$have_gnutls" = "xyes" && test "x$have_gcrypt" = "xyes"; then : $as_echo "#define HTTPS_SUPPORT 1" >>confdefs.h + enable_https=yes + MSG_HTTPS="yes (using libgnutls and libgcrypt)" MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CPPFLAGS" MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CFLAGS" MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS" - enable_https=yes - MSG_HTTPS="yes (using libgnutls and libgcrypt)" + if test "x$have_gnutls_pkgcfg" = "xyes" ; then : + # remove GnuTLS from private libs in .pc file as it defined in Requires.private + MHD_REQ_PRIVATE='gnutls' + MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + +else + + MHD_REQ_PRIVATE='' + MHD_LIBDEPS_PKGCFG="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + +fi else if test "x$have_gnutls" = "xyes"; then : - crypt_missing="libgrypt" + crypt_missing="libgcrypt" elif test "x$have_gcrypt" = "xyes"; then : crypt_missing="libgnutls" else - crypt_missing="libgrypt and libgnutls" + crypt_missing="libgcrypt and libgnutls" fi if test "x$enable_https" = "xyes" ; then : as_fn_error $? "HTTPS support cannot be enabled without $crypt_missing." "$LINENO" 5 fi - -$as_echo "#define HTTPS_SUPPORT 0" >>confdefs.h - enable_https=no MSG_HTTPS="no (lacking $crypt_missing)" fi else - -$as_echo "#define HTTPS_SUPPORT 0" >>confdefs.h - MSG_HTTPS="no (disabled)" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTPS" >&5 +$as_echo_n "checking whether to support HTTPS... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSG_HTTPS" >&5 $as_echo "$MSG_HTTPS" >&6; } + if test "x$have_gnutls" = "xyes"; then + HAVE_GNUTLS_TRUE= + HAVE_GNUTLS_FALSE='#' +else + HAVE_GNUTLS_TRUE='#' + HAVE_GNUTLS_FALSE= +fi + + if test "x$have_gnutls_sni" = "xyes"; then + HAVE_GNUTLS_SNI_TRUE= + HAVE_GNUTLS_SNI_FALSE='#' +else + HAVE_GNUTLS_SNI_TRUE='#' + HAVE_GNUTLS_SNI_FALSE= +fi + if test "x$enable_https" = "xyes"; then ENABLE_HTTPS_TRUE= ENABLE_HTTPS_FALSE='#' @@ -17021,19 +21759,12 @@ enable_bauth=yes fi -if test "x$enable_bauth" != "xno" -then - enable_bauth=yes +if test "x$enable_bauth" != "xno"; then : + enable_bauth=yes $as_echo "#define BAUTH_SUPPORT 1" >>confdefs.h -else - -$as_echo "#define BAUTH_SUPPORT 0" >>confdefs.h - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_bauth" >&5 -$as_echo "$enable_bauth" >&6; } if test "x$enable_bauth" != "xno"; then ENABLE_BAUTH_TRUE= ENABLE_BAUTH_FALSE='#' @@ -17042,6 +21773,8 @@ ENABLE_BAUTH_FALSE= fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_bauth" >&5 +$as_echo "$enable_bauth" >&6; } # optional: HTTP Digest Auth support. Enabled by default { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTP digest authentication" >&5 @@ -17053,19 +21786,12 @@ enable_dauth=yes fi -if test "x$enable_dauth" != "xno" -then - enable_dauth=yes +if test "x$enable_dauth" != "xno"; then : + enable_dauth=yes $as_echo "#define DAUTH_SUPPORT 1" >>confdefs.h -else - -$as_echo "#define DAUTH_SUPPORT 0" >>confdefs.h - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dauth" >&5 -$as_echo "$enable_dauth" >&6; } if test "x$enable_dauth" != "xno"; then ENABLE_DAUTH_TRUE= ENABLE_DAUTH_FALSE='#' @@ -17074,96 +21800,286 @@ ENABLE_DAUTH_FALSE= fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dauth" >&5 +$as_echo "$enable_dauth" >&6; } +# optional: HTTP "Upgrade" support. Enabled by default +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTP \"Upgrade\"" >&5 +$as_echo_n "checking whether to support HTTP \"Upgrade\"... " >&6; } +# Check whether --enable-httpupgrade was given. +if test "${enable_httpupgrade+set}" = set; then : + enableval=$enable_httpupgrade; if test "x$enable_httpupgrade" = x"no"; then : +else + enable_httpupgrade='yes' +fi +else + enable_httpupgrade='yes' +fi -MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" +if test "x$enable_httpupgrade" = x"yes"; then : -# gcov compilation -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile with support for code coverage analysis" >&5 -$as_echo_n "checking whether to compile with support for code coverage analysis... " >&6; } -# Check whether --enable-coverage was given. -if test "${enable_coverage+set}" = set; then : - enableval=$enable_coverage; use_gcov=${enableval} + +$as_echo "#define UPGRADE_SUPPORT 1" >>confdefs.h + +fi + if test "x$enable_httpupgrade" = "xyes"; then + ENABLE_UPGRADE_TRUE= + ENABLE_UPGRADE_FALSE='#' else - use_gcov=no + ENABLE_UPGRADE_TRUE='#' + ENABLE_UPGRADE_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_gcov" >&5 -$as_echo "$use_gcov" >&6; } - if test "x$use_gcov" = "xyes"; then - USE_COVERAGE_TRUE= - USE_COVERAGE_FALSE='#' +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_httpupgrade" >&5 +$as_echo "$enable_httpupgrade" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for calloc()" >&5 +$as_echo_n "checking for calloc()... " >&6; } +if ${mhd_cv_have_func_calloc+:} false; then : + $as_echo_n "(cached) " >&6 else - USE_COVERAGE_TRUE='#' - USE_COVERAGE_FALSE= + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ +void * ptr = calloc(1, 2) + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_have_func_calloc='yes' +else + mhd_cv_have_func_calloc='no' + fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_have_func_calloc" >&5 +$as_echo "$mhd_cv_have_func_calloc" >&6; } +if test "x$mhd_cv_have_func_calloc" = x"yes"; then : +$as_echo "#define HAVE_CALLOC 1" >>confdefs.h +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 -$as_echo_n "checking the number of available CPUs... " >&6; } - CPU_COUNT="0" +# Check for fork() and waitpid(). They are used for tests. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fork()" >&5 +$as_echo_n "checking for fork()... " >&6; } +mhd_have_fork_waitpid='no' +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - case $host_os in #( - *darwin*) : +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif - if test -x /usr/sbin/sysctl; then : +int +main () +{ - sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` - if test sysctl_a; then : + pid_t p = fork (); + if (0 == p) + return 1; - CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` + ; + return 0; +} -fi +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_FORK 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for waitpid()" >&5 +$as_echo_n "checking for waitpid()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + + pid_t p = fork (); + if (0 == p) + return 1; + waitpid (p, (void*)0, 0) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : -fi ;; #( - *linux*) : +$as_echo "#define HAVE_WAITPID 1" >>confdefs.h - if test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + mhd_have_fork_waitpid='yes' - if test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo; then : +else - CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -fi ;; #( +else - *mingw*) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - if test -n "$NUMBER_OF_PROCESSORS"; then : +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext - CPU_COUNT="$NUMBER_OF_PROCESSORS" + if test "x$mhd_have_fork_waitpid" = "xyes"; then + HAVE_FORK_WAITPID_TRUE= + HAVE_FORK_WAITPID_FALSE='#' +else + HAVE_FORK_WAITPID_TRUE='#' + HAVE_FORK_WAITPID_FALSE= +fi -fi ;; #( - *cygwin*) : +MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" + +# gcov compilation +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile with support for code coverage analysis" >&5 +$as_echo_n "checking whether to compile with support for code coverage analysis... " >&6; } +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then : + enableval=$enable_coverage; use_gcov=${enableval} +else + use_gcov=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_gcov" >&5 +$as_echo "$use_gcov" >&6; } + if test "x$use_gcov" = "xyes"; then + USE_COVERAGE_TRUE= + USE_COVERAGE_FALSE='#' +else + USE_COVERAGE_TRUE='#' + USE_COVERAGE_FALSE= +fi + - if test -n "$NUMBER_OF_PROCESSORS"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 +$as_echo_n "checking the number of available CPUs... " >&6; } + CPU_COUNT="0" - CPU_COUNT="$NUMBER_OF_PROCESSORS" + # Try generic methods + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1; then : + : # empty +else + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null; then : + : # empty +else + # Try platform-specific preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( + freebsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( + netbsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( + solaris*) : + command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( + mingw*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + msys*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + cygwin*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + *) : + ;; +esac fi - ;; #( + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1; then : + : # empty +else + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null; then : + : # empty +else + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( + freebsd*) : + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + netbsd*) : + CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + solaris*) : + command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( + mingw*) : + if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c`; then : + : # empty +else + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" +fi ;; #( + msys*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + cygwin*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( *) : ;; esac - - if test "x$CPU_COUNT" = "x0"; then : - - CPU_COUNT="1" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1) " >&5 -$as_echo "unable to detect (assuming 1) " >&6; } +fi + if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 +$as_echo "$CPU_COUNT" >&6; } else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT " >&5 -$as_echo "$CPU_COUNT " >&6; } + CPU_COUNT="1" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 +$as_echo "unable to detect (assuming 1)" >&6; } fi @@ -17174,26 +22090,19 @@ # for pkg-config -if test "x$enable_https" = "xyes" && test "x$have_gnutls_pkgcfg" = "xyes" ; then : - # remove GnuTLS from private libs in .pc file as it defined in Requires.private - MHD_REQ_PRIVATE='gnutls' - MHD_LIBDEPS_PKGCFG="${MHD_LIBDEPS//$GNUTLS_LIBS/}" -else - MHD_REQ_PRIVATE='' - MHD_LIBDEPS_PKGCFG="$MHD_LIBDEPS" -fi +# Used for 'po' directory staff +EMPTY_VAR= - -ac_config_files="$ac_config_files libmicrohttpd.pc libmicrospdy.pc w32/VS2013/microhttpd_dll_res_vc.rc Makefile contrib/Makefile doc/Makefile doc/doxygen/Makefile doc/examples/Makefile m4/Makefile src/Makefile src/include/Makefile src/platform/Makefile src/microhttpd/Makefile src/microspdy/Makefile src/spdy2http/Makefile src/examples/Makefile src/testcurl/Makefile src/testcurl/https/Makefile src/testspdy/Makefile src/testzzuf/Makefile" +ac_config_files="$ac_config_files libmicrohttpd.pc w32/common/microhttpd_dll_res_vc.rc po/configure.acT:po/configure.ac.in Makefile contrib/Makefile doc/Makefile doc/doxygen/Makefile doc/examples/Makefile m4/Makefile src/Makefile src/include/Makefile src/microhttpd/Makefile src/examples/Makefile src/testcurl/Makefile src/testcurl/https/Makefile src/testzzuf/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17352,6 +22261,10 @@ as_fn_error $? "conditional \"USE_MS_LIB_TOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_LISTEN_SHUTDOWN_TRUE}" && test -z "${HAVE_LISTEN_SHUTDOWN_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LISTEN_SHUTDOWN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_CURL_BINARY_TRUE}" && test -z "${HAVE_CURL_BINARY_FALSE}"; then as_fn_error $? "conditional \"HAVE_CURL_BINARY\" was never defined. @@ -17373,8 +22286,8 @@ as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_TSEARCH_TRUE}" && test -z "${HAVE_TSEARCH_FALSE}"; then - as_fn_error $? "conditional \"HAVE_TSEARCH\" was never defined. +if test -z "${MHD_HAVE_TSEARCH_TRUE}" && test -z "${MHD_HAVE_TSEARCH_FALSE}"; then + as_fn_error $? "conditional \"MHD_HAVE_TSEARCH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_CURL_TRUE}" && test -z "${HAVE_CURL_FALSE}"; then @@ -17385,26 +22298,6 @@ as_fn_error $? "conditional \"HAVE_MAGIC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_MAGIC_TRUE}" && test -z "${HAVE_MAGIC_FALSE}"; then - as_fn_error $? "conditional \"HAVE_MAGIC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_MAGIC_TRUE}" && test -z "${HAVE_MAGIC_FALSE}"; then - as_fn_error $? "conditional \"HAVE_MAGIC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_OPENSSL_TRUE}" && test -z "${HAVE_OPENSSL_FALSE}"; then - as_fn_error $? "conditional \"HAVE_OPENSSL\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${ENABLE_SPDY_TRUE}" && test -z "${ENABLE_SPDY_FALSE}"; then - as_fn_error $? "conditional \"ENABLE_SPDY\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_SPDYLAY_TRUE}" && test -z "${HAVE_SPDYLAY_FALSE}"; then - as_fn_error $? "conditional \"HAVE_SPDYLAY\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${HAVE_POSTPROCESSOR_TRUE}" && test -z "${HAVE_POSTPROCESSOR_FALSE}"; then as_fn_error $? "conditional \"HAVE_POSTPROCESSOR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17437,6 +22330,14 @@ as_fn_error $? "conditional \"ENABLE_DAUTH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_UPGRADE_TRUE}" && test -z "${ENABLE_UPGRADE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_UPGRADE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_FORK_WAITPID_TRUE}" && test -z "${HAVE_FORK_WAITPID_FALSE}"; then + as_fn_error $? "conditional \"HAVE_FORK_WAITPID\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USE_COVERAGE_TRUE}" && test -z "${USE_COVERAGE_FALSE}"; then as_fn_error $? "conditional \"USE_COVERAGE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17838,7 +22739,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libmicrohttpd $as_me 0.9.44, which was +This file was extended by GNU Libmicrohttpd $as_me 0.9.55, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17898,13 +22799,15 @@ Configuration commands: $config_commands -Report bugs to ." +Report bugs to . +GNU Libmicrohttpd home page: . +General help using GNU software: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libmicrohttpd config.status 0.9.44 +GNU Libmicrohttpd config.status 0.9.55 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -18042,6 +22945,7 @@ enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' @@ -18089,10 +22993,13 @@ GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' @@ -18157,7 +23064,8 @@ finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' @@ -18251,9 +23159,12 @@ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ nm_file_list_spec \ +lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ @@ -18307,7 +23218,7 @@ file_list_spec_RC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -18334,7 +23245,8 @@ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ reload_cmds_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ @@ -18348,7 +23260,7 @@ postlink_cmds_RC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -18357,19 +23269,16 @@ done ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' -# See if we are running on zsh, and set the options which allow our +# See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then +if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' @@ -18391,8 +23300,8 @@ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "src/microhttpd/microhttpd_dll_res.rc") CONFIG_FILES="$CONFIG_FILES src/microhttpd/microhttpd_dll_res.rc" ;; "libmicrohttpd.pc") CONFIG_FILES="$CONFIG_FILES libmicrohttpd.pc" ;; - "libmicrospdy.pc") CONFIG_FILES="$CONFIG_FILES libmicrospdy.pc" ;; - "w32/VS2013/microhttpd_dll_res_vc.rc") CONFIG_FILES="$CONFIG_FILES w32/VS2013/microhttpd_dll_res_vc.rc" ;; + "w32/common/microhttpd_dll_res_vc.rc") CONFIG_FILES="$CONFIG_FILES w32/common/microhttpd_dll_res_vc.rc" ;; + "po/configure.acT") CONFIG_FILES="$CONFIG_FILES po/configure.acT:po/configure.ac.in" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; @@ -18401,14 +23310,10 @@ "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; - "src/platform/Makefile") CONFIG_FILES="$CONFIG_FILES src/platform/Makefile" ;; "src/microhttpd/Makefile") CONFIG_FILES="$CONFIG_FILES src/microhttpd/Makefile" ;; - "src/microspdy/Makefile") CONFIG_FILES="$CONFIG_FILES src/microspdy/Makefile" ;; - "src/spdy2http/Makefile") CONFIG_FILES="$CONFIG_FILES src/spdy2http/Makefile" ;; "src/examples/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; "src/testcurl/Makefile") CONFIG_FILES="$CONFIG_FILES src/testcurl/Makefile" ;; "src/testcurl/https/Makefile") CONFIG_FILES="$CONFIG_FILES src/testcurl/https/Makefile" ;; - "src/testspdy/Makefile") CONFIG_FILES="$CONFIG_FILES src/testspdy/Makefile" ;; "src/testzzuf/Makefile") CONFIG_FILES="$CONFIG_FILES src/testzzuf/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -19100,55 +24005,52 @@ ;; "libtool":C) - # See if we are running on zsh, and set the options which allow our + # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then + if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi - cfgfile="${ofile}T" + cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. # -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . # The names of the tagged configurations supported by this script. -available_tags="RC " +available_tags='RC ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG @@ -19177,6 +24079,9 @@ # Whether or not to optimize for fast installation. fast_install=$enable_fast_install +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + # Shell to use when invoking shell scripts. SHELL=$lt_SHELL @@ -19288,18 +24193,27 @@ # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec -# The root where to search for dependent libraries,and in which our libraries should be installed. +# The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19390,8 +24304,11 @@ # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen @@ -19484,13 +24401,13 @@ # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute @@ -19542,13 +24459,72 @@ _LT_EOF + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then +if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -19557,7 +24533,7 @@ esac -ltmain="$ac_aux_dir/ltmain.sh" +ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if @@ -19567,165 +24543,6 @@ sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -19812,13 +24629,13 @@ # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_RC -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_RC @@ -19920,37 +24737,43 @@ Cross-compiling: ${cross_compiling} Operating System: ${host_os} Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Inter-thread comm: ${use_itc} libcurl (testing): ${MSG_CURL} Target directory: ${prefix} + Shutdown of listening socket + trigger select: ${mhd_cv_host_shtdwn_trgr_select} Messages: ${enable_messages} Basic auth.: ${enable_bauth} Digest auth.: ${enable_dauth} + HTTP \"Upgrade\": ${enable_httpupgrade} Postproc: ${enable_postprocessor} HTTPS support: ${MSG_HTTPS} poll support: ${enable_poll=no} epoll support: ${enable_epoll=no} build docs: ${enable_doc} build examples: ${enable_examples} - libmicrospdy: ${enable_spdy} - spdylay (testing): ${have_spdylay} " >&5 $as_echo "$as_me: libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: Cross-compiling: ${cross_compiling} Operating System: ${host_os} Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Inter-thread comm: ${use_itc} libcurl (testing): ${MSG_CURL} Target directory: ${prefix} + Shutdown of listening socket + trigger select: ${mhd_cv_host_shtdwn_trgr_select} Messages: ${enable_messages} Basic auth.: ${enable_bauth} Digest auth.: ${enable_dauth} + HTTP \"Upgrade\": ${enable_httpupgrade} Postproc: ${enable_postprocessor} HTTPS support: ${MSG_HTTPS} poll support: ${enable_poll=no} epoll support: ${enable_epoll=no} build docs: ${enable_doc} build examples: ${enable_examples} - libmicrospdy: ${enable_spdy} - spdylay (testing): ${have_spdylay} " >&6;} if test "x$enable_https" = "xyes" @@ -19970,9 +24793,10 @@ " >&6;} fi -if test "x$enable_bauth" != "xyes" -o \ - "x$enable_dauth" != "xyes" -o \ - "x$enable_postprocessor" != "xyes" +if test "x$enable_bauth" != "xyes" || \ + test "x$enable_dauth" != "xyes" || \ + test "x$enable_httpupgrade" != "xyes" || \ + test "x$enable_postprocessor" != "xyes" then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems." >&5 $as_echo "$as_me: WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems." >&6;} diff -Nru libmicrohttpd-0.9.44+dfsg/configure.ac libmicrohttpd-0.9.55/configure.ac --- libmicrohttpd-0.9.44+dfsg/configure.ac 2015-10-01 21:21:49.000000000 +0200 +++ libmicrohttpd-0.9.55/configure.ac 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # This file is part of libmicrohttpd. -# (C) 2006-2015 Christian Grothoff (and other contributing authors) +# (C) 2006-2017 Christian Grothoff (and other contributing authors) # # libmicrohttpd is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published @@ -20,29 +20,20 @@ # Process this file with autoconf to produce a configure script. # # -AC_PREREQ([2.60]) +AC_PREREQ([2.64]) LT_PREREQ([2.4.0]) -AC_INIT([libmicrohttpd],[0.9.44],[libmicrohttpd@gnu.org]) +AC_INIT([GNU Libmicrohttpd],[0.9.55],[libmicrohttpd@gnu.org]) AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) AC_CONFIG_HEADERS([MHD_config.h]) AC_CONFIG_MACRO_DIR([m4]) -AH_TOP([#define _GNU_SOURCE 1]) -LIB_VERSION_CURRENT=44 +LIB_VERSION_CURRENT=55 LIB_VERSION_REVISION=0 -LIB_VERSION_AGE=34 +LIB_VERSION_AGE=43 AC_SUBST(LIB_VERSION_CURRENT) AC_SUBST(LIB_VERSION_REVISION) AC_SUBST(LIB_VERSION_AGE) -LIBSPDY_VERSION_CURRENT=0 -LIBSPDY_VERSION_REVISION=0 -LIBSPDY_VERSION_AGE=0 -AC_SUBST(LIBSPDY_VERSION_CURRENT) -AC_SUBST(LIBSPDY_VERSION_REVISION) -AC_SUBST(LIBSPDY_VERSION_AGE) - - AC_MSG_CHECKING([[whether z/OS special settings are required]]) if test `uname -s` = "OS/390" then @@ -74,14 +65,13 @@ AC_PROG_MAKE_SET AC_CANONICAL_HOST AC_PROG_CC_STDC -AS_IF([[test -n "$ac_cv_prog_cc_stdc" && test "x$ac_cv_prog_cc_stdc" != "xno"]], - [[CFLAGS="$CFLAGS $ac_cv_prog_cc_stdc"]]) +MHD_SYS_EXT LT_INIT([win32-dll]) LT_LANG([Windows Resource]) -PACKAGE_VERSION_MAJOR=${PACKAGE_VERSION%.*.*} -PACKAGE_VERSION_MINOR=${PACKAGE_VERSION%.*}; PACKAGE_VERSION_MINOR=${PACKAGE_VERSION_MINOR#*.} -PACKAGE_VERSION_SUBMINOR=${PACKAGE_VERSION#*.*.} +PACKAGE_VERSION_MAJOR='m4_car(m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' +PACKAGE_VERSION_MINOR='m4_argn(2, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' +PACKAGE_VERSION_SUBMINOR='m4_argn(3, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' AC_SUBST([PACKAGE_VERSION_MAJOR]) AC_SUBST([PACKAGE_VERSION_MINOR]) AC_SUBST([PACKAGE_VERSION_SUBMINOR]) @@ -90,37 +80,174 @@ MHD_LIB_CPPFLAGS="" MHD_LIB_CFLAGS="" MHD_LIB_LDFLAGS="" -# for pkg-config MHD_LIBDEPS="" +# for pkg-config MHD_REQ_PRIVATE='' +MHD_LIBDEPS_PKGCFG='' -AC_ARG_WITH([threads], - [AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])], - [], [with_threads='auto']) -test "x$with_threads" = "xwin32" && with_threads='w32' -test "x$with_threads" = "xpthreads" && with_threads='posix' +AH_TEMPLATE([[HAVE_STDBOOL_H]], [Define to 1 if you have the header file and defines 'bool' type.]) +AH_TEMPLATE([[HAVE_REAL_BOOL]], [Define to 1 if you have the real boolean type.]) +AH_TEMPLATE([[bool]], [Define to type name which will be used as boolean type.]) +AC_CHECK_HEADER([stdbool.h], + [ + AC_CHECK_TYPE([bool], + [ + AC_DEFINE([[HAVE_STDBOOL_H]], [[1]]) + AC_DEFINE([[HAVE_REAL_BOOL]], [[1]]) + ], + [ + AC_MSG_WARN([[Header is present, but "bool" type cannot be detected. Check compiler flags.]]) + AC_DEFINE([[bool]], [[int]]) + ], [ +#include + ] + ) + ], + [ + AC_CHECK_TYPE([bool], + [AC_DEFINE([[HAVE_REAL_BOOL]], [[1]])], + [ + AC_CHECK_TYPE([_Bool], + [ + AC_DEFINE([[HAVE_REAL_BOOL]], [[1]]) + AC_DEFINE([[bool]], [[_Bool]]) + ], + [ + AC_DEFINE([[bool]], [[int]]) + ], [] + ) + ], [] + ) + ], + [AC_INCLUDES_DEFAULT] +) + +AC_CACHE_CHECK([[whether "true" is defined or builtin]], [[mhd_cv_macro_true_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ +#if defined(true) + /* dummy */ +#else + (void)true; +#endif + ]]) + ], [[mhd_cv_macro_true_defined='yes']], [[mhd_cv_macro_true_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_defined]], [["yes"]], [[:]], + [AC_DEFINE([[true]],[[(!0)]], [Define to value interpreted by compiler as boolean "true", if "true" is not defined by system headers.])]) -# Check for posix threads support -AX_PTHREAD([HAVE_POSIX_THREADS='yes'],[HAVE_POSIX_THREADS='no']) -AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$HAVE_POSIX_THREADS" = "xyes"]) -# Simple check for W32 threads support -AC_CHECK_HEADER([windows.h], +AC_CACHE_CHECK([[whether "false" is defined or builtin]], [[mhd_cv_macro_false_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ +#if !defined(false) + (void)false; +#else + /* dummy */ +#endif + ]]) + ], [[mhd_cv_macro_false_defined='yes']], [[mhd_cv_macro_false_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_false_defined]], [["yes"]], [[:]], + [AC_DEFINE([[false]],[[0]], [Define to value interpreted by compiler as boolean "false", if "false" is not defined by system headers.])]) + +AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true_false_valid]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ + int var1[true ? 1 : -1] = { 1 }; + int var2[false ? -1 : 1] = { 2 }; + int var3[!true ? -1 : 1] = { 3 }; + int var4[!false ? 1 : -1] = { 4 }; + if (var1[0] == var2[0] || var3[0] == var4[0]) + return 1; + ]]) + ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]], + [AC_MSG_ERROR([[Value of "true" or value of "false" is not valid. Check config.log for details.]])]) + + +AX_CHECK_COMPILE_FLAG([[-Werror=attributes]], [ - AC_MSG_CHECKING([for CreateThread()]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([#include ], [ HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);])], - [ - AC_MSG_RESULT([yes]) - HAVE_W32_THREADS='yes' - ], + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror=attributes" + AC_MSG_CHECKING([[whether -Werror=attributes actually works]]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])], + [ + AC_MSG_RESULT([[no]]) + errattr_CFLAGS="" + ], [ + AC_MSG_RESULT([[yes]]) + errattr_CFLAGS="-Werror=attributes" + ]) + CFLAGS="$save_CFLAGS" + ], + [[errattr_CFLAGS=""]], [], []) +AC_MSG_CHECKING([[for function inline keywords suppoted by $CC]]) +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $errattr_CFLAGS" +inln_prfx="none" +# Prefer always inline functions +for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline; do + # Try to link to avoid "symbol undefined" problems at build time + AS_IF([[test "x$inln_prfx_chk" = "xInlineWithAttr"]], + [ + AS_IF([[test "x$errattr_CFLAGS" = "x"]], + [[ # Skip test with attribute as negative result can't be detected + inln_prfx_chk="__forceinline" # use next value + ]],[[inln_prfx_chk="inline __attribute__((always_inline))"]]) + ]) + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#ifdef __cplusplus +#error This test is only for C. +choke me +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + static $inln_prfx_chk bool cmpfn(int x, int y) + { return x > y; } + static $inln_prfx_chk int sumfn(int x, int y) + { return x + y; } + ]],[[ + int a = 1, b = 100, c; + if (cmpfn(a, b)) + c = sumfn(a, b); + else + c = 0 - sumfn(a, b); + ]]) + ], + [[ inln_prfx="$inln_prfx_chk" ]]) + test "x$inln_prfx" != "xnone" && break +done +AS_IF([[test "x$inln_prfx" != "xnone"]], [ - AC_MSG_RESULT([no]) - HAVE_W32_THREADS='no' + AC_DEFINE([INLINE_FUNC],[1],[Define to 1 if your C compiler supports inline functions.]) + AC_DEFINE_UNQUOTED([_MHD_inline],[static $inln_prfx],[Define to prefix which will be used with MHD inline functions.]) ]) - ], - [HAVE_W32_THREADS='no']) +AC_MSG_RESULT([[$inln_prfx]]) +CFLAGS="$save_CFLAGS" # Check system type +shutdown_trig_select='no' AC_MSG_CHECKING([[for target host OS]]) case "$host_os" in *darwin* | *rhapsody* | *macosx*) @@ -157,14 +284,12 @@ ;; *arm-linux*) AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) - AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets]) mhd_host_os='ARM Linux' AC_MSG_RESULT([[$mhd_host_os]]) CFLAGS="-fPIC -pipe $CFLAGS" ;; *linux*) AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) - AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets]) mhd_host_os='Linux' AC_MSG_RESULT([[$mhd_host_os]]) ;; @@ -180,7 +305,7 @@ mhd_host_os='Windows (MinGW)' AC_MSG_RESULT([[$mhd_host_os]]) LIBS="$LIBS -lws2_32" - AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],, AC_MSG_ERROR([[Winsock2 headers are required for W32]])) + AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT]) AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool], [[mslibcheck=`lib 2>&1` if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then @@ -213,56 +338,279 @@ ;; esac -if test "x$with_threads" = "xposix"; then -# forced posix threads - if test "x$HAVE_POSIX_THREADS" = "xyes"; then - USE_THREADS='posix' - else - if test "x$HAVE_W32_THREADS" = "xyes"; then - AC_MSG_ERROR([[Posix threads are not available. Try to configure --with-threads=auto]]) - else - AC_MSG_ERROR([[Posix threads are not available]]) - fi - fi -elif test "x$with_threads" = "xw32"; then -# forced w32 threads - if test "x$HAVE_W32_THREADS" = "xyes"; then - USE_THREADS='w32' - else - if test "x$HAVE_POSIX_THREADS" = "xyes"; then - AC_MSG_ERROR([[W32 threads are not available. Try to configure --with-threads=auto]]) - else - AC_MSG_ERROR([[W32 threads are not available]]) - fi - fi -else -# automatic threads lib selection - if test "x$HAVE_POSIX_THREADS" = "xyes" && test "x$HAVE_W32_THREADS" = "xyes"; then - if test "x$os_is_native_w32" = "xyes"; then - USE_THREADS='w32' - else - USE_THREADS='posix' - fi - elif test "x$HAVE_POSIX_THREADS" = "xyes"; then - USE_THREADS='posix' - elif test "x$HAVE_W32_THREADS" = "xyes"; then - USE_THREADS='w32' - else - AC_MSG_ERROR([[No threading lib is available. Cosider installing pthreads]]) - fi -fi +AC_ARG_WITH([threads], + [AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])], + [], [with_threads='auto']) +AS_CASE([[$with_threads]], + [[win32]], [[with_threads='w32']], + [[pthreads]], [[with_threads='posix']], + [[posix]], [[:]], + [[w32]], [[:]], + [[auto]], [[:]], + [AC_MSG_ERROR([[incorrect parameter "$with_threads" specified for --with-threads]])] +) + +# Check for posix threads support, regardless of configure parameters as +# testsuite use only posix threads. +AX_PTHREAD( + [ + mhd_have_posix_threads='yes' + AC_DEFINE([[HAVE_PTHREAD_H]],[[1]],[Define to 1 if you have the header file.]) + ],[[mhd_have_posix_threads='no']]) +AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$mhd_have_posix_threads" = "xyes"]) +mhd_have_w32_threads='no' +AS_IF([[test "x$with_threads" = "xauto"]], + [ + AS_IF([[test "x$os_is_windows" = "xyes"]], + [ + AC_MSG_CHECKING([[for W32 threads]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ], [ HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);])] + , [[mhd_have_w32_threads='yes']], [[mhd_have_w32_threads='no']] + ) + AC_MSG_RESULT([[$mhd_have_w32_threads]]) + ]) + ] +) + +AC_MSG_CHECKING([[for threading lib to use with libmicrohttpd]]) +AS_IF([[test "x$with_threads" = "xposix"]], + [ # forced posix threads + AS_IF([[test "x$mhd_have_posix_threads" = "xyes"]], [[ USE_THREADS='posix' ]], + [ AS_IF([[test "x$os_is_windows" = "xyes"]] , + [ AC_MSG_ERROR([[Posix threads are not available. Try to configure --with-threads=auto]])], + [ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]])] ) + ]) + ] , + [[ test "x$with_threads" = "xw32" ]] , + [ # forced w32 threads + AS_IF([[test "x$mhd_have_w32_threads" = "xyes"]], + [[ USE_THREADS='w32' ]], + [ AC_MSG_ERROR([[W32 threads are not available. Try to configure --with-threads=auto]])]) + ] , + [ # automatic threads lib selection + AS_IF([[test "x$os_is_native_w32" = "xyes" && test "x$mhd_have_w32_threads" = "xyes"]] , + [[ USE_THREADS='w32' ]] , + [[ test "x$mhd_have_posix_threads" = "xyes" ]], [[ USE_THREADS='posix' ]], + [[ test "x$mhd_have_w32_threads" = "xyes" ]], [[ USE_THREADS='w32' ]], + [ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]]) ] + ) + ] + ) if test "x$USE_THREADS" = "xposix"; then CC="$PTHREAD_CC" AC_DEFINE([MHD_USE_POSIX_THREADS],[1],[define to use pthreads]) MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS" MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG" elif test "x$USE_THREADS" = "xw32"; then AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads]) fi AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"]) AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"]) +AC_MSG_RESULT([[$USE_THREADS]]) + +AC_ARG_ENABLE([[thread-names]], + [AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD generated threads])], + [], [enable_thread_names='auto']) + +if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then + # Check for thread name function + HAVE_THREAD_NAME_FUNC="no" + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + AC_CHECK_HEADERS([pthread_np.h],[],[], + [ +AC_INCLUDES_DEFAULT + [ +#include + ] + ]) + + # Try to find how to set thread name by thread attributes. + # If pthread_attr_setname_np(3) is not declared, it's not possible to detect + # form of pthread_attr_setname_np(3) due to C "feature" "implicit declaration". + AC_CHECK_DECL([[pthread_attr_setname_np]],[],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]]) + + AS_IF([[test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in NetBSD or OSF1 form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[ + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name", 0); + pthread_attr_destroy(&thr_attr); + ]])], + [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_attr_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in IBM i form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[ + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name"); + pthread_attr_destroy(&thr_attr); + ]])], + [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI]], [[1]], [Define if you have IBM i form of pthread_attr_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + # Try to find how to set thread name for started thread - less convinent + # than setting name by attributes. + # If pthread_setname_np(3) is not declared, it's not possible to detect + # form of pthread_setname_np(3) due to C "feature" "implicit declaration". + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]], + [AC_CHECK_DECL([[pthread_setname_np]],[],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + ]]) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np(pthread_self(), "name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have GNU/Linux form of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np("name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you have Darwin form of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]], + [ + AC_CHECK_DECL([[pthread_set_name_np]], + [ + AC_MSG_CHECKING([[for pthread_set_name_np(3) in FreeBSD form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[pthread_set_name_np(pthread_self(), "name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if you have FreeBSD form of pthread_set_name_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + ]] + ) + ]) + + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" +fi + +AS_IF( + [[test "x$enable_thread_names" != "xno"]], + [ + AC_MSG_CHECKING([[whether to enable thread names]]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[ +#ifdef MHD_NO_THREAD_NAMES +#error Thread names are disabled. +choke me +#endif + +/* Keep in sync with mhd_threads.h */ +#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) || \ + defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || \ + defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) ) +int a = 1; +#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER) +int b = 2; +#else +#error No thread name function is available. +choke me +#endif + ]]) + ], [ + enable_thread_names='yes' + ], [ + AS_IF([[test "x$enable_thread_names" = "xyes"]], + [ + AC_MSG_RESULT([[no]]) + AC_MSG_ERROR([[thread names was explicitly requested, but thread name function is not available]]) + ]) + enable_thread_names='no' + ]) + AC_MSG_RESULT([[$enable_thread_names]]) + ]) + +AS_IF([[test "x$enable_thread_names" = "xno"]], + [AC_DEFINE([[MHD_NO_THREAD_NAMES]], [[1]], [Define to 1 to disable setting name on generated threads])]) AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"]) w32_shared_lib_exp=no @@ -277,6 +625,9 @@ AM_CONDITIONAL(W32_SHARED_LIB_EXP, [test "x$w32_shared_lib_exp" = "xyes"]) AM_CONDITIONAL(USE_MS_LIB_TOOL, [test "x$ac_cv_use_ms_lib_tool" = "xyes"]) +MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can use shutdown on listen sockets])]) +AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]) + # set GCC options # use '-fno-strict-aliasing', but only if the compiler # and linker can take it @@ -315,7 +666,7 @@ AC_CHECK_HEADERS([poll.h], [ AC_CHECK_FUNCS([poll], [have_poll='yes'], [have_poll='no']) - ]) + ], [], [AC_INCLUDES_DEFAULT]) else AC_MSG_CHECKING([for WSAPoll()]) AC_LINK_IFELSE([ @@ -343,10 +694,9 @@ if test "$enable_epoll" != "no"; then AX_HAVE_EPOLL if test "${ax_cv_have_epoll}" = "yes"; then - AC_DEFINE([EPOLL_SUPPORT],[1],[define to 1 to enable epoll support]) + AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll support]) enable_epoll='yes' else - AC_DEFINE([EPOLL_SUPPORT],[0],[define to 0 to disable epoll support]) if test "$enable_epoll" = "yes"; then AC_MSG_ERROR([[Support for epoll was explicitly requested but cannot be enabled on this platform.]]) fi @@ -366,125 +716,259 @@ AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 function.])]) fi -if test "x$HAVE_POSIX_THREADS" = "xyes"; then - # Check for pthread_setname_np() - SAVE_LIBS="$LIBS" - SAVE_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - AC_MSG_CHECKING([[for pthread_setname_np]]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], [[ pthread_setname_np(pthread_self(), "name")]])], - [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.]) - AC_MSG_RESULT([[yes]])], - [AC_MSG_RESULT([[no]])] ) - LIBS="$SAVE_LIBS" - CFLAGS="$SAVE_CFLAGS" -fi - # Check for headers that are ALWAYS required -AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h],,AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])) +AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h], [], [AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])], [AC_INCLUDES_DEFAULT]) # Check for optional headers -AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h netdb.h netinet/in.h netinet/tcp.h time.h sys/socket.h sys/mman.h arpa/inet.h sys/select.h search.h endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h]) -AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) +AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \ + sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ + endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ + inttypes.h stddef.h unistd.h \ + sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_HEADER([[search.h]], + [ + gl_FUNC_TSEARCH + AS_IF([[test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]], + [AC_DEFINE([[HAVE_SEARCH_H]], [[1]], + [Define to 1 if you have the header file and your system have properly functioning tsearch(), tfind() and tdelete() functions])]) + ], + [], [AC_INCLUDES_DEFAULT]) + +AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]]) + +# Check for generic functions +AC_CHECK_FUNCS([rand random]) AC_CHECK_MEMBER([struct sockaddr_in.sin_len], [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ], [], [ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - #ifdef HAVE_NETINET_IN_H - #include - #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif ]) -# Check for pipe/socketpair signaling -AC_MSG_CHECKING([[whether to enable signaling by socketpair]]) +# Check for inter-thread signaling type +AC_ARG_ENABLE([[itc]], + [AS_HELP_STRING([[--enable-itc=TYPE]], [use TYPE of inter-thread communication (pipe, socketpair, eventfd) [auto]])], [], + [[enable_itc='auto']] +) + +AS_CASE([[$enable_itc]], + [[pipe]], [[:]], + [[socketpair]], [[:]], + [[eventfd]], [[:]], + [[auto]], [AS_VAR_IF([[os_is_windows]], [["yes"]], [[enable_itc='socketpair']])], + [[eventFD]], [[enable_itc='eventfd']], + [[socket]], [[enable_itc='socketpair']], + [[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])], + [AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])] +) +# AS_UNSET([[use_itc]]) + +AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ + AC_CHECK_HEADERS([[sys/eventfd.h]], [], [], [AC_INCLUDES_DEFAULT]) + AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [ + AC_CACHE_CHECK([whether eventfd(2) is usable], [[mhd_cv_eventfd_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]], [[int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK) + ]]) + ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']]) + ]) + ]) + ]) + AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [ + use_itc='eventfd' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication]) + ], [ + AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) + +AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ + AC_CACHE_CHECK([[whether pipe(3) is usable]], [[mhd_cv_pipe_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_UNISTD_H +#include +#endif + ], [[ + int arr[2]; + int res; + res = pipe(arr) + ]]) + ], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']]) + ]) + ]) + AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [ + use_itc='pipe' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) + AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + ], [[ + int arr[2]; + int res; + res = pipe2(arr, O_CLOEXEC | O_NONBLOCK) + ]]) + ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']]) + ]) + AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]], + [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]) + ], [ + AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) + +AS_IF([[test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [[mhd_cv_socketpair_usable='yes']], [ + AC_CACHE_CHECK([[whether socketpair(3) is usable]], [[mhd_cv_socketpair_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + ], [[ + int arr[2]; + int res; +#if defined(AF_LOCAL) + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr); +#elif defined(AF_UNIX) + res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr); +#else +#error AF_LOCAL and AF_UNIX are both undefined + choke me now; +#endif + if (res != 0) return 1 + ]]) + ], [[mhd_cv_socketpair_usable='yes']], [[mhd_cv_socketpair_usable='no']]) + ]) + ]) + AS_VAR_IF([[mhd_cv_socketpair_usable]], [["yes"]], [ + use_itc='socketpair' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_SOCKETPAIR]], [[1]], [Define to use socketpair for inter-thread communication]) + ], [ + AS_VAR_IF([[enable_itc]], [["socketpair"]], [AC_MSG_ERROR([[socketpair(3) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) -AC_ARG_ENABLE([[socketpair]], - [AS_HELP_STRING([[--enable-socketpair[=ARG]]], [disable internal singalling by pipes and use socket pair instead (yes, no, try) [no]])], , - [AS_IF([[test "x$os_is_windows" = "xyes"]], [enable_socketpair=yes], [enable_socketpair=no])] - ) +AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find useable type of inter-thread communication]])]) -AS_IF( - [[test "x$enable_socketpair" != "xno"]], - [AS_IF([[test "x$os_is_windows" = "xyes"]], - [ AC_MSG_RESULT([[yes, forced on W32]]) ], - [ AC_LINK_IFELSE( - [ AC_LANG_PROGRAM([[ - #ifdef HAVE_SYS_TYPES_H - #include - #endif - #ifdef HAVE_SYS_SOCKET_H - #include - #endif - ]],[[ - int sv[2]; - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) != 0) return 1 - ]]) - ], - [ AC_MSG_RESULT([[yes, socketpair in available]]) ], - [ AC_MSG_RESULT([[no, socketpair in not available]]) - AS_IF([[test "x$enable_socketpair" = "xyes"]], [ AC_MSG_ERROR([[socketpair signalling cannot be enabled.]]) ]) - ] - ) - ] - ) - ], - [ - AC_MSG_RESULT([[no]]) - AS_IF([[test "x$os_is_windows" = "xyes"]], [ AC_MSG_ERROR([[socketpair must be enabled on W32]]) ]) - ] - ) -if test "x$enable_socketpair" = "xyes"; then - AC_DEFINE([[MHD_DONT_USE_PIPES]], [[1]], [Define to use pair of sockets instead of pipes for signaling]) -fi -AC_CHECK_FUNCS_ONCE([memmem accept4]) -AC_MSG_CHECKING([[for gmtime_s]]) -AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ #include ]], [[struct tm now; time_t t; time (&t); gmtime_s (&now, &t)]]) - ], +AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf]) +AC_CHECK_DECL([gmtime_s], [ - AC_DEFINE([HAVE_GMTIME_S], [1], [Define to 1 if you have `gmtime_s' function (only for W32).]) - AC_MSG_RESULT([[yes]]) - ], - [AC_MSG_RESULT([[no]]) - ]) + AC_MSG_CHECKING([[whether gmtime_s is in C11 form]]) + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM( + [[ +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#ifdef __cplusplus +extern "C" +#endif + struct tm* gmtime_s(const time_t* time, struct tm* result); + ]], [[ + struct tm res; + time_t t; + gmtime_s (&t, &res); + ]]) + ], + [ + AC_DEFINE([HAVE_C11_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in C11 form.]) + AC_MSG_RESULT([[yes]]) + ], + [ + AC_MSG_RESULT([[no]]) + AC_MSG_CHECKING([[whether gmtime_s is in W32 form]]) + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM( + [[ +#include +#ifdef __cplusplus +extern "C" +#endif +errno_t gmtime_s(struct tm* _tm, const time_t* time); + ]], [[ + struct tm res; + time_t t; + gmtime_s (&res, &t); + ]]) + ], + [ + AC_DEFINE([HAVE_W32_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in W32 form.]) + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ]) + ]) + ], [], + [[#define __STDC_WANT_LIB_EXT1__ 1 +#include ]]) AC_CHECK_DECLS([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONBLOCK is defined in a socket header])], [], [ - #if defined HAVE_SYS_TYPES_H - # include - #endif - #if defined HAVE_SYS_SOCKET_H - # include - #elif defined HAVE_WINSOCK2_H - # include - #endif +#if defined(HAVE_SYS_TYPES_H) +# include +#endif +#if defined(HAVE_SYS_SOCKET_H) +# include +#elif defined(HAVE_WINSOCK2_H) +# include +#endif ]) -AC_SEARCH_LIBS([clock_gettime], [rt], [ - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Have clock_gettime]) -]) +AC_CHECK_DECL([[clock_gettime]], + [ + SAVE_LIBS="$LIBS" + AC_SEARCH_LIBS([clock_gettime], [rt], + [ + AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime]) + AS_VAR_IF([[ac_cv_search_clock_gettime]],[["none required"]], [], + [ + MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" + ]) + ], [], [$MHD_LIBDEPS]) + LIBS="$SAVE_LIBS" + ], [], [[#include ]]) AC_MSG_CHECKING([[for clock_get_time]]) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ - #include - #include +#include +#include ]], [[ clock_serv_t cs; @@ -504,7 +988,16 @@ AC_MSG_CHECKING([[for gethrtime]]) AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[#include ]], [[hrtime_t hrt = gethrtime(); ]]) + [[ +#ifdef HAVE_SYS_TIME_H +/* Solaris define gethrtime() in sys/time.h */ +#include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX define gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ + ]], [[hrtime_t hrt = gethrtime(); ]]) ], [ AC_DEFINE([HAVE_GETHRTIME], [1], [Define to 1 if you have `gethrtime' function.]) @@ -542,9 +1035,6 @@ ]) AC_MSG_RESULT($have_inet6) -# TCP_CORK and TCP_NOPUSH -AC_CHECK_DECLS([TCP_CORK, TCP_NOPUSH], [], [], [[#include ]]) - HIDDEN_VISIBILITY_CFLAGS="" case "$host" in *-*-mingw*) @@ -589,119 +1079,43 @@ fi AM_CONDITIONAL([HAVE_CURL], [test "x$enable_curl" = "xyes"]) -AC_CHECK_LIB([[magic]], [[magic_open]], - [AC_CHECK_HEADERS([magic.h], - AM_CONDITIONAL(HAVE_MAGIC, true), - AM_CONDITIONAL(HAVE_MAGIC, false))], - AM_CONDITIONAL(HAVE_MAGIC, false)) +mhd_have_magic_open='no' +AC_CHECK_HEADERS([[magic.h]], + [ AC_CHECK_LIB([[magic]], [[magic_open]], [[mhd_have_magic_open='yes']]) ],[], + [AC_INCLUDES_DEFAULT]) - -# optional: libmicrospdy support. Enabled by default if not on W32 -AC_ARG_ENABLE([spdy], - AS_HELP_STRING([--enable-spdy], - [enable build libmicrospdy (yes, no, auto) [auto]]), - [enable_spdy=${enableval}], - [ AS_IF([[test "x$os_is_windows" = "xyes"]], [enable_spdy=no]) ]) - -if test "$enable_spdy" != "no" -then - AX_CHECK_OPENSSL([ have_openssl=yes ],[ have_openssl=no ]) - if test "x$have_openssl" = "xyes" - then - # check OpenSSL headers - SAVE_CPP_FLAGS="$CPPFLAGS" - CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" - AC_CHECK_HEADERS([openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h], [ have_openssl=yes ],[ have_openssl=no ]) - if test "x$have_openssl" = "xyes" - then - # check OpenSSL libs - SAVE_LIBS="$LIBS" - SAVE_LD_FLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" - LIBS="$OPENSSL_LIBS $LIBS" - AC_CHECK_FUNC([SSL_CTX_set_next_protos_advertised_cb], - [ - AC_CHECK_FUNC([SSL_library_init], [ have_openssl=yes ],[ have_openssl=no ]) - ],[ have_openssl=no ]) - LIBS="$SAVE_LIBS" - LDFLAGS="$SAVE_LD_FLAGS" - fi - CPPFLAGS="$SAVE_CPP_FLAGS" - fi - if test "x$have_openssl" = "xyes" - then - enable_spdy=yes - else - AS_IF([[test "x$enable_spdy" = "xyes" ]], [AC_MSG_ERROR([[libmicrospdy cannot be enabled without OpenSSL.]])]) - have_openssl=no - enable_spdy=no - fi -else - # OpenSSL is used only for libmicrospdy - have_openssl=no -fi -AM_CONDITIONAL([HAVE_OPENSSL], [test "x$have_openssl" = "xyes"]) - -if test "$enable_spdy" = "yes" -then - AC_DEFINE([SPDY_SUPPORT],[1],[include libmicrospdy support]) -else - AC_DEFINE([SPDY_SUPPORT],[0],[disable libmicrospdy support]) -fi -AM_CONDITIONAL(ENABLE_SPDY, [test "x$enable_spdy" != "xno"]) -AC_MSG_CHECKING(whether we have OpenSSL and thus can support libmicrospdy) -AC_MSG_RESULT($enable_spdy) - -# for pkg-config -SPDY_LIBDEPS="$OPENSSL_LIBS" - -SPDY_LIB_LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" -SPDY_LIB_CFLAGS="$CFLAGS" -SPDY_LIB_CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" -AC_SUBST(SPDY_LIB_LDFLAGS) -AC_SUBST(SPDY_LIB_CFLAGS) -AC_SUBST(SPDY_LIB_CPPFLAGS) -# for pkg-config -AC_SUBST(SPDY_LIBDEPS) - -AC_CHECK_HEADERS([spdylay/spdylay.h], [ have_spdylay="yes" ], [have_spdylay="no"]) -AM_CONDITIONAL(HAVE_SPDYLAY, [test "x$have_spdylay" = "xyes"]) +AM_CONDITIONAL([HAVE_MAGIC], [[test "x$mhd_have_magic_open" = "xyes"]]) # large file support (> 4 GB) AC_SYS_LARGEFILE AC_FUNC_FSEEKO -AC_CHECK_FUNCS([_lseeki64 lseek64 sendfile64]) +AC_CHECK_FUNCS([lseek64 sendfile64 pread64 pread]) # optional: have error messages ? -AC_MSG_CHECKING(whether to generate error messages) +AC_MSG_CHECKING([[whether to generate error messages]]) AC_ARG_ENABLE([messages], [AS_HELP_STRING([--disable-messages], [disable MHD error messages])], [enable_messages=${enableval}], [enable_messages=yes]) -AC_MSG_RESULT($enable_messages) -if test "$enable_messages" = "yes" -then - AC_DEFINE([HAVE_MESSAGES],[1],[Include error messages]) -else - AC_DEFINE([HAVE_MESSAGES],[0],[Disable error messages]) -fi +AS_IF([[test "x$enable_messages" = "xyes"]], + [ AC_DEFINE([HAVE_MESSAGES],[1],[Define to 1 to enable support for error messages.]) ], + [[ enable_messages=no ]]) +AC_MSG_RESULT([[$enable_messages]]) # optional: have postprocessor? -AC_MSG_CHECKING(whether to enable postprocessor) +AC_MSG_CHECKING([[whether to enable postprocessor]]) AC_ARG_ENABLE([postprocessor], [AS_HELP_STRING([--disable-postprocessor], [disable MHD PostProcessor functionality])], [enable_postprocessor=${enableval}], [enable_postprocessor=yes]) -test "x$enable_postprocessor" = "xno" || enable_postprocessor=yes +AS_IF([[test "x$enable_postprocessor" != "xno"]], + [ enable_postprocessor=yes + AC_DEFINE([HAVE_POSTPROCESSOR],[1],[Define to 1 if libmicrohttpd is compiled with postprocessor support.]) ]) +AM_CONDITIONAL([HAVE_POSTPROCESSOR], [test "x$enable_postprocessor" != "xno"]) AC_MSG_RESULT([[$enable_postprocessor]]) -AM_CONDITIONAL([HAVE_POSTPROCESSOR],test "x$enable_postprocessor" != "xno") -if test "x$enable_postprocessor" != "xno" -then - AC_DEFINE([HAVE_POSTPROCESSOR],[1],[define to 1 if MHD was build with postprocessor.c]) -fi # optional: have zzuf, socat? @@ -710,6 +1124,22 @@ AM_CONDITIONAL([HAVE_ZZUF], [test "x$have_zzuf" = "xyes"]) AM_CONDITIONAL([HAVE_SOCAT], [test "x$have_socat" = "xyes"]) +GNUTLS_CPPFLAGS="" +GNUTLS_LDFLAGS="" +have_gnutls=no +have_gnutls_sni=no +have_gcrypt=no + +# optional: HTTPS support. Enabled by default +AC_ARG_ENABLE([https], + [AS_HELP_STRING([--enable-https], + [enable HTTPS support (yes, no, auto)[auto]])], + [enable_https=${enableval}]) +if test "x$enable_https" != "xno" +then +# +# Next block is large unindented block +# # libgcrypt linkage: required for HTTPS support AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) @@ -720,16 +1150,12 @@ # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" - AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no]) + AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT]) CFLAGS="$SAVE_CFLAGS" CPPFLAGS="$SAVE_CPPFLAGS" fi # gnutls -GNUTLS_CPPFLAGS="" -GNUTLS_LDFLAGS="" -have_gnutls=no -have_gnutls_sni=no have_gnutls_pkgcfg=no AC_MSG_CHECKING([[how to find GnuTLS library]]) AC_ARG_WITH([[gnutls]], @@ -757,7 +1183,7 @@ GNUTLS_LIBS="-lgnutls" AC_CHECK_LIB([gnutls], [gnutls_load_file], [AC_CHECK_LIB([gnutls], [gnutls_privkey_import_x509_raw], [have_gnutls_sni=yes])]) have_gnutls=yes - ])]) + ])], [], [AC_INCLUDES_DEFAULT]) AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])]) LDFLAGS="$SAVE_LDFLAGS" CPPFLAGS="$SAVE_CPPFLAGS" @@ -793,7 +1219,7 @@ [ AC_MSG_RESULT([[yes]]) have_gnutls=yes - GNUTLS_CPPLAGS="$GNUTLS_CFLAGS" + GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS" GNUTLS_LDFLAGS="$GNUTLS_LIBS" AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]]) AC_LINK_IFELSE([ @@ -819,94 +1245,177 @@ ], [ have_gnutls_pkgcfg='no' + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + # Try to use libgcrypt search path + # as libgcrypt flags will be used + # anyway for HTTPs builds + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" AC_CHECK_HEADERS([gnutls/gnutls.h], [AC_CHECK_LIB([gnutls], [gnutls_priority_set], [ + GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS" GNUTLS_LIBS="-lgnutls" AC_CHECK_LIB([gnutls], [gnutls_load_file], [AC_CHECK_LIB([gnutls], [gnutls_privkey_import_x509_raw], [have_gnutls_sni=yes])]) have_gnutls=yes - ])]) + ])], [], [AC_INCLUDES_DEFAULT]) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" ]) ]) AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"], [AC_MSG_ERROR([[can't find usable libgnutls]])]) -AM_CONDITIONAL(HAVE_GNUTLS, test "x$have_gnutls" = "xyes") -AM_CONDITIONAL([HAVE_GNUTLS_SNI], [test "x$have_gnutls_sni" = "xyes"]) - AC_SUBST([GNUTLS_CPPFLAGS]) AC_SUBST([GNUTLS_CFLAGS]) AC_SUBST([GNUTLS_LDFLAGS]) AC_SUBST([GNUTLS_LIBS]) -# optional: HTTPS support. Enabled by default -AC_MSG_CHECKING(whether to support HTTPS) -AC_ARG_ENABLE([https], - [AS_HELP_STRING([--enable-https], - [enable HTTPS support (yes, no, auto)[auto]])], - [enable_https=${enableval}]) -if test "x$enable_https" != "xno" -then +# +# End of large unindented block +# AS_IF([test "x$have_gnutls" = "xyes" && test "x$have_gcrypt" = "xyes"], [ - AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) + AC_DEFINE([[HTTPS_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTPS support.]) + enable_https=yes + MSG_HTTPS="yes (using libgnutls and libgcrypt)" MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CPPFLAGS" MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CFLAGS" MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS" - enable_https=yes - MSG_HTTPS="yes (using libgnutls and libgcrypt)" + AS_IF([[ test "x$have_gnutls_pkgcfg" = "xyes" ]], + [ # remove GnuTLS from private libs in .pc file as it defined in Requires.private + MHD_REQ_PRIVATE='gnutls' + MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + ], + [ + MHD_REQ_PRIVATE='' + MHD_LIBDEPS_PKGCFG="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + ]) ], [ - AS_IF([test "x$have_gnutls" = "xyes"], [crypt_missing="libgrypt"], + AS_IF([test "x$have_gnutls" = "xyes"], [crypt_missing="libgcrypt"], [test "x$have_gcrypt" = "xyes"], [crypt_missing="libgnutls"], - [crypt_missing="libgrypt and libgnutls"]) + [crypt_missing="libgcrypt and libgnutls"]) AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without $crypt_missing.]])]) - AC_DEFINE([HTTPS_SUPPORT],[0],[no libgcrypt or libgnutls]) enable_https=no MSG_HTTPS="no (lacking $crypt_missing)" ]) else - AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support]) MSG_HTTPS="no (disabled)" fi +AC_MSG_CHECKING(whether to support HTTPS) AC_MSG_RESULT([$MSG_HTTPS]) +AM_CONDITIONAL([HAVE_GNUTLS], [[test "x$have_gnutls" = "xyes"]]) +AM_CONDITIONAL([HAVE_GNUTLS_SNI], [[test "x$have_gnutls_sni" = "xyes"]]) AM_CONDITIONAL([ENABLE_HTTPS], [test "x$enable_https" = "xyes"]) # optional: HTTP Basic Auth support. Enabled by default -AC_MSG_CHECKING(whether to support HTTP basic authentication) +AC_MSG_CHECKING([[whether to support HTTP basic authentication]]) AC_ARG_ENABLE([bauth], AS_HELP_STRING([--disable-bauth], [disable HTTP basic Auth support]), [enable_bauth=${enableval}], [enable_bauth=yes]) -if test "x$enable_bauth" != "xno" -then - enable_bauth=yes - AC_DEFINE([BAUTH_SUPPORT],[1],[include basic Auth support]) -else - AC_DEFINE([BAUTH_SUPPORT],[0],[disable basic Auth support]) -fi -AC_MSG_RESULT($enable_bauth) -AM_CONDITIONAL(ENABLE_BAUTH, [test "x$enable_bauth" != "xno"]) +AS_IF([[test "x$enable_bauth" != "xno"]], + [ enable_bauth=yes + AC_DEFINE([BAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with basic Auth support.]) ]) +AM_CONDITIONAL([ENABLE_BAUTH], [test "x$enable_bauth" != "xno"]) +AC_MSG_RESULT([[$enable_bauth]]) # optional: HTTP Digest Auth support. Enabled by default -AC_MSG_CHECKING(whether to support HTTP digest authentication) +AC_MSG_CHECKING([[whether to support HTTP digest authentication]]) AC_ARG_ENABLE([dauth], AS_HELP_STRING([--disable-dauth], [disable HTTP basic and digest Auth support]), [enable_dauth=${enableval}], [enable_dauth=yes]) -if test "x$enable_dauth" != "xno" -then - enable_dauth=yes - AC_DEFINE([DAUTH_SUPPORT],[1],[include digest Auth support]) -else - AC_DEFINE([DAUTH_SUPPORT],[0],[disable digest Auth support]) -fi -AC_MSG_RESULT($enable_dauth) -AM_CONDITIONAL(ENABLE_DAUTH, [test "x$enable_dauth" != "xno"]) +AS_IF([[test "x$enable_dauth" != "xno"]], + [ enable_dauth=yes + AC_DEFINE([DAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with digest Auth support.]) ]) +AM_CONDITIONAL([ENABLE_DAUTH], [test "x$enable_dauth" != "xno"]) +AC_MSG_RESULT([[$enable_dauth]]) + +# optional: HTTP "Upgrade" support. Enabled by default +AC_MSG_CHECKING([[whether to support HTTP "Upgrade"]]) +AC_ARG_ENABLE([[httpupgrade]], + AS_HELP_STRING([[--disable-httpupgrade]], + [disable HTTP "Upgrade" support]), + [AS_VAR_IF([[enable_httpupgrade]],[["no"]],[],[[enable_httpupgrade='yes']])], + [[enable_httpupgrade='yes']]) +AS_VAR_IF([[enable_httpupgrade]],[["yes"]], + [ + AC_DEFINE([[UPGRADE_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support.]) ]) +AM_CONDITIONAL([ENABLE_UPGRADE], [[test "x$enable_httpupgrade" = "xyes"]]) +AC_MSG_RESULT([[$enable_httpupgrade]]) +AC_CACHE_CHECK([[for calloc()]], [[mhd_cv_have_func_calloc]], + [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include + ]],[[void * ptr = calloc(1, 2)]]) + ], + [[mhd_cv_have_func_calloc='yes']], + [[mhd_cv_have_func_calloc='no']] + ) + ] +) +AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]], + [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])]) + +# Check for fork() and waitpid(). They are used for tests. +AC_MSG_CHECKING([[for fork()]]) +mhd_have_fork_waitpid='no' +AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + ]], [[ + pid_t p = fork (); + if (0 == p) + return 1; + ]]) + ], [ + AC_DEFINE([[HAVE_FORK]], [[1]], [Define to 1 if you have the usable `fork' function.]) + AC_MSG_RESULT([[yes]]) + + AC_MSG_CHECKING([[for waitpid()]]) + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#include + ]], [[ + pid_t p = fork (); + if (0 == p) + return 1; + waitpid (p, (void*)0, 0) + ]]) + ], [ + AC_DEFINE([[HAVE_WAITPID]], [[1]], [Define to 1 if you have the usable `waitpid' function.]) + AC_MSG_RESULT([[yes]]) + mhd_have_fork_waitpid='yes' + ],[ + AC_MSG_RESULT([[no]]) + ]) +],[ + AC_MSG_RESULT([[no]]) +]) +AM_CONDITIONAL([HAVE_FORK_WAITPID], [test "x$mhd_have_fork_waitpid" = "xyes"]) MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" @@ -926,29 +1435,24 @@ AC_SUBST(MHD_LIB_CPPFLAGS) AC_SUBST(MHD_LIB_CFLAGS) AC_SUBST(MHD_LIB_LDFLAGS) +AC_SUBST(MHD_LIBDEPS) # for pkg-config -AS_IF([[test "x$enable_https" = "xyes" && test "x$have_gnutls_pkgcfg" = "xyes" ]], - [ # remove GnuTLS from private libs in .pc file as it defined in Requires.private - MHD_REQ_PRIVATE='gnutls' - MHD_LIBDEPS_PKGCFG="${MHD_LIBDEPS//$GNUTLS_LIBS/}" - ], - [ - MHD_REQ_PRIVATE='' - MHD_LIBDEPS_PKGCFG="$MHD_LIBDEPS" - ]) AC_SUBST([MHD_REQ_PRIVATE]) AC_SUBST([MHD_LIBDEPS_PKGCFG]) -AC_SUBST(MHD_LIBDEPS) AC_SUBST(CPPFLAGS) AC_SUBST(LIBS) AC_SUBST(LDFLAGS) +# Used for 'po' directory staff +AC_SUBST([ac_configure_args]) +AC_SUBST([EMPTY_VAR], [[]]) + AC_CONFIG_FILES([ libmicrohttpd.pc -libmicrospdy.pc -w32/VS2013/microhttpd_dll_res_vc.rc +w32/common/microhttpd_dll_res_vc.rc +po/configure.acT:po/configure.ac.in Makefile contrib/Makefile doc/Makefile @@ -957,14 +1461,10 @@ m4/Makefile src/Makefile src/include/Makefile -src/platform/Makefile src/microhttpd/Makefile -src/microspdy/Makefile -src/spdy2http/Makefile src/examples/Makefile src/testcurl/Makefile src/testcurl/https/Makefile -src/testspdy/Makefile src/testzzuf/Makefile]) AC_OUTPUT @@ -979,19 +1479,22 @@ Cross-compiling: ${cross_compiling} Operating System: ${host_os} Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Inter-thread comm: ${use_itc} libcurl (testing): ${MSG_CURL} Target directory: ${prefix} + Shutdown of listening socket + trigger select: ${mhd_cv_host_shtdwn_trgr_select} Messages: ${enable_messages} Basic auth.: ${enable_bauth} Digest auth.: ${enable_dauth} + HTTP "Upgrade": ${enable_httpupgrade} Postproc: ${enable_postprocessor} HTTPS support: ${MSG_HTTPS} poll support: ${enable_poll=no} epoll support: ${enable_epoll=no} build docs: ${enable_doc} build examples: ${enable_examples} - libmicrospdy: ${enable_spdy} - spdylay (testing): ${have_spdylay} ]) if test "x$enable_https" = "xyes" @@ -1005,9 +1508,10 @@ ]) fi -if test "x$enable_bauth" != "xyes" -o \ - "x$enable_dauth" != "xyes" -o \ - "x$enable_postprocessor" != "xyes" +if test "x$enable_bauth" != "xyes" || \ + test "x$enable_dauth" != "xyes" || \ + test "x$enable_httpupgrade" != "xyes" || \ + test "x$enable_postprocessor" != "xyes" then AC_MSG_NOTICE([WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems.]) fi diff -Nru libmicrohttpd-0.9.44+dfsg/contrib/Makefile.in libmicrohttpd-0.9.55/contrib/Makefile.in --- libmicrohttpd-0.9.44+dfsg/contrib/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/contrib/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -93,7 +93,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -101,8 +100,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -157,8 +159,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -166,6 +170,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -181,9 +186,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -191,6 +193,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -205,9 +208,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -229,13 +229,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -243,6 +240,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -287,6 +285,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff -Nru libmicrohttpd-0.9.44+dfsg/debian/changelog libmicrohttpd-0.9.55/debian/changelog --- libmicrohttpd-0.9.44+dfsg/debian/changelog 2016-02-17 23:26:17.000000000 +0100 +++ libmicrohttpd-0.9.55/debian/changelog 2017-07-04 14:12:37.000000000 +0200 @@ -1,3 +1,75 @@ +libmicrohttpd (0.9.55-1ubuntu1) artful; urgency=low + + * Merge from Debian unstable (Fixes LP: #1702286). Remaining changes: + - debian/libmicrohttpd-dev.install: Install missing performance_data.png for + info page. + * No longer necessary to disable SPDY packages, they have been removed by + upstream. + + -- Hans Joachim Desserud Tue, 04 Jul 2017 14:12:37 +0200 + +libmicrohttpd (0.9.55-1) unstable; urgency=medium + + * Add Evgeny Grin's key to debian/upstream/signing-key.asc. + * New upstream version 0.9.55 (Closes: #844146). + * Add 2 new symbols to libmicrohttpd12.symbols. + * debian/copyright: + + Use the https form of the copyright-format URL in debian/copyright. + + Add my @debian.org address. + + Add the new maintainer. + + Update the years. + * debian/control: update standards version to 4.0.0. + + -- Bertrand Marc Tue, 27 Jun 2017 18:37:43 +0200 + +libmicrohttpd (0.9.51-1) unstable; urgency=medium + + * New upstream version 0.9.51. + * Enable all hardening flags as MHD handles untrusted data. + * Disable tests on hppa and hurd-i386 as they fail on these. + + -- Bertrand Marc Thu, 01 Sep 2016 10:53:10 +0200 + +libmicrohttpd (0.9.50-3) unstable; urgency=medium + + * Remove build-dependency on socat on hurd-i386 as it is not available and + only used to enable tests at build time (Closes: #833028). + * Use my @debian.org address for the maintainer field. + + -- Bertrand Marc Thu, 11 Aug 2016 22:55:29 +0200 + +libmicrohttpd (0.9.50-2) unstable; urgency=medium + + * Upload to unstable. + + -- Bertrand Marc Sat, 23 Jul 2016 15:28:52 +0200 + +libmicrohttpd (0.9.50-1) experimental; urgency=medium + + * Imported Upstream version 0.9.50 (Closes: #813636). + * Stop building libmicrospdy, since upstream removed it: + + debian/control: remove libmicrospdy binary packages and remove + build-dependency on libssl-dev and zlib1g-dev. + + debian/copyright: remove src/microspdy/* files, the GPL3+ paragraph, + and the Files-excluded field. + + remove debian/libmicrospdy-dev.install, debian/libmicrospdy0.install and + debian/libmicrospdy0.symbols. + + debian/rules: remove libmicrospdy-dbg from dh_strip. + * Change soname version to libmicrohttpd12: + + debian/control: update the binary package name. + + rename debian/libmicrohttpd10.install. + + rename and update debian/libmicrohttpd10.symbols. + + debian/rules: strip libmicrohttpd12. + * Migrate from a manual "-dbg" package to an automatic generated debug symbol + package: + + debian/control: remove libmicrohttpd-dbg. + + debian/rules: use --dbgsym-migration in override_dh_strip. + * Standards version 3.9.8: no changes needed. + * debian/control: use secure URIs in vcs-fields. + * Build-depend on libcurl4-gnutls-dev, socat and zzuf to enable more tests. + + -- Bertrand Marc Sun, 19 Jun 2016 16:27:47 +0200 + libmicrohttpd (0.9.44+dfsg-1ubuntu2) xenial; urgency=medium * No-change rebuild for gnutls transition. @@ -454,3 +526,4 @@ * Initial release. -- Daniel Baumann Tue, 14 Aug 2007 18:53:00 +0200 + diff -Nru libmicrohttpd-0.9.44+dfsg/debian/control libmicrohttpd-0.9.55/debian/control --- libmicrohttpd-0.9.44+dfsg/debian/control 2015-12-04 10:57:21.000000000 +0100 +++ libmicrohttpd-0.9.55/debian/control 2017-07-04 14:12:11.000000000 +0200 @@ -2,15 +2,16 @@ Section: libs Priority: optional Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Bertrand Marc +XSBC-Original-Maintainer: Bertrand Marc Build-Depends: debhelper (>= 9), autoconf, automake, dh-autoreconf, - libgcrypt-dev, libgnutls28-dev, libssl-dev, texinfo, pkg-config, zlib1g-dev -Standards-Version: 3.9.6 -Vcs-Git: git://anonscm.debian.org/collab-maint/libmicrohttpd.git -Vcs-browser: http://anonscm.debian.org/gitweb/?p=collab-maint/libmicrohttpd.git + libcurl4-gnutls-dev, libgcrypt-dev, libgnutls28-dev, texinfo, pkg-config, + socat[!hurd-i386], zzuf +Standards-Version: 4.0.0 +Vcs-Git: https://anonscm.debian.org/git/collab-maint/libmicrohttpd.git +Vcs-browser: https://anonscm.debian.org/git/collab-maint/libmicrohttpd.git Homepage: http://www.gnu.org/software/libmicrohttpd/ -Package: libmicrohttpd10 +Package: libmicrohttpd12 Architecture: any Pre-Depends: ${misc:Pre-Depends} Depends: ${misc:Depends}, ${shlibs:Depends} @@ -29,35 +30,11 @@ * Support for basic and digest authentication (optional) * Support for SSL3 and TLS -Package: libmicrohttpd-dbg -Section: debug -Priority: extra -Architecture: any -Depends: - ${misc:Depends}, libmicrohttpd10 (= ${binary:Version}), - libmicrohttpd-dev (= ${binary:Version}) -Description: library embedding HTTP server functionality (debug) - GNU libmicrohttpd is a small C library that is supposed to make it easy to run - an HTTP server as part of another application. Key features that distinguish - GNU Libmicrohttpd from other projects are: - * C library: fast and small - * API is simple, expressive and fully reentrant - * Implementation is HTTP 1.1 compliant - * HTTP server can listen on multiple ports - * Four different threading models (select, poll, pthread, thread pool) - * Support for IPv6 - * Support for SHOUTcast - * Support for incremental processing of POST data (optional) - * Support for basic and digest authentication (optional) - * Support for SSL3 and TLS - . - This package contains the debugging symbols. - Package: libmicrohttpd-dev Section: libdevel Architecture: any Depends: - ${misc:Depends}, libmicrohttpd10 (= ${binary:Version}), libgnutls28-dev, + ${misc:Depends}, libmicrohttpd12 (= ${binary:Version}), libgnutls28-dev, libgcrypt-dev Description: library embedding HTTP server functionality (development) GNU libmicrohttpd is a small C library that is supposed to make it easy to run @@ -75,43 +52,3 @@ * Support for SSL3 and TLS . This package contains the development files. - -Package: libmicrospdy0 -Architecture: any -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${shlibs:Depends} -Description: library embedding SPDY server functionality - GNU libmicrospdy is a small C very experimental library embedding a SPDY - server (the base for HTTP 2.0). libmicrospdy provides a compact API and - implementation of SPDY server. libmicrospdy currently only implements partially - version 3 of SPDY. - -Package: libmicrospdy-dbg -Section: debug -Priority: extra -Architecture: any -Depends: - ${misc:Depends}, libmicrospdy0 (= ${binary:Version}), - libmicrospdy-dev (= ${binary:Version}) -Description: library embedding SPDY server functionality (debug) - GNU libmicrospdy is a small C very experimental library embedding a SPDY - server (the base for HTTP 2.0). libmicrospdy provides a compact API and - implementation of SPDY server. libmicrospdy currently only implements partially - version 3 of SPDY. - . - This package contains the debugging symbols. - -Package: libmicrospdy-dev -Section: libdevel -Architecture: any -Depends: - ${misc:Depends}, libmicrospdy0 (= ${binary:Version}), libssl-dev -Replaces: libmicrohttpd-dev (<< 0.9.42~) -Breaks: libmicrohttpd-dev (<< 0.9.42~) -Description: library embedding SPDY server functionality (development) - GNU libmicrospdy is a small C very experimental library embedding a SPDY - server (the base for HTTP 2.0). libmicrospdy provides a compact API and - implementation of SPDY server. libmicrospdy currently only implements partially - version 3 of SPDY. - . - This package contains the development files. diff -Nru libmicrohttpd-0.9.44+dfsg/debian/copyright libmicrohttpd-0.9.55/debian/copyright --- libmicrohttpd-0.9.44+dfsg/debian/copyright 2015-10-05 22:19:48.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/copyright 2017-06-28 08:49:12.000000000 +0200 @@ -1,18 +1,15 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Libmicrohttpd Upstream-Contact: Christian Grothoff Source: http://www.gnu.org/software/libmicrohttpd/ License: LGPL-2.1+ -Files-Excluded: src/datadir/spdy-draft.txt Files: * -Copyright: (C) 2007-2015 Christian Grothoff +Copyright: + (C) 2007-2017 Christian Grothoff + (C) 2015-2017 Evgeny Grin (Karlson2k) License: LGPL-2.1+ -Files: src/microspdy/* -Copyright: (C) 2012 Andrey Uzunov -License: GPL-3+ - Files: doc/* Copyright: (C) 2007-2013 Christian Grothoff License: GFDL-1.3+ @@ -24,7 +21,7 @@ Files: debian/* Copyright: - (C) 2012-2015 Bertrand Marc + (C) 2012-2017 Bertrand Marc (C) 2007-2012 Daniel Baumann License: LGPL-2.1+ @@ -37,20 +34,6 @@ The complete text of the GNU Free Documentation License can be found in /usr/share/common-licenses/GFDL-1.3 file. -License: GPL-3+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - . - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - The complete text of the GNU Library General Public License - can be found in /usr/share/common-licenses/GPL-3 file. - License: LGPL-2.1+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd10.install libmicrohttpd-0.9.55/debian/libmicrohttpd10.install --- libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd10.install 2015-09-26 16:23:36.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/libmicrohttpd10.install 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -usr/lib/*/libmicrohttpd.so.* diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd10.symbols libmicrohttpd-0.9.55/debian/libmicrohttpd10.symbols --- libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd10.symbols 2015-10-05 22:14:10.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/libmicrohttpd10.symbols 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -libmicrohttpd.so.10 libmicrohttpd10 #MINVER# - MHD_add_connection@Base 0.9.20 - MHD_add_response_footer@Base 0.9.20 - MHD_add_response_header@Base 0.9.20 - MHD_basic_auth_get_username_password@Base 0.9.20 - MHD_create_post_processor@Base 0.9.20 - MHD_create_response_from_buffer@Base 0.9.20 - MHD_create_response_from_callback@Base 0.9.20 - MHD_create_response_from_data@Base 0.9.20 - MHD_create_response_from_fd64@Base 0.9.44 - MHD_create_response_from_fd@Base 0.9.20 - MHD_create_response_from_fd_at_offset64@Base 0.9.44 - MHD_create_response_from_fd_at_offset@Base 0.9.20 - MHD_del_response_header@Base 0.9.20 - MHD_destroy_post_processor@Base 0.9.20 - MHD_destroy_response@Base 0.9.20 - MHD_digest_auth_check@Base 0.9.20 - MHD_digest_auth_get_username@Base 0.9.20 - MHD_get_connection_info@Base 0.9.20 - MHD_get_connection_values@Base 0.9.20 - MHD_get_daemon_info@Base 0.9.20 - MHD_get_fdset2@Base 0.9.35 - MHD_get_fdset@Base 0.9.20 - MHD_get_response_header@Base 0.9.20 - MHD_get_response_headers@Base 0.9.20 - MHD_get_timeout@Base 0.9.20 - MHD_get_version@Base 0.9.20 - MHD_http_unescape@Base 0.9.39 - MHD_is_feature_supported@Base 0.9.35 - MHD_lookup_connection_value@Base 0.9.20 - MHD_post_process@Base 0.9.20 - MHD_queue_auth_fail_response@Base 0.9.20 - MHD_queue_basic_auth_fail_response@Base 0.9.20 - MHD_queue_response@Base 0.9.20 - MHD_quiesce_daemon@Base 0.9.27 - MHD_resume_connection@Base 0.9.32 - MHD_run@Base 0.9.20 - MHD_run_from_select@Base 0.9.27 - MHD_set_connection_option@Base 0.9.20 - MHD_set_connection_value@Base 0.9.20 - MHD_set_panic_func@Base 0.9.20 - MHD_set_response_options@Base 0.9.38 - MHD_start_daemon@Base 0.9.20 - MHD_start_daemon_va@Base 0.9.20 - MHD_stop_daemon@Base 0.9.20 - MHD_suspend_connection@Base 0.9.32 diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd12.install libmicrohttpd-0.9.55/debian/libmicrohttpd12.install --- libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd12.install 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/debian/libmicrohttpd12.install 2016-09-01 09:48:56.000000000 +0200 @@ -0,0 +1 @@ +usr/lib/*/libmicrohttpd.so.* diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd12.symbols libmicrohttpd-0.9.55/debian/libmicrohttpd12.symbols --- libmicrohttpd-0.9.44+dfsg/debian/libmicrohttpd12.symbols 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/debian/libmicrohttpd12.symbols 2017-06-23 19:25:18.000000000 +0200 @@ -0,0 +1,49 @@ +libmicrohttpd.so.12 libmicrohttpd12 #MINVER# + MHD_add_connection@Base 0.9.50 + MHD_add_response_footer@Base 0.9.50 + MHD_add_response_header@Base 0.9.50 + MHD_basic_auth_get_username_password@Base 0.9.50 + MHD_create_post_processor@Base 0.9.50 + MHD_create_response_for_upgrade@Base 0.9.52 + MHD_create_response_from_buffer@Base 0.9.50 + MHD_create_response_from_callback@Base 0.9.50 + MHD_create_response_from_data@Base 0.9.50 + MHD_create_response_from_fd64@Base 0.9.50 + MHD_create_response_from_fd@Base 0.9.50 + MHD_create_response_from_fd_at_offset64@Base 0.9.50 + MHD_create_response_from_fd_at_offset@Base 0.9.50 + MHD_del_response_header@Base 0.9.50 + MHD_destroy_post_processor@Base 0.9.50 + MHD_destroy_response@Base 0.9.50 + MHD_digest_auth_check@Base 0.9.50 + MHD_digest_auth_get_username@Base 0.9.50 + MHD_get_connection_info@Base 0.9.50 + MHD_get_connection_values@Base 0.9.50 + MHD_get_daemon_info@Base 0.9.50 + MHD_get_fdset2@Base 0.9.50 + MHD_get_fdset@Base 0.9.50 + MHD_get_reason_phrase_for@Base 0.9.50 + MHD_get_response_header@Base 0.9.50 + MHD_get_response_headers@Base 0.9.50 + MHD_get_timeout@Base 0.9.50 + MHD_get_version@Base 0.9.50 + MHD_http_unescape@Base 0.9.50 + MHD_is_feature_supported@Base 0.9.50 + MHD_lookup_connection_value@Base 0.9.50 + MHD_post_process@Base 0.9.50 + MHD_queue_auth_fail_response@Base 0.9.50 + MHD_queue_basic_auth_fail_response@Base 0.9.50 + MHD_queue_response@Base 0.9.50 + MHD_quiesce_daemon@Base 0.9.50 + MHD_resume_connection@Base 0.9.50 + MHD_run@Base 0.9.50 + MHD_run_from_select@Base 0.9.50 + MHD_set_connection_option@Base 0.9.50 + MHD_set_connection_value@Base 0.9.50 + MHD_set_panic_func@Base 0.9.50 + MHD_set_response_options@Base 0.9.50 + MHD_start_daemon@Base 0.9.50 + MHD_start_daemon_va@Base 0.9.50 + MHD_stop_daemon@Base 0.9.50 + MHD_suspend_connection@Base 0.9.50 + MHD_upgrade_action@Base 0.9.52 diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy0.install libmicrohttpd-0.9.55/debian/libmicrospdy0.install --- libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy0.install 2015-09-26 16:23:36.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/libmicrospdy0.install 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -usr/lib/*/libmicrospdy.so.* diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy0.symbols libmicrohttpd-0.9.55/debian/libmicrospdy0.symbols --- libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy0.symbols 2015-09-26 16:23:36.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/libmicrospdy0.symbols 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -libmicrospdy.so.0 libmicrospdy0 #MINVER# - SPDYF_name_value_from_stream@Base 0.9.42 - SPDYF_name_value_to_stream@Base 0.9.42 - SPDY_build_response@Base 0.9.42 - SPDY_build_response_with_callback@Base 0.9.42 - SPDY_deinit@Base 0.9.42 - SPDY_destroy_request@Base 0.9.42 - SPDY_destroy_response@Base 0.9.42 - SPDY_get_cls_from_request@Base 0.9.42 - SPDY_get_cls_from_session@Base 0.9.42 - SPDY_get_fdset@Base 0.9.42 - SPDY_get_remote_addr@Base 0.9.42 - SPDY_get_session_for_request@Base 0.9.42 - SPDY_get_timeout@Base 0.9.42 - SPDY_init@Base 0.9.42 - SPDY_name_value_add@Base 0.9.42 - SPDY_name_value_create@Base 0.9.42 - SPDY_name_value_destroy@Base 0.9.42 - SPDY_name_value_iterate@Base 0.9.42 - SPDY_name_value_lookup@Base 0.9.42 - SPDY_queue_response@Base 0.9.42 - SPDY_run@Base 0.9.42 - SPDY_set_cls_to_request@Base 0.9.42 - SPDY_set_cls_to_session@Base 0.9.42 - SPDY_set_panic_func@Base 0.9.42 - SPDY_start_daemon@Base 0.9.42 - SPDY_stop_daemon@Base 0.9.42 diff -Nru libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy-dev.install libmicrohttpd-0.9.55/debian/libmicrospdy-dev.install --- libmicrohttpd-0.9.44+dfsg/debian/libmicrospdy-dev.install 2015-09-26 16:23:36.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/libmicrospdy-dev.install 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -usr/include/microspdy.h -usr/lib/*/libmicrospdy.a -usr/lib/*/libmicrospdy.so -usr/lib/*/pkgconfig/libmicrospdy.pc diff -Nru libmicrohttpd-0.9.44+dfsg/debian/rules libmicrohttpd-0.9.55/debian/rules --- libmicrohttpd-0.9.44+dfsg/debian/rules 2015-12-04 10:55:47.000000000 +0100 +++ libmicrohttpd-0.9.55/debian/rules 2017-07-04 14:12:31.000000000 +0200 @@ -1,13 +1,13 @@ #!/usr/bin/make -f -# test suite is known to fail on kfreebsd, don't fail build on that +# test suite is known to fail on kfreebsd, hurd-i386, and hppa, don't fail build on that TESTSUITE_FAIL_CMD=exit 1 -ifneq ($(filter $(DEB_BUILD_ARCH), kfreebsd-amd64 kfreebsd-i386),) +ifneq ($(filter $(DEB_BUILD_ARCH), kfreebsd-amd64 kfreebsd-i386 hurd-i386 hppa),) TESTSUITE_FAIL_CMD=exit 0 endif -# Ubuntu: SPDY was rejected for main in LP#1488341 -export DH_OPTIONS = -Nlibmicrospdy0 -Nlibmicrospdy-dbg -Nlibmicrospdy-dev +# Enabling all hardening flags as MHD handles untrusted data +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh ${@} --with autoreconf @@ -25,5 +25,4 @@ dh_install --fail-missing override_dh_strip: - dh_strip -plibmicrohttpd10 --dbg-package=libmicrohttpd-dbg - dh_strip -plibmicrospdy0 --dbg-package=libmicrospdy-dbg + dh_strip --dbgsym-migration='libmicrohttpd-dbg (<< 0.9.50~)' diff -Nru libmicrohttpd-0.9.44+dfsg/debian/upstream/signing-key.asc libmicrohttpd-0.9.55/debian/upstream/signing-key.asc --- libmicrohttpd-0.9.44+dfsg/debian/upstream/signing-key.asc 2015-09-26 16:23:36.000000000 +0200 +++ libmicrohttpd-0.9.55/debian/upstream/signing-key.asc 2017-06-28 08:49:12.000000000 +0200 @@ -75,3 +75,41 @@ Dftxtqs3IyhKUDyA4EXWeou3zuo4G9IstVCVGwKC0IFE2l/fSlCnsgrohlA= =rMsi -----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBFZ2i18BCADDdA/Teg430QesS7Ac39uJr+BbV/1D6mjX6sXY9gEO3I5sJ02a +Tc6HN6i8tkE2IxDy9OujzjFJwpeHxf4YzRpHaEgpqFYF1iMsVGiCll/+Bn3bzeha +KktAfGA2Zf/AEc+9AjHZZWP1v/TEke3dExN+acvN9p5c5xDoHqcqG0BdSredoXrG +WhDxRYm3UdMwskL7kZD1Gm//WWtTecUw0e0v6iiqTpnpm6iGWZ2z04ZEfGNFwOEq +DWNS9kxxUOeSzwKIP07IRnftaMF0utFAnKJwF6XC0w6OE3uAgHtLaownCrH9bBEU ++iUNsW1OhX1wq8uhN6x976tlrewu/xwCwTI9ABEBAAG0JkV2Z2VueSBHcmluIChL +YXJsc29uMmspIDxrMmtAbmFyb2QucnU+iQFUBBMBAgA+AhsDBQkFo5qABgsJCAcD +AgYVCAIJCgsEFgIDAQIeAQIXgAUCVnpt/RUYaGtwOi8va2V5cy5nbnVwZy5uZXQA +CgkQv3rEperCuvRneQf7Bu6p/3vxd6+8nPuFc35hGCs9yXSUtRyDZVYnzfZaR2vE +HSmSh1cHt0w4lTZeCxFo1r5QWn7tmnZJsCV1U/k/WCYCY8wgzRf2CKStTA8g7cHn +ZU32C2ym9ukglbtiworz09i2Tu6oYvQREPvqCk5esZJaUJF7RCZjkpSjbSHD01KA +D+1IOvjXNtf2blhdy2LISMTYQYLjLnsY86cAAr+II2V2ff9DNB3OiDFM1BpAtFbX +KxLVprOueont0vK+oKsTlW7ikcfuSrZ8nThC8ZWEoj1LR06QlMF9KmoDnrq8MZPA +Rns27QWfFtGRANO4VTK1kICx2ghMutcOxmE+JTTlDbQnRXZnZW55IEdyaW4gKEth +cmxzb24yaykgPGsya0B5YW5kZXgucnU+iQFYBBMBCABCAhsDBQkFo5qABwsJCAcD +AgEGFQgCCQoLBBYCAwECHgECF4ACGQEFAlZ6bf0VGGhrcDovL2tleXMuZ251cGcu +bmV0AAoJEL96xKXqwrr07u0H/RHECR1d8fIf1QZC44rQ9jT9zwaKvKSk01RLQDFL +aK0S5WH68uu7s5YjMuI/3SrS1j/++oYtOZxvwMtAOO9CFDnRVqSYY18+DWzOrbuy +ZMQqm+G8O7iJT1NIQkurKPqZPZKgCwkoWP0abit0w4PAL2LqivyDpb+MVnBafS1k +3bSWBMj7r3gPGF+Fl87pxBB/6rwYGeQKlaAFYf7jsuRjwAsAuZh5JUvq3kW4jZJK +pGgZRs3sipE59invsxNdrOfqlqnpRn7ptpfozZ4zPPLb+HQyzenWiZuMRqS8Obml +dC3q9wz2Upm7yossOVWM6Z5CviLWJvqvFKpDtnNSc9jg/0y5AQ0EVnaLXwEIAK11 +3TAkZ1mJCu5FLTpenB0Gh9VXrKO1LlHJy8QWW55gAbmle5nvvjvPE/Za4nUYmkuE +WgehiahfaFBvePJ96auY0fVCFePInmeFIhylqRxNobCunjwQJYaKbiI+021KEf3l +SRRVZm0sUWDSP+XgS/pLu3lv1ItQhrkGfvfKPViG/l9ew9lBVfuSE5O/c/ScWml8 +IUsbrG6NOqTq07As8TwNdGeg1+2H2/nFh9NxRZr27jMuVPtuM+hNgl8JA4TCf2mh +/x7JYwMy94ZPMc91M6BxuJjAjwATLyvJo11jmSDBpm2lZ6fRiji2i2uWYRL3aaP9 +Ed/AkRrWMoxKVbXreocAEQEAAYkBJQQYAQIADwUCVnaLXwIbDAUJBaOagAAKCRC/ +esSl6sK69CuLB/9cdYGRh8VRa9IWQLX0QbWE7NznSs7ZEaT5JmlaxhQV8cksrl4u +VlLbEb+JJGDdjJsl/02sg+hYh4S6/Ek5UDZaF3IvTXFFofNrLbjzAT/KQfe1EmRP +t6lxNlbTVCNCOgBThqMreuJzEqAap08N+AL5mv1kWdX4E9Rrg93jh55ifTU+MMsY +rA1LMqPyP+t73ct9dM8Ka/cS5fsI3zzRfcmCiD8ptfc485yTtAzJocq7nw2gbdfE +HjjRtHWIrmD9Il2/UmTxYB8JB5i0/CnVHwAjq9JrYoMRM+oRUX7cAvjjJwfWO2u+ +wPrLVO8bzT8BmZMfBq4X7cprAe5YaDMVDprK +=bqww +-----END PGP PUBLIC KEY BLOCK----- diff -Nru libmicrohttpd-0.9.44+dfsg/doc/chapters/hellobrowser.inc libmicrohttpd-0.9.55/doc/chapters/hellobrowser.inc --- libmicrohttpd-0.9.44+dfsg/doc/chapters/hellobrowser.inc 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/chapters/hellobrowser.inc 2017-05-28 22:34:00.000000000 +0200 @@ -1,13 +1,13 @@ The most basic task for a HTTP server is to deliver a static text message to any client connecting to it. Given that this is also easy to implement, it is an excellent problem to start with. -For now, the particular URI the client asks for shall have no effect on the message that will +For now, the particular URI the client asks for shall have no effect on the message that will be returned. In addition, the server shall end the connection after the message has been sent so that the client will know there is nothing more to expect. The C program @code{hellobrowser.c}, which is to be found in the examples section, does just that. If you are very eager, you can compile and start it right away but it is advisable to type the -lines in by yourself as they will be discussed and explained in detail. +lines in by yourself as they will be discussed and explained in detail. After the necessary includes and the definition of the port which our server should listen on @verbatim @@ -23,7 +23,7 @@ @noindent the desired behaviour of our server when HTTP request arrive has to be implemented. We already have agreed that it should not care about the particular details of the request, such as who is requesting -what. The server will respond merely with the same small HTML page to every request. +what. The server will respond merely with the same small HTML page to every request. The function we are going to write now will be called by @emph{GNU libmicrohttpd} every time an appropriate request comes in. While the name of this callback function is arbitrary, its parameter @@ -39,10 +39,10 @@ Talking about the reply, it is defined as a string right after the function header @verbatim -int answer_to_connection (void *cls, struct MHD_Connection *connection, - const char *url, - const char *method, const char *version, - const char *upload_data, +int answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, void **con_cls) { const char *page = "Hello, browser!"; @@ -53,7 +53,7 @@ HTTP is a rather strict protocol and the client would certainly consider it "inappropriate" if we just sent the answer string "as is". Instead, it has to be wrapped with additional information stored in so-called headers and footers. Most of the work in this area is done by the library for us---we just have to ask. Our reply string packed in the necessary layers will be called a "response". -To obtain such a response we hand our data (the reply--string) and its size over to the +To obtain such a response we hand our data (the reply--string) and its size over to the @code{MHD_create_response_from_buffer} function. The last two parameters basically tell @emph{MHD} that we do not want it to dispose the message data for us when it has been sent and there also needs no internal copy to be done because the @emph{constant} string won't change anyway. @@ -68,11 +68,11 @@ @end verbatim @noindent -Now that the the response has been laced up, it is ready for delivery and can be queued for sending. +Now that the the response has been laced up, it is ready for delivery and can be queued for sending. This is done by passing it to another @emph{GNU libmicrohttpd} function. As all our work was done in the scope of one function, the recipient is without doubt the one associated with the -local variable @code{connection} and consequently this variable is given to the queue function. -Every HTTP response is accompanied by a status code, here "OK", so that the client knows +local variable @code{connection} and consequently this variable is given to the queue function. +Every HTTP response is accompanied by a status code, here "OK", so that the client knows this response is the intended result of his request and not due to some error or malfunction. Finally, the packet is destroyed and the return value from the queue returned, @@ -88,14 +88,14 @@ @end verbatim @noindent -With the primary task of our server implemented, we can start the actual server daemon which will listen +With the primary task of our server implemented, we can start the actual server daemon which will listen on @code{PORT} for connections. This is done in the main function. @verbatim int main () { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_END); if (NULL == daemon) return 1; @@ -108,11 +108,11 @@ example, where the reply is already known and therefore the request is served quickly, this poses no problem. We will allow all clients to connect regardless of their name or location, therefore we do not check -them on connection and set the forth and fifth parameter to NULL. +them on connection and set the third and fourth parameter to NULL. -Parameter six is the address of the function we want to be called whenever a new connection has been +Parameter five is the address of the function we want to be called whenever a new connection has been established. Our @code{answer_to_connection} knows best what the client wants and needs no additional -information (which could be passed via the next parameter) so the next parameter is NULL. Likewise, +information (which could be passed via the next parameter) so the next (sixth) parameter is NULL. Likewise, we do not need to pass extra options to the daemon so we just write the MHD_OPTION_END as the last parameter. As the server daemon runs in the background in its own thread, the execution flow in our main @@ -121,7 +121,7 @@ friendly manner by waiting for the enter key to be pressed. In the end, we stop the daemon so it can do its cleanup tasks. @verbatim - getchar (); + getchar (); MHD_stop_daemon (daemon); return 0; @@ -132,9 +132,9 @@ @noindent The first example is now complete. -Compile it with +Compile it with @verbatim -cc hellobrowser.c -o hellobrowser -I$PATH_TO_LIBMHD_INCLUDES +cc hellobrowser.c -o hellobrowser -I$PATH_TO_LIBMHD_INCLUDES -L$PATH_TO_LIBMHD_LIBS -lmicrohttpd @end verbatim with the two paths set accordingly and run it. @@ -145,7 +145,7 @@ @heading Remarks To keep this first example as small as possible, some drastic shortcuts were taken and are to be -discussed now. +discussed now. Firstly, there is no distinction made between the kinds of requests a client could send. We implied that the client sends a GET request, that means, that he actually asked for some data. Even when @@ -168,16 +168,16 @@ the @code{src/examples} directory of the @emph{MHD} package. The source code of this program should look very familiar to you by now and easy to understand. -For our example, the @code{must_copy} and @code{must_free} parameter at the response construction -function could be set to @code{MHD_NO}. In the usual case, responses cannot be sent immediately +For our example, we create the response from a static (persistent) buffer in memory and thus pass @code{MHD_RESPMEM_PERSISTENT} to the response construction +function. In the usual case, responses are not transmitted immediately after being queued. For example, there might be other data on the system that needs to be sent with a higher priority. Nevertheless, the queue function will return successfully---raising the problem that the data we have pointed to may be invalid by the time it is about being sent. This is not an issue here because we can expect the @code{page} string, which is a constant @emph{string literal} -here, to be static. That means it will be present and unchanged for as long as the program runs. -For dynamic data, one could choose to either have @emph{MHD} free the memory @code{page} points -to itself when it is not longer needed or, alternatively, have the library to make and manage -its own copy of it. +here, to be static. That means it will be present and unchanged for as long as the program runs. +For dynamic data, one could choose to either have @emph{MHD} free the memory @code{page} points +to itself when it is not longer needed (by passing @code{MHD_RESPMEM_MUST_FREE}) or, alternatively, have the library to make and manage +its own copy of it (by passing @code{MHD_RESPMEM_MUST_COPY}). Naturally, this last option is the most expensive. @heading Exercises @itemize @bullet @@ -191,7 +191,7 @@ @end verbatim @noindent and see what the server returns to you. - + @item Also, try other requests, like POST, and see how our server does not mind and why. @@ -214,7 +214,7 @@ @item -@emph{Demanding:} Write a separate function returning a string containing some useful information, +@emph{Demanding:} Write a separate function returning a string containing some useful information, for example, the time. Pass the function's address as the sixth parameter and evaluate this function on every request anew in @code{answer_to_connection}. Remember to free the memory of the string every time after satisfying the request. diff -Nru libmicrohttpd-0.9.44+dfsg/doc/chapters/processingpost.inc libmicrohttpd-0.9.55/doc/chapters/processingpost.inc --- libmicrohttpd-0.9.44+dfsg/doc/chapters/processingpost.inc 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/chapters/processingpost.inc 2017-05-28 22:34:00.000000000 +0200 @@ -134,7 +134,7 @@ @verbatim ... -daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, +daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/doc/chapters/sessions.inc libmicrohttpd-0.9.55/doc/chapters/sessions.inc --- libmicrohttpd-0.9.44+dfsg/doc/chapters/sessions.inc 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/chapters/sessions.inc 2017-05-28 22:34:00.000000000 +0200 @@ -16,10 +16,14 @@ is straightforward: @verbatim -FIXME. +const char *value; + +value = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + "KEY"); @end verbatim -Here, FIXME is the name we chose for our session cookie. +Here, "KEY" is the name we chose for our session cookie. @heading Setting the cookie header @@ -29,14 +33,27 @@ 64-character text string to be used as the value of the cookie: @verbatim -FIXME. +char value[128]; +char raw_value[65]; + +for (unsigned int i=0;i #include +#ifdef _MSC_VER +#ifndef strcasecmp +#define strcasecmp(a,b) _stricmp((a),(b)) +#endif /* !strcasecmp */ +#endif /* _MSC_VER */ + +#if defined(_MSC_VER) && _MSC_VER+0 <= 1800 +/* Substitution is OK while return value is not used */ +#define snprintf _snprintf +#endif + #define PORT 8888 #define POSTBUFFERSIZE 512 #define MAXCLIENTS 2 -#define GET 0 -#define POST 1 +enum ConnectionType + { + GET = 0, + POST = 1 + }; static unsigned int nr_of_uploading_clients = 0; + +/** + * Information we keep per connection. + */ struct connection_info_struct { - int connectiontype; + enum ConnectionType connectiontype; + + /** + * Handle to the POST processing state. + */ struct MHD_PostProcessor *postprocessor; + + /** + * File handle where we write uploaded data. + */ FILE *fp; + + /** + * HTTP response body we will return, NULL if not yet known. + */ const char *answerstring; - int answercode; + + /** + * HTTP status code we will return, 0 for undecided. + */ + unsigned int answercode; }; + const char *askpage = "\n\ Upload a file, please!
\n\ There are %u clients uploading at the moment.
\n\ @@ -38,35 +73,42 @@ \n\ \n\ "; - const char *busypage = "This server is busy, please try again later."; - const char *completepage = "The upload has been completed."; - const char *errorpage = "This doesn't seem to be right."; const char *servererrorpage = - "An internal server error has occured."; + "Invalid request."; const char *fileexistspage = "This file already exists."; +const char *fileioerror = + "IO error writing to disk."; +const char* const postprocerror = + "ErrorError processing POST data"; static int -send_page (struct MHD_Connection *connection, const char *page, +send_page (struct MHD_Connection *connection, + const char *page, int status_code) { int ret; struct MHD_Response *response; response = - MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_create_response_from_buffer (strlen (page), + (void *) page, MHD_RESPMEM_MUST_COPY); if (!response) return MHD_NO; - MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, "text/html"); - ret = MHD_queue_response (connection, status_code, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); + ret = MHD_queue_response (connection, + status_code, + response); MHD_destroy_response (response); return ret; @@ -74,51 +116,66 @@ static int -iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, - const char *filename, const char *content_type, - const char *transfer_encoding, const char *data, uint64_t off, +iterate_post (void *coninfo_cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, size_t size) { struct connection_info_struct *con_info = coninfo_cls; FILE *fp; - con_info->answerstring = servererrorpage; - con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; - if (0 != strcmp (key, "file")) - return MHD_NO; + { + con_info->answerstring = servererrorpage; + con_info->answercode = MHD_HTTP_BAD_REQUEST; + return MHD_YES; + } - if (!con_info->fp) + if (! con_info->fp) { + if (0 != con_info->answercode) /* something went wrong */ + return MHD_YES; if (NULL != (fp = fopen (filename, "rb"))) { fclose (fp); con_info->answerstring = fileexistspage; con_info->answercode = MHD_HTTP_FORBIDDEN; - return MHD_NO; + return MHD_YES; } con_info->fp = fopen (filename, "ab"); if (!con_info->fp) - return MHD_NO; + { + con_info->answerstring = fileioerror; + con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; + return MHD_YES; + } } if (size > 0) { - if (!fwrite (data, size, sizeof (char), con_info->fp)) - return MHD_NO; + if (! fwrite (data, sizeof (char), size, con_info->fp)) + { + con_info->answerstring = fileioerror; + con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; + return MHD_YES; + } } - con_info->answerstring = completepage; - con_info->answercode = MHD_HTTP_OK; - return MHD_YES; } static void -request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, enum MHD_RequestTerminationCode toe) +request_completed (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) { struct connection_info_struct *con_info = *con_cls; @@ -143,29 +200,38 @@ static int -answer_to_connection (void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - size_t *upload_data_size, void **con_cls) +answer_to_connection (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) { if (NULL == *con_cls) { + /* First call, setup data structures */ struct connection_info_struct *con_info; if (nr_of_uploading_clients >= MAXCLIENTS) - return send_page (connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE); + return send_page (connection, + busypage, + MHD_HTTP_SERVICE_UNAVAILABLE); con_info = malloc (sizeof (struct connection_info_struct)); if (NULL == con_info) return MHD_NO; - + con_info->answercode = 0; /* none yet */ con_info->fp = NULL; - if (0 == strcmp (method, "POST")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) { con_info->postprocessor = - MHD_create_post_processor (connection, POSTBUFFERSIZE, - iterate_post, (void *) con_info); + MHD_create_post_processor (connection, + POSTBUFFERSIZE, + &iterate_post, + (void *) con_info); if (NULL == con_info->postprocessor) { @@ -176,52 +242,77 @@ nr_of_uploading_clients++; con_info->connectiontype = POST; - con_info->answercode = MHD_HTTP_OK; - con_info->answerstring = completepage; } else - con_info->connectiontype = GET; + { + con_info->connectiontype = GET; + } *con_cls = (void *) con_info; return MHD_YES; } - if (0 == strcmp (method, "GET")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) { + /* We just return the standard form for uploads on all GET requests */ char buffer[1024]; - snprintf (buffer, sizeof (buffer), askpage, nr_of_uploading_clients); - return send_page (connection, buffer, MHD_HTTP_OK); + snprintf (buffer, + sizeof (buffer), + askpage, + nr_of_uploading_clients); + return send_page (connection, + buffer, + MHD_HTTP_OK); } - if (0 == strcmp (method, "POST")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) { struct connection_info_struct *con_info = *con_cls; if (0 != *upload_data_size) { - MHD_post_process (con_info->postprocessor, upload_data, - *upload_data_size); + /* Upload not yet done */ + if (0 != con_info->answercode) + { + /* we already know the answer, skip rest of upload */ + *upload_data_size = 0; + return MHD_YES; + } + if (MHD_YES != + MHD_post_process (con_info->postprocessor, + upload_data, + *upload_data_size)) + { + con_info->answerstring = postprocerror; + con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; + } *upload_data_size = 0; return MHD_YES; } - else - { - if (NULL != con_info->fp) - { - fclose (con_info->fp); - con_info->fp = NULL; - } - /* Now it is safe to open and inspect the file before calling send_page with a response */ - return send_page (connection, con_info->answerstring, - con_info->answercode); - } - + /* Upload finished */ + if (NULL != con_info->fp) + { + fclose (con_info->fp); + con_info->fp = NULL; + } + if (0 == con_info->answercode) + { + /* No errors encountered, declare success */ + con_info->answerstring = completepage; + con_info->answercode = MHD_HTTP_OK; + } + return send_page (connection, + con_info->answerstring, + con_info->answercode); } - return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST); + /* Note a GET or a POST, generate error */ + return send_page (connection, + errorpage, + MHD_HTTP_BAD_REQUEST); } @@ -230,12 +321,17 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, + PORT, NULL, NULL, &answer_to_connection, NULL, - MHD_OPTION_NOTIFY_COMPLETED, request_completed, - NULL, MHD_OPTION_END); + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, + MHD_OPTION_END); if (NULL == daemon) - return 1; + { + fprintf (stderr, + "Failed to start daemon\n"); + return 1; + } (void) getchar (); MHD_stop_daemon (daemon); return 0; diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/logging.c libmicrohttpd-0.9.55/doc/examples/logging.c --- libmicrohttpd-0.9.44+dfsg/doc/examples/logging.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/examples/logging.c 2017-05-28 22:34:00.000000000 +0200 @@ -43,7 +43,7 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_END); if (NULL == daemon) return 1; diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/Makefile.in libmicrohttpd-0.9.55/doc/examples/Makefile.in --- libmicrohttpd-0.9.44+dfsg/doc/examples/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/examples/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -103,7 +103,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -111,8 +110,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -295,8 +297,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -304,6 +308,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -319,9 +324,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -329,6 +331,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -343,9 +346,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -367,13 +367,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -381,6 +378,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -425,6 +423,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/responseheaders.c libmicrohttpd-0.9.55/doc/examples/responseheaders.c --- libmicrohttpd-0.9.44+dfsg/doc/examples/responseheaders.c 2015-07-15 19:40:38.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/examples/responseheaders.c 2017-05-28 22:34:00.000000000 +0200 @@ -36,12 +36,12 @@ if ( (-1 == (fd = open (FILENAME, O_RDONLY))) || (0 != fstat (fd, &sbuf)) ) { - /* error accessing file */ - if (fd != -1) - (void) close (fd); const char *errorstr = "An internal server error has occured!\ "; + /* error accessing file */ + if (fd != -1) + (void) close (fd); response = MHD_create_response_from_buffer (strlen (errorstr), (void *) errorstr, @@ -73,7 +73,7 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_END); if (NULL == daemon) return 1; diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/sessions.c libmicrohttpd-0.9.55/doc/examples/sessions.c --- libmicrohttpd-0.9.44+dfsg/doc/examples/sessions.c 2015-06-20 16:20:21.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/examples/sessions.c 2017-05-28 22:34:00.000000000 +0200 @@ -722,7 +722,7 @@ fd_set rs; fd_set ws; fd_set es; - int max; + MHD_socket max; MHD_UNSIGNED_LONG_LONG mhd_timeout; if (argc != 2) @@ -732,7 +732,7 @@ } /* initialize PRNG */ srand ((unsigned int) time (NULL)); - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &create_response, NULL, diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/simplepost.c libmicrohttpd-0.9.55/doc/examples/simplepost.c --- libmicrohttpd-0.9.44+dfsg/doc/examples/simplepost.c 2015-07-25 15:55:24.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/examples/simplepost.c 2017-05-28 22:34:00.000000000 +0200 @@ -13,6 +13,11 @@ #include #include +#if defined(_MSC_VER) && _MSC_VER+0 <= 1800 +/* Substitution is OK while return value is not used */ +#define snprintf _snprintf +#endif + #define PORT 8888 #define POSTBUFFERSIZE 512 #define MAXNAMESIZE 20 @@ -178,7 +183,7 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_NOTIFY_COMPLETED, request_completed, NULL, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/doc/examples/tlsauthentication.c libmicrohttpd-0.9.55/doc/examples/tlsauthentication.c --- libmicrohttpd-0.9.44+dfsg/doc/examples/tlsauthentication.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/examples/tlsauthentication.c 2017-05-28 22:34:00.000000000 +0200 @@ -83,6 +83,7 @@ return 0; } + static char * load_file (const char *filename) { @@ -91,19 +92,20 @@ long size; size = get_file_size (filename); - if (size == 0) + if (0 == size) return NULL; fp = fopen (filename, "rb"); - if (!fp) + if (! fp) return NULL; - buffer = malloc (size); - if (!buffer) + buffer = malloc (size + 1); + if (! buffer) { fclose (fp); return NULL; } + buffer[size] = '\0'; if (size != fread (buffer, 1, size, fp)) { @@ -115,6 +117,7 @@ return buffer; } + static int ask_for_authentication (struct MHD_Connection *connection, const char *realm) { @@ -123,7 +126,7 @@ char *headervalue; const char *strbase = "Basic realm="; - response = MHD_create_response_from_buffer (0, NULL, + response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); if (!response) return MHD_NO; @@ -197,7 +200,7 @@ const char *page = "A secret."; response = - MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_create_response_from_buffer (strlen (page), (void *) page, MHD_RESPMEM_PERSISTENT); if (!response) return MHD_NO; @@ -243,11 +246,15 @@ if ((key_pem == NULL) || (cert_pem == NULL)) { printf ("The key/certificate files could not be read.\n"); + if (NULL != key_pem) + free (key_pem); + if (NULL != cert_pem) + free (cert_pem); return 1; } daemon = - MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, PORT, NULL, + MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_HTTPS_MEM_KEY, key_pem, MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd.info libmicrohttpd-0.9.55/doc/libmicrohttpd.info --- libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd.info 2015-10-01 21:23:00.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/libmicrohttpd.info 2017-05-28 22:34:00.000000000 +0200 @@ -1,10 +1,10 @@ -This is libmicrohttpd.info, produced by makeinfo version 6.0 from +This is libmicrohttpd.info, produced by makeinfo version 6.3 from libmicrohttpd.texi. -This manual is for GNU libmicrohttpd (version 0.9.44, 22 September -2015), a library for embedding an HTTP(S) server into C applications. +This manual is for GNU libmicrohttpd (version 0.9.55, 15 May 2017), a +library for embedding an HTTP(S) server into C applications. - Copyright (C) 2007-2013 Christian Grothoff + Copyright © 2007–2017 Christian Grothoff Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -23,10 +23,10 @@ The GNU libmicrohttpd Library ***************************** -This manual is for GNU libmicrohttpd (version 0.9.44, 22 September -2015), a library for embedding an HTTP(S) server into C applications. +This manual is for GNU libmicrohttpd (version 0.9.55, 15 May 2017), a +library for embedding an HTTP(S) server into C applications. - Copyright (C) 2007-2013 Christian Grothoff + Copyright © 2007–2017 Christian Grothoff Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -42,23 +42,23 @@ * microhttpd-struct:: Structures type definition. * microhttpd-cb:: Callback functions definition. * microhttpd-init:: Starting and stopping the server. -* microhttpd-inspect:: Implementing external 'select'. +* microhttpd-inspect:: Implementing external ‘select’. * microhttpd-requests:: Handling requests. * microhttpd-responses:: Building responses to requests. * microhttpd-flow:: Flow control. * microhttpd-dauth:: Utilizing Authentication. -* microhttpd-post:: Adding a 'POST' processor. +* microhttpd-post:: Adding a ‘POST’ processor. * microhttpd-info:: Obtaining and modifying status information. * microhttpd-util:: Utilities. Appendices * GNU-LGPL:: The GNU Lesser General Public License says how you - can copy and share almost all of 'libmicrohttpd'. + can copy and share almost all of ‘libmicrohttpd’. * GNU GPL with eCos Extension:: The GNU General Public License with eCos extension says how you - can copy and share some parts of 'libmicrohttpd'. + can copy and share some parts of ‘libmicrohttpd’. * GNU-FDL:: The GNU Free Documentation License says how you - can copy and share the documentation of 'libmicrohttpd'. + can copy and share the documentation of ‘libmicrohttpd’. Indices @@ -72,7 +72,7 @@ 1 Introduction ************** -All symbols defined in the public API start with 'MHD_'. MHD is a small +All symbols defined in the public API start with ‘MHD_’. MHD is a small HTTP daemon library. As such, it does not have any API for logging errors (you can only enable or disable logging to stderr). Also, it may not support all of the HTTP features directly, where applicable, @@ -80,17 +80,29 @@ The library is supposed to handle everything that it must handle (because the API would not allow clients to do this), such as basic -connection management; however, detailed interpretations of headers -- -such as range requests -- and HTTP methods are left to clients. The -library does understand 'HEAD' and will only send the headers of the -response and not the body, even if the client supplied a body. The -library also understands headers that control connection management -(specifically, 'Connection: close' and 'Expect: 100 continue' are -understood and handled automatically). - - MHD understands 'POST' data and is able to decode certain formats (at -the moment only 'application/x-www-form-urlencoded' and -'multipart/form-data') using the post processor API. The data stream of +connection management. However, detailed interpretations of headers, +such as range requests, are left to the main application. In +particular, if an application developer wants to support range requests, +he needs to explicitly indicate support in responses and also explicitly +parse the range header and generate a response (for example, using the +‘MHD_create_response_from_fd_at_offset’ call to serve ranges from a +file). MHD does understands headers that control connection management +(specifically, ‘Connection: close’ and ‘Expect: 100 continue’ are +understood and handled automatically). ‘Connection: upgrade’ is +supported by passing control over the socket (or something that behaves +like the real socket in the case of TLS) to the application (after +sending the desired HTTP response header). + + MHD largely ignores the semantics of the different HTTP methods, so +clients are left to handle those. One exception is that MHD does +understand ‘HEAD’ and will only send the headers of the response and not +the body, even if the client supplied a body. (In fact, clients do need +to construct a response with the correct length, even for ‘HEAD’ +request.) + + MHD understands ‘POST’ data and is able to decode certain formats (at +the moment only ‘application/x-www-form-urlencoded’ and +‘multipart/form-data’) using the post processor API. The data stream of a POST is also provided directly to the main application, so unsupported encodings could still be processed, just not conveniently by MHD. @@ -112,36 +124,38 @@ ========= MHD is currently used in a wide range of implementations. Examples -based on reports we've received from developers include: - * Embedded HTTP server on a cortex M3 (128 KB code space) - * Large-scale multimedia server (reportedly serving at the simulator +based on reports we’ve received from developers include: + • Embedded HTTP server on a cortex M3 (128 KB code space) + • Large-scale multimedia server (reportedly serving at the simulator limit of 7.5 GB/s) - * Administrative console (via HTTP/HTTPS) for network appliances + • Administrative console (via HTTP/HTTPS) for network appliances 1.2 Thread modes and event loops ================================ -MHD supports four basic thread modes and up to three event loop styes. +MHD supports four basic thread modes and up to three event loop styles. - The four basic thread modes are external (MHD creates no threads, -event loop is fully managed by the application), internal (MHD creates -one thread for all connections), thread pool (MHD creates a thread pool -which is used to process all connections) and thread-per-connection (MHD -creates one listen thread and then one thread per accepted connection). - - These thread modes are then combined with the event loop styles. MHD -support select, poll and epoll. epoll is only available on Linux, poll -may not be available on some platforms. Note that it is possible to -combine MHD using epoll with an external select-based event loop. + The four basic thread modes are external sockets polling (MHD creates +no threads, event loop is fully managed by the application), internal +polling (MHD creates one thread for all connections), polling in thread +pool (MHD creates a thread pool which is used to process all +connections) and thread-per-connection (MHD creates one thread for +listen sockets and then one thread per accepted connection). + + These thread modes are then combined with the evet loop styles +(polling function type). MHD support select, poll and epoll. select is +available on all platforms, epoll and poll may not be available on some +platforms. Note that it is possible to combine MHD using epoll with an +external select-based event loop. - The default (if no other option is passed) is "external select". The + The default (if no other option is passed) is “external select”. The highest performance can typically be obtained with a thread pool using -'epoll'. Apache Benchmark (ab) was used to compare the performance of -'select' and 'epoll' when using a thread pool and a large number of +‘epoll’. Apache Benchmark (ab) was used to compare the performance of +‘select’ and ‘epoll’ when using a thread pool and a large number of connections. *note Figure 1.1: fig:performance. shows the resulting -plot from the 'benchmark.c' example, which measures the latency between +plot from the ‘benchmark.c’ example, which measures the latency between an incoming request and the completion of the transmission of the -response. In this setting, the 'epoll' thread pool with four threads +response. In this setting, the ‘epoll’ thread pool with four threads was able to handle more than 45,000 connections per second on loopback (with Apache Benchmark running three processes on the same machine). @@ -159,9 +173,9 @@ within the callbacks from MHD must use a thread per connection. This is typically rather costly. Applications that do not support threads or that must run on embedded devices without thread-support must use the -external mode. Using 'epoll' is only supported on Linux, thus portable -applications must at least have a fallback option available. *note -Table 1.1: tbl:supported. lists the sane combinations. +external mode. Using ‘epoll’ is only supported on some platform, thus +portable applications must at least have a fallback option available. +*note Table 1.1: tbl:supported. lists the sane combinations. select poll epoll external yes no yes @@ -189,44 +203,48 @@ all features enabled, otherwise unexpected incompatibilities can arise! Here is a list of MHD-specific options that can be given to configure -(canonical configure options such as "-prefix" are also supported, for a -full list of options run "./configure -help"): +(canonical configure options such as “–prefix” are also supported, for a +full list of options run “./configure –help”): -'``--disable-curl''' +‘``--disable-curl''’ disable running testcases using libcurl -'``--disable-largefile''' +‘``--disable-largefile''’ disable support for 64-bit files -'``--disable-messages''' +‘``--disable-messages''’ disable logging of error messages (smaller binary size, not so much fun for debugging) -'``--disable-https''' +‘``--disable-https''’ disable HTTPS support, even if GNUtls is found; this option must be used if eCOS license is desired as an option (in all cases the resulting binary falls under a GNU LGPL-only license) -'``--disable-postprocessor''' +‘``--disable-postprocessor''’ do not include the post processor API (results in binary incompatibility) -'``--disable-dauth''' +‘``--disable-dauth''’ do not include the authentication APIs (results in binary incompatibility) -'``--disable-epoll' - do not include epoll support, even on Linux (minimally smaller - binary size, good for testing portability to non-Linux systems) +‘``--disable-httpupgrade''’ + do not build code for HTTP “Upgrade” (smaller binary size, binary + incompatible library) + +‘``--disable-epoll''’ + do not include epoll support, even if it supported (minimally + smaller binary size, good for portability testing) -'``--enable-coverage''' +‘``--enable-coverage''’ set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries) -'``--with-gcrypt=PATH''' +‘``--with-gcrypt=PATH''’ specifies path to libgcrypt installation -'``--with-gnutls=PATH''' +‘``--with-gnutls=PATH''’ specifies path to libgnutls installation 1.4 Validity of pointers @@ -239,34 +257,34 @@ Most MHD data structures are associated with the connection of an HTTP client. Thus, pointers associated with a connection are typically valid until the connection is finished, at which point MHD will call the -'MHD_RequestCompletedCallback' if one is registered. Applications that +‘MHD_RequestCompletedCallback’ if one is registered. Applications that have such a callback registered may assume that keys and values from the -'MHD_KeyValueIterator', return values from 'MHD_lookup_connection_value' -and the 'url', 'method' and 'version' arguments to the -'MHD_AccessHandlerCallback' will remain valid until the respective -'MHD_RequestCompletedCallback' is invoked. - - In contrast, the 'upload_data' argument of -'MHD_RequestCompletedCallback' as well as all pointers from the -'MHD_PostDataIterator' are only valid for the duration of the callback. +‘MHD_KeyValueIterator’, return values from ‘MHD_lookup_connection_value’ +and the ‘url’, ‘method’ and ‘version’ arguments to the +‘MHD_AccessHandlerCallback’ will remain valid until the respective +‘MHD_RequestCompletedCallback’ is invoked. + + In contrast, the ‘upload_data’ argument of +‘MHD_RequestCompletedCallback’ as well as all pointers from the +‘MHD_PostDataIterator’ are only valid for the duration of the callback. - Pointers returned from 'MHD_get_response_header' are valid as long as + Pointers returned from ‘MHD_get_response_header’ are valid as long as the response itself is valid. 1.5 Including the microhttpd.h header ===================================== Ideally, before including "microhttpd.h" you should add the necessary -includes to define the 'uint64_t', 'size_t', 'fd_set', 'socklen_t' and -'struct sockaddr' data types. Which specific headers are needed may +includes to define the ‘uint64_t’, ‘size_t’, ‘fd_set’, ‘socklen_t’ and +‘struct sockaddr’ data types. Which specific headers are needed may depend on your platform and your build system might include some tests to provide you with the necessary conditional operations. For possible -suggestions consult 'platform.h' and 'configure.ac' in the MHD +suggestions consult ‘platform.h’ and ‘configure.ac’ in the MHD distribution. Once you have ensured that you manually (!) included the right headers for your platform before "microhttpd.h", you should also add a -line with '#define MHD_PLATFORM_H' which will prevent the "microhttpd.h" +line with ‘#define MHD_PLATFORM_H’ which will prevent the "microhttpd.h" header from trying (and, depending on your platform, failing) to include the right headers. @@ -279,16 +297,16 @@ MHD does not install a signal handler for SIGPIPE. On platforms where this is possible (such as GNU/Linux), it disables SIGPIPE for its I/O -operations (by passing MSG_NOSIGNAL). On other platforms, SIGPIPE -signals may be generated from network operations by MHD and will cause -the process to die unless the developer explicitly installs a signal -handler for SIGPIPE. +operations (by passing MSG_NOSIGNAL or similar). On other platforms, +SIGPIPE signals may be generated from network operations by MHD and will +cause the process to die unless the developer explicitly installs a +signal handler for SIGPIPE. Hence portable code using MHD must install a SIGPIPE handler or explicitly block the SIGPIPE signal. MHD does not do so in order to avoid messing with other parts of the application that may need to handle SIGPIPE in a particular way. You can make your application -handle SIGPIPE by calling the following function in 'main': +handle SIGPIPE by calling the following function in ‘main’: static void catcher (int sig) @@ -316,18 +334,18 @@ 1.7 MHD_UNSIGNED_LONG_LONG ========================== -Some platforms do not support 'long long'. Hence MHD defines a macro -'MHD_UNSIGNED LONG_LONG' which will default to 'unsigned long long'. +Some platforms do not support ‘long long’. Hence MHD defines a macro +‘MHD_UNSIGNED LONG_LONG’ which will default to ‘unsigned long long’. For standard desktop operating systems, this is all you need to know. - However, if your platform does not support 'unsigned long long', you -should change "platform.h" to define 'MHD_LONG_LONG' and -'MHD_UNSIGNED_LONG_LONG' to an appropriate alternative type and also -define 'MHD_LONG_LONG_PRINTF' and 'MHD_UNSIGNED_LONG_LONG_PRINTF' to the + However, if your platform does not support ‘unsigned long long’, you +should change "platform.h" to define ‘MHD_LONG_LONG’ and +‘MHD_UNSIGNED_LONG_LONG’ to an appropriate alternative type and also +define ‘MHD_LONG_LONG_PRINTF’ and ‘MHD_UNSIGNED_LONG_LONG_PRINTF’ to the corresponding format string for printing such a data type. Note that -the "signed" versions are deprecated. Also, for historical reasons, -'MHD_LONG_LONG_PRINTF' is without the percent sign, whereas -'MHD_UNSIGNED_LONG_LONG_PRINTF' is with the percent sign. Newly written +the “signed” versions are deprecated. Also, for historical reasons, +‘MHD_LONG_LONG_PRINTF’ is without the percent sign, whereas +‘MHD_UNSIGNED_LONG_LONG_PRINTF’ is with the percent sign. Newly written code should only use the unsigned versions. However, you need to define both in "platform.h" if you need to change the definition for the specific platform. @@ -351,8 +369,8 @@ /tmp/ascebc.sh $n done to convert all source files to EBCDIC. Note that you must run -'configure' from the directory where the configure script is located. -Otherwise, configure will fail to find the 'contrib/xcc' script (which +‘configure’ from the directory where the configure script is located. +Otherwise, configure will fail to find the ‘contrib/xcc’ script (which is a wrapper around the z/OS c89 compiler).  @@ -364,172 +382,216 @@ -- Enumeration: MHD_FLAG Options for the MHD daemon. - Note that if neither 'MHD_USE_THREAD_PER_CONNECTION' nor - 'MHD_USE_SELECT_INTERNALLY' is used, the client wants control over - the process and will call the appropriate microhttpd callbacks. + Note that MHD will run automatically in background thread(s) only + if ‘MHD_USE_INTERNAL_POLLING_THREAD’ is used. Otherwise caller + (application) must use ‘MHD_run’ or ‘MHD_run_from_select’ to have + MHD processed network connections and data. Starting the daemon may also fail if a particular option is not implemented or not supported on the target platform (i.e. no - support for SSL, threads or IPv6). SSL support generally depends + support for TLS, threads or IPv6). TLS support generally depends on options given during MHD compilation. Threaded operations - (including 'MHD_USE_SELECT_INTERNALLY') are not supported on + (including ‘MHD_USE_INTERNAL_POLLING_THREAD’) are not supported on Symbian. - 'MHD_NO_FLAG' + ‘MHD_NO_FLAG’ No options selected. - 'MHD_USE_DEBUG' - Run in debug mode. If this flag is used, the library should - print error messages and warnings to stderr. Note that for - this run-time option to have any effect, MHD needs to be - compiled with messages enabled. This is done by default - except you ran configure with the '--disable-messages' flag - set. - - 'MHD_USE_SSL' - Run in HTTPS-mode. If you specify 'MHD_USE_SSL' and MHD was - compiled without SSL support, 'MHD_start_daemon' will return + ‘MHD_USE_ERROR_LOG’ + If this flag is used, the library should print error messages + and warnings to stderr (or to custom error printer if it’s + specified by options). Note that for this run-time option to + have any effect, MHD needs to be compiled with messages + enabled. This is done by default except you ran configure + with the ‘--disable-messages’ flag set. + + ‘MHD_USE_DEBUG’ + Currently the same as ‘MHD_USE_ERROR_LOG’. + + ‘MHD_USE_TLS’ + Run in HTTPS-mode. If you specify ‘MHD_USE_TLS’ and MHD was + compiled without SSL support, ‘MHD_start_daemon’ will return NULL. - 'MHD_USE_THREAD_PER_CONNECTION' + ‘MHD_USE_THREAD_PER_CONNECTION’ Run using one thread per connection. - 'MHD_USE_SELECT_INTERNALLY' - Run using an internal thread doing 'SELECT'. + ‘MHD_USE_INTERNAL_POLLING_THREAD’ + Run using an internal thread doing ‘SELECT’. - 'MHD_USE_IPv6' + ‘MHD_USE_IPv6’ Run using the IPv6 protocol (otherwise, MHD will just support - IPv4). If you specify 'MHD_USE_IPV6' and the local platform - does not support it, 'MHD_start_daemon' will return NULL. + IPv4). If you specify ‘MHD_USE_IPV6’ and the local platform + does not support it, ‘MHD_start_daemon’ will return NULL. If you want MHD to support IPv4 and IPv6 using a single socket, pass MHD_USE_DUAL_STACK, otherwise, if you only pass this option, MHD will try to bind to IPv6-only (resulting in no IPv4 support). - 'MHD_USE_DUAL_STACK' + ‘MHD_USE_DUAL_STACK’ Use a single socket for IPv4 and IPv6. Note that this will mean that IPv4 addresses are returned by MHD in the - IPv6-mapped format (the 'struct sockaddr_in6' format will be + IPv6-mapped format (the ’struct sockaddr_in6’ format will be used for IPv4 and IPv6). - 'MHD_USE_PEDANTIC_CHECKS' - Be pedantic about the protocol (as opposed to as tolerant as - possible). Specifically, at the moment, this flag causes MHD - to reject HTTP 1.1 connections without a 'Host' header. This - is required by the standard, but of course in violation of the - "be as liberal as possible in what you accept" norm. It is - recommended to turn this *ON* if you are testing clients - against MHD, and *OFF* in production. - - 'MHD_USE_POLL' - Use 'poll()' instead of 'select()'. This allows sockets with - descriptors '>= FD_SETSIZE'. This option currently only works - in conjunction with 'MHD_USE_THREAD_PER_CONNECTION' or - 'MHD_USE_INTERNAL_SELECT' (at this point). If you specify - 'MHD_USE_POLL' and the local platform does not support it, - 'MHD_start_daemon' will return NULL. - - 'MHD_USE_EPOLL_LINUX_ONLY' - Use 'epoll()' instead of 'poll()' or 'select()'. This allows - sockets with descriptors '>= FD_SETSIZE'. This option is only - available on Linux systems and does not work in conjunction - with 'MHD_USE_THREAD_PER_CONNECTION' (at this point). If you - specify 'MHD_USE_EPOLL_LINUX_ONLY' and the local platform does - not support it, 'MHD_start_daemon' will return NULL. Using - 'epoll()' instead of 'select()' or 'poll()' can in some + ‘MHD_USE_PEDANTIC_CHECKS’ + Deprecated (use ‘MHD_OPTION_STRICT_FOR_CLIENT’). Be pedantic + about the protocol. Specifically, at the moment, this flag + causes MHD to reject HTTP 1.1 connections without a ‘Host’ + header. This is required by the standard, but of course in + violation of the “be as liberal as possible in what you + accept” norm. It is recommended to turn this *ON* if you are + testing clients against MHD, and *OFF* in production. + + ‘MHD_USE_POLL’ + Use ‘poll()’ instead of ‘select()’. This allows sockets with + descriptors ‘>= FD_SETSIZE’. This option currently only works + in conjunction with ‘MHD_USE_INTERNAL_POLLING_THREAD’ (at this + point). If you specify ‘MHD_USE_POLL’ and the local platform + does not support it, ‘MHD_start_daemon’ will return NULL. + + ‘MHD_USE_EPOLL’ + Use ‘epoll()’ instead of ‘poll()’ or ‘select()’. This allows + sockets with descriptors ‘>= FD_SETSIZE’. This option is only + available on some systems and does not work in conjunction + with ‘MHD_USE_THREAD_PER_CONNECTION’ (at this point). If you + specify ‘MHD_USE_EPOLL’ and the local platform does not + support it, ‘MHD_start_daemon’ will return NULL. Using + ‘epoll()’ instead of ‘select()’ or ‘poll()’ can in some situations result in significantly higher performance as the system call has fundamentally lower complexity (O(1) for - 'epoll()' vs. O(n) for 'select()'/'poll()' where n is the + ‘epoll()’ vs. O(n) for ‘select()’/‘poll()’ where n is the number of open connections). - 'MHD_SUPPRESS_DATE_NO_CLOCK' - Suppress (automatically) adding the 'Date:' header to HTTP + ‘MHD_USE_TURBO’ + Enable optimizations to aggressively improve performance. + + Currently, the optimizations this option enables are based on + opportunistic reads and writes. Bascially, MHD will simply + try to read or write or accept on a socket before checking + that the socket is ready for IO using the event loop + mechanism. As the sockets are non-blocking, this may fail (at + a loss of performance), but generally MHD does this in + situations where the operation is likely to succeed, in which + case performance is improved. Setting the flag should + generally be safe (even though the code is slightly more + experimental). You may want to benchmark your application to + see if this makes any difference for you. + + ‘MHD_USE_SUPPRESS_DATE_NO_CLOCK’ + Suppress (automatically) adding the ’Date:’ header to HTTP responses. This option should ONLY be used on systems that do not have a clock and that DO provide other mechanisms for cache control. See also RFC 2616, section 14.18 (exception 3). - 'MHD_USE_NO_LISTEN_SOCKET' + ‘MHD_USE_NO_LISTEN_SOCKET’ Run the HTTP server without any listen socket. This option - only makes sense if 'MHD_add_connection' is going to be used + only makes sense if ‘MHD_add_connection’ is going to be used exclusively to connect HTTP clients to the HTTP server. This option is incompatible with using a thread pool; if it is - used, 'MHD_OPTION_THREAD_POOL_SIZE' is ignored. + used, ‘MHD_OPTION_THREAD_POOL_SIZE’ is ignored. - 'MHD_USE_PIPE_FOR_SHUTDOWN' - Force MHD to use a signal pipe to notify the event loop (of - threads) of our shutdown. This is required if an appliction - uses 'MHD_USE_INTERNAL_SELECT' or - 'MHD_USE_THREAD_PER_CONNECTION' and then performs - 'MHD_quiesce_daemon' (which eliminates our ability to signal + ‘MHD_USE_ITC’ + Force MHD to use a signal inter-thread communication channel + to notify the event loop (of threads) of our shutdown and + other events. This is required if an application uses + ‘MHD_USE_INTERNAL_POLLING_THREAD’ and then performs + ‘MHD_quiesce_daemon’ (which eliminates our ability to signal termination via the listen socket). In these modes, - 'MHD_quiesce_daemon' will fail if this option was not set. + ‘MHD_quiesce_daemon’ will fail if this option was not set. Also, use of this option is automatic (as in, you do not even - have to specify it), if 'MHD_USE_NO_LISTEN_SOCKET' is + have to specify it), if ‘MHD_USE_NO_LISTEN_SOCKET’ is specified. In "external" select mode, this option is always simply ignored. Using this option also guarantees that MHD will not call - 'shutdown()' on the listen socket, which means a parent + ‘shutdown()’ on the listen socket, which means a parent process can continue to use the socket. - 'MHD_USE_SUSPEND_RESUME' - Enables using 'MHD_suspend_connection' and - 'MHD_resume_connection', as performing these calls requires - some additional pipes to be created, and code not using these - calls should not pay the cost. + ‘MHD_ALLOW_SUSPEND_RESUME’ + Enables using ‘MHD_suspend_connection’ and + ‘MHD_resume_connection’, as performing these calls requires + some additional inter-thred communication channels to be + created, and code not using these calls should not pay the + cost. - 'MHD_USE_TCP_FASTOPEN' + ‘MHD_USE_TCP_FASTOPEN’ Enable TCP_FASTOPEN on the listen socket. TCP_FASTOPEN is currently supported on Linux >= 3.6. On other systems using - this option with cause 'MHD_start_daemon' to fail. + this option with cause ‘MHD_start_daemon’ to fail. + + ‘MHD_ALLOW_UPGRADE’ + This option must be set if you want to upgrade connections + (via “101 Switching Protocols” responses). This requires MHD + to allocate additional resources, and hence we require this + special flag so we only use the resources that are really + needed. + + ‘MHD_USE_AUTO’ + Automatically select best event loop style (polling function) + depending on requested mode by other MHD flags and functions + available on platform. If application doesn’t have + requirements for any specific polling function, it’s + recommended to use this flag. This flag is very convenient + for multiplatform applications. -- Enumeration: MHD_OPTION MHD options. Passed in the varargs portion of - 'MHD_start_daemon()'. + ‘MHD_start_daemon()’. - 'MHD_OPTION_END' + ‘MHD_OPTION_END’ No more options / last option. This is used to terminate the VARARGs list. - 'MHD_OPTION_CONNECTION_MEMORY_LIMIT' - Maximum memory size per connection (followed by a 'size_t'). + ‘MHD_OPTION_CONNECTION_MEMORY_LIMIT’ + Maximum memory size per connection (followed by a ‘size_t’). The default is 32 kB (32*1024 bytes) as defined by the - internal constant 'MHD_POOL_SIZE_DEFAULT'. Values above 128k + internal constant ‘MHD_POOL_SIZE_DEFAULT’. Values above 128k are unlikely to result in much benefit, as half of the memory will be typically used for IO, and TCP buffers are unlikely to support window sizes above 64k on most systems. - 'MHD_OPTION_CONNECTION_MEMORY_INCREMENT' + ‘MHD_OPTION_CONNECTION_MEMORY_INCREMENT’ Increment to use for growing the read buffer (followed by a - 'size_t'). The default is 1024 (bytes). Increasing this + ‘size_t’). The default is 1024 (bytes). Increasing this value will make MHD use memory for reading more aggressively, - which can reduce the number of 'recvfrom' calls but may - increase the number of 'sendto' calls. The given value must + which can reduce the number of ‘recvfrom’ calls but may + increase the number of ‘sendto’ calls. The given value must fit within MHD_OPTION_CONNECTION_MEMORY_LIMIT. - 'MHD_OPTION_CONNECTION_LIMIT' + ‘MHD_OPTION_CONNECTION_LIMIT’ Maximum number of concurrent connections to accept (followed - by an 'unsigned int'). The default is 'FD_SETSIZE - 4' (the - maximum number of file descriptors supported by 'select' minus - four for 'stdin', 'stdout', 'stderr' and the server socket). + by an ‘unsigned int’). The default is ‘FD_SETSIZE - 4’ (the + maximum number of file descriptors supported by ‘select’ minus + four for ‘stdin’, ‘stdout’, ‘stderr’ and the server socket). In other words, the default is as large as possible. + If the connection limit is reached, MHD’s behavior depends a + bit on other options. If ‘MHD_USE_ITC’ was given, MHD will + stop accepting connections on the listen socket. This will + cause the operating system to queue connections (up to the + ‘listen()’ limit) above the connection limit. Those + connections will be held until MHD is done processing at least + one of the active connections. If ‘MHD_USE_ITC’ is not set, + then MHD will continue to ‘accept()’ and immediately ‘close()’ + these connections. + Note that if you set a low connection limit, you can easily get into trouble with browsers doing request pipelining. For - example, if your connection limit is "1", a browser may open a - first connection to access your "index.html" file, keep it + example, if your connection limit is “1”, a browser may open a + first connection to access your “index.html” file, keep it open but use a second connection to retrieve CSS files, images and the like. In fact, modern browsers are typically by default configured for up to 15 parallel connections to a single server. If this happens, MHD will refuse to even accept the second connection until the first connection is - closed -- which does not happen until timeout. As a result, + closed — which does not happen until timeout. As a result, the browser will fail to render the page and seem to hang. If you expect your server to operate close to the connection limit, you should first consider using a lower timeout value - and also possibly add a "Connection: close" header to your + and also possibly add a “Connection: close” header to your response to ensure that request pipelining is not used and connections are closed immediately after the request has completed: @@ -537,66 +599,92 @@ MHD_HTTP_HEADER_CONNECTION, "close"); - 'MHD_OPTION_CONNECTION_TIMEOUT' + ‘MHD_OPTION_CONNECTION_TIMEOUT’ After how many seconds of inactivity should a connection - automatically be timed out? (followed by an 'unsigned int'; + automatically be timed out? (followed by an ‘unsigned int’; use zero for no timeout). The default is zero (no timeout). - 'MHD_OPTION_NOTIFY_COMPLETED' + ‘MHD_OPTION_NOTIFY_COMPLETED’ Register a function that should be called whenever a request has been completed (this can be used for application-specific clean up). Requests that have never been presented to the - application (via 'MHD_AccessHandlerCallback()') will not + application (via ‘MHD_AccessHandlerCallback()’) will not result in notifications. This option should be followed by *TWO* pointers. First a - pointer to a function of type 'MHD_RequestCompletedCallback()' + pointer to a function of type ‘MHD_RequestCompletedCallback()’ and second a pointer to a closure to pass to the request - completed callback. The second pointer maybe 'NULL'. + completed callback. The second pointer maybe ‘NULL’. - 'MHD_OPTION_NOTIFY_CONNECTION' + ‘MHD_OPTION_NOTIFY_CONNECTION’ Register a function that should be called when the TCP connection to a client is opened or closed. Note that - 'MHD_OPTION_NOTIFY_COMPLETED' and the 'con_cls' argument to - the 'MHD_AccessHandlerCallback' are per HTTP request (and + ‘MHD_OPTION_NOTIFY_COMPLETED’ and the ‘con_cls’ argument to + the ‘MHD_AccessHandlerCallback’ are per HTTP request (and there can be multiple HTTP requests per TCP connection). The registered callback is called twice per TCP connection, with - 'MHD_CONNECTION_NOTIFY_STARTED' and - 'MHD_CONNECTION_NOTIFY_CLOSED' respectively. An additional + ‘MHD_CONNECTION_NOTIFY_STARTED’ and + ‘MHD_CONNECTION_NOTIFY_CLOSED’ respectively. An additional argument can be used to store TCP connection specific information, which can be retrieved using - 'MHD_CONNECTION_INFO_SOCKET_CONTEXT' during the lifetime of + ‘MHD_CONNECTION_INFO_SOCKET_CONTEXT’ during the lifetime of the TCP connection. The respective location is not the same - as the HTTP-request-specific 'con_cls' from the - 'MHD_AccessHandlerCallback'. + as the HTTP-request-specific ‘con_cls’ from the + ‘MHD_AccessHandlerCallback’. This option should be followed by *TWO* pointers. First a - pointer to a function of type 'MHD_NotifyConnectionCallback()' + pointer to a function of type ‘MHD_NotifyConnectionCallback()’ and second a pointer to a closure to pass to the request - completed callback. The second pointer maybe 'NULL'. + completed callback. The second pointer maybe ‘NULL’. - 'MHD_OPTION_PER_IP_CONNECTION_LIMIT' + ‘MHD_OPTION_PER_IP_CONNECTION_LIMIT’ Limit on the number of (concurrent) connections made to the server from the same IP address. Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. The option - should be followed by an 'unsigned int'. The default is zero, + should be followed by an ‘unsigned int’. The default is zero, which means no limit on the number of connections from the same IP address. - 'MHD_OPTION_SOCK_ADDR' + ‘MHD_OPTION_LISTEN_BACKLOG_SIZE’ + Set the size of the ‘listen()’ back log queue of the TCP + socket. Takes an ‘unsigned int’ as the argument. Default is + the platform-specific value of ‘SOMAXCONN’. + + ‘MHD_OPTION_STRICT_FOR_CLIENT’ + Specify how strict we should enforce the HTTP protocol. Takes + an ‘int’ as the argument. Default is zero. + + If set to 1, MHD will be strict about the protocol. + Specifically, at the moment, this flag uses MHD to reject HTTP + 1.1 connections without a "Host" header. This is required by + the standard, but of course in violation of the "be as liberal + as possible in what you accept" norm. It is recommended to + set this to 1 if you are testing clients against MHD, and 0 in + production. + + If set to -1 MHD will be permissive about the protocol, + allowing slight deviations that are technically not allowed by + the RFC. Specifically, at the moment, this flag causes MHD to + allow spaces in header field names. This is disallowed by the + standard. + + It is not recommended to set it to -1 on publicly available + servers as it may potentially lower level of protection. + + ‘MHD_OPTION_SOCK_ADDR’ Bind daemon to the supplied socket address. This option - should be followed by a 'struct sockaddr *'. If - 'MHD_USE_IPv6' is specified, the 'struct sockaddr*' should - point to a 'struct sockaddr_in6', otherwise to a 'struct - sockaddr_in'. If this option is not specified, the daemon + should be followed by a ‘struct sockaddr *’. If + ‘MHD_USE_IPv6’ is specified, the ‘struct sockaddr*’ should + point to a ‘struct sockaddr_in6’, otherwise to a ‘struct + sockaddr_in’. If this option is not specified, the daemon will listen to incoming connections from anywhere. If you use - this option, the 'port' argument from 'MHD_start_daemon' is - ignored and the port from the given 'struct sockaddr *' will + this option, the ’port’ argument from ‘MHD_start_daemon’ is + ignored and the port from the given ‘struct sockaddr *’ will be used instead. - 'MHD_OPTION_URI_LOG_CALLBACK' + ‘MHD_OPTION_URI_LOG_CALLBACK’ Specify a function that should be called before parsing the URI from the client. The specified callback function can be used for processing the URI (including the options) before it @@ -605,43 +693,43 @@ should be followed by two arguments, the first one must be of the form void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) - where the return value will be passed as '*con_cls' in calls - to the 'MHD_AccessHandlerCallback' when this request is - processed later; returning a value of 'NULL' has no special - significance; (however, note that if you return non-'NULL', + where the return value will be passed as ‘*con_cls’ in calls + to the ‘MHD_AccessHandlerCallback’ when this request is + processed later; returning a value of ‘NULL’ has no special + significance; (however, note that if you return non-‘NULL’, you can no longer rely on the first call to the access handler - having 'NULL == *con_cls' on entry) 'cls' will be set to the + having ‘NULL == *con_cls’ on entry) ‘cls’ will be set to the second argument following MHD_OPTION_URI_LOG_CALLBACK. - Finally, 'uri' will be the 0-terminated URI of the request. + Finally, ‘uri’ will be the 0-terminated URI of the request. Note that during the time of this call, most of the - connection's state is not initialized (as we have not yet + connection’s state is not initialized (as we have not yet parsed he headers). However, information about the connecting client (IP, socket) is available. - 'MHD_OPTION_HTTPS_MEM_KEY' + ‘MHD_OPTION_HTTPS_MEM_KEY’ Memory pointer to the private key to be used by the HTTPS daemon. This option should be followed by an "const char*" argument. This should be used in conjunction with - 'MHD_OPTION_HTTPS_MEM_CERT'. + ’MHD_OPTION_HTTPS_MEM_CERT’. - 'MHD_OPTION_HTTPS_KEY_PASSWORD' + ‘MHD_OPTION_HTTPS_KEY_PASSWORD’ Memory pointer to the password that decrypts the private key to be used by the HTTPS daemon. This option should be followed by an "const char*" argument. This should be used in - conjunction with 'MHD_OPTION_HTTPS_MEM_KEY'. + conjunction with ’MHD_OPTION_HTTPS_MEM_KEY’. The password (or passphrase) is only used immediately during - 'MHD_start_daemon()'. Thus, the application may want to erase + ‘MHD_start_daemon()’. Thus, the application may want to erase it from memory afterwards for additional security. - 'MHD_OPTION_HTTPS_MEM_CERT' + ‘MHD_OPTION_HTTPS_MEM_CERT’ Memory pointer to the certificate to be used by the HTTPS daemon. This option should be followed by an "const char*" argument. This should be used in conjunction with - 'MHD_OPTION_HTTPS_MEM_KEY'. + ’MHD_OPTION_HTTPS_MEM_KEY’. - 'MHD_OPTION_HTTPS_MEM_TRUST' + ‘MHD_OPTION_HTTPS_MEM_TRUST’ Memory pointer to the CA certificate to be used by the HTTPS daemon to authenticate and trust clients certificates. This option should be followed by an "const char*" argument. The @@ -653,20 +741,20 @@ have one matching the specified CA, not sending any certificate otherwise. - 'MHD_OPTION_HTTPS_CRED_TYPE' + ‘MHD_OPTION_HTTPS_CRED_TYPE’ Daemon credentials type. Either certificate or anonymous, this option should be followed by one of the values listed in "enum gnutls_credentials_type_t". - 'MHD_OPTION_HTTPS_PRIORITIES' + ‘MHD_OPTION_HTTPS_PRIORITIES’ SSL/TLS protocol version and ciphers. This option must be followed by an "const char *" argument specifying the SSL/TLS protocol versions and ciphers that are acceptable for the application. The string is passed unchanged to gnutls_priority_init. If this option is not specified, - "NORMAL" is used. + “NORMAL” is used. - 'MHD_OPTION_HTTPS_CERT_CALLBACK' + ‘MHD_OPTION_HTTPS_CERT_CALLBACK’ Use a callback to determine which X.509 certificate should be used for a given HTTPS connection. This option should be followed by a argument of type @@ -674,15 +762,15 @@ provides an alternative to MHD_OPTION_HTTPS_MEM_KEY and MHD_OPTION_HTTPS_MEM_CERT. You must use this version if multiple domains are to be hosted at the same IP address using - TLS's Server Name Indication (SNI) extension. In this case, + TLS’s Server Name Indication (SNI) extension. In this case, the callback is expected to select the correct certificate based on the SNI information provided. The callback is expected to access the SNI data using gnutls_server_name_get(). Using this option requires GnuTLS 3.0 or higher. - 'MHD_OPTION_DIGEST_AUTH_RANDOM' - Digest Authentication nonce's seed. + ‘MHD_OPTION_DIGEST_AUTH_RANDOM’ + Digest Authentication nonce’s seed. This option should be followed by two arguments. First an integer of type "size_t" which specifies the size of the @@ -692,7 +780,7 @@ running. For security, you SHOULD provide a fresh random nonce when using MHD with Digest Authentication. - 'MHD_OPTION_NONCE_NC_SIZE' + ‘MHD_OPTION_NONCE_NC_SIZE’ Size of an array of nonce and nonce counter map. This option must be followed by an "unsigned int" argument that have the @@ -715,39 +803,39 @@ request latency of 250 ms, then a value of about 5 should be fine. - 'MHD_OPTION_LISTEN_SOCKET' + ‘MHD_OPTION_LISTEN_SOCKET’ Listen socket to use. Pass a listen socket for MHD to use (systemd-style). If this option is used, MHD will not open its own listen socket(s). The argument passed must be of type "int" and refer to an existing socket that has been bound to a port and is listening. - 'MHD_OPTION_EXTERNAL_LOGGER' + ‘MHD_OPTION_EXTERNAL_LOGGER’ Use the given function for logging error messages. This option must be followed by two arguments; the first must be a - pointer to a function of type 'void fun(void * arg, const char - * fmt, va_list ap)' and the second a pointer of type 'void*' + pointer to a function of type ’void fun(void * arg, const char + * fmt, va_list ap)’ and the second a pointer of type ’void*’ which will be passed as the "arg" argument to "fun". Note that MHD will not generate any log messages without the - MHD_USE_DEBUG flag set and if MHD was compiled with the - "-disable-messages" flag. + MHD_USE_ERROR_LOG flag set and if MHD was compiled with the + "–disable-messages" flag. - 'MHD_OPTION_THREAD_POOL_SIZE' + ‘MHD_OPTION_THREAD_POOL_SIZE’ Number (unsigned int) of threads in thread pool. Enable thread pooling by setting this value to to something greater than 1. Currently, thread model must be - MHD_USE_SELECT_INTERNALLY if thread pooling is enabled - ('MHD_start_daemon' returns 'NULL' for an unsupported thread + MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled + (‘MHD_start_daemon’ returns ‘NULL’ for an unsupported thread model). - 'MHD_OPTION_ARRAY' + ‘MHD_OPTION_ARRAY’ This option can be used for initializing MHD using options from an array. A common use for this is writing an FFI for - MHD. The actual options given are in an array of 'struct - MHD_OptionItem', so this option requires a single argument of - type 'struct MHD_OptionItem'. The array must be terminated - with an entry 'MHD_OPTION_END'. + MHD. The actual options given are in an array of ’struct + MHD_OptionItem’, so this option requires a single argument of + type ’struct MHD_OptionItem’. The array must be terminated + with an entry ‘MHD_OPTION_END’. An example for code using MHD_OPTION_ARRAY is: struct MHD_OptionItem ops[] = { @@ -759,11 +847,11 @@ MHD_OPTION_ARRAY, ops, MHD_OPTION_END); For options that expect a single pointer argument, the second - member of the 'struct MHD_OptionItem' is ignored. For options + member of the ‘struct MHD_OptionItem’ is ignored. For options that expect two pointer arguments, the first argument must be - cast to 'intptr_t'. + cast to ‘intptr_t’. - 'MHD_OPTION_UNESCAPE_CALLBACK' + ‘MHD_OPTION_UNESCAPE_CALLBACK’ Specify a function that should be called for unescaping escape sequences in URIs and URI arguments. Note that this function @@ -774,147 +862,143 @@ size_t my_unescaper(void * cls, struct MHD_Connection *c, char *s) - where the return value must be 'strlen(s)' and 's' should be + where the return value must be ‘strlen(s)’ and ‘s’ should be updated. Note that the unescape function must not lengthen - 's' (the result must be shorter than the input and still be - 0-terminated). 'cls' will be set to the second argument + ‘s’ (the result must be shorter than the input and still be + 0-terminated). ‘cls’ will be set to the second argument following MHD_OPTION_UNESCAPE_CALLBACK. - 'MHD_OPTION_THREAD_STACK_SIZE' + ‘MHD_OPTION_THREAD_STACK_SIZE’ Maximum stack size for threads created by MHD. This option - must be followed by a 'size_t'). Not specifying this option + must be followed by a ‘size_t’). Not specifying this option or using a value of zero means using the system default (which is likely to differ based on your platform). - 'MHD_OPTION_TCP_FASTQUEUE_QUEUE_SIZE' - When the flag 'MHD_USE_TCP_FASTOPEN' is used, this option sets + ‘MHD_OPTION_TCP_FASTQUEUE_QUEUE_SIZE’ + When the flag ‘MHD_USE_TCP_FASTOPEN’ is used, this option sets the connection handshake queue size for the TCP FASTOPEN connections. Note that a TCP FASTOPEN connection handshake occupies more resources than a TCP handshake as the SYN packets also contain DATA which is kept in the associate state until handshake is completed. If this option is not given the queue size is set to a default value of 10. This option must - be followed by a 'unsigned int'. + be followed by a ‘unsigned int’. - 'MHD_OPTION_HTTPS_MEM_DHPARAMS' + ‘MHD_OPTION_HTTPS_MEM_DHPARAMS’ Memory pointer for the Diffie-Hellman parameters (dh.pem) to be used by the HTTPS daemon for key exchange. This option - must be followed by a 'const char *' argument. The argument + must be followed by a ‘const char *’ argument. The argument would be a zero-terminated string with a PEM encoded PKCS3 DH parameters structure suitable for passing to - 'gnutls_dh_parms_import_pkcs3'. + ‘gnutls_dh_parms_import_pkcs3’. - 'MHD_OPTION_LISTENING_ADDRESS_REUSE' - This option must be followed by a 'unsigned int' argument. If + ‘MHD_OPTION_LISTENING_ADDRESS_REUSE’ + This option must be followed by a ‘unsigned int’ argument. If this option is present and true (nonzero) parameter is given, allow reusing the address:port of the listening socket (using - 'SO_REUSEPORT' on most platforms, and 'SO_REUSEADDR' on + ‘SO_REUSEPORT’ on most platforms, and ‘SO_REUSEADDR’ on Windows). If a false (zero) parameter is given, disallow reusing the the address:port of the listening socket (this - usually requires no special action, but 'SO_EXCLUSIVEADDRUSE' - is needed on Windows). If this option is not present, default - behaviour is undefined (currently, 'SO_REUSEADDR' is used on - all platforms, which disallows address:port reusing with the - exception of Windows). + usually requires no special action, but ‘SO_EXCLUSIVEADDRUSE’ + is needed on Windows). If this option is not present + ‘SO_REUSEADDR’ is used on all platforms except Windows so + reusing of address:port is disallowed. -- C Struct: MHD_OptionItem - Entry in an MHD_OPTION_ARRAY. See the 'MHD_OPTION_ARRAY' option + Entry in an MHD_OPTION_ARRAY. See the ‘MHD_OPTION_ARRAY’ option argument for its use. - The 'option' member is used to specify which option is specified in + The ‘option’ member is used to specify which option is specified in the array. The other members specify the respective argument. - Note that for options taking only a single pointer, the 'ptr_value' + Note that for options taking only a single pointer, the ‘ptr_value’ member should be set. For options taking two pointer arguments, - the first pointer must be cast to 'intptr_t' and both the 'value' - and the 'ptr_value' members should be used to pass the two + the first pointer must be cast to ‘intptr_t’ and both the ‘value’ + and the ‘ptr_value’ members should be used to pass the two pointers. -- Enumeration: MHD_ValueKind - The 'MHD_ValueKind' specifies the source of the key-value pairs in + The ‘MHD_ValueKind’ specifies the source of the key-value pairs in the HTTP protocol. - 'MHD_RESPONSE_HEADER_KIND' - Response header. - - 'MHD_HEADER_KIND' + ‘MHD_HEADER_KIND’ HTTP header. - 'MHD_COOKIE_KIND' + ‘MHD_COOKIE_KIND’ Cookies. Note that the original HTTP header containing the cookie(s) will still be available and intact. - 'MHD_POSTDATA_KIND' - 'POST' data. This is available only if a content encoding + ‘MHD_POSTDATA_KIND’ + ‘POST’ data. This is available only if a content encoding supported by MHD is used (currently only URL encoding), and only if the posted content fits within the available memory pool. Note that in that case, the upload data given to the - 'MHD_AccessHandlerCallback()' will be empty (since it has + ‘MHD_AccessHandlerCallback()’ will be empty (since it has already been processed). - 'MHD_GET_ARGUMENT_KIND' - 'GET' (URI) arguments. + ‘MHD_GET_ARGUMENT_KIND’ + ‘GET’ (URI) arguments. - 'MHD_FOOTER_KIND' + ‘MHD_FOOTER_KIND’ HTTP footer (only for http 1.1 chunked encodings). -- Enumeration: MHD_RequestTerminationCode - The 'MHD_RequestTerminationCode' specifies reasons why a request + The ‘MHD_RequestTerminationCode’ specifies reasons why a request has been terminated (or completed). - 'MHD_REQUEST_TERMINATED_COMPLETED_OK' + ‘MHD_REQUEST_TERMINATED_COMPLETED_OK’ We finished sending the response. - 'MHD_REQUEST_TERMINATED_WITH_ERROR' + ‘MHD_REQUEST_TERMINATED_WITH_ERROR’ Error handling the connection (resources exhausted, other side closed connection, application error accepting request, etc.) - 'MHD_REQUEST_TERMINATED_TIMEOUT_REACHED' + ‘MHD_REQUEST_TERMINATED_TIMEOUT_REACHED’ No activity on the connection for the number of seconds - specified using 'MHD_OPTION_CONNECTION_TIMEOUT'. + specified using ‘MHD_OPTION_CONNECTION_TIMEOUT’. - 'MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN' + ‘MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN’ We had to close the session since MHD was being shut down. -- Enumeration: MHD_ResponseMemoryMode - The 'MHD_ResponeMemoryMode' specifies how MHD should treat the + The ‘MHD_ResponeMemoryMode’ specifies how MHD should treat the memory buffer given for the response in - 'MHD_create_response_from_buffer'. + ‘MHD_create_response_from_buffer’. - 'MHD_RESPMEM_PERSISTENT' - Buffer is a persistent (static/global) buffer that won't + ‘MHD_RESPMEM_PERSISTENT’ + Buffer is a persistent (static/global) buffer that won’t change for at least the lifetime of the response, MHD should just use it, not free it, not copy it, just keep an alias to it. - 'MHD_RESPMEM_MUST_FREE' - Buffer is heap-allocated with 'malloc' (or equivalent) and + ‘MHD_RESPMEM_MUST_FREE’ + Buffer is heap-allocated with ‘malloc’ (or equivalent) and should be freed by MHD after processing the response has concluded (response reference counter reaches zero). - 'MHD_RESPMEM_MUST_COPY' + ‘MHD_RESPMEM_MUST_COPY’ Buffer is in transient memory, but not on the heap (for example, on the stack or non-malloc allocated) and only valid - during the call to 'MHD_create_response_from_buffer'. MHD + during the call to ‘MHD_create_response_from_buffer’. MHD must make its own private copy of the data for processing. -- Enumeration: MHD_ResponseFlags Response-specific flags. Passed as an argument to - 'MHD_set_response_options()'. + ‘MHD_set_response_options()’. - 'MHD_RF_NONE' + ‘MHD_RF_NONE’ No special handling. - 'MHD_RF_HTTP_VERSION_1_0_ONLY' + ‘MHD_RF_HTTP_VERSION_1_0_ONLY’ Only respond in conservative HTTP 1.0-mode. In particular, do not (automatically) sent "Connection" headers and always close the connection after generating the response. -- Enumeration: MHD_ResponseOptions Response-specific options. Passed in the varargs portion of - 'MHD_set_response_options()'. + ‘MHD_set_response_options()’. - 'MHD_RO_END' + ‘MHD_RO_END’ No more options / last option. This is used to terminate the VARARGs list. @@ -937,7 +1021,7 @@ Handle for a response. -- C Struct: MHD_PostProcessor - Handle for 'POST' processing. + Handle for ‘POST’ processing. -- C Union: MHD_ConnectionInfo Information about a connection. @@ -954,8 +1038,8 @@ -- Function Pointer: int *MHD_AcceptPolicyCallback (void *cls, const struct sockaddr * addr, socklen_t addrlen) Invoked in the context of a connection to allow or deny a client to - connect. This callback return 'MHD_YES' if connection is allowed, - 'MHD_NO' if not. + connect. This callback return ‘MHD_YES’ if connection is allowed, + ‘MHD_NO’ if not. CLS custom value selected at callback registration time; @@ -970,13 +1054,13 @@ *upload_data_size, void **con_cls) Invoked in the context of a connection to answer a request from the client. This callback must call MHD functions (example: the - 'MHD_Response' ones) to provide content to give back to the client - and return an HTTP status code (i.e. '200' for OK, '404', etc.). + ‘MHD_Response’ ones) to provide content to give back to the client + and return an HTTP status code (i.e. ‘200’ for OK, ‘404’, etc.). *note microhttpd-post::, for details on how to code this callback. - Must return 'MHD_YES' if the connection was handled successfully, - 'MHD_NO' if the socket must be closed due to a serious error while + Must return ‘MHD_YES’ if the connection was handled successfully, + ‘MHD_NO’ if the socket must be closed due to a serious error while handling the request CLS @@ -986,18 +1070,18 @@ the URL requested by the client; METHOD - the HTTP method used by the client ('GET', 'PUT', 'DELETE', - 'POST', etc.); + the HTTP method used by the client (‘GET’, ‘PUT’, ‘DELETE’, + ‘POST’, etc.); VERSION - the HTTP version string (i.e. 'HTTP/1.1'); + the HTTP version string (i.e. ‘HTTP/1.1’); UPLOAD_DATA the data being uploaded (excluding headers): - 'POST' data *will* be made available incrementally in - UPLOAD_DATA; even if 'POST' data is available, the first time - the callback is invoked there won't be upload data, as this is + ‘POST’ data *will* be made available incrementally in + UPLOAD_DATA; even if ‘POST’ data is available, the first time + the callback is invoked there won’t be upload data, as this is done just after MHD parses the headers. If supported by the client and the HTTP version, the application can at this point queue an error response to possibly avoid the upload entirely. @@ -1006,7 +1090,7 @@ Afterwards, POST data will be passed to the callback to be processed incrementally by the application. The application - may return 'MHD_NO' to forcefully terminate the TCP connection + may return ‘MHD_NO’ to forcefully terminate the TCP connection without generating a proper HTTP response. Once all of the upload data has been provided to the application, the application will be called again with 0 bytes of upload data. @@ -1025,21 +1109,21 @@ handling the connection and return an internal server error to the client. In order to avoid this, clients must be able to process upload data incrementally and reduce the value of - 'upload_data_size'. + ‘upload_data_size’. CON_CLS - reference to a pointer, initially set to 'NULL', that this + reference to a pointer, initially set to ‘NULL’, that this callback can set to some address and that will be preserved by MHD for future calls for this request; since the access handler may be called many times (i.e., for a - 'PUT'/'POST' operation with plenty of upload data) this allows + ‘PUT’/‘POST’ operation with plenty of upload data) this allows the application to easily associate some request-specific state; if necessary, this state can be cleaned up in the global - 'MHD_RequestCompletedCallback' (which can be set with the - 'MHD_OPTION_NOTIFY_COMPLETED'). + ‘MHD_RequestCompletedCallback’ (which can be set with the + ‘MHD_OPTION_NOTIFY_COMPLETED’). -- Function Pointer: void *MHD_RequestCompletedCallback (void *cls, struct MHD_Connectionconnection, void **con_cls, enum @@ -1055,16 +1139,16 @@ CON_CLS value as set by the last call to the - 'MHD_AccessHandlerCallback'; + ‘MHD_AccessHandlerCallback’; TOE reason for request termination see - 'MHD_OPTION_NOTIFY_COMPLETED'. + ‘MHD_OPTION_NOTIFY_COMPLETED’. -- Function Pointer: int *MHD_KeyValueIterator (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) Iterator over key-value pairs. This iterator can be used to - iterate over all of the cookies, headers, or 'POST'-data fields of + iterate over all of the cookies, headers, or ‘POST’-data fields of a request, and also to iterate over the headers that have been added to a response. @@ -1080,7 +1164,7 @@ VALUE value corresponding value, can be NULL - Return 'MHD_YES' to continue iterating, 'MHD_NO' to abort the + Return ‘MHD_YES’ to continue iterating, ‘MHD_NO’ to abort the iteration. -- Function Pointer: int *MHD_ContentReaderCallback (void *cls, @@ -1091,29 +1175,29 @@ Note that returning zero will cause MHD to try again. Thus, returning zero should only be used in conjunction with - 'MHD_suspend_connection()' to avoid busy waiting. + ‘MHD_suspend_connection()’ to avoid busy waiting. While usually the callback simply returns the number of bytes written into BUF, there are two special return value: - 'MHD_CONTENT_READER_END_OF_STREAM' (-1) should be returned for the + ‘MHD_CONTENT_READER_END_OF_STREAM’ (-1) should be returned for the regular end of transmission (with chunked encoding, MHD will then terminate the chunk and send any HTTP footers that might be present; without chunked encoding and given an unknown response size, MHD will simply close the connection; note that while - returning 'MHD_CONTENT_READER_END_OF_STREAM' is not technically + returning ‘MHD_CONTENT_READER_END_OF_STREAM’ is not technically legal if a response size was specified, MHD accepts this and treats - it just as 'MHD_CONTENT_READER_END_WITH_ERROR'. + it just as ‘MHD_CONTENT_READER_END_WITH_ERROR’. - 'MHD_CONTENT_READER_END_WITH_ERROR' (-2) is used to indicate a + ‘MHD_CONTENT_READER_END_WITH_ERROR’ (-2) is used to indicate a server error generating the response; this will cause MHD to simply close the connection immediately. If a response size was given or if chunked encoding is in use, this will indicate an error to the client. Note, however, that if the client does not know a response size and chunked encoding is not in use, then clients will not be able to tell the difference between - 'MHD_CONTENT_READER_END_WITH_ERROR' and - 'MHD_CONTENT_READER_END_OF_STREAM'. This is not a limitation of + ‘MHD_CONTENT_READER_END_WITH_ERROR’ and + ‘MHD_CONTENT_READER_END_OF_STREAM’. This is not a limitation of MHD but rather of the HTTP protocol. CLS @@ -1121,13 +1205,13 @@ POS position in the datastream to access; note that if an - 'MHD_Response' object is re-used, it is possible for the same + ‘MHD_Response’ object is re-used, it is possible for the same content reader to be queried multiple times for the same data; - however, if an 'MHD_Response' is not re-used, MHD guarantees + however, if an ‘MHD_Response’ is not re-used, MHD guarantees that POS will be the sum of all non-negative return values obtained from the content reader so far. - Return '-1' on error (MHD will no longer try to read content and + Return ‘-1’ on error (MHD will no longer try to read content and instead close the connection with the client). -- Function Pointer: void *MHD_ContentReaderFreeCallback (void *cls) @@ -1141,7 +1225,7 @@ char *data, uint64_t off, size_t size) Iterator over key-value pairs where the value maybe made available in increments and/or may not be zero-terminated. Used for - processing 'POST' data. + processing ‘POST’ data. CLS custom value selected at callback registration time; @@ -1153,13 +1237,13 @@ zero-terminated key for the value; FILENAME - name of the uploaded file, 'NULL' if not known; + name of the uploaded file, ‘NULL’ if not known; CONTENT_TYPE - mime-type of the data, 'NULL' if not known; + mime-type of the data, ‘NULL’ if not known; TRANSFER_ENCODING - encoding of the data, 'NULL' if not known; + encoding of the data, ‘NULL’ if not known; DATA pointer to size bytes of data at the specified offset; @@ -1170,7 +1254,7 @@ SIZE number of bytes in data available. - Return 'MHD_YES' to continue iterating, 'MHD_NO' to abort the + Return ‘MHD_YES’ to continue iterating, ‘MHD_NO’ to abort the iteration.  @@ -1184,12 +1268,12 @@ CB function to call if MHD encounters a fatal internal error. If - no handler was set explicitly, MHD will call 'abort'. + no handler was set explicitly, MHD will call ‘abort’. CLS closure argument for cb; the other arguments are the name of the source file, line number and a string describing the - nature of the fatal error (which can be 'NULL') + nature of the fatal error (which can be ‘NULL’) -- Function: struct MHD_Daemon * MHD_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void @@ -1197,14 +1281,14 @@ Start a webserver on the given port. FLAGS - OR-ed combination of 'MHD_FLAG' values; + OR-ed combination of ‘MHD_FLAG’ values; PORT port to bind to; APC callback to call to check which clients will be allowed to - connect; you can pass 'NULL' in which case connections from + connect; you can pass ‘NULL’ in which case connections from any IP will be accepted; APC_CLS @@ -1217,11 +1301,11 @@ extra argument to DH. Additional arguments are a list of options (type-value pairs, - terminated with 'MHD_OPTION_END'). It is mandatory to use - 'MHD_OPTION_END' as last argument, even when there are no + terminated with ‘MHD_OPTION_END’). It is mandatory to use + ‘MHD_OPTION_END’ as last argument, even when there are no additional arguments. - Return 'NULL' on error, handle to daemon on success. + Return ‘NULL’ on error, handle to daemon on success. -- Function: int MHD_quiesce_daemon (struct MHD_Daemon *daemon) Stop accepting connections from the listening socket. Allows @@ -1229,7 +1313,7 @@ connections. Note that the caller is responsible for closing the returned socket; however, if MHD is run using threads (anything but external select mode), it must not be closed until AFTER - 'MHD_stop_daemon' has been called (as it is theoretically possible + ‘MHD_stop_daemon’ has been called (as it is theoretically possible that an existing thread is still using it). This function is useful in the special case that a listen socket is @@ -1237,7 +1321,7 @@ HTTP server) while existing connections should continue to be processed until they are finished. - Return '-1' on error (daemon not listening), the handle to the + Return ‘-1’ on error (daemon not listening), the handle to the listen socket otherwise. -- Function: void MHD_stop_daemon (struct MHD_Daemon *daemon) @@ -1246,17 +1330,17 @@ -- Function: int MHD_run (struct MHD_Daemon *daemon) Run webserver operations (without blocking unless in client callbacks). This method should be called by clients in combination - with 'MHD_get_fdset()' if the client-controlled 'select'-method is + with ‘MHD_get_fdset()’ if the client-controlled ‘select’-method is used. - This function will work for external 'poll' and 'select' mode. - However, if using external 'select' mode, you may want to instead - use 'MHD_run_from_select', as it is more efficient. + This function will work for external ‘poll’ and ‘select’ mode. + However, if using external ‘select’ mode, you may want to instead + use ‘MHD_run_from_select’, as it is more efficient. DAEMON daemon to process connections of - Return 'MHD_YES' on success, 'MHD_NO' if this daemon was not + Return ‘MHD_YES’ on success, ‘MHD_NO’ if this daemon was not started with the right options for this call. -- Function: int MHD_run_from_select (struct MHD_Daemon *daemon, const @@ -1265,14 +1349,14 @@ Run webserver operations given sets of ready socket handles. This method should be called by clients in combination with - 'MHD_get_fdset' if the client-controlled (external) select method + ‘MHD_get_fdset’ if the client-controlled (external) select method is used. - You can use this function instead of 'MHD_run' if you called - 'select' on the result from 'MHD_get_fdset'. File descriptors in + You can use this function instead of ‘MHD_run’ if you called + ‘select’ on the result from ‘MHD_get_fdset’. File descriptors in the sets that are not controlled by MHD will be ignored. Calling - this function instead of 'MHD_run' is more efficient as MHD will - not have to call 'select' again to determine which operations are + this function instead of ‘MHD_run’ is more efficient as MHD will + not have to call ‘select’ again to determine which operations are ready. DAEMON @@ -1286,7 +1370,7 @@ EXCEPT_FD_SET ignored, can be NULL - Return 'MHD_YES' on success, 'MHD_NO' on serious internal errors. + Return ‘MHD_YES’ on success, ‘MHD_NO’ on serious internal errors. -- Function: void MHD_add_connection (struct MHD_Daemon *daemon, int client_socket, const struct sockaddr *addr, socklen_t addrlen) @@ -1297,9 +1381,8 @@ out to the HTTP client, or if you are building a proxy. If you use this API in conjunction with a internal select or a - thread pool, you must set the option 'MHD_USE_PIPE_FOR_SHUTDOWN' to - ensure that the freshly added connection is immediately processed - by MHD. + thread pool, you must set the option ‘MHD_USE_ITC’ to ensure that + the freshly added connection is immediately processed by MHD. The given client socket will be managed (and closed!) by MHD after this call and must no longer be used directly by the application @@ -1315,51 +1398,66 @@ ADDRLEN number of bytes in addr - This function will return 'MHD_YES' on success, 'MHD_NO' if this + This function will return ‘MHD_YES’ on success, ‘MHD_NO’ if this daemon could not handle the connection (i.e. malloc failed, etc). - The socket will be closed in any case; 'errno' is set to indicate + The socket will be closed in any case; ’errno’ is set to indicate further details about the error.  File: libmicrohttpd.info, Node: microhttpd-inspect, Next: microhttpd-requests, Prev: microhttpd-init, Up: Top -6 Implementing external 'select' +6 Implementing external ‘select’ ******************************** -- Function: int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd) - Obtain the 'select()' sets for this daemon. The daemon's socket is + Obtain the ‘select()’ sets for this daemon. The daemon’s socket is added to READ_FD_SET. The list of currently existent connections is scanned and their file descriptors added to the correct set. + When calling this function, FD_SETSIZE is assumed to be platform’s + default. If you changed FD_SETSIZE for your application, you + should use ‘MHD_get_fdset2()’ instead. + + This function should only be called in when MHD is configured to + use external select with ‘select()’ or with ‘epoll()’. In the + latter case, it will only add the single ‘epoll()’ file descriptor + used by MHD to the sets. + After the call completed successfully: the variable referenced by MAX_FD references the file descriptor with highest integer identifier. The variable must be set to zero before invoking this function. - Return 'MHD_YES' on success, 'MHD_NO' if: the arguments are invalid - (example: 'NULL' pointers); this daemon was not started with the + Return ‘MHD_YES’ on success, ‘MHD_NO’ if: the arguments are invalid + (example: ‘NULL’ pointers); this daemon was not started with the right options for this call. + -- Function: int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * + read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, + int *max_fd, unsigned int fd_setsize) + Like ‘MHD_get_fdset()’, except that you can manually specify the + value of FD_SETSIZE used by your application. + -- Function: int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) Obtain timeout value for select for this daemon (only needed if connection timeout is used). The returned value is how many - milliseconds 'select' should at most block, not the timeout value + milliseconds ‘select’ should at most block, not the timeout value set for connections. This function must not be called if the - 'MHD_USE_THREAD_PER_CONNECTION' mode is in use (since then it is + ‘MHD_USE_THREAD_PER_CONNECTION’ mode is in use (since then it is not meaningful to ask for a timeout, after all, there is concurrenct activity). The function must also not be called by - user-code if 'MHD_USE_INTERNAL_SELECT' is in use. In the latter - case, the behavior is undefined. + user-code if ‘MHD_USE_INTERNAL_POLLING_THREAD’ is in use. In the + latter case, the behavior is undefined. DAEMON which daemon to obtain the timeout from. TIMEOUT will be set to the timeout (in milliseconds). - Return 'MHD_YES' on success, 'MHD_NO' if timeouts are not used (or + Return ‘MHD_YES’ on success, ‘MHD_NO’ if timeouts are not used (or no connections exist that would necessiate the use of a timeout right now). @@ -1372,7 +1470,9 @@ -- Function: int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls) - Get all the headers matching KIND from the request. + Get all the headers matching KIND from the request. The KIND + argument can be a bitmask, ORing the various header kinds that are + requested. The ITERATOR callback is invoked once for each header, with ITERATOR_CLS as first argument. After version 0.9.19, the headers @@ -1380,28 +1480,28 @@ network; previous versions iterated over the headers in reverse order. - 'MHD_get_connection_values' returns the number of entries iterated + ‘MHD_get_connection_values’ returns the number of entries iterated over; this can be less than the number of headers if, while - iterating, ITERATOR returns 'MHD_NO'. + iterating, ITERATOR returns ‘MHD_NO’. - ITERATOR can be 'NULL': in this case this function just counts and + ITERATOR can be ‘NULL’: in this case this function just counts and returns the number of headers. - In the case of 'MHD_GET_ARGUMENT_KIND', the VALUE argument will be - 'NULL' if the URL contained a key without an equals operator. For - example, for a HTTP request to the URL "http://foo/bar?key", the - VALUE argument is 'NULL'; in contrast, a HTTP request to the URL - "http://foo/bar?key=", the VALUE argument is the empty string. The - normal case is that the URL contains "http://foo/bar?key=value" in - which case VALUE would be the string "value" and KEY would contain - the string "key". + In the case of ‘MHD_GET_ARGUMENT_KIND’, the VALUE argument will be + ‘NULL’ if the URL contained a key without an equals operator. For + example, for a HTTP request to the URL “http://foo/bar?key”, the + VALUE argument is ‘NULL’; in contrast, a HTTP request to the URL + “http://foo/bar?key=”, the VALUE argument is the empty string. The + normal case is that the URL contains “http://foo/bar?key=value” in + which case VALUE would be the string “value” and KEY would contain + the string “key”. -- Function: int MHD_set_connection_value (struct MHD_Connection - *connection, enum MHD_ValueKind kind, const char * key, const - char * value) + *connection, enum MHD_ValueKind kind, const char *key, const + char *value) This function can be used to append an entry to the list of HTTP - headers of a connection (so that the 'MHD_get_connection_values - function' will return them - and the MHD PostProcessor will also + headers of a connection (so that the ‘MHD_get_connection_values + function’ will return them – and the MHD PostProcessor will also see them). This maybe required in certain situations (see Mantis #1399) where (broken) HTTP implementations fail to supply values needed by the post processor (or other parts of the application). @@ -1416,20 +1516,20 @@ CONNECTION is the connection for which the entry for KEY of the given KIND should be set to the given VALUE. - The function returns 'MHD_NO' if the operation could not be - performed due to insufficient memory and 'MHD_YES' on success. + The function returns ‘MHD_NO’ if the operation could not be + performed due to insufficient memory and ‘MHD_YES’ on success. -- Function: const char * MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key) Get a particular header value. If multiple values match the KIND, - return one of them (the "first", whatever that means). KEY must + return one of them (the “first”, whatever that means). KEY must reference a zero-terminated ASCII-coded string representing the header to look for: it is compared against the headers using - 'strcasecmp()', so case is ignored. A value of 'NULL' for KEY can - be used to lookup 'trailing' values without a key, for example if a - URI is of the form "http://example.com/?trailer", a KEY of 'NULL' - can be used to access "tailer" The function returns 'NULL' if no + ‘strcasecmp()’, so case is ignored. A value of ‘NULL’ for KEY can + be used to lookup ’trailing’ values without a key, for example if a + URI is of the form “http://example.com/?trailer”, a KEY of ‘NULL’ + can be used to access “tailer" The function returns ‘NULL’ if no matching item was found.  @@ -1439,16 +1539,16 @@ ******************************** Response objects handling by MHD is asynchronous with respect to the -application execution flow. Instances of the 'MHD_Response' structure +application execution flow. Instances of the ‘MHD_Response’ structure are not associated to a daemon and neither to a client connection: they are managed with reference counting. - In the simplest case: we allocate a new 'MHD_Response' structure for + In the simplest case: we allocate a new ‘MHD_Response’ structure for each response, we use it once and finally we destroy it. MHD allows more efficient resources usages. - Example: we allocate a new 'MHD_Response' structure for each response + Example: we allocate a new ‘MHD_Response’ structure for each response *kind*, we use it every time we have to give that response and we finally destroy it only when the daemon shuts down. @@ -1459,6 +1559,7 @@ * microhttpd-response headers:: Adding headers to a response. * microhttpd-response options:: Setting response options. * microhttpd-response inspect:: Inspecting a response object. +* microhttpd-response upgrade:: Creating a response for protocol upgrades.  File: libmicrohttpd.info, Node: microhttpd-response enqueue, Next: microhttpd-response create, Up: microhttpd-responses @@ -1479,13 +1580,13 @@ the connection identifying the client; STATUS_CODE - HTTP status code (i.e. '200' for OK); + HTTP status code (i.e. ‘200’ for OK); RESPONSE response to transmit. - Return 'MHD_YES' on success or if message has been queued. Return - 'MHD_NO': if arguments are invalid (example: 'NULL' pointer); on + Return ‘MHD_YES’ on success or if message has been queued. Return + ‘MHD_NO’: if arguments are invalid (example: ‘NULL’ pointer); on error (i.e. reply already sent). -- Function: void MHD_destroy_response (struct MHD_Response *response) @@ -1496,12 +1597,12 @@ An explanation of reference counting(1): - 1. a 'MHD_Response' object is allocated: + 1. a ‘MHD_Response’ object is allocated: struct MHD_Response * response = MHD_create_response_from_buffer(...); /* here: reference counter = 1 */ - 2. the 'MHD_Response' object is enqueued in a 'MHD_Connection': + 2. the ‘MHD_Response’ object is enqueued in a ‘MHD_Connection’: MHD_queue_response(connection, , response); /* here: reference counter = 2 */ @@ -1512,17 +1613,17 @@ MHD_destroy_response(response); /* here: reference counter = 1 */ - 4. the daemon handles the connection sending the response's data to + 4. the daemon handles the connection sending the response’s data to the client then decrements the reference counter by calling - 'MHD_destroy_response()': the counter's value drops to zero and the - 'MHD_Response' object is released. + ‘MHD_destroy_response()’: the counter’s value drops to zero and the + ‘MHD_Response’ object is released. ---------- Footnotes ---------- (1) Note to readers acquainted to the Tcl API: reference counting on -'MHD_Connection' structures is handled in the same way as Tcl handles -'Tcl_Obj' structures through 'Tcl_IncrRefCount()' and -'Tcl_DecrRefCount()'. +‘MHD_Connection’ structures is handled in the same way as Tcl handles +‘Tcl_Obj’ structures through ‘Tcl_IncrRefCount()’ and +‘Tcl_DecrRefCount()’.  File: libmicrohttpd.info, Node: microhttpd-response create, Next: microhttpd-response headers, Prev: microhttpd-response enqueue, Up: microhttpd-responses @@ -1537,7 +1638,7 @@ header information and then it can be used any number of times. SIZE - size of the data portion of the response, '-1' for unknown; + size of the data portion of the response, ‘-1’ for unknown; BLOCK_SIZE preferred block size for querying CRC (advisory only, MHD may @@ -1554,7 +1655,7 @@ CRFC callback to call to free CRC_CLS resources. - Return 'NULL' on error (i.e. invalid arguments, out of memory). + Return ‘NULL’ on error (i.e. invalid arguments, out of memory). -- Function: struct MHD_Response * MHD_create_response_from_fd (uint64_t size, int fd) @@ -1567,28 +1668,28 @@ FD file descriptor referring to a file on disk with the data; - will be closed when response is destroyed; note that 'fd' must + will be closed when response is destroyed; note that ’fd’ must be an actual file descriptor (not a pipe or socket) since MHD - might use 'sendfile' or 'seek' on it. The descriptor should + might use ’sendfile’ or ’seek’ on it. The descriptor should be in blocking-IO mode. - Return 'NULL' on error (i.e. invalid arguments, out of memory). + Return ‘NULL’ on error (i.e. invalid arguments, out of memory). -- Function: struct MHD_Response * MHD_create_response_from_fd_at_offset (size_t size, int fd, off_t offset) Create a response object. The response object can be extended with header information and then it can be used any number of times. - Note that you need to be a bit careful about 'off_t' when writing + Note that you need to be a bit careful about ‘off_t’ when writing this code. Depending on your platform, MHD is likely to have been compiled with support for 64-bit files. When you compile your own - application, you must make sure that 'off_t' is also a 64-bit - value. If not, your compiler may pass a 32-bit value as 'off_t', + application, you must make sure that ‘off_t’ is also a 64-bit + value. If not, your compiler may pass a 32-bit value as ‘off_t’, which will result in 32-bits of garbage. - If you use the autotools, use the 'AC_SYS_LARGEFILE' autoconf macro - and make sure to include the generated 'config.h' file before - 'microhttpd.h' to avoid problems. If you do not have a build + If you use the autotools, use the ‘AC_SYS_LARGEFILE’ autoconf macro + and make sure to include the generated ‘config.h’ file before + ‘microhttpd.h’ to avoid problems. If you do not have a build system and only want to run on a GNU/Linux system, you could also use #define _FILE_OFFSET_BITS 64 @@ -1596,9 +1697,9 @@ #include #include #include - to ensure 64-bit 'off_t'. Note that if your operating system does + to ensure 64-bit ‘off_t’. Note that if your operating system does not support 64-bit files, MHD will be compiled with a 32-bit - 'off_t' (in which case the above would be wrong). + ‘off_t’ (in which case the above would be wrong). SIZE size of the data portion of the response (number of bytes to @@ -1606,15 +1707,15 @@ FD file descriptor referring to a file on disk with the data; - will be closed when response is destroyed; note that 'fd' must + will be closed when response is destroyed; note that ’fd’ must be an actual file descriptor (not a pipe or socket) since MHD - might use 'sendfile' or 'seek' on it. The descriptor should + might use ’sendfile’ or ’seek’ on it. The descriptor should be in blocking-IO mode. OFFSET offset to start reading from in the file - Return 'NULL' on error (i.e. invalid arguments, out of memory). + Return ‘NULL’ on error (i.e. invalid arguments, out of memory). -- Function: struct MHD_Response * MHD_create_response_from_buffer (size_t size, void *data, enum MHD_ResponseMemoryMode mode) @@ -1635,13 +1736,13 @@ is in transient memory (i.e. on the stack) and must be copied by MHD; - Return 'NULL' on error (i.e. invalid arguments, out of memory). + Return ‘NULL’ on error (i.e. invalid arguments, out of memory). -- Function: struct MHD_Response * MHD_create_response_from_data (size_t size, void *data, int must_free, int must_copy) Create a response object. The response object can be extended with header information and then it can be used any number of times. - This function is deprecated, use 'MHD_create_response_from_buffer' + This function is deprecated, use ‘MHD_create_response_from_buffer’ instead. SIZE @@ -1655,11 +1756,11 @@ MUST_COPY if true: MHD allocates a block of memory and use it to make a - copy of DATA embedded in the returned 'MHD_Response' + copy of DATA embedded in the returned ‘MHD_Response’ structure; handling of the embedded memory is responsibility of MHD; DATA can be released anytime after this call returns. - Return 'NULL' on error (i.e. invalid arguments, out of memory). + Return ‘NULL’ on error (i.e. invalid arguments, out of memory). Example: create a response from a statically allocated string: @@ -1688,7 +1789,7 @@ Notice that the strings must not hold newlines, carriage returns or tab chars. - Return 'MHD_NO' on error (i.e. invalid header or content format or + Return ‘MHD_NO’ on error (i.e. invalid header or content format or memory allocation error). -- Function: int MHD_add_response_footer (struct MHD_Response @@ -1700,17 +1801,17 @@ Notice that the strings must not hold newlines, carriage returns or tab chars. You can add response footers at any time before signalling the end of the response to MHD (not just before calling - 'MHD_queue_response'). Footers are useful for adding cryptographic + ’MHD_queue_response’). Footers are useful for adding cryptographic checksums to the reply or to signal errors encountered during data generation. This call was introduced in MHD 0.9.3. - Return 'MHD_NO' on error (i.e. invalid header or content format or + Return ‘MHD_NO’ on error (i.e. invalid header or content format or memory allocation error). -- Function: int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) Delete a header (or footer) line from the response. Return - 'MHD_NO' on error (arguments are invalid or no such header known). + ‘MHD_NO’ on error (arguments are invalid or no such header known).  File: libmicrohttpd.info, Node: microhttpd-response options, Next: microhttpd-response inspect, Prev: microhttpd-response headers, Up: microhttpd-responses @@ -1732,13 +1833,13 @@ flags to set for the response; Additional arguments are a list of options (type-value pairs, - terminated with 'MHD_RO_END'). It is mandatory to use 'MHD_RO_END' + terminated with ‘MHD_RO_END’). It is mandatory to use ‘MHD_RO_END’ as last argument, even when there are no additional arguments. - Return 'MHD_NO' on error, 'MHD_YES' on success. + Return ‘MHD_NO’ on error, ‘MHD_YES’ on success.  -File: libmicrohttpd.info, Node: microhttpd-response inspect, Prev: microhttpd-response options, Up: microhttpd-responses +File: libmicrohttpd.info, Node: microhttpd-response inspect, Next: microhttpd-response upgrade, Prev: microhttpd-response options, Up: microhttpd-responses 8.5 Inspecting a response object ================================ @@ -1749,7 +1850,7 @@ Invoke the ITERATOR callback for each header in the response, using ITERATOR_CLS as first argument. Return number of entries iterated - over. ITERATOR can be 'NULL': in this case the function just + over. ITERATOR can be ‘NULL’: in this case the function just counts headers. ITERATOR should not modify the its key and value arguments, unless @@ -1760,11 +1861,120 @@ Find and return a pointer to the value of a particular header from the response. KEY must reference a zero-terminated string representing the header to look for. The search is case sensitive. - Return 'NULL' if header does not exist or KEY is 'NULL'. + Return ‘NULL’ if header does not exist or KEY is ‘NULL’. We should not modify the value, unless we know what we are doing.  +File: libmicrohttpd.info, Node: microhttpd-response upgrade, Prev: microhttpd-response inspect, Up: microhttpd-responses + +8.6 Creating a response for protocol upgrades +============================================= + +With RFC 2817 a mechanism to switch protocols within HTTP was +introduced. Here, a client sends a request with a “Connection: Upgrade” +header. The server responds with a “101 Switching Protocols” response +header, after which the two parties begin to speak a different +(non-HTTP) protocol over the TCP connection. + + This mechanism is used for upgrading HTTP 1.1 connections to HTTP2 or +HTTPS, as well as for implementing WebSockets. Which protocol upgrade +is performed is negotiated between server and client in additional +headers, in particular the “Upgrade” header. + + MHD supports switching protocols using this mechanism only if the +‘MHD_ALLOW_SUSPEND_RESUME’ flag has been set when starting the daemon. +If this flag has been set, applications can upgrade a connection by +queueing a response (using the ‘MHD_HTTP_SWITCHING_PROTOCOLS’ status +code) which must have been created with the following function: + + -- Function: int MHD_create_response_for_upgrade (MHD_UpgradeHandler + upgrade_handler, void *upgrade_handler_cls) + Create a response suitable for switching protocols. Returns + ‘MHD_YES’ on success. ‘upgrade_handler’ must not be ‘NULL’. + + When creating this type of response, the “Connection: Upgrade” + header will be set automatically for you. MHD requires that you + additionally set an “Upgrade:” header. The “Upgrade” header must + simply exist, the specific value is completely up to the + application. + + The ‘upgrade_handler’ argument to the above has the following type: + + -- Function Pointer: void *MHD_UpgradeHandler (void *cls, struct + MHD_Connection *connection, const char *extra_in, size_t + extra_in_size, MHD_socket sock, struct + MHD_UpgradeResponseHandle *urh) + This function will be called once MHD has transmitted the header of + the response to the connection that is being upgraded. At this + point, the application is expected to take over the socket ‘sock’ + and speak the non-HTTP protocol to which the connection was + upgraded. MHD will no longer use the socket; this includes + handling timeouts. The application must call ‘MHD_upgrade_action’ + with an upgrade action of ‘MHD_UPGRADE_ACTION_CLOSE’ when it is + done processing the connection to close the socket. The + application must not call ‘MHD_stop_daemon’ on the respective + daemon as long as it is still handling the connection. The + arguments given to the ‘upgrade_handler’ have the following + meaning: + + CLS + matches the ‘upgrade_handler_cls’ that was given to + ‘MHD_create_response_for_upgrade’ + CONNECTION + identifies the connection that is being upgraded; + + CON_CLS + last value left in ‘*con_cls‘ in the + ‘MHD_AccessHandlerCallback‘ + + EXTRA_IN + buffer of bytes MHD read “by accident” from the socket + already. This can happen if the client eagerly transmits more + than just the HTTP request. The application should treat + these as if it had read them from the socket. + + EXTRA_IN_SIZE + number of bytes in ‘extra_in’ + + SOCK + the socket which the application can now use directly for some + bi-directional communication with the client. The application + can henceforth use ‘recv()’ and ‘send()’ or ‘read()’ and + ‘write()’ system calls on the socket. However, ‘ioctl()’ and + ‘setsockopt()’ functions will not work as expected when using + HTTPS. Such operations may be supported in the future via + ‘MHD_upgrade_action’. Most importantly, the application must + never call ‘close()’ on this socket. Closing the socket must + be done using ‘MHD_upgrade_action’. However, while close is + forbidden, the application may call ‘shutdown()’ on the + socket. + + URH + argument for calls to ‘MHD_upgrade_action’. Applications must + eventually use this function to perform the ‘close()’ action + on the socket. + + -- Function: int MHD_upgrade_action (struct MHD_UpgradeResponseHandle + *urh, enum MHD_UpgradeAction action, ...) + Perform special operations related to upgraded connections. + + URH + identifies the upgraded connection to perform an action on + + ACTION + specifies the action to perform; further arguments to the + function depend on the specifics of the action. + + -- Enumeration: MHD_UpgradeAction + Set of actions to be performed on upgraded connections. Passed as + an argument to ‘MHD_upgrade_action()’. + + ‘MHD_UPGRADE_ACTION_CLOSE’ + Closes the connection. Must be called once the application is + done with the client. Takes no additional arguments. + + File: libmicrohttpd.info, Node: microhttpd-flow, Next: microhttpd-dauth, Prev: microhttpd-responses, Up: Top 9 Flow control. @@ -1773,7 +1983,7 @@ Sometimes it may be possible that clients upload data faster than an application can process it, or that an application needs an extended period of time to generate a response. If -'MHD_USE_THREAD_PER_CONNECTION' is used, applications can simply deal +‘MHD_USE_THREAD_PER_CONNECTION’ is used, applications can simply deal with this by performing their logic within the thread and thus effectively blocking connection processing by MHD. In all other modes, blocking logic must not be placed within the callbacks invoked by MHD as @@ -1781,18 +1991,18 @@ may be responsible for tens of thousands of connections. Instead, applications using thread modes other than -'MHD_USE_THREAD_PER_CONNECTION' should use the following functions to +‘MHD_USE_THREAD_PER_CONNECTION’ should use the following functions to perform flow control. -- Function: int MHD_suspend_connection (struct MHD_Connection *connection) Suspend handling of network data for a given connection. This can - be used to dequeue a connection from MHD's event loop (external + be used to dequeue a connection from MHD’s event loop (external select, internal select or thread pool; not applicable to thread-per-connection!) for a while. If you use this API in conjunction with a internal select or a - thread pool, you must set the option 'MHD_USE_SUSPEND_RESUME' to + thread pool, you must set the option ‘MHD_ALLOW_SUSPEND_RESUME’ to ensure that a resumed connection is immediately processed by MHD. Suspended connections continue to count against the total number of @@ -1803,11 +2013,11 @@ client. The only safe time to suspend a connection is from the - 'MHD_AccessHandlerCallback' or from the respective - 'MHD_ContentReaderCallback' (but in this case the response object + ‘MHD_AccessHandlerCallback’ or from the respective + ‘MHD_ContentReaderCallback’ (but in this case the response object must not be shared among multiple connections). - Finally, it is an API violation to call 'MHD_stop_daemon' while + Finally, it is an API violation to call ‘MHD_stop_daemon’ while having suspended connections (this will at least create memory and socket leaks or lead to undefined behavior). You must explicitly resume all connections before stopping the daemon. @@ -1822,6 +2032,16 @@ function on a connection that was not previously suspended will result in undefined behavior. + If you are using this function in “external” select mode, you must + make sure to run ‘MHD_run’ afterwards (before again calling + ‘MHD_get_fdset’), as otherwise the change may not be reflected in + the set returned by ‘MHD_get_fdset’ and you may end up with a + connection that is stuck until the next network activity. + + You can check whether a connection is currently suspended using + ‘MHD_get_connection_info’ by querying for + ‘MHD_CONNECTION_INFO_CONNECTION_SUSPENDED’. + CONNECTION the connection to resume @@ -1869,19 +2089,19 @@ -- Function: char * MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password) Get the username and password from the basic authorization header - sent by the client. Return 'NULL' if no username could be found, a - pointer to the username if found. If returned value is not 'NULL', - the value must be 'free()''ed. + sent by the client. Return ‘NULL’ if no username could be found, a + pointer to the username if found. If returned value is not ‘NULL’, + the value must be ‘free()’’ed. PASSWORD reference a buffer to store the password. It can be - 'NULL'. If returned value is not 'NULL', the value must be - 'free()''ed. + ‘NULL’. If returned value is not ‘NULL’, the value must be + ‘free()’’ed. -- Function: int MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response) Queues a response to request basic authentication from the client. - Return 'MHD_YES' if successful, otherwise 'MHD_NO'. + Return ‘MHD_YES’ if successful, otherwise ‘MHD_NO’. REALM must reference to a zero-terminated string representing the realm. @@ -1898,16 +2118,16 @@ -- Function: char * MHD_digest_auth_get_username (struct MHD_Connection *connection) Find and return a pointer to the username value from the request - header. Return 'NULL' if the value is not found or header does not - exist. If returned value is not 'NULL', the value must be - 'free()''ed. + header. Return ‘NULL’ if the value is not found or header does not + exist. If returned value is not ‘NULL’, the value must be + ‘free()’’ed. -- Function: int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout) Checks if the provided values in the WWW-Authenticate header are - valid and sound according to RFC2716. If valid return 'MHD_YES', - otherwise return 'MHD_NO'. + valid and sound according to RFC2716. If valid return ‘MHD_YES’, + otherwise return ‘MHD_NO’. REALM must reference to a zero-terminated string representing the realm. @@ -1928,7 +2148,7 @@ *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale) Queues a response to request authentication from the client, return - 'MHD_YES' if successful, otherwise 'MHD_NO'. + ‘MHD_YES’ if successful, otherwise ‘MHD_NO’. REALM must reference to a zero-terminated string representing the realm. @@ -1944,7 +2164,7 @@ SIGNAL_STALE a value that signals "stale=true" in the response header to indicate the invalidity of the nonce and no need to ask for authentication parameters and only a new nonce gets generated. - 'MHD_YES' to generate a new nonce, 'MHD_NO' to ask for + ‘MHD_YES’ to generate a new nonce, ‘MHD_NO’ to ask for authentication parameters. Example: handling digest authentication requests and responses. @@ -2010,29 +2230,29 @@  File: libmicrohttpd.info, Node: microhttpd-post, Next: microhttpd-info, Prev: microhttpd-dauth, Up: Top -11 Adding a 'POST' processor +11 Adding a ‘POST’ processor **************************** * Menu: * microhttpd-post api:: Programming interface for the - 'POST' processor. + ‘POST’ processor. MHD provides the post processor API to make it easier for applications -to parse the data of a client's 'POST' request: the -'MHD_AccessHandlerCallback' will be invoked multiple times to process +to parse the data of a client’s ‘POST’ request: the +‘MHD_AccessHandlerCallback’ will be invoked multiple times to process data as it arrives; at each invocation a new chunk of data must be processed. The arguments UPLOAD_DATA and UPLOAD_DATA_SIZE are used to reference the chunk of data. - When 'MHD_AccessHandlerCallback' is invoked for a new connection: its -'*CON_CLS' argument is set to 'NULL'. When 'POST' data comes in the + When ‘MHD_AccessHandlerCallback’ is invoked for a new connection: its +‘*CON_CLS’ argument is set to ‘NULL’. When ‘POST’ data comes in the upload buffer it is *mandatory* to use the CON_CLS to store a reference -to per-connection data. The fact that the pointer was initially 'NULL' +to per-connection data. The fact that the pointer was initially ‘NULL’ can be used to detect that this is a new request. One method to detect that a new connection was established is to set -'*con_cls' to an unused integer: +‘*con_cls’ to an unused integer: int access_handler (void *cls, @@ -2054,8 +2274,8 @@ ... } -In contrast to the previous example, for 'POST' requests in particular, -it is more common to use the value of '*con_cls' to keep track of actual +In contrast to the previous example, for ‘POST’ requests in particular, +it is more common to use the value of ‘*con_cls’ to keep track of actual state used during processing, such as the post processor (or a struct containing a post processor): @@ -2088,25 +2308,25 @@ } } - Note that the callback from 'MHD_OPTION_NOTIFY_COMPLETED' should be + Note that the callback from ‘MHD_OPTION_NOTIFY_COMPLETED’ should be used to destroy the post processor. This cannot be done inside of the access handler since the connection may not always terminate normally.  File: libmicrohttpd.info, Node: microhttpd-post api, Up: microhttpd-post -11.1 Programming interface for the 'POST' processor +11.1 Programming interface for the ‘POST’ processor =================================================== -- Function: struct MHD_PostProcessor * MHD_create_post_processor (struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iterator, void *iterator_cls) Create a PostProcessor. A PostProcessor can be used to - (incrementally) parse the data portion of a 'POST' request. + (incrementally) parse the data portion of a ‘POST’ request. CONNECTION - the connection on which the 'POST' is happening (used to - determine the 'POST' format); + the connection on which the ‘POST’ is happening (used to + determine the ‘POST’ format); BUFFER_SIZE maximum number of bytes to use for internal buffering (used @@ -2117,31 +2337,31 @@ ITERATOR iterator to be called with the parsed data; must *NOT* be - 'NULL'; + ‘NULL’; ITERATOR_CLS custom value to be used as first argument to ITERATOR. - Return 'NULL' on error (out of memory, unsupported encoding), + Return ‘NULL’ on error (out of memory, unsupported encoding), otherwise a PP handle. -- Function: int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) - Parse and process 'POST' data. Call this function when 'POST' data - is available (usually during an 'MHD_AccessHandlerCallback') with + Parse and process ‘POST’ data. Call this function when ‘POST’ data + is available (usually during an ‘MHD_AccessHandlerCallback’) with the UPLOAD_DATA and UPLOAD_DATA_SIZE. Whenever possible, this will - then cause calls to the 'MHD_IncrementalKeyValueIterator'. + then cause calls to the ‘MHD_IncrementalKeyValueIterator’. PP the post processor; POST_DATA - POST_DATA_LEN bytes of 'POST' data; + POST_DATA_LEN bytes of ‘POST’ data; POST_DATA_LEN length of POST_DATA. - Return 'MHD_YES' on success, 'MHD_NO' on error (out-of-memory, + Return ‘MHD_YES’ on success, ‘MHD_NO’ on error (out-of-memory, iterator aborted, parse error). -- Function: int MHD_destroy_post_processor (struct MHD_PostProcessor @@ -2153,7 +2373,7 @@ PostProcessor, the programmer should perform any necessary work to complete the processing of the iterator. - Return 'MHD_YES' if processing completed nicely, 'MHD_NO' if there + Return ‘MHD_YES’ if processing completed nicely, ‘MHD_NO’ if there were spurious characters or formatting problems with the post request. It is common to ignore the return value of this function. @@ -2186,60 +2406,60 @@ INFOTYPE type of information that is desired - ... + ... additional arguments about the desired information (depending on infoType) Returns a union with the respective member (depending on infoType) - set to the desired information), or 'NULL' in case the desired + set to the desired information), or ‘NULL’ in case the desired information is not available or applicable. -- Enumeration: MHD_DaemonInfoType Values of this enum are used to specify what information about a daemon is desired. - 'MHD_DAEMON_INFO_KEY_SIZE' + ‘MHD_DAEMON_INFO_KEY_SIZE’ Request information about the key size for a particular cipher algorithm. The cipher algorithm should be passed as an extra - argument (of type 'enum MHD_GNUTLS_CipherAlgorithm'). No + argument (of type ’enum MHD_GNUTLS_CipherAlgorithm’). No longer supported, using this value will cause - 'MHD_get_daemon_info' to return NULL. + ‘MHD_get_daemon_info’ to return NULL. - 'MHD_DAEMON_INFO_MAC_KEY_SIZE' + ‘MHD_DAEMON_INFO_MAC_KEY_SIZE’ Request information about the key size for a particular cipher algorithm. The cipher algorithm should be passed as an extra - argument (of type 'enum MHD_GNUTLS_HashAlgorithm'). No longer - supported, using this value will cause 'MHD_get_daemon_info' + argument (of type ’enum MHD_GNUTLS_HashAlgorithm’). No longer + supported, using this value will cause ‘MHD_get_daemon_info’ to return NULL. - 'MHD_DAEMON_INFO_LISTEN_FD' + ‘MHD_DAEMON_INFO_LISTEN_FD’ Request the file-descriptor number that MHD is using to listen to the server socket. This can be useful if no port was specified and a client needs to learn what port is actually being used by MHD. No extra arguments should be passed. - 'MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY' + ‘MHD_DAEMON_INFO_EPOLL_FD’ Request the file-descriptor number that MHD is using for epoll. If the build is not supporting epoll, NULL is returned; if we are using a thread pool or this daemon was not - started with 'MHD_USE_EPOLL_LINUX_ONLY', (a pointer to) -1 is - returned. If we are using 'MHD_USE_SELECT_INTERNALLY' or are - in 'external' select mode, the internal epoll FD is returned. + started with ‘MHD_USE_EPOLL’, (a pointer to) -1 is returned. + If we are using ‘MHD_USE_INTERNAL_POLLING_THREAD’ or are in + ’external’ select mode, the internal epoll FD is returned. This function must be used in external select mode with epoll to obtain the FD to call epoll on. No extra arguments should be passed. - 'MHD_DAEMON_INFO_CURRENT_CONNECTIONS' + ‘MHD_DAEMON_INFO_CURRENT_CONNECTIONS’ Request the number of current connections handled by the daemon. No extra arguments should be passed and a pointer to - a 'union MHD_DaemonInfo' value is returned, with the - 'num_connections' member of type 'unsigned int' set to the + a ‘union MHD_DaemonInfo’ value is returned, with the + ‘num_connections’ member of type ‘unsigned int’ set to the number of active connections. Note that in multi-threaded or internal-select mode, the real number of current connections may already be different when - 'MHD_get_daemon_info' returns. The number of current + ‘MHD_get_daemon_info’ returns. The number of current connections can be used (even in multi-threaded and - internal-select mode) after 'MHD_quiesce_daemon' to detect + internal-select mode) after ‘MHD_quiesce_daemon’ to detect whether all connections have been handled.  @@ -2259,57 +2479,66 @@ INFOTYPE type of information that is desired - ... + ... additional arguments about the desired information (depending on infoType) Returns a union with the respective member (depending on infoType) - set to the desired information), or 'NULL' in case the desired + set to the desired information), or ‘NULL’ in case the desired information is not available or applicable. -- Enumeration: MHD_ConnectionInfoType Values of this enum are used to specify what information about a connection is desired. - 'MHD_CONNECTION_INFO_CIPHER_ALGO' + ‘MHD_CONNECTION_INFO_CIPHER_ALGO’ What cipher algorithm is being used (HTTPS connections only). - Takes no extra arguments. 'NULL' is returned for non-HTTPS + ‘NULL’ is returned for non-HTTPS connections. + + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_PROTOCOL,’ + Allows finding out the TLS/SSL protocol used (HTTPS + connections only). ‘NULL’ is returned for non-HTTPS connections. - 'MHD_CONNECTION_INFO_PROTOCOL,' - Takes no extra arguments. Allows finding out the TLS/SSL - protocol used (HTTPS connections only). 'NULL' is returned - for non-HTTPS connections. + Takes no extra arguments. - 'MHD_CONNECTION_INFO_CLIENT_ADDRESS' + ‘MHD_CONNECTION_INFO_CLIENT_ADDRESS’ Returns information about the address of the client. Returns - essentially a 'struct sockaddr **' (since the API returns a - 'union MHD_ConnectionInfo *' and that union contains a 'struct - sockaddr *'). + essentially a ‘struct sockaddr **’ (since the API returns a + ‘union MHD_ConnectionInfo *’ and that union contains a ‘struct + sockaddr *’). + + Takes no extra arguments. - 'MHD_CONNECTION_INFO_GNUTLS_SESSION,' + ‘MHD_CONNECTION_INFO_GNUTLS_SESSION,’ Takes no extra arguments. Allows access to the underlying GNUtls session, including access to the underlying GNUtls client certificate (HTTPS connections only). Takes no extra - arguments. 'NULL' is returned for non-HTTPS connections. + arguments. ‘NULL’ is returned for non-HTTPS connections. - 'MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,' + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,’ Dysfunctional (never implemented, deprecated). Use MHD_CONNECTION_INFO_GNUTLS_SESSION to get the - 'gnutls_session_t' and then call - 'gnutls_certificate_get_peers()'. + ‘gnutls_session_t’ and then call + ‘gnutls_certificate_get_peers()’. - 'MHD_CONNECTION_INFO_DAEMON' - Returns information about 'struct MHD_Daemon' which manages + ‘MHD_CONNECTION_INFO_DAEMON’ + Returns information about ‘struct MHD_Daemon’ which manages this connection. - 'MHD_CONNECTION_INFO_CONNECTION_FD' + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_CONNECTION_FD’ Returns the file descriptor (usually a TCP socket) associated - with this connection (in the "connect-fd" member of the + with this connection (in the “connect-fd” member of the returned struct). Note that manipulating the descriptor directly can have problematic consequences (as in, break HTTP). Applications might use this access to manipulate TCP - options, for example to set the "TCP-NODELAY" option for + options, for example to set the “TCP-NODELAY” option for COMET-like applications. Note that MHD will set TCP-CORK after sending the HTTP header and clear it after finishing the footers automatically (if the platform supports it). As the @@ -2317,13 +2546,41 @@ used to set different values for TCP-CORK and TCP-NODELAY in the meantime. - 'MHD_CONNECTION_INFO_SOCKET_CONTEXT' - Returns the client-specific pointer to a 'void *' that was - (possibly) set during a 'MHD_NotifyConnectionCallback' when + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_CONNECTION_SUSPENDED’ + Returns pointer to an integer that is ‘MHD_YES’ if the + connection is currently suspended (and thus can be safely + resumed) and ‘MHD_NO’ otherwise. + + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_SOCKET_CONTEXT’ + Returns the client-specific pointer to a ‘void *’ that was + (possibly) set during a ‘MHD_NotifyConnectionCallback’ when the socket was first accepted. Note that this is NOT the same - as the 'con_cls' argument of the 'MHD_AccessHandlerCallback'. - The 'con_cls' is fresh for each HTTP request, while the - 'socket_context' is fresh for each socket. + as the ‘con_cls’ argument of the ‘MHD_AccessHandlerCallback’. + The ‘con_cls’ is fresh for each HTTP request, while the + ‘socket_context’ is fresh for each socket. + + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_CONNECTION_TIMEOUT’ + Returns pointer to an ‘unsigned int’ that is the current + timeout used for the connection (in seconds, 0 for no + timeout). Note that while suspended connections will not + timeout, the timeout value returned for suspended connections + will be the timeout that the connection will use after it is + resumed, and thus might not be zero. + + Takes no extra arguments. + + ‘MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE’ + Returns pointer to an ‘size_t’ that represents the size of the + HTTP header received from the client. Only valid after the + first callback to the access handler. + + Takes no extra arguments.  File: libmicrohttpd.info, Node: microhttpd-option conn, Prev: microhttpd-info conn, Up: microhttpd-info @@ -2341,19 +2598,19 @@ OPTION option to set - ... + ... additional arguments for the option (depending on option) - Returns 'MHD_YES' on success, 'MHD_NO' for errors (i.e. option + Returns ‘MHD_YES’ on success, ‘MHD_NO’ for errors (i.e. option argument invalid or option unknown). -- Enumeration: MHD_CONNECTION_OPTION Values of this enum are used to specify which option for a connection should be changed. - 'MHD_CONNECTION_OPTION_TIMEOUT' + ‘MHD_CONNECTION_OPTION_TIMEOUT’ Set a custom timeout for the given connection. Specified as - the number of seconds, given as an 'unsigned int'. Use zero + the number of seconds, given as an ‘unsigned int’. Use zero for no timeout.  @@ -2376,71 +2633,70 @@ -- Enumeration: MHD_FEATURE Values of this enum are used to specify what information about a daemon is desired. - 'MHD_FEATURE_MESSAGES' + ‘MHD_FEATURE_MESSAGES’ Get whether messages are supported. If supported then in debug mode messages can be printed to stderr or to external logger. - 'MHD_FEATURE_SSL' + ‘MHD_FEATURE_SSL’ Get whether HTTPS is supported. If supported then flag MHD_USE_SSL and options MHD_OPTION_HTTPS_MEM_KEY, MHD_OPTION_HTTPS_MEM_CERT, MHD_OPTION_HTTPS_MEM_TRUST, MHD_OPTION_HTTPS_MEM_DHPARAMS, MHD_OPTION_HTTPS_CRED_TYPE, MHD_OPTION_HTTPS_PRIORITIES can be used. - 'MHD_FEATURE_HTTPS_CERT_CALLBACK' + ‘MHD_FEATURE_HTTPS_CERT_CALLBACK’ Get whether option #MHD_OPTION_HTTPS_CERT_CALLBACK is supported. - 'MHD_FEATURE_IPv6' + ‘MHD_FEATURE_IPv6’ Get whether IPv6 is supported. If supported then flag MHD_USE_IPv6 can be used. - 'MHD_FEATURE_IPv6_ONLY' + ‘MHD_FEATURE_IPv6_ONLY’ Get whether IPv6 without IPv4 is supported. If not supported then IPv4 is always enabled in IPv6 sockets and flag MHD_USE_DUAL_STACK if always used when MHD_USE_IPv6 is specified. - 'MHD_FEATURE_POLL' - Get whether 'poll()' is supported. If supported then flag + ‘MHD_FEATURE_POLL’ + Get whether ‘poll()’ is supported. If supported then flag MHD_USE_POLL can be used. - 'MHD_FEATURE_EPOLL' - Get whether 'epoll()' is supported. If supported then Flags - MHD_USE_EPOLL_LINUX_ONLY and - MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used. + ‘MHD_FEATURE_EPOLL’ + Get whether ‘epoll()’ is supported. If supported then Flags + MHD_USE_EPOLL and MHD_USE_EPOLL_INTERNAL_THREAD can be used. - 'MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET' + ‘MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET’ Get whether shutdown on listen socket to signal other threads - is supported. If not supported flag MHD_USE_PIPE_FOR_SHUTDOWN - is automatically forced. + is supported. If not supported flag MHD_USE_ITC is + automatically forced. - 'MHD_FEATURE_SOCKETPAIR' - Get whether a 'socketpair()' is used internally instead of a - 'pipe()' to signal other threads. + ‘MHD_FEATURE_SOCKETPAIR’ + Get whether a ‘socketpair()’ is used internally instead of a + ‘pipe()’ to signal other threads. - 'MHD_FEATURE_TCP_FASTOPEN' + ‘MHD_FEATURE_TCP_FASTOPEN’ Get whether TCP Fast Open is supported. If supported then flag MHD_USE_TCP_FASTOPEN and option MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE can be used. - 'MHD_FEATURE_BASIC_AUTH' + ‘MHD_FEATURE_BASIC_AUTH’ Get whether HTTP Basic authorization is supported. If supported then functions - 'MHD_basic_auth_get_username_password()' and - 'MHD_queue_basic_auth_fail_response()' can be used. + ‘MHD_basic_auth_get_username_password()’ and + ‘MHD_queue_basic_auth_fail_response()’ can be used. - 'MHD_FEATURE_DIGEST_AUTH' + ‘MHD_FEATURE_DIGEST_AUTH’ Get whether HTTP Digest authorization is supported. If supported then options MHD_OPTION_DIGEST_AUTH_RANDOM, MHD_OPTION_NONCE_NC_SIZE and functions - 'MHD_digest_auth_check()', can be used. + ‘MHD_digest_auth_check()’, can be used. - 'MHD_FEATURE_POSTPROCESSOR' + ‘MHD_FEATURE_POSTPROCESSOR’ Get whether postprocessor is supported. If supported then - functions 'MHD_create_post_processor()', 'MHD_post_process()', - 'MHD_destroy_post_processor()' can be used. + functions ‘MHD_create_post_processor()’, ‘MHD_post_process()’, + ‘MHD_destroy_post_processor()’ can be used. -- Function: int MHD_is_feature_supported (enum MHD_FEATURE feature) Get information about supported MHD features. Indicate that MHD @@ -2451,7 +2707,7 @@ FEATURE type of requested information - Returns 'MHD_YES' if the feature is supported, and 'MHD_NO' if not. + Returns ‘MHD_YES’ if the feature is supported, and ‘MHD_NO’ if not.  File: libmicrohttpd.info, Node: microhttpd-util unescape, Prev: microhttpd-util feature, Up: microhttpd-util @@ -2460,7 +2716,7 @@ ===================== -- Function: size_t MHD_http_unescape (char *val) - Process escape sequences ('%HH') Updates val in place; the result + Process escape sequences (’%HH’) Updates val in place; the result should be UTF-8 encoded and cannot be larger than the input. The result must also still be 0-terminated. @@ -2468,7 +2724,7 @@ value to unescape (modified in the process), must be a 0-terminated UTF-8 string. - Returns length of the resulting val ('strlen(val)' may be shorter + Returns length of the resulting val (‘strlen(val)’ may be shorter afterwards due to elimination of escape sequences).  @@ -2479,7 +2735,7 @@ Version 2.1, February 1999 - Copyright (C) 1991, 1999 Free Software Foundation, Inc. + Copyright © 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies @@ -2494,11 +2750,11 @@ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are -intended to guarantee your freedom to share and change free software--to +intended to guarantee your freedom to share and change free software—to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some -specially designated software--typically libraries--of the Free Software +specially designated software—typically libraries—of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any @@ -2532,7 +2788,7 @@ To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they -have is not the original version, so that the original author's +have is not the original version, so that the original author’s reputation will not be affected by problems that might be introduced by others. @@ -2558,8 +2814,8 @@ License permits more lax criteria for linking other code with the library. - We call this license the "Lesser" General Public License because it -does _Less_ to protect the user's freedom than the ordinary General + We call this license the “Lesser” General Public License because it +does _Less_ to protect the user’s freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many @@ -2581,13 +2837,13 @@ as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is linked +users’ freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The +“work based on the library” and a “work that uses the library”. The former contains code derived from the library, whereas the latter must be combined with the library in order to run. @@ -2597,23 +2853,23 @@ 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms - of this Lesser General Public License (also called "this License"). - Each licensee is addressed as "you". + of this Lesser General Public License (also called “this License”). + Each licensee is addressed as “you”. - A "library" means a collection of software functions and/or data + A “library” means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - The "Library", below, refers to any such software library or work - which has been distributed under these terms. A "work based on the - Library" means either the Library or any derivative work under + The “Library”, below, refers to any such software library or work + which has been distributed under these terms. A “work based on the + Library” means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term - "modification".) + “modification”.) - "Source code" for a work means the preferred form of the work for + “Source code” for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to @@ -2628,7 +2884,7 @@ depends on what the Library does and what the program that uses the Library does. - 1. You may copy and distribute verbatim copies of the Library's + 1. You may copy and distribute verbatim copies of the Library’s complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep @@ -2720,17 +2976,17 @@ 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled - or linked with it, is called a "work that uses the Library". Such + or linked with it, is called a “work that uses the Library”. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - However, linking a "work that uses the Library" with the Library + However, linking a “work that uses the Library” with the Library creates an executable that is a derivative of the Library (because - it contains portions of the Library), rather than a "work that uses - the library". The executable is therefore covered by this License. + it contains portions of the Library), rather than a “work that uses + the library”. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - When a "work that uses the Library" uses material from a header + When a “work that uses the Library” uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work @@ -2751,10 +3007,10 @@ whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link - a "work that uses the Library" with the Library to produce a work + a “work that uses the Library” with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification - of the work for the customer's own use and reverse engineering for + of the work for the customer’s own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the @@ -2770,7 +3026,7 @@ whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete - machine-readable "work that uses the Library", as object code + machine-readable “work that uses the Library”, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who @@ -2780,7 +3036,7 @@ b. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run - time a copy of the library already present on the user's + time a copy of the library already present on the user’s computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as @@ -2799,8 +3055,8 @@ e. Verify that the user has already received a copy of these materials or that you have already sent this user a copy. - For an executable, the required form of the "work that uses the - Library" must include any data and utility programs needed for + For an executable, the required form of the “work that uses the + Library” must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary @@ -2853,7 +3109,7 @@ Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose - any further restrictions on the recipients' exercise of the rights + any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. @@ -2906,7 +3162,7 @@ Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to - it and "any later version", you have the option of following the + it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever @@ -2926,7 +3182,7 @@ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS - AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY + AND/OR OTHER PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND @@ -2960,7 +3216,7 @@ To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have -at least the "copyright" line and a pointer to where the full notice is +at least the “copyright” line and a pointer to where the full notice is found. ONE LINE TO GIVE THE LIBRARY'S NAME AND AN IDEA OF WHAT IT DOES. @@ -2985,7 +3241,7 @@ mail. You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, +your school, if any, to sign a “copyright disclaimer” for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library @@ -2994,7 +3250,7 @@ SIGNATURE OF TY COON, 1 April 1990 Ty Coon, President of Vice - That's all there is to it! + That’s all there is to it!  File: libmicrohttpd.info, Node: GNU GPL with eCos Extension, Next: GNU-FDL, Prev: GNU-LGPL, Up: Top @@ -3004,7 +3260,7 @@ Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. + Copyright © 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies @@ -3015,9 +3271,9 @@ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is -intended to guarantee your freedom to share and change free software--to +intended to guarantee your freedom to share and change free software—to make sure the software is free for all its users. This General Public -License applies to most of the Free Software Foundation's software and +License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. @@ -3044,18 +3300,18 @@ and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - Also, for each author's protection and ours, we want to make certain + Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original -authors' reputations. +authors’ reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +patent must be licensed for everyone’s free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. @@ -3064,14 +3320,14 @@ 1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed - under the terms of this General Public License. The "Program", - below, refers to any such program or work, and a "work based on the - Program" means either the Program or any derivative work under + under the terms of this General Public License. The “Program”, + below, refers to any such program or work, and a “work based on the + Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is - included without limitation in the term "modification".) Each - licensee is addressed as "you". + included without limitation in the term “modification”.) Each + licensee is addressed as “you”. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act @@ -3080,7 +3336,7 @@ the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - 2. You may copy and distribute verbatim copies of the Program's source + 2. You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the @@ -3199,7 +3455,7 @@ Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further - restrictions on the recipients' exercise of the rights granted + restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. @@ -3252,7 +3508,7 @@ Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to - it and "any later version", you have the option of following the + it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any @@ -3272,7 +3528,7 @@ 12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS - AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY + AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND @@ -3319,7 +3575,7 @@ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. +“copyright” line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND AN IDEA OF WHAT IT DOES. Copyright (C) 19YY NAME OF AUTHOR @@ -3350,14 +3606,14 @@ to redistribute it under certain conditions; type `show c' for details. - The hypothetical commands 'show w' and 'show c' should show the + The hypothetical commands ‘show w’ and ‘show c’ should show the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than 'show w' and 'show -c'; they could even be mouse-clicks or menu items--whatever suits your +commands you use may be called something other than ‘show w’ and ‘show +c’; they could even be mouse-clicks or menu items—whatever suits your program. You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the program, +your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright @@ -3382,7 +3638,7 @@ Version 1.3, 3 November 2008 - Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies @@ -3391,14 +3647,14 @@ 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other - functional and useful document "free" in the sense of freedom: to + functional and useful document “free” in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. - This License is a kind of "copyleft", which means that derivative + This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. @@ -3419,18 +3675,18 @@ be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You accept + “Document”, below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. - A "Modified Version" of the Document means any work containing the + A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. - A "Secondary Section" is a named appendix or a front-matter section + A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall + publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not @@ -3439,7 +3695,7 @@ of legal, commercial, philosophical, ethical or political position regarding them. - The "Invariant Sections" are certain Secondary Sections whose + The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it @@ -3447,13 +3703,13 @@ contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. - The "Cover Texts" are certain short passages of text that are + The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. - A "Transparent" copy of the Document means a machine-readable copy, + A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed @@ -3465,7 +3721,7 @@ been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not - "Transparent" is called "Opaque". + “Transparent” is called “Opaque”. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, @@ -3478,23 +3734,23 @@ the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. - The "Title Page" means, for a printed book, the title page itself, + The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. + works in formats which do not have any title page as such, “Title + Page” means the text near the most prominent appearance of the + work’s title, preceding the beginning of the body of the text. - The "publisher" means any person or entity that distributes copies + The “publisher” means any person or entity that distributes copies of the Document to the public. - A section "Entitled XYZ" means a named subunit of the Document + A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according + “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) + To “Preserve the Title” of such a section when you modify the + Document means that it remains a section “Entitled XYZ” according to this definition. The Document may include Warranty Disclaimers next to the notice @@ -3524,7 +3780,7 @@ If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must + the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly @@ -3596,15 +3852,15 @@ the Addendum below. G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's + Sections and required Cover Texts given in the Document’s license notice. H. Include an unaltered copy of this License. - I. Preserve the section Entitled "History", Preserve its Title, + I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the - Title Page. If there is no section Entitled "History" in the + Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the @@ -3614,12 +3870,12 @@ for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the - "History" section. You may omit a network location for a work + “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. - K. For any section Entitled "Acknowledgements" or "Dedications", + K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. @@ -3628,11 +3884,11 @@ in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. - M. Delete any section Entitled "Endorsements". Such a section + M. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant + “Endorsements” or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. @@ -3641,15 +3897,15 @@ appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their - titles to the list of Invariant Sections in the Modified Version's + titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles. - You may add a section Entitled "Endorsements", provided it contains + You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. + parties—for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition of + a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of @@ -3687,10 +3943,10 @@ combined work. In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." + “History” in the various original documents, forming one section + Entitled “History”; likewise combine any sections Entitled + “Acknowledgements”, and any sections Entitled “Dedications”. You + must delete all sections Entitled “Endorsements.” 6. COLLECTIONS OF DOCUMENTS @@ -3711,16 +3967,16 @@ A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a - storage or distribution medium, is called an "aggregate" if the + storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual + legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed + of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket @@ -3742,8 +3998,8 @@ this License or a notice or disclaimer, the original version will prevail. - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to + If a section in the Document is Entitled “Acknowledgements”, + “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. @@ -3784,7 +4040,7 @@ Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you + version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the @@ -3792,29 +4048,29 @@ choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that - proxy's public statement of acceptance of a version permanently + proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING - "Massive Multiauthor Collaboration Site" (or "MMC Site") means any + “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. - A "Massive Multiauthor Collaboration" (or "MMC") contained in the + A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site. - "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 + “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. - "Incorporate" means to publish or republish a Document, in whole or + “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document. - An MMC is "eligible for relicensing" if it is licensed under this + An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover @@ -3841,7 +4097,7 @@ Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: +Texts, replace the “with...Texts.” line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts @@ -3865,115 +4121,128 @@ [index] * Menu: -* ARM: microhttpd-intro. (line 249) -* bind, restricting bind: microhttpd-const. (line 231) -* bind, restricting bind <1>: microhttpd-const. (line 450) -* cipher: microhttpd-const. (line 304) -* clock: microhttpd-const. (line 89) -* compilation: microhttpd-intro. (line 107) +* ARM: microhttpd-intro. (line 267) +* bind, restricting bind: microhttpd-const. (line 301) +* bind, restricting bind <1>: microhttpd-const. (line 520) +* cipher: microhttpd-const. (line 374) +* clock: microhttpd-const. (line 107) +* compilation: microhttpd-intro. (line 121) * connection, limiting number of connections: microhttpd-const. - (line 155) + (line 189) * connection, limiting number of connections <1>: microhttpd-info daemon. (line 60) -* cookie: microhttpd-const. (line 486) -* cortex m3: microhttpd-intro. (line 249) -* date: microhttpd-const. (line 89) -* debugging: microhttpd-const. (line 24) -* debugging <1>: microhttpd-const. (line 242) -* DH: microhttpd-const. (line 442) -* digest auth: microhttpd-const. (line 327) -* digest auth <1>: microhttpd-const. (line 338) +* cookie: microhttpd-const. (line 552) +* cortex m3: microhttpd-intro. (line 267) +* date: microhttpd-const. (line 107) +* debugging: microhttpd-const. (line 33) +* debugging <1>: microhttpd-const. (line 312) +* deprecated: microhttpd-const. (line 63) +* DH: microhttpd-const. (line 512) +* digest auth: microhttpd-const. (line 397) +* digest auth <1>: microhttpd-const. (line 408) * eCos, GNU General Public License with eCos Extension: GNU GPL with eCos Extension. (line 6) -* embedded systems: microhttpd-intro. (line 107) -* embedded systems <1>: microhttpd-intro. (line 249) -* embedded systems <2>: microhttpd-const. (line 89) -* embedded systems <3>: microhttpd-const. (line 96) -* embedded systems <4>: microhttpd-const. (line 426) -* epoll: microhttpd-intro. (line 55) -* epoll <1>: microhttpd-const. (line 76) +* embedded systems: microhttpd-intro. (line 121) +* embedded systems <1>: microhttpd-intro. (line 267) +* embedded systems <2>: microhttpd-const. (line 107) +* embedded systems <3>: microhttpd-const. (line 114) +* embedded systems <4>: microhttpd-const. (line 496) +* epoll: microhttpd-intro. (line 67) +* epoll <1>: microhttpd-const. (line 79) * epoll <2>: microhttpd-info daemon. (line 49) -* escaping: microhttpd-const. (line 409) -* FD_SETSIZE: microhttpd-const. (line 68) -* FD_SETSIZE <1>: microhttpd-const. (line 76) -* foreign-function interface: microhttpd-const. (line 387) +* escaping: microhttpd-const. (line 479) +* FD_SETSIZE: microhttpd-const. (line 72) +* FD_SETSIZE <1>: microhttpd-const. (line 79) +* foreign-function interface: microhttpd-const. (line 457) * GPL, GNU General Public License: GNU GPL with eCos Extension. (line 6) -* IAR: microhttpd-intro. (line 249) -* internationalization: microhttpd-const. (line 409) -* IPv6: microhttpd-const. (line 43) -* IPv6 <1>: microhttpd-const. (line 53) +* HTTP2: microhttpd-response upgrade. + (line 6) +* IAR: microhttpd-intro. (line 267) +* internationalization: microhttpd-const. (line 479) +* IPv6: microhttpd-const. (line 47) +* IPv6 <1>: microhttpd-const. (line 57) * license: GNU-LGPL. (line 6) * license <1>: GNU GPL with eCos Extension. (line 6) * license <2>: GNU-FDL. (line 6) -* listen: microhttpd-const. (line 96) -* listen <1>: microhttpd-const. (line 126) -* listen <2>: microhttpd-const. (line 432) +* listen: microhttpd-const. (line 114) +* listen <1>: microhttpd-const. (line 145) +* listen <2>: microhttpd-const. (line 502) * listen <3>: microhttpd-info daemon. (line 43) -* logging: microhttpd-const. (line 242) -* logging <1>: microhttpd-const. (line 368) -* long long: microhttpd-intro. (line 249) -* memory: microhttpd-const. (line 147) -* memory, limiting memory utilization: microhttpd-const. (line 139) -* MHD_LONG_LONG: microhttpd-intro. (line 249) -* microhttpd.h: microhttpd-intro. (line 189) -* options: microhttpd-const. (line 387) -* performance: microhttpd-intro. (line 77) -* performance <1>: microhttpd-const. (line 379) -* poll: microhttpd-intro. (line 55) -* poll <1>: microhttpd-const. (line 68) +* logging: microhttpd-const. (line 312) +* logging <1>: microhttpd-const. (line 438) +* long long: microhttpd-intro. (line 267) +* memory: microhttpd-const. (line 181) +* memory, limiting memory utilization: microhttpd-const. (line 173) +* MHD_LONG_LONG: microhttpd-intro. (line 267) +* microhttpd.h: microhttpd-intro. (line 207) +* options: microhttpd-const. (line 457) +* performance: microhttpd-intro. (line 91) +* performance <1>: microhttpd-const. (line 92) +* performance <2>: microhttpd-const. (line 449) +* performance <3>: microhttpd-info conn. + (line 114) +* poll: microhttpd-intro. (line 67) +* poll <1>: microhttpd-const. (line 72) * poll <2>: microhttpd-init. (line 74) -* portability: microhttpd-intro. (line 107) -* portability <1>: microhttpd-intro. (line 189) -* POST method: microhttpd-const. (line 490) +* portability: microhttpd-intro. (line 121) +* portability <1>: microhttpd-intro. (line 207) +* POST method: microhttpd-const. (line 556) * POST method <1>: microhttpd-struct. (line 19) * POST method <2>: microhttpd-cb. (line 48) * POST method <3>: microhttpd-post. (line 6) * POST method <4>: microhttpd-post api. (line 6) -* proxy: microhttpd-const. (line 96) -* pthread: microhttpd-const. (line 426) +* proxy: microhttpd-const. (line 114) +* pthread: microhttpd-const. (line 496) * PUT method: microhttpd-cb. (line 48) -* query string: microhttpd-const. (line 242) -* quiesce: microhttpd-const. (line 103) +* query string: microhttpd-const. (line 312) +* quiesce: microhttpd-const. (line 121) * quiesce <1>: microhttpd-init. (line 51) -* random: microhttpd-const. (line 327) -* replay attack: microhttpd-const. (line 338) -* reusing listening address: microhttpd-const. (line 450) -* select: microhttpd-intro. (line 55) -* select <1>: microhttpd-const. (line 68) -* select <2>: microhttpd-const. (line 76) +* random: microhttpd-const. (line 397) +* replay attack: microhttpd-const. (line 408) +* reusing listening address: microhttpd-const. (line 520) +* RFC2817: microhttpd-response upgrade. + (line 6) +* select: microhttpd-intro. (line 67) +* select <1>: microhttpd-const. (line 72) +* select <2>: microhttpd-const. (line 79) * select <3>: microhttpd-init. (line 74) * select <4>: microhttpd-init. (line 89) -* signals: microhttpd-intro. (line 210) -* SNI: microhttpd-const. (line 312) -* SSL: microhttpd-const. (line 32) -* SSL <1>: microhttpd-const. (line 265) -* SSL <2>: microhttpd-const. (line 271) -* SSL <3>: microhttpd-const. (line 281) -* SSL <4>: microhttpd-const. (line 287) -* SSL <5>: microhttpd-const. (line 299) -* SSL <6>: microhttpd-const. (line 304) -* SSL <7>: microhttpd-const. (line 312) -* SSL <8>: microhttpd-const. (line 442) -* stack: microhttpd-const. (line 426) -* systemd: microhttpd-const. (line 361) -* thread: microhttpd-const. (line 426) -* timeout: microhttpd-const. (line 183) -* timeout <1>: microhttpd-inspect. (line 24) +* signals: microhttpd-intro. (line 228) +* SNI: microhttpd-const. (line 382) +* SSL: microhttpd-const. (line 36) +* SSL <1>: microhttpd-const. (line 335) +* SSL <2>: microhttpd-const. (line 341) +* SSL <3>: microhttpd-const. (line 351) +* SSL <4>: microhttpd-const. (line 357) +* SSL <5>: microhttpd-const. (line 369) +* SSL <6>: microhttpd-const. (line 374) +* SSL <7>: microhttpd-const. (line 382) +* SSL <8>: microhttpd-const. (line 512) +* stack: microhttpd-const. (line 496) +* systemd: microhttpd-const. (line 431) +* thread: microhttpd-const. (line 496) +* timeout: microhttpd-const. (line 227) +* timeout <1>: microhttpd-inspect. (line 39) * timeout <2>: microhttpd-option conn. (line 6) -* TLS: microhttpd-const. (line 32) -* TLS <1>: microhttpd-const. (line 265) -* TLS <2>: microhttpd-const. (line 271) -* TLS <3>: microhttpd-const. (line 281) -* TLS <4>: microhttpd-const. (line 287) -* TLS <5>: microhttpd-const. (line 299) -* TLS <6>: microhttpd-const. (line 304) -* TLS <7>: microhttpd-const. (line 312) -* TLS <8>: microhttpd-const. (line 442) +* TLS: microhttpd-const. (line 36) +* TLS <1>: microhttpd-const. (line 335) +* TLS <2>: microhttpd-const. (line 341) +* TLS <3>: microhttpd-const. (line 351) +* TLS <4>: microhttpd-const. (line 357) +* TLS <5>: microhttpd-const. (line 369) +* TLS <6>: microhttpd-const. (line 374) +* TLS <7>: microhttpd-const. (line 382) +* TLS <8>: microhttpd-const. (line 512) +* upgrade: microhttpd-const. (line 150) +* Upgrade: microhttpd-response upgrade. + (line 6) +* WebSockets: microhttpd-response upgrade. + (line 6)  File: libmicrohttpd.info, Node: Function and Data Index, Next: Type Index, Prev: Concept Index, Up: Top @@ -3991,6 +4260,8 @@ * *MHD_KeyValueIterator: microhttpd-cb. (line 116) * *MHD_PostDataIterator: microhttpd-cb. (line 190) * *MHD_RequestCompletedCallback: microhttpd-cb. (line 96) +* *MHD_UpgradeHandler: microhttpd-response upgrade. + (line 36) * MHD_add_connection: microhttpd-init. (line 115) * MHD_add_response_footer: microhttpd-response headers. (line 18) @@ -3999,6 +4270,8 @@ * MHD_basic_auth_get_username_password: microhttpd-dauth basic. (line 6) * MHD_create_post_processor: microhttpd-post api. (line 6) +* MHD_create_response_for_upgrade: microhttpd-response upgrade. + (line 23) * MHD_create_response_from_buffer: microhttpd-response create. (line 92) * MHD_create_response_from_callback: microhttpd-response create. @@ -4024,16 +4297,17 @@ * MHD_get_daemon_info: microhttpd-info daemon. (line 6) * MHD_get_fdset: microhttpd-inspect. (line 6) +* MHD_get_fdset2: microhttpd-inspect. (line 31) * MHD_get_response_header: microhttpd-response inspect. (line 18) * MHD_get_response_headers: microhttpd-response inspect. (line 6) -* MHD_get_timeout: microhttpd-inspect. (line 22) +* MHD_get_timeout: microhttpd-inspect. (line 37) * MHD_http_unescape: microhttpd-util unescape. (line 6) * MHD_is_feature_supported: microhttpd-util feature. - (line 75) -* MHD_lookup_connection_value: microhttpd-requests. (line 56) + (line 74) +* MHD_lookup_connection_value: microhttpd-requests. (line 58) * MHD_post_process: microhttpd-post api. (line 33) * MHD_queue_auth_fail_response: microhttpd-dauth digest. (line 35) @@ -4047,13 +4321,15 @@ * MHD_run_from_select: microhttpd-init. (line 86) * MHD_set_connection_option: microhttpd-option conn. (line 6) -* MHD_set_connection_value: microhttpd-requests. (line 33) +* MHD_set_connection_value: microhttpd-requests. (line 35) * MHD_set_panic_func: microhttpd-init. (line 6) * MHD_set_response_options: microhttpd-response options. (line 6) * MHD_start_daemon: microhttpd-init. (line 18) * MHD_stop_daemon: microhttpd-init. (line 67) * MHD_suspend_connection: microhttpd-flow. (line 20) +* MHD_upgrade_action: microhttpd-response upgrade. + (line 90)  File: libmicrohttpd.info, Node: Type Index, Prev: Function and Data Index, Up: Top @@ -4077,54 +4353,62 @@ * MHD_FEATURE: microhttpd-util feature. (line 6) * MHD_FLAG: microhttpd-const. (line 6) -* MHD_OPTION: microhttpd-const. (line 130) -* MHD_OptionItem: microhttpd-const. (line 462) +* MHD_OPTION: microhttpd-const. (line 164) +* MHD_OptionItem: microhttpd-const. (line 531) * MHD_PostProcessor: microhttpd-struct. (line 18) -* MHD_RequestTerminationCode: microhttpd-const. (line 503) +* MHD_RequestTerminationCode: microhttpd-const. (line 569) * MHD_Response: microhttpd-struct. (line 15) -* MHD_ResponseFlags: microhttpd-const. (line 543) -* MHD_ResponseMemoryMode: microhttpd-const. (line 521) -* MHD_ResponseOptions: microhttpd-const. (line 555) -* MHD_ValueKind: microhttpd-const. (line 475) +* MHD_ResponseFlags: microhttpd-const. (line 609) +* MHD_ResponseMemoryMode: microhttpd-const. (line 587) +* MHD_ResponseOptions: microhttpd-const. (line 621) +* MHD_UpgradeAction: microhttpd-response upgrade. + (line 101) +* MHD_ValueKind: microhttpd-const. (line 544)  Tag Table: -Node: Top818 -Node: microhttpd-intro3024 -Ref: fig:performance7073 -Ref: tbl:supported8019 -Node: microhttpd-const15292 -Node: microhttpd-struct43050 -Node: microhttpd-cb43830 -Node: microhttpd-init53172 -Node: microhttpd-inspect58926 -Node: microhttpd-requests60863 -Node: microhttpd-responses64347 -Node: microhttpd-response enqueue65459 -Ref: microhttpd-response enqueue-Footnote-167726 -Node: microhttpd-response create67945 -Node: microhttpd-response headers73978 -Node: microhttpd-response options75805 -Node: microhttpd-response inspect76660 -Node: microhttpd-flow77833 -Node: microhttpd-dauth80570 -Node: microhttpd-dauth basic82121 -Node: microhttpd-dauth digest83313 -Node: microhttpd-post87961 -Node: microhttpd-post api90906 -Node: microhttpd-info93490 -Node: microhttpd-info daemon93912 -Node: microhttpd-info conn97317 -Node: microhttpd-option conn101034 -Node: microhttpd-util102098 -Node: microhttpd-util feature102369 -Node: microhttpd-util unescape105810 -Node: GNU-LGPL106450 -Node: GNU GPL with eCos Extension134554 -Node: GNU-FDL154431 -Node: Concept Index179517 -Node: Function and Data Index187607 -Node: Type Index192779 +Node: Top813 +Node: microhttpd-intro3034 +Ref: fig:performance7951 +Ref: tbl:supported8908 +Node: microhttpd-const16504 +Node: microhttpd-struct48622 +Node: microhttpd-cb49406 +Node: microhttpd-init58918 +Node: microhttpd-inspect64769 +Node: microhttpd-requests67513 +Node: microhttpd-responses71181 +Node: microhttpd-response enqueue72380 +Ref: microhttpd-response enqueue-Footnote-174687 +Node: microhttpd-response create74922 +Node: microhttpd-response headers81043 +Node: microhttpd-response options82886 +Node: microhttpd-response inspect83757 +Node: microhttpd-response upgrade84978 +Node: microhttpd-flow90132 +Node: microhttpd-dauth93426 +Node: microhttpd-dauth basic94977 +Node: microhttpd-dauth digest96205 +Node: microhttpd-post100891 +Node: microhttpd-post api103890 +Node: microhttpd-info106534 +Node: microhttpd-info daemon106956 +Node: microhttpd-info conn110417 +Node: microhttpd-option conn115473 +Node: microhttpd-util116554 +Node: microhttpd-util feature116825 +Node: microhttpd-util unescape120325 +Node: GNU-LGPL120973 +Node: GNU GPL with eCos Extension149179 +Node: GNU-FDL169117 +Node: Concept Index194406 +Node: Function and Data Index203423 +Node: Type Index209097  End Tag Table + + +Local Variables: +coding: utf-8 +End: diff -Nru libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd.texi libmicrohttpd-0.9.55/doc/libmicrohttpd.texi --- libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd.texi 2015-09-22 19:19:01.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/libmicrohttpd.texi 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,6 @@ \input texinfo @setfilename libmicrohttpd.info +@documentencoding UTF-8 @include version.texi @settitle The GNU libmicrohttpd Reference Manual @c Unify all the indices into concept index. @@ -11,7 +12,7 @@ (version @value{VERSION}, @value{UPDATED}), a library for embedding an HTTP(S) server into C applications. -Copyright @copyright{} 2007--2013 Christian Grothoff +Copyright @copyright{} 2007--2017 Christian Grothoff @quotation Permission is granted to copy, distribute and/or modify this document @@ -100,13 +101,26 @@ The library is supposed to handle everything that it must handle (because the API would not allow clients to do this), such as basic -connection management; however, detailed interpretations of headers --- -such as range requests --- and HTTP methods are left to clients. The -library does understand @code{HEAD} and will only send the headers of -the response and not the body, even if the client supplied a body. The -library also understands headers that control connection management -(specifically, @code{Connection: close} and @code{Expect: 100 continue} -are understood and handled automatically). +connection management. However, detailed interpretations of headers, +such as range requests, are left to the main application. In +particular, if an application developer wants to support range +requests, he needs to explicitly indicate support in responses and +also explicitly parse the range header and generate a response (for +example, using the @code{MHD_create_response_from_fd_at_offset} call +to serve ranges from a file). MHD does understands headers that +control connection management (specifically, @code{Connection: close} +and @code{Expect: 100 continue} are understood and handled +automatically). @code{Connection: upgrade} is supported by passing +control over the socket (or something that behaves like the real +socket in the case of TLS) to the application (after sending the +desired HTTP response header). + +MHD largely ignores the semantics of the different HTTP methods, +so clients are left to handle those. One exception is that MHD does +understand @code{HEAD} and will only send the headers of the response +and not the body, even if the client supplied a body. (In fact, +clients do need to construct a response with the correct length, even +for @code{HEAD} request.) MHD understands @code{POST} data and is able to decode certain formats (at the moment only @code{application/x-www-form-urlencoded} @@ -148,20 +162,20 @@ @cindex select MHD supports four basic thread modes and up to three event loop -styes. +styles. -The four basic thread modes are external (MHD creates no threads, -event loop is fully managed by the application), internal (MHD creates -one thread for all connections), thread pool (MHD creates a thread -pool which is used to process all connections) and -thread-per-connection (MHD creates one listen thread and then one -thread per accepted connection). - -These thread modes are then combined with the event loop styles. -MHD support select, poll and epoll. epoll is only available on -Linux, poll may not be available on some platforms. Note that -it is possible to combine MHD using epoll with an external -select-based event loop. +The four basic thread modes are external sockets polling (MHD creates +no threads, event loop is fully managed by the application), internal +polling (MHD creates one thread for all connections), polling in +thread pool (MHD creates a thread pool which is used to process all +connections) and thread-per-connection (MHD creates one thread for +listen sockets and then one thread per accepted connection). + +These thread modes are then combined with the evet loop styles +(polling function type). MHD support select, poll and epoll. select +is available on all platforms, epoll and poll may not be available on +some platforms. Note that it is possible to combine MHD using epoll +with an external select-based event loop. The default (if no other option is passed) is ``external select''. The highest performance can typically be obtained with a thread pool @@ -193,8 +207,8 @@ connection. This is typically rather costly. Applications that do not support threads or that must run on embedded devices without thread-support must use the external mode. Using @code{epoll} is only -supported on Linux, thus portable applications must at least have a -fallback option available. @ref{tbl:supported} lists the sane +supported on some platform, thus portable applications must at least +have a fallback option available. @ref{tbl:supported} lists the sane combinations. @float Table,tbl:supported @@ -254,8 +268,11 @@ @item ``--disable-dauth'' do not include the authentication APIs (results in binary incompatibility) -@item ``--disable-epoll -do not include epoll support, even on Linux (minimally smaller binary size, good for testing portability to non-Linux systems) +@item ``--disable-httpupgrade'' +do not build code for HTTP ``Upgrade'' (smaller binary size, binary incompatible library) + +@item ``--disable-epoll'' +do not include epoll support, even if it supported (minimally smaller binary size, good for portability testing) @item ``--enable-coverage'' set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries) @@ -321,17 +338,18 @@ @section SIGPIPE @cindex signals -MHD does not install a signal handler for SIGPIPE. On platforms -where this is possible (such as GNU/Linux), it disables SIGPIPE for -its I/O operations (by passing MSG_NOSIGNAL). On other platforms, -SIGPIPE signals may be generated from network operations by -MHD and will cause the process to die unless the developer -explicitly installs a signal handler for SIGPIPE. +MHD does not install a signal handler for SIGPIPE. On platforms where +this is possible (such as GNU/Linux), it disables SIGPIPE for its I/O +operations (by passing MSG_NOSIGNAL or similar). On other platforms, +SIGPIPE signals may be generated from network operations by MHD and +will cause the process to die unless the developer explicitly installs +a signal handler for SIGPIPE. Hence portable code using MHD must install a SIGPIPE handler or -explicitly block the SIGPIPE signal. MHD does not do so in order -to avoid messing with other parts of the application that may -need to handle SIGPIPE in a particular way. You can make your application handle SIGPIPE by calling the following function in @code{main}: +explicitly block the SIGPIPE signal. MHD does not do so in order to +avoid messing with other parts of the application that may need to +handle SIGPIPE in a particular way. You can make your application +handle SIGPIPE by calling the following function in @code{main}: @verbatim static void @@ -422,40 +440,43 @@ @deftp {Enumeration} MHD_FLAG Options for the MHD daemon. -Note that if neither @code{MHD_USE_THREAD_PER_CONNECTION} nor -@code{MHD_USE_SELECT_INTERNALLY} is used, the client wants control over -the process and will call the appropriate microhttpd callbacks. +Note that MHD will run automatically in background thread(s) only if +@code{MHD_USE_INTERNAL_POLLING_THREAD} is used. Otherwise caller +(application) must use @code{MHD_run} or @code{MHD_run_from_select} to +have MHD processed network connections and data. Starting the daemon may also fail if a particular option is not -implemented or not supported on the target platform (i.e. no support for -@acronym{SSL}, threads or IPv6). SSL support generally depends on -options given during MHD compilation. Threaded operations -(including @code{MHD_USE_SELECT_INTERNALLY}) are not supported on -Symbian. +implemented or not supported on the target platform (i.e. no support +for @acronym{TLS}, threads or IPv6). TLS support generally depends on +options given during MHD compilation. Threaded operations (including +@code{MHD_USE_INTERNAL_POLLING_THREAD}) are not supported on Symbian. @table @code @item MHD_NO_FLAG No options selected. +@item MHD_USE_ERROR_LOG +If this flag is used, the library should print error messages and +warnings to stderr (or to custom error printer if it's specified by +options). Note that for this run-time option to have any effect, MHD +needs to be compiled with messages enabled. This is done by default +except you ran configure with the @code{--disable-messages} flag set. + @item MHD_USE_DEBUG @cindex debugging -Run in debug mode. If this flag is used, the library should print error -messages and warnings to stderr. Note that for this -run-time option to have any effect, MHD needs to be -compiled with messages enabled. This is done by default except you ran -configure with the @code{--disable-messages} flag set. +Currently the same as @code{MHD_USE_ERROR_LOG}. -@item MHD_USE_SSL +@item MHD_USE_TLS @cindex TLS @cindex SSL -Run in HTTPS-mode. If you specify @code{MHD_USE_SSL} and MHD was +Run in HTTPS-mode. If you specify @code{MHD_USE_TLS} and MHD was compiled without SSL support, @code{MHD_start_daemon} will return NULL. @item MHD_USE_THREAD_PER_CONNECTION Run using one thread per connection. -@item MHD_USE_SELECT_INTERNALLY +@item MHD_USE_INTERNAL_POLLING_THREAD Run using an internal thread doing @code{SELECT}. @item MHD_USE_IPv6 @@ -475,7 +496,9 @@ (the 'struct sockaddr_in6' format will be used for IPv4 and IPv6). @item MHD_USE_PEDANTIC_CHECKS -Be pedantic about the protocol (as opposed to as tolerant as possible). +@cindex deprecated +Deprecated (use @code{MHD_OPTION_STRICT_FOR_CLIENT}). +Be pedantic about the protocol. Specifically, at the moment, this flag causes MHD to reject HTTP 1.1 connections without a @code{Host} header. This is required by the standard, but of course in violation of the ``be as liberal as possible @@ -489,28 +512,43 @@ @cindex select Use @code{poll()} instead of @code{select()}. This allows sockets with descriptors @code{>= FD_SETSIZE}. This option currently only works in -conjunction with @code{MHD_USE_THREAD_PER_CONNECTION} or -@code{MHD_USE_INTERNAL_SELECT} (at this point). If you specify -@code{MHD_USE_POLL} and the local platform does not support it, -@code{MHD_start_daemon} will return NULL. +conjunction with @code{MHD_USE_INTERNAL_POLLING_THREAD} (at this point). +If you specify @code{MHD_USE_POLL} and the local platform does not +support it, @code{MHD_start_daemon} will return NULL. -@item MHD_USE_EPOLL_LINUX_ONLY +@item MHD_USE_EPOLL @cindex FD_SETSIZE @cindex epoll @cindex select Use @code{epoll()} instead of @code{poll()} or @code{select()}. This allows sockets with descriptors @code{>= FD_SETSIZE}. This option is -only available on Linux systems and does not work in conjunction with +only available on some systems and does not work in conjunction with @code{MHD_USE_THREAD_PER_CONNECTION} (at this point). If you specify -@code{MHD_USE_EPOLL_LINUX_ONLY} and the local platform does not -support it, @code{MHD_start_daemon} will return NULL. Using -@code{epoll()} instead of @code{select()} or @code{poll()} can in some -situations result in significantly higher performance as the system -call has fundamentally lower complexity (O(1) for @code{epoll()} -vs. O(n) for @code{select()}/@code{poll()} where n is the number of -open connections). +@code{MHD_USE_EPOLL} and the local platform does not support it, +@code{MHD_start_daemon} will return NULL. Using @code{epoll()} +instead of @code{select()} or @code{poll()} can in some situations +result in significantly higher performance as the system call has +fundamentally lower complexity (O(1) for @code{epoll()} vs. O(n) for +@code{select()}/@code{poll()} where n is the number of open +connections). + +@item MHD_USE_TURBO +@cindex performance +Enable optimizations to aggressively improve performance. -@item MHD_SUPPRESS_DATE_NO_CLOCK +Currently, the optimizations this option enables are based on +opportunistic reads and writes. Bascially, MHD will simply try to +read or write or accept on a socket before checking that the socket is +ready for IO using the event loop mechanism. As the sockets are +non-blocking, this may fail (at a loss of performance), but generally +MHD does this in situations where the operation is likely to succeed, +in which case performance is improved. Setting the flag should generally +be safe (even though the code is slightly more experimental). You may +want to benchmark your application to see if this makes any difference +for you. + + +@item MHD_USE_SUPPRESS_DATE_NO_CLOCK @cindex date @cindex clock @cindex embedded systems @@ -530,11 +568,12 @@ with using a thread pool; if it is used, @code{MHD_OPTION_THREAD_POOL_SIZE} is ignored. -@item MHD_USE_PIPE_FOR_SHUTDOWN + +@item MHD_USE_ITC @cindex quiesce -Force MHD to use a signal pipe to notify the event loop (of threads) -of our shutdown. This is required if an appliction uses -@code{MHD_USE_INTERNAL_SELECT} or @code{MHD_USE_THREAD_PER_CONNECTION} +Force MHD to use a signal inter-thread communication channel to notify +the event loop (of threads) of our shutdown and other events. This is +required if an application uses @code{MHD_USE_INTERNAL_POLLING_THREAD} and then performs @code{MHD_quiesce_daemon} (which eliminates our ability to signal termination via the listen socket). In these modes, @code{MHD_quiesce_daemon} will fail if this option was not set. Also, @@ -546,11 +585,11 @@ @code{shutdown()} on the listen socket, which means a parent process can continue to use the socket. -@item MHD_USE_SUSPEND_RESUME +@item MHD_ALLOW_SUSPEND_RESUME Enables using @code{MHD_suspend_connection} and @code{MHD_resume_connection}, as performing these calls requires some -additional pipes to be created, and code not using these calls should -not pay the cost. +additional inter-thred communication channels to be created, and code +not using these calls should not pay the cost. @item MHD_USE_TCP_FASTOPEN @cindex listen @@ -558,6 +597,22 @@ supported on Linux >= 3.6. On other systems using this option with cause @code{MHD_start_daemon} to fail. + +@item MHD_ALLOW_UPGRADE +@cindex upgrade +This option must be set if you want to upgrade connections +(via ``101 Switching Protocols'' responses). This requires MHD to +allocate additional resources, and hence we require this +special flag so we only use the resources that are really needed. + + +@item MHD_USE_AUTO +Automatically select best event loop style (polling function) +depending on requested mode by other MHD flags and functions available +on platform. If application doesn't have requirements for any +specific polling function, it's recommended to use this flag. This +flag is very convenient for multiplatform applications. + @end table @end deftp @@ -597,6 +652,15 @@ four for @code{stdin}, @code{stdout}, @code{stderr} and the server socket). In other words, the default is as large as possible. +If the connection limit is reached, MHD's behavior depends a bit on +other options. If @code{MHD_USE_ITC} was given, MHD +will stop accepting connections on the listen socket. This will cause +the operating system to queue connections (up to the @code{listen()} +limit) above the connection limit. Those connections will be held +until MHD is done processing at least one of the active connections. +If @code{MHD_USE_ITC} is not set, then MHD will continue +to @code{accept()} and immediately @code{close()} these connections. + Note that if you set a low connection limit, you can easily get into trouble with browsers doing request pipelining. For example, if your connection limit is ``1'', a browser may open a first connection to @@ -666,6 +730,31 @@ zero, which means no limit on the number of connections from the same IP address. +@item MHD_OPTION_LISTEN_BACKLOG_SIZE +Set the size of the @code{listen()} back log queue of the TCP socket. +Takes an @code{unsigned int} as the argument. Default is the +platform-specific value of @code{SOMAXCONN}. + +@item MHD_OPTION_STRICT_FOR_CLIENT +Specify how strict we should enforce the HTTP protocol. +Takes an @code{int} as the argument. Default is zero. + +If set to 1, MHD will be strict about the protocol. Specifically, at +the moment, this flag uses MHD to reject HTTP 1.1 connections without +a "Host" header. This is required by the standard, but of course in +violation of the "be as liberal as possible in what you accept" norm. +It is recommended to set this to 1 if you are testing clients against +MHD, and 0 in production. + +If set to -1 MHD will be permissive about the protocol, allowing +slight deviations that are technically not allowed by the +RFC. Specifically, at the moment, this flag causes MHD to allow spaces +in header field names. This is disallowed by the standard. + +It is not recommended to set it to -1 on publicly available servers as +it may potentially lower level of protection. + + @item MHD_OPTION_SOCK_ADDR @cindex bind, restricting bind Bind daemon to the supplied socket address. This option should be followed by a @@ -833,7 +922,7 @@ be passed as the "arg" argument to "fun". Note that MHD will not generate any log messages without -the MHD_USE_DEBUG flag set and if MHD was compiled +the MHD_USE_ERROR_LOG flag set and if MHD was compiled with the "--disable-messages" flag. @item MHD_OPTION_THREAD_POOL_SIZE @@ -841,7 +930,7 @@ Number (unsigned int) of threads in thread pool. Enable thread pooling by setting this value to to something greater than 1. Currently, thread model must be -MHD_USE_SELECT_INTERNALLY if thread pooling is enabled +MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled (@code{MHD_start_daemon} returns @code{NULL} for an unsupported thread model). @@ -931,9 +1020,8 @@ platforms, and @code{SO_REUSEADDR} on Windows). If a false (zero) parameter is given, disallow reusing the the address:port of the listening socket (this usually requires no special action, but @code{SO_EXCLUSIVEADDRUSE} is needed on -Windows). If this option is not present, default behaviour is undefined -(currently, @code{SO_REUSEADDR} is used on all platforms, which disallows -address:port reusing with the exception of Windows). +Windows). If this option is not present @code{SO_REUSEADDR} is used on all +platforms except Windows so reusing of address:port is disallowed. @end table @end deftp @@ -959,9 +1047,6 @@ the HTTP protocol. @table @code -@item MHD_RESPONSE_HEADER_KIND -Response header. - @item MHD_HEADER_KIND HTTP header. @@ -1494,7 +1579,7 @@ HTTP client, or if you are building a proxy. If you use this API in conjunction with a internal select or a thread -pool, you must set the option @code{MHD_USE_PIPE_FOR_SHUTDOWN} to +pool, you must set the option @code{MHD_USE_ITC} to ensure that the freshly added connection is immediately processed by MHD. @@ -1534,6 +1619,15 @@ connections is scanned and their file descriptors added to the correct set. +When calling this function, FD_SETSIZE is assumed to be platform's +default. If you changed FD_SETSIZE for your application, +you should use @code{MHD_get_fdset2()} instead. + +This function should only be called in when MHD is configured to use +external select with @code{select()} or with @code{epoll()}. In +the latter case, it will only add the single @code{epoll()} file +descriptor used by MHD to the sets. + After the call completed successfully: the variable referenced by @var{max_fd} references the file descriptor with highest integer identifier. The variable must be set to zero before invoking this @@ -1545,6 +1639,11 @@ @end deftypefun +@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize) +Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application. +@end deftypefun + + @deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) @cindex timeout Obtain timeout value for select for this daemon (only needed if @@ -1554,7 +1653,7 @@ @code{MHD_USE_THREAD_PER_CONNECTION} mode is in use (since then it is not meaningful to ask for a timeout, after all, there is concurrenct activity). The function must also not be called by user-code if -@code{MHD_USE_INTERNAL_SELECT} is in use. In the latter case, the +@code{MHD_USE_INTERNAL_POLLING_THREAD} is in use. In the latter case, the behavior is undefined. @table @var @@ -1578,7 +1677,9 @@ @deftypefun int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls) -Get all the headers matching @var{kind} from the request. +Get all the headers matching @var{kind} from the request. The @var{kind} +argument can be a bitmask, ORing the various header kinds that are +requested. The @var{iterator} callback is invoked once for each header, with @var{iterator_cls} as first argument. After version 0.9.19, the @@ -1604,7 +1705,7 @@ @end deftypefun -@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char * key, const char * value) +@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) This function can be used to append an entry to the list of HTTP headers of a connection (so that the @code{MHD_get_connection_values function} will return @@ -1676,6 +1777,7 @@ * microhttpd-response headers:: Adding headers to a response. * microhttpd-response options:: Setting response options. * microhttpd-response inspect:: Inspecting a response object. +* microhttpd-response upgrade:: Creating a response for protocol upgrades. @end menu @c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -2026,6 +2128,100 @@ @end deftypefun +@c ------------------------------------------------------------ +@node microhttpd-response upgrade +@section Creating a response for protocol upgrades +@cindex WebSockets +@cindex Upgrade +@cindex HTTP2 +@cindex RFC2817 + +With RFC 2817 a mechanism to switch protocols within HTTP was +introduced. Here, a client sends a request with a ``Connection: +Upgrade'' header. The server responds with a ``101 Switching +Protocols'' response header, after which the two parties begin to +speak a different (non-HTTP) protocol over the TCP connection. + +This mechanism is used for upgrading HTTP 1.1 connections to HTTP2 or +HTTPS, as well as for implementing WebSockets. Which protocol +upgrade is performed is negotiated between server and client in +additional headers, in particular the ``Upgrade'' header. + +MHD supports switching protocols using this mechanism only if the +@code{MHD_ALLOW_SUSPEND_RESUME} flag has been set when starting +the daemon. If this flag has been set, applications can upgrade +a connection by queueing a response (using the +@code{MHD_HTTP_SWITCHING_PROTOCOLS} status code) which must +have been created with the following function: + + +@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) +Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}. + +When creating this type of response, the ``Connection: Upgrade'' +header will be set automatically for you. MHD requires that you +additionally set an ``Upgrade:'' header. The ``Upgrade'' header +must simply exist, the specific value is completely up to the +application. + +@end deftypefun + +The @code{upgrade_handler} argument to the above has the following type: + + +@deftypefn {Function Pointer} void {*MHD_UpgradeHandler} (void *cls, struct MHD_Connection *connection, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh) +This function will be called once MHD has transmitted the header of the response to the connection that is being upgraded. At this point, the application is expected to take over the socket @code{sock} and speak the non-HTTP protocol to which the connection was upgraded. MHD will no longer use the socket; this includes handling timeouts. The application must call @code{MHD_upgrade_action} with an upgrade action of @code{MHD_UPGRADE_ACTION_CLOSE} when it is done processing the connection to close the socket. The application must not call @code{MHD_stop_daemon} on the respective daemon as long as it is still handling the connection. The arguments given to the @code{upgrade_handler} have the following meaning: + +@table @var +@item cls +matches the @code{upgrade_handler_cls} that was given to @code{MHD_create_response_for_upgrade} +@item connection +identifies the connection that is being upgraded; + +@item con_cls +last value left in `*con_cls` in the `MHD_AccessHandlerCallback` + +@item extra_in +buffer of bytes MHD read ``by accident'' from the socket already. This can happen if the client eagerly transmits more than just the HTTP request. The application should treat these as if it had read them from the socket. + +@item extra_in_size +number of bytes in @code{extra_in} + +@item sock +the socket which the application can now use directly for some bi-directional communication with the client. The application can henceforth use @code{recv()} and @code{send()} or @code{read()} and @code{write()} system calls on the socket. However, @code{ioctl()} and @code{setsockopt()} functions will not work as expected when using HTTPS. Such operations may be supported in the future via @code{MHD_upgrade_action}. Most importantly, the application must never call @code{close()} on this socket. Closing the socket must be done using @code{MHD_upgrade_action}. However, while close is forbidden, the application may call @code{shutdown()} on the socket. + +@item urh +argument for calls to @code{MHD_upgrade_action}. Applications must eventually use this function to perform the @code{close()} action on the socket. +@end table + +@end deftypefn + +@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) +Perform special operations related to upgraded connections. + +@table @var +@item urh +identifies the upgraded connection to perform an action on + +@item action +specifies the action to perform; further arguments to the function depend on the specifics of the action. +@end table + +@end deftypefun + + +@deftp {Enumeration} MHD_UpgradeAction +Set of actions to be performed on upgraded connections. Passed as an argument to +@code{MHD_upgrade_action()}. + +@table @code +@item MHD_UPGRADE_ACTION_CLOSE +Closes the connection. Must be called once the application is done with the client. Takes no additional arguments. + +@end table +@end deftp + + @c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @c ------------------------------------------------------------ @@ -2055,7 +2251,7 @@ thread-per-connection!) for a while. If you use this API in conjunction with a internal select or a -thread pool, you must set the option @code{MHD_USE_SUSPEND_RESUME} to +thread pool, you must set the option @code{MHD_ALLOW_SUSPEND_RESUME} to ensure that a resumed connection is immediately processed by MHD. Suspended connections continue to count against the total number of @@ -2088,6 +2284,16 @@ on a connection that was not previously suspended will result in undefined behavior. +If you are using this function in ``external'' select mode, you must +make sure to run @code{MHD_run} afterwards (before again calling +@code{MHD_get_fdset}), as otherwise the change may not be reflected in +the set returned by @code{MHD_get_fdset} and you may end up with a +connection that is stuck until the next network activity. + +You can check whether a connection is currently suspended using +@code{MHD_get_connection_info} by querying for +@code{MHD_CONNECTION_INFO_CONNECTION_SUSPENDED}. + @table @var @item connection the connection to resume @@ -2501,13 +2707,13 @@ is actually being used by MHD. No extra arguments should be passed. -@item MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY +@item MHD_DAEMON_INFO_EPOLL_FD @cindex epoll Request the file-descriptor number that MHD is using for epoll. If the build is not supporting epoll, NULL is returned; if we are using a thread pool or this daemon was not started with -@code{MHD_USE_EPOLL_LINUX_ONLY}, (a pointer to) -1 is returned. If we are -using @code{MHD_USE_SELECT_INTERNALLY} or are in 'external' select mode, the +@code{MHD_USE_EPOLL}, (a pointer to) -1 is returned. If we are +using @code{MHD_USE_INTERNAL_POLLING_THREAD} or are in 'external' select mode, the internal epoll FD is returned. This function must be used in external select mode with epoll to obtain the FD to call epoll on. No extra arguments should be passed. @@ -2565,26 +2771,33 @@ @item MHD_CONNECTION_INFO_CIPHER_ALGO What cipher algorithm is being used (HTTPS connections only). -Takes no extra arguments. @code{NULL} is returned for non-HTTPS connections. +Takes no extra arguments. + @item MHD_CONNECTION_INFO_PROTOCOL, -Takes no extra arguments. Allows finding out the TLS/SSL protocol used +Allows finding out the TLS/SSL protocol used (HTTPS connections only). @code{NULL} is returned for non-HTTPS connections. +Takes no extra arguments. + @item MHD_CONNECTION_INFO_CLIENT_ADDRESS Returns information about the address of the client. Returns essentially a @code{struct sockaddr **} (since the API returns a @code{union MHD_ConnectionInfo *} and that union contains a @code{struct sockaddr *}). +Takes no extra arguments. + @item MHD_CONNECTION_INFO_GNUTLS_SESSION, Takes no extra arguments. Allows access to the underlying GNUtls session, including access to the underlying GNUtls client certificate (HTTPS connections only). Takes no extra arguments. @code{NULL} is returned for non-HTTPS connections. +Takes no extra arguments. + @item MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT, Dysfunctional (never implemented, deprecated). Use MHD_CONNECTION_INFO_GNUTLS_SESSION to get the @code{gnutls_session_t} @@ -2594,6 +2807,8 @@ Returns information about @code{struct MHD_Daemon} which manages this connection. +Takes no extra arguments. + @item MHD_CONNECTION_INFO_CONNECTION_FD Returns the file descriptor (usually a TCP socket) associated with this connection (in the ``connect-fd'' member of the returned struct). @@ -2606,6 +2821,15 @@ callbacks are invoked in between, those might be used to set different values for TCP-CORK and TCP-NODELAY in the meantime. +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CONNECTION_SUSPENDED +Returns pointer to an integer that is @code{MHD_YES} if the connection +is currently suspended (and thus can be safely resumed) and +@code{MHD_NO} otherwise. + +Takes no extra arguments. + @item MHD_CONNECTION_INFO_SOCKET_CONTEXT Returns the client-specific pointer to a @code{void *} that was (possibly) set during a @code{MHD_NotifyConnectionCallback} when the @@ -2614,6 +2838,25 @@ @code{con_cls} is fresh for each HTTP request, while the @code{socket_context} is fresh for each socket. +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CONNECTION_TIMEOUT +Returns pointer to an @code{unsigned int} that is the current timeout +used for the connection (in seconds, 0 for no timeout). Note that +while suspended connections will not timeout, the timeout value +returned for suspended connections will be the timeout that the +connection will use after it is resumed, and thus might not be zero. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE +@cindex performance +Returns pointer to an @code{size_t} that represents the size of the +HTTP header received from the client. Only valid after the first callback +to the access handler. + +Takes no extra arguments. + @end table @end deftp @@ -2714,13 +2957,13 @@ @item MHD_FEATURE_EPOLL Get whether @code{epoll()} is supported. If supported then Flags -MHD_USE_EPOLL_LINUX_ONLY and -MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used. +MHD_USE_EPOLL and +MHD_USE_EPOLL_INTERNAL_THREAD can be used. @item MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET Get whether shutdown on listen socket to signal other threads is supported. If not supported flag -MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced. +MHD_USE_ITC is automatically forced. @item MHD_FEATURE_SOCKETPAIR Get whether a @code{socketpair()} is used internally instead of diff -Nru libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd-tutorial.info libmicrohttpd-0.9.55/doc/libmicrohttpd-tutorial.info --- libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd-tutorial.info 2015-01-01 22:00:05.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/libmicrohttpd-tutorial.info 2017-05-28 22:34:00.000000000 +0200 @@ -1,24 +1,22 @@ -This is libmicrohttpd-tutorial.info, produced by makeinfo version 4.13 +This is libmicrohttpd-tutorial.info, produced by makeinfo version 6.3 from libmicrohttpd-tutorial.texi. -INFO-DIR-SECTION Software libraries -START-INFO-DIR-ENTRY -* libmicrohttpdtutorial: (libmicrohttpd). A tutorial for GNU libmicrohttpd. -END-INFO-DIR-ENTRY +This tutorial documents GNU libmicrohttpd version 0.9.48, last updated 2 +April 2016. - This tutorial documents GNU libmicrohttpd version 0.9.23, last -updated 17 November 2013. - - Copyright (c) 2008 Sebastian Gerhardt. - - Copyright (c) 2010, 2011, 2012, 2013 Christian Grothoff. + Copyright (c) 2008 Sebastian Gerhardt. + Copyright (c) 2010, 2011, 2012, 2013, 2016 Christian Grothoff. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". +INFO-DIR-SECTION Software libraries +START-INFO-DIR-ENTRY +* libmicrohttpdtutorial: (libmicrohttpd). A tutorial for GNU libmicrohttpd. +END-INFO-DIR-ENTRY  File: libmicrohttpd-tutorial.info, Node: Top, Next: Introduction, Up: (dir) @@ -26,13 +24,12 @@ A Tutorial for GNU libmicrohttpd ******************************** -This tutorial documents GNU libmicrohttpd version 0.9.23, last updated -17 November 2013. - - Copyright (c) 2008 Sebastian Gerhardt. +This tutorial documents GNU libmicrohttpd version 0.9.48, last updated 2 +April 2016. - Copyright (c) 2010, 2011, 2012, 2013 Christian Grothoff. + Copyright (c) 2008 Sebastian Gerhardt. + Copyright (c) 2010, 2011, 2012, 2013, 2016 Christian Grothoff. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software @@ -63,9 +60,9 @@ This tutorial is for developers who want to learn how they can add HTTP serving capabilities to their applications with the _GNU libmicrohttpd_ -library, abbreviated _MHD_. The reader will learn how to implement -basic HTTP functions from simple executable sample programs that -implement various features. +library, abbreviated _MHD_. The reader will learn how to implement basic +HTTP functions from simple executable sample programs that implement +various features. The text is supposed to be a supplement to the API reference manual of _GNU libmicrohttpd_ and for that reason does not explain many of the @@ -75,10 +72,10 @@ which document the HTTP standard. _GNU libmicrohttpd_ is assumed to be already installed. This -tutorial is written for version 0.9.23. At the time being, this +tutorial is written for version 0.9.48. At the time being, this tutorial has only been tested on _GNU/Linux_ machines even though -efforts were made not to rely on anything that would prevent the -samples from being built on similar systems. +efforts were made not to rely on anything that would prevent the samples +from being built on similar systems. 1.1 History =========== @@ -94,21 +91,21 @@ *********************** The most basic task for a HTTP server is to deliver a static text -message to any client connecting to it. Given that this is also easy -to implement, it is an excellent problem to start with. +message to any client connecting to it. Given that this is also easy to +implement, it is an excellent problem to start with. For now, the particular URI the client asks for shall have no effect -on the message that will be returned. In addition, the server shall end +on the message that will be returned. In addition, the server shall end the connection after the message has been sent so that the client will know there is nothing more to expect. - The C program `hellobrowser.c', which is to be found in the examples + The C program 'hellobrowser.c', which is to be found in the examples section, does just that. If you are very eager, you can compile and -start it right away but it is advisable to type the lines in by -yourself as they will be discussed and explained in detail. +start it right away but it is advisable to type the lines in by yourself +as they will be discussed and explained in detail. - After the necessary includes and the definition of the port which -our server should listen on + After the necessary includes and the definition of the port which our +server should listen on #include #include #include @@ -116,25 +113,26 @@ #define PORT 8888 + the desired behaviour of our server when HTTP request arrive has to be -implemented. We already have agreed that it should not care about the -particular details of the request, such as who is requesting what. The +implemented. We already have agreed that it should not care about the +particular details of the request, such as who is requesting what. The server will respond merely with the same small HTML page to every request. The function we are going to write now will be called by _GNU -libmicrohttpd_ every time an appropriate request comes in. While the +libmicrohttpd_ every time an appropriate request comes in. While the name of this callback function is arbitrary, its parameter list has to -follow a certain layout. So please, ignore the lot of parameters for -now, they will be explained at the point they are needed. We have to -use only one of them, `struct MHD_Connection *connection', for the +follow a certain layout. So please, ignore the lot of parameters for +now, they will be explained at the point they are needed. We have to +use only one of them, 'struct MHD_Connection *connection', for the minimalistic functionality we want to archive at the moment. This parameter is set by the _libmicrohttpd_ daemon and holds the necessary information to relate the call with a certain connection. Keep in mind that a server might have to satisfy hundreds of concurrent connections and we have to make sure that the correct data is sent to -the destined client. Therefore, this variable is a means to refer to a +the destined client. Therefore, this variable is a means to refer to a particular connection if we ask the daemon to sent the reply. Talking about the reply, it is defined as a string right after the @@ -147,17 +145,18 @@ { const char *page = "Hello, browser!"; -HTTP is a rather strict protocol and the client would certainly -consider it "inappropriate" if we just sent the answer string "as is". -Instead, it has to be wrapped with additional information stored in -so-called headers and footers. Most of the work in this area is done -by the library for us--we just have to ask. Our reply string packed in -the necessary layers will be called a "response". To obtain such a -response we hand our data (the reply-string) and its size over to the -`MHD_create_response_from_buffer' function. The last two parameters + +HTTP is a rather strict protocol and the client would certainly consider +it "inappropriate" if we just sent the answer string "as is". Instead, +it has to be wrapped with additional information stored in so-called +headers and footers. Most of the work in this area is done by the +library for us--we just have to ask. Our reply string packed in the +necessary layers will be called a "response". To obtain such a response +we hand our data (the reply-string) and its size over to the +'MHD_create_response_from_buffer' function. The last two parameters basically tell _MHD_ that we do not want it to dispose the message data -for us when it has been sent and there also needs no internal copy to -be done because the _constant_ string won't change anyway. +for us when it has been sent and there also needs no internal copy to be +done because the _constant_ string won't change anyway. struct MHD_Response *response; int ret; @@ -165,18 +164,19 @@ response = MHD_create_response_from_buffer (strlen (page), (void*) page, MHD_RESPMEM_PERSISTENT); + Now that the the response has been laced up, it is ready for delivery and can be queued for sending. This is done by passing it to another -_GNU libmicrohttpd_ function. As all our work was done in the scope of +_GNU libmicrohttpd_ function. As all our work was done in the scope of one function, the recipient is without doubt the one associated with the -local variable `connection' and consequently this variable is given to +local variable 'connection' and consequently this variable is given to the queue function. Every HTTP response is accompanied by a status code, here "OK", so that the client knows this response is the intended result of his request and not due to some error or malfunction. Finally, the packet is destroyed and the return value from the queue -returned, already being set at this point to either MHD_YES or MHD_NO -in case of success or failure. +returned, already being set at this point to either MHD_YES or MHD_NO in +case of success or failure. ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); @@ -184,9 +184,10 @@ return ret; } -With the primary task of our server implemented, we can start the -actual server daemon which will listen on `PORT' for connections. This -is done in the main function. + +With the primary task of our server implemented, we can start the actual +server daemon which will listen on 'PORT' for connections. This is done +in the main function. int main () { struct MHD_Daemon *daemon; @@ -195,46 +196,48 @@ &answer_to_connection, NULL, MHD_OPTION_END); if (NULL == daemon) return 1; -The first parameter is one of three possible modes of operation. Here + +The first parameter is one of three possible modes of operation. Here we want the daemon to run in a separate thread and to manage all -incoming connections in the same thread. This means that while -producing the response for one connection, the other connections will -be put on hold. In this example, where the reply is already known and +incoming connections in the same thread. This means that while +producing the response for one connection, the other connections will be +put on hold. In this example, where the reply is already known and therefore the request is served quickly, this poses no problem. We will allow all clients to connect regardless of their name or -location, therefore we do not check them on connection and set the -forth and fifth parameter to NULL. +location, therefore we do not check them on connection and set the third +and fourth parameter to NULL. - Parameter six is the address of the function we want to be called -whenever a new connection has been established. Our -`answer_to_connection' knows best what the client wants and needs no -additional information (which could be passed via the next parameter) -so the next parameter is NULL. Likewise, we do not need to pass extra -options to the daemon so we just write the MHD_OPTION_END as the last -parameter. + Parameter five is the address of the function we want to be called +whenever a new connection has been established. Our +'answer_to_connection' knows best what the client wants and needs no +additional information (which could be passed via the next parameter) so +the next (sixth) parameter is NULL. Likewise, we do not need to pass +extra options to the daemon so we just write the MHD_OPTION_END as the +last parameter. As the server daemon runs in the background in its own thread, the execution flow in our main function will contine right after the call. Because of this, we must delay the execution flow in the main thread or -else the program will terminate prematurely. We let it pause in a +else the program will terminate prematurely. We let it pause in a processing-time friendly manner by waiting for the enter key to be -pressed. In the end, we stop the daemon so it can do its cleanup tasks. +pressed. In the end, we stop the daemon so it can do its cleanup tasks. getchar (); MHD_stop_daemon (daemon); return 0; } + The first example is now complete. Compile it with cc hellobrowser.c -o hellobrowser -I$PATH_TO_LIBMHD_INCLUDES -L$PATH_TO_LIBMHD_LIBS -lmicrohttpd - with the two paths set accordingly and run it. + with the two paths set accordingly and run it. Now open your favorite Internet browser and go to the address -`http://localhost:8888/', provided that 8888 is the port you chose. If +'http://localhost:8888/', provided that 8888 is the port you chose. If everything works as expected, the browser will present the message of the static HTML page it got from our minimal server. @@ -244,85 +247,87 @@ To keep this first example as small as possible, some drastic shortcuts were taken and are to be discussed now. - Firstly, there is no distinction made between the kinds of requests -a client could send. We implied that the client sends a GET request, -that means, that he actually asked for some data. Even when it is not + Firstly, there is no distinction made between the kinds of requests a +client could send. We implied that the client sends a GET request, that +means, that he actually asked for some data. Even when it is not intended to accept POST requests, a good server should at least recognize that this request does not constitute a legal request and -answer with an error code. This can be easily implemented by checking -if the parameter `method' equals the string "GET" and returning a -`MHD_NO' if not so. +answer with an error code. This can be easily implemented by checking +if the parameter 'method' equals the string "GET" and returning a +'MHD_NO' if not so. Secondly, the above practice of queuing a response upon the first call of the callback function brings with it some limitations. This is because the content of the message body will not be received if a response is queued in the first iteration. Furthermore, the connection -will be closed right after the response has been transferred then. -This is typically not what you want as it disables HTTP pipelining. -The correct approach is to simply not queue a message on the first -callback unless there is an error. The `void**' argument to the -callback provides a location for storing information about the history -of the connection; for the first call, the pointer will point to NULL. -A simplistic way to differenciate the first call from others is to check +will be closed right after the response has been transferred then. This +is typically not what you want as it disables HTTP pipelining. The +correct approach is to simply not queue a message on the first callback +unless there is an error. The 'void**' argument to the callback +provides a location for storing information about the history of the +connection; for the first call, the pointer will point to NULL. A +simplistic way to differenciate the first call from others is to check if the pointer is NULL and set it to a non-NULL value during the first call. Both of these issues you will find addressed in the official -`minimal_example.c' residing in the `src/examples' directory of the +'minimal_example.c' residing in the 'src/examples' directory of the _MHD_ package. The source code of this program should look very familiar to you by now and easy to understand. - For our example, the `must_copy' and `must_free' parameter at the -response construction function could be set to `MHD_NO'. In the usual -case, responses cannot be sent immediately after being queued. For -example, there might be other data on the system that needs to be sent -with a higher priority. Nevertheless, the queue function will return -successfully--raising the problem that the data we have pointed to may -be invalid by the time it is about being sent. This is not an issue -here because we can expect the `page' string, which is a constant -_string literal_ here, to be static. That means it will be present and -unchanged for as long as the program runs. For dynamic data, one could -choose to either have _MHD_ free the memory `page' points to itself -when it is not longer needed or, alternatively, have the library to -make and manage its own copy of it. + For our example, we create the response from a static (persistent) +buffer in memory and thus pass 'MHD_RESPMEM_PERSISTENT' to the response +construction function. In the usual case, responses are not transmitted +immediately after being queued. For example, there might be other data +on the system that needs to be sent with a higher priority. +Nevertheless, the queue function will return successfully--raising the +problem that the data we have pointed to may be invalid by the time it +is about being sent. This is not an issue here because we can expect +the 'page' string, which is a constant _string literal_ here, to be +static. That means it will be present and unchanged for as long as the +program runs. For dynamic data, one could choose to either have _MHD_ +free the memory 'page' points to itself when it is not longer needed (by +passing 'MHD_RESPMEM_MUST_FREE') or, alternatively, have the library to +make and manage its own copy of it (by passing 'MHD_RESPMEM_MUST_COPY'). +Naturally, this last option is the most expensive. Exercises ========= - * While the server is running, use a program like `telnet' or - `netcat' to connect to it. Try to form a valid HTTP 1.1 request - yourself like GET /dontcare HTTP/1.1 + * While the server is running, use a program like 'telnet' or + 'netcat' to connect to it. Try to form a valid HTTP 1.1 request + yourself like + GET /dontcare HTTP/1.1 Host: itsme - and see what the server returns to you. + and see what the server returns to you. * Also, try other requests, like POST, and see how our server does not mind and why. How far in malforming a request can you go - before the builtin functionality of _MHD_ intervenes and an - altered response is sent? Make sure you read about the status - codes in the _RFC_. - - * Add the option `MHD_USE_PEDANTIC_CHECKS' to the start function of - the daemon in `main'. Mind the special format of the parameter - list here which is described in the manual. How indulgent is the + before the builtin functionality of _MHD_ intervenes and an altered + response is sent? Make sure you read about the status codes in the + _RFC_. + + * Add the option 'MHD_USE_PEDANTIC_CHECKS' to the start function of + the daemon in 'main'. Mind the special format of the parameter + list here which is described in the manual. How indulgent is the server now to your input? * Let the main function take a string as the first command line - argument and pass `argv[1]' to the `MHD_start_daemon' function as - the sixth parameter. The address of this string will be passed to - the callback function via the `cls' variable. Decorate the text + argument and pass 'argv[1]' to the 'MHD_start_daemon' function as + the sixth parameter. The address of this string will be passed to + the callback function via the 'cls' variable. Decorate the text given at the command line when the server is started with proper HTML tags and send it as the response instead of the former static string. * _Demanding:_ Write a separate function returning a string - containing some useful information, for example, the time. Pass + containing some useful information, for example, the time. Pass the function's address as the sixth parameter and evaluate this - function on every request anew in `answer_to_connection'. Remember + function on every request anew in 'answer_to_connection'. Remember to free the memory of the string every time after satisfying the request. -  File: libmicrohttpd-tutorial.info, Node: Exploring requests, Next: Response headers, Prev: Hello browser example, Up: Top @@ -330,8 +335,8 @@ ******************** This chapter will deal with the information which the client sends to -the server at every request. We are going to examine the most useful -fields of such an request and print them out in a readable manner. This +the server at every request. We are going to examine the most useful +fields of such an request and print them out in a readable manner. This could be useful for logging facilities. The starting point is the _hellobrowser_ program with the former @@ -339,7 +344,7 @@ This time, we just want to collect information in the callback function, thus we will just return MHD_NO after we have probed the -request. This way, the connection is closed without much ado by the +request. This way, the connection is closed without much ado by the server. static int @@ -352,22 +357,23 @@ ... return MHD_NO; } - The ellipsis marks the position where the following instructions shall +The ellipsis marks the position where the following instructions shall be inserted. We begin with the most obvious information available to the server, -the request line. You should already have noted that a request consists -of a command (or "HTTP method") and a URI (e.g. a filename). It also +the request line. You should already have noted that a request consists +of a command (or "HTTP method") and a URI (e.g. a filename). It also contains a string for the version of the protocol which can be found in -`version'. To call it a "new request" is justified because we return -only `MHD_NO', thus ensuring the function will not be called again for +'version'. To call it a "new request" is justified because we return +only 'MHD_NO', thus ensuring the function will not be called again for this connection. printf ("New %s request for %s using version %s\n", method, url, version); - The rest of the information is a bit more hidden. Nevertheless, there -is lot of it sent from common Internet browsers. It is stored in + + The rest of the information is a bit more hidden. Nevertheless, +there is lot of it sent from common Internet browsers. It is stored in "key-value" pairs and we want to list what we find in the header. As there is no mandatory set of keys a client has to send, each key-value -pair is printed out one by one until there are no more left. We do this +pair is printed out one by one until there are no more left. We do this by writing a separate function which will be called for each pair just like the above function is called for each HTTP request. It can then print out the content of this pair. @@ -377,20 +383,21 @@ printf ("%s: %s\n", key, value); return MHD_YES; } - To start the iteration process that calls our new function for every + + To start the iteration process that calls our new function for every key, the line MHD_get_connection_values (connection, MHD_HEADER_KIND, &print_out_key, NULL); - needs to be inserted in the connection callback function too. The +needs to be inserted in the connection callback function too. The second parameter tells the function that we are only interested in keys -from the general HTTP header of the request. Our iterating function -`print_out_key' does not rely on any additional information to fulfill +from the general HTTP header of the request. Our iterating function +'print_out_key' does not rely on any additional information to fulfill its duties so the last parameter can be NULL. - All in all, this constitutes the complete `logging.c' program for -this chapter which can be found in the `examples' section. + All in all, this constitutes the complete 'logging.c' program for +this chapter which can be found in the 'examples' section. - Connecting with any modern Internet browser should yield a handful -of keys. You should try to interpret them with the aid of _RFC 2616_. + Connecting with any modern Internet browser should yield a handful of +keys. You should try to interpret them with the aid of _RFC 2616_. Especially worth mentioning is the "Host" key which is often used to serve several different websites hosted under one single IP address but reachable by different domain names (this is called virtual hosting). @@ -400,8 +407,8 @@ The introduced capabilities to itemize the content of a simple GET request--especially the URI--should already allow the server to satisfy -clients' requests for small specific resources (e.g. files) or even -induce alteration of server state. However, the latter is not +clients' requests for small specific resources (e.g. files) or even +induce alteration of server state. However, the latter is not recommended as the GET method (including its header data) is by convention considered a "safe" operation, which should not change the server's state in a significant way. By convention, GET operations can @@ -409,34 +416,33 @@ actions like searching for a passed string are fine. Of course, no transmission can occur while the return value is still -set to `MHD_NO' in the callback function. +set to 'MHD_NO' in the callback function. Exercises ========= - * By parsing the `url' string and delivering responses accordingly, - implement a small server for "virtual" files. When asked for - `/index.htm{l}', let the response consist of a HTML page - containing a link to `/another.html' page which is also to be - created "on the fly" in case of being requested. If neither of - these two pages are requested, `MHD_HTTP_NOT_FOUND' shall be - returned accompanied by an informative message. + * By parsing the 'url' string and delivering responses accordingly, + implement a small server for "virtual" files. When asked for + '/index.htm{l}', let the response consist of a HTML page containing + a link to '/another.html' page which is also to be created "on the + fly" in case of being requested. If neither of these two pages are + requested, 'MHD_HTTP_NOT_FOUND' shall be returned accompanied by an + informative message. * A very interesting information has still been ignored by our - logger--the client's IP address. Implement a callback function static int on_client_connect (void *cls, + logger--the client's IP address. Implement a callback function + static int on_client_connect (void *cls, const struct sockaddr *addr, socklen_t addrlen) - that prints out the IP address in an appropriate format. You - might want to use the POSIX function `inet_ntoa' but bear in mind - that `addr' is actually just a structure containing other - substructures and is _not_ the variable this function expects. - Make sure to return `MHD_YES' so that the library knows the client - is allowed to connect (and to then process the request). If one - wanted to limit access basing on IP addresses, this would be the - place to do it. The address of your `on_client_connect' function - must be passed as the third parameter to the `MHD_start_daemon' - call. - + that prints out the IP address in an appropriate format. You might + want to use the POSIX function 'inet_ntoa' but bear in mind that + 'addr' is actually just a structure containing other substructures + and is _not_ the variable this function expects. Make sure to + return 'MHD_YES' so that the library knows the client is allowed to + connect (and to then process the request). If one wanted to limit + access basing on IP addresses, this would be the place to do it. + The address of your 'on_client_connect' function must be passed as + the third parameter to the 'MHD_start_daemon' call.  File: libmicrohttpd-tutorial.info, Node: Response headers, Next: Supporting basic authentication, Prev: Exploring requests, Up: Top @@ -450,24 +456,23 @@ As you have learned in the _Hello, Browser_ chapter, some obligatory header fields are added and set automatically for simple responses by -the library itself but if more advanced features are desired, -additional fields have to be created. One of the possible fields is -the content type field and an example will be developed around it. -This will lead to an application capable of correctly serving different -types of files. +the library itself but if more advanced features are desired, additional +fields have to be created. One of the possible fields is the content +type field and an example will be developed around it. This will lead +to an application capable of correctly serving different types of files. When we responded with HTML page packed in the static string previously, the client had no choice but guessing about how to handle the response, because the server had not told him. What if we had sent a picture or a sound file? Would the message have been understood or merely been displayed as an endless stream of random characters in the -browser? This is what the mime content types are for. The header of -the response is extended by certain information about how the data is -to be interpreted. +browser? This is what the mime content types are for. The header of +the response is extended by certain information about how the data is to +be interpreted. To introduce the concept, a picture of the format _PNG_ will be sent -to the client and labeled accordingly with `image/png'. Once again, we -can base the new example on the `hellobrowser' program. +to the client and labeled accordingly with 'image/png'. Once again, we +can base the new example on the 'hellobrowser' program. #define FILENAME "picture.png" #define MIMETYPE "image/png" @@ -481,7 +486,8 @@ { unsigned char *buffer = NULL; struct MHD_Response *response; - We want the program to open the file for reading and determine its + + We want the program to open the file for reading and determine its size: int fd; int ret; @@ -496,9 +502,10 @@ /* ... (see below) */ } /* ... (see below) */ - When dealing with files, there is a lot that could go wrong on the + + When dealing with files, there is a lot that could go wrong on the server side and if so, the client should be informed with -`MHD_HTTP_INTERNAL_SERVER_ERROR'. +'MHD_HTTP_INTERNAL_SERVER_ERROR'. /* error accessing file */ if (fd != -1) close (fd); @@ -541,7 +548,8 @@ } else return MHD_NO; } - Note that we nevertheless have to create a response object even for + + Note that we nevertheless have to create a response object even for sending a simple error code. Otherwise, the connection would just be closed without comment, leaving the client curious about what has happened. @@ -558,14 +566,15 @@ MHD_add_response_header (response, "Content-Type", MIMETYPE); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); - Note that the response object will take care of closing the file + + Note that the response object will take care of closing the file desciptor for us. - Up to this point, there was little new. The actual novelty is that -we enhance the header with the meta data about the content. Aware of + Up to this point, there was little new. The actual novelty is that +we enhance the header with the meta data about the content. Aware of the field's name we want to add, it is as easy as that: MHD_add_response_header(response, "Content-Type", MIMETYPE); - We do not have to append a colon expected by the protocol behind the +We do not have to append a colon expected by the protocol behind the first field--_GNU libhttpdmicro_ will take care of this. The function finishes with the well-known lines @@ -573,21 +582,22 @@ MHD_destroy_response (response); return ret; } - The complete program `responseheaders.c' is in the `examples' section + + The complete program 'responseheaders.c' is in the 'examples' section as usual. Find a _PNG_ file you like and save it to the directory the -example is run from under the name `picture.png'. You should find the +example is run from under the name 'picture.png'. You should find the image displayed on your browser if everything worked well. Remarks ======= The include file of the _MHD_ library comes with the header types -mentioned in _RFC 2616_ already defined as macros. Thus, we could have -written `MHD_HTTP_HEADER_CONTENT_TYPE' instead of `"Content-Type"' as -well. However, one is not limited to these standard headers and could -add custom response headers without violating the protocol. Whether, +mentioned in _RFC 2616_ already defined as macros. Thus, we could have +written 'MHD_HTTP_HEADER_CONTENT_TYPE' instead of '"Content-Type"' as +well. However, one is not limited to these standard headers and could +add custom response headers without violating the protocol. Whether, and how, the client would react to these custom header is up to the -receiver. Likewise, the client is allowed to send custom request +receiver. Likewise, the client is allowed to send custom request headers to the server as well, opening up yet more possibilities how client and server could communicate with each other. @@ -600,11 +610,11 @@ * Remember that the original program was written under a few assumptions--a static response using a local file being one of - them. In order to simulate a very large or hard to reach file that + them. In order to simulate a very large or hard to reach file that cannot be provided instantly, postpone the queuing in the callback - with the `sleep' function for 30 seconds _if_ the file `/big.png' - is requested (but deliver the same as above). A request for - `/picture.png' should provide just the same but without any + with the 'sleep' function for 30 seconds _if_ the file '/big.png' + is requested (but deliver the same as above). A request for + '/picture.png' should provide just the same but without any artificial delays. Now start two instances of your browser (or even use two machines) @@ -612,30 +622,29 @@ for his request on the slow file to be fulfilled. Finally, change the sourcecode to use - `MHD_USE_THREAD_PER_CONNECTION' when the daemon is started and try + 'MHD_USE_THREAD_PER_CONNECTION' when the daemon is started and try again. - * Did you succeed in implementing the clock exercise yet? This time, - let the server save the program's start time `t' and implement a - response simulating a countdown that reaches 0 at `t+60'. + * Did you succeed in implementing the clock exercise yet? This time, + let the server save the program's start time 't' and implement a + response simulating a countdown that reaches 0 at 't+60'. Returning a message saying on which point the countdown is, the response should ultimately be to reply "Done" if the program has been running long enough, An unofficial, but widely understood, response header line is - `Refresh: DELAY; url=URL' with the uppercase words substituted to + 'Refresh: DELAY; url=URL' with the uppercase words substituted to tell the client it should request the given resource after the - given delay again. Improve your program in that the browser (any + given delay again. Improve your program in that the browser (any modern browser should work) automatically reconnects and asks for - the status again every 5 seconds or so. The URL would have to be + the status again every 5 seconds or so. The URL would have to be composed so that it begins with "http://", followed by the _URI_ the server is reachable from the client's point of view. Maybe you want also to visualize the countdown as a status bar by - creating a `' consisting of one row and `n' columns whose + creating a '
' consisting of one row and 'n' columns whose fields contain small images of either a red or a green light. -  File: libmicrohttpd-tutorial.info, Node: Supporting basic authentication, Next: Processing POST data, Prev: Response headers, Up: Top @@ -649,19 +658,20 @@ A very simple approach feasible with the means already discussed would be to expect the password in the _URI_ string before granting -access to the secured areas. The password could be separated from the -actual resource identifier by a certain character, thus the request -line might look like +access to the secured areas. The password could be separated from the +actual resource identifier by a certain character, thus the request line +might look like GET /picture.png?mypassword - In the rare situation where the client is customized enough and the + + In the rare situation where the client is customized enough and the connection occurs through secured lines (e.g., a embedded device -directly attached to another via wire) and where the ability to embedd -a password in the URI or to pass on a URI with a password are desired, +directly attached to another via wire) and where the ability to embedd a +password in the URI or to pass on a URI with a password are desired, this can be a reasonable choice. But when it is assumed that the user connecting does so with an ordinary Internet browser, this implementation brings some problems -about. For example, the URI including the password stays in the address +about. For example, the URI including the password stays in the address field or at least in the history of the browser for anybody near enough to see. It will also be inconvenient to add the password manually to any new URI when the browser does not know how to compose this @@ -669,28 +679,27 @@ At least the convenience issue can be addressed by employing the simplest built-in password facilities of HTTP compliant browsers, hence -we want to start there. It will however turn out to have still severe +we want to start there. It will however turn out to have still severe weaknesses in terms of security which need consideration. - Before we will start implementing _Basic Authentication_ as -described in _RFC 2617_, we should finally abandon the bad practice of -responding every request the first time our callback is called for a -given connection. This is becoming more important now because the -client and the server will have to talk in a more bi-directional way -than before to + Before we will start implementing _Basic Authentication_ as described +in _RFC 2617_, we should finally abandon the bad practice of responding +every request the first time our callback is called for a given +connection. This is becoming more important now because the client and +the server will have to talk in a more bi-directional way than before to But how can we tell whether the callback has been called before for the particular connection? Initially, the pointer this parameter -references is set by _MHD_ in the callback. But it will also be +references is set by _MHD_ in the callback. But it will also be "remembered" on the next call (for the same connection). Thus, we will generate no response until the parameter is non-null--implying the -callback was called before at least once. We do not need to share +callback was called before at least once. We do not need to share information between different calls of the callback, so we can set the -parameter to any adress that is assured to be not null. The pointer to -the `connection' structure will be pointing to a legal address, so we +parameter to any adress that is assured to be not null. The pointer to +the 'connection' structure will be pointing to a legal address, so we take this. - The first time `answer_to_connection' is called, we will not even + The first time 'answer_to_connection' is called, we will not even look at the headers. static int @@ -706,8 +715,9 @@ /* else respond accordingly */ ... } - Note how we lop off the connection on the first condition (no "GET" -request), but return asking for more on the other one with `MHD_YES'. + + Note how we lop off the connection on the first condition (no "GET" +request), but return asking for more on the other one with 'MHD_YES'. With this minor change, we can proceed to implement the actual authentication process. @@ -719,11 +729,11 @@ challenged. _RFC 2617_ describes how the server shall ask for authentication by adding a _WWW-Authenticate_ response header with the name of the _realm_ protected. MHD can generate and queue such a -failure response for you using the `MHD_queue_basic_auth_fail_response' -API. The only thing you need to do is construct a response with the +failure response for you using the 'MHD_queue_basic_auth_fail_response' +API. The only thing you need to do is construct a response with the error page to be shown to the user if he aborts basic authentication. But first, you should check if the proper credentials were already -supplied using the `MHD_basic_auth_get_username_password' call. +supplied using the 'MHD_basic_auth_get_username_password' call. Your code would then look like this: static int @@ -773,44 +783,43 @@ return ret; } - See the `examples' directory for the complete example file. + See the 'examples' directory for the complete example file. Remarks ======= For a proper server, the conditional statements leading to a return of -`MHD_NO' should yield a response with a more precise status code -instead of silently closing the connection. For example, failures of -memory allocation are best reported as _internal server error_ and -unexpected authentication methods as _400 bad request_. +'MHD_NO' should yield a response with a more precise status code instead +of silently closing the connection. For example, failures of memory +allocation are best reported as _internal server error_ and unexpected +authentication methods as _400 bad request_. Exercises ========= * Make the server respond to wrong credentials (but otherwise well-formed requests) with the recommended _401 unauthorized_ - status code. If the client still does not authenticate correctly + status code. If the client still does not authenticate correctly within the same connection, close it and store the client's IP - address for a certain time. (It is OK to check for expiration not - until the main thread wakes up again on the next connection.) If - the client fails authenticating three times during this period, - add it to another list for which the `AcceptPolicyCallback' - function denies connection (temporally). - - * With the network utility `netcat' connect and log the response of - a "GET" request as you did in the exercise of the first example, - this time to a file. Now stop the server and let _netcat_ listen - on the same port the server used to listen on and have it fake - being the proper server by giving the file's content as the - response (e.g. `cat log | nc -l -p 8888'). Pretending to think - your were connecting to the actual server, browse to the - eavesdropper and give the correct credentials. + address for a certain time. (It is OK to check for expiration not + until the main thread wakes up again on the next connection.) If + the client fails authenticating three times during this period, add + it to another list for which the 'AcceptPolicyCallback' function + denies connection (temporally). + + * With the network utility 'netcat' connect and log the response of a + "GET" request as you did in the exercise of the first example, this + time to a file. Now stop the server and let _netcat_ listen on the + same port the server used to listen on and have it fake being the + proper server by giving the file's content as the response (e.g. + 'cat log | nc -l -p 8888'). Pretending to think your were + connecting to the actual server, browse to the eavesdropper and + give the correct credentials. - Copy and paste the encoded string you see in `netcat''s output to + Copy and paste the encoded string you see in 'netcat''s output to some of the Base64 decode tools available online and see how both the user's name and password could be completely restored. -  File: libmicrohttpd-tutorial.info, Node: Processing POST data, Next: Improved processing of POST data, Prev: Supporting basic authentication, Up: Top @@ -820,17 +829,16 @@ The previous chapters already have demonstrated a variety of possibilities to send information to the HTTP server, but it is not recommended that the _GET_ method is used to alter the way the server -operates. To induce changes on the server, the _POST_ method is +operates. To induce changes on the server, the _POST_ method is preferred over and is much more powerful than _GET_ and will be introduced in this chapter. - We are going to write an application that asks for the visitor's -name and, after the user has posted it, composes an individual response -text. Even though it was not mandatory to use the _POST_ method here, -as there is no permanent change caused by the POST, it is an -illustrative example on how to share data between different functions -for the same connection. Furthermore, the reader should be able to -extend it easily. + We are going to write an application that asks for the visitor's name +and, after the user has posted it, composes an individual response text. +Even though it was not mandatory to use the _POST_ method here, as there +is no permanent change caused by the POST, it is an illustrative example +on how to share data between different functions for the same +connection. Furthermore, the reader should be able to extend it easily. GET request =========== @@ -844,8 +852,9 @@ \ "; - The `action' entry is the _URI_ to be called by the browser when -posting, and the `name' will be used later to be sure it is the + + The 'action' entry is the _URI_ to be called by the browser when +posting, and the 'name' will be used later to be sure it is the editbox's content that has been posted. We also prepare the answer page, where the name is to be filled in @@ -855,7 +864,8 @@ const char* greatingpage="

Welcome, %s!

"; const char* errorpage="This doesn't seem to be right."; - Whenever we need to send a page, we use an extra function `int + + Whenever we need to send a page, we use an extra function 'int send_page(struct MHD_Connection *connection, const char* page)' for this, which does not contain anything new and whose implementation is therefore not discussed further in the tutorial. @@ -863,22 +873,22 @@ POST request ============ -Posted data can be of arbitrary and considerable size; for example, if -a user uploads a big image to the server. Similar to the case of the +Posted data can be of arbitrary and considerable size; for example, if a +user uploads a big image to the server. Similar to the case of the header fields, there may also be different streams of posted data, such as one containing the text of an editbox and another the state of a -button. Likewise, we will have to register an iterator function that -is going to be called maybe several times not only if there are -different POSTs but also if one POST has only been received partly yet -and needs processing before another chunk can be received. +button. Likewise, we will have to register an iterator function that is +going to be called maybe several times not only if there are different +POSTs but also if one POST has only been received partly yet and needs +processing before another chunk can be received. Such an iterator function is called by a _postprocessor_, which must be created upon arriving of the post request. We want the iterator -function to read the first post data which is tagged `name' and to +function to read the first post data which is tagged 'name' and to create an individual greeting string based on the template and the name. -But in order to pass this string to other functions and still be able -to differentiate different connections, we must first define a -structure to share the information, holding the most import entries. +But in order to pass this string to other functions and still be able to +differentiate different connections, we must first define a structure to +share the information, holding the most import entries. struct connection_info_struct { @@ -886,13 +896,14 @@ char *answerstring; struct MHD_PostProcessor *postprocessor; }; - With these information available to the iterator function, it is able + + With these information available to the iterator function, it is able to fulfill its task. Once it has composed the greeting string, it -returns `MHD_NO' to inform the post processor that it does not need to -be called again. Note that this function does not handle processing of -data for the same `key'. If we were to expect that the name will be -posted in several chunks, we had to expand the namestring dynamically -as additional parts of it with the same `key' came in. But in this +returns 'MHD_NO' to inform the post processor that it does not need to +be called again. Note that this function does not handle processing of +data for the same 'key'. If we were to expect that the name will be +posted in several chunks, we had to expand the namestring dynamically as +additional parts of it with the same 'key' came in. But in this example, the name is assumed to fit entirely inside one single packet. static int @@ -921,11 +932,12 @@ return MHD_YES; } - Once a connection has been established, it can be terminated for many -reasons. As these reasons include unexpected events, we have to + + Once a connection has been established, it can be terminated for many +reasons. As these reasons include unexpected events, we have to register another function that cleans up any resources that might have been allocated for that connection by us, namely the post processor and -the greetings string. This cleanup function must take into account that +the greetings string. This cleanup function must take into account that it will also be called for finished requests other than _POST_ requests. void request_completed (void *cls, struct MHD_Connection *connection, @@ -944,7 +956,8 @@ free (con_info); *con_cls = NULL; } - _GNU libmicrohttpd_ is informed that it shall call the above function + + _GNU libmicrohttpd_ is informed that it shall call the above function when the daemon is started in the main function. ... @@ -957,11 +970,11 @@ Request handling ================ -With all other functions prepared, we can now discuss the actual -request handling. +With all other functions prepared, we can now discuss the actual request +handling. On the first iteration for a new request, we start by allocating a -new instance of a `struct connection_info_struct' structure, which will +new instance of a 'struct connection_info_struct' structure, which will store all necessary information for later iterations and other functions. @@ -979,8 +992,9 @@ con_info = malloc (sizeof (struct connection_info_struct)); if (NULL == con_info) return MHD_NO; con_info->answerstring = NULL; - If the new request is a _POST_, the postprocessor must be created now. -In addition, the type of the request is stored for convenience. + + If the new request is a _POST_, the postprocessor must be created +now. In addition, the type of the request is stored for convenience. if (0 == strcmp (method, "POST")) { con_info->postprocessor @@ -995,21 +1009,24 @@ con_info->connectiontype = POST; } else con_info->connectiontype = GET; - The address of our structure will both serve as the indicator for + + The address of our structure will both serve as the indicator for successive iterations and to remember the particular details about the connection. *con_cls = (void*) con_info; return MHD_YES; } - The rest of the function will not be executed on the first iteration. + + The rest of the function will not be executed on the first iteration. A _GET_ request is easily satisfied by sending the question form. if (0 == strcmp (method, "GET")) { return send_page (connection, askpage); } - In case of _POST_, we invoke the post processor for as long as data -keeps incoming, setting `*upload_data_size' to zero in order to -indicate that we have processed--or at least have considered--all of it. + + In case of _POST_, we invoke the post processor for as long as data +keeps incoming, setting '*upload_data_size' to zero in order to indicate +that we have processed--or at least have considered--all of it. if (0 == strcmp (method, "POST")) { struct connection_info_struct *con_info = *con_cls; @@ -1025,11 +1042,13 @@ else if (NULL != con_info->answerstring) return send_page (connection, con_info->answerstring); } - Finally, if they are neither _GET_ nor _POST_ requests, the error page -is returned. + + Finally, if they are neither _GET_ nor _POST_ requests, the error +page is returned. return send_page(connection, errorpage); } - These were the important parts of the program `simplepost.c'. + + These were the important parts of the program 'simplepost.c'.  File: libmicrohttpd-tutorial.info, Node: Improved processing of POST data, Next: Session management, Prev: Processing POST data, Up: Top @@ -1039,28 +1058,30 @@ The previous chapter introduced a way to upload data to the server, but the developed example program has some shortcomings, such as not being -able to handle larger chunks of data. In this chapter, we are going to +able to handle larger chunks of data. In this chapter, we are going to discuss a more advanced server program that allows clients to upload a -file in order to have it stored on the server's filesystem. The server -shall also watch and limit the number of clients concurrently -uploading, responding with a proper busy message if necessary. +file in order to have it stored on the server's filesystem. The server +shall also watch and limit the number of clients concurrently uploading, +responding with a proper busy message if necessary. Prepared answers ================ -We choose to operate the server with the `SELECT_INTERNALLY' method. +We choose to operate the server with the 'SELECT_INTERNALLY' method. This makes it easier to synchronize the global states at the cost of possible delays for other connections if the processing of a request is -too slow. One of these variables that needs to be shared for all +too slow. One of these variables that needs to be shared for all connections is the total number of clients that are uploading. #define MAXCLIENTS 2 static unsigned int nr_of_uploading_clients = 0; - If there are too many clients uploading, we want the server to respond -to all requests with a busy message. + + If there are too many clients uploading, we want the server to +respond to all requests with a busy message. const char* busypage = "This server is busy, please try again later."; - Otherwise, the server will send a _form_ that informs the user of the + + Otherwise, the server will send a _form_ that informs the user of the current number of uploading clients, and ask her to pick a file on her local filesystem which is to be uploaded. const char* askpage = "\n\ @@ -1071,18 +1092,21 @@ \n\ \n\ "; - If the upload has succeeded, the server will respond with a message + + If the upload has succeeded, the server will respond with a message saying so. const char* completepage = "The upload has been completed."; - We want the server to report internal errors, such as memory shortage + + We want the server to report internal errors, such as memory shortage or file access problems, adequately. const char* servererrorpage = "An internal server error has occured."; const char* fileexistspage = "This file already exists."; - It would be tolerable to send all these responses undifferentiated -with a `200 HTTP_OK' status code but in order to improve the `HTTP' -conformance of our server a bit, we extend the `send_page' function so + + It would be tolerable to send all these responses undifferentiated +with a '200 HTTP_OK' status code but in order to improve the 'HTTP' +conformance of our server a bit, we extend the 'send_page' function so that it accepts individual status codes. static int @@ -1101,16 +1125,17 @@ return ret; } - Note how we ask _MHD_ to make its own copy of the message data. The + + Note how we ask _MHD_ to make its own copy of the message data. The reason behind this will become clear later. Connection cycle ================ The decision whether the server is busy or not is made right at the -beginning of the connection. To do that at this stage is especially +beginning of the connection. To do that at this stage is especially important for _POST_ requests because if no response is queued at this -point, and `MHD_YES' returned, _MHD_ will not sent any queued messages +point, and 'MHD_YES' returned, _MHD_ will not sent any queued messages until a postprocessor has been created and the post iterator is called at least once. @@ -1127,7 +1152,8 @@ if (nr_of_uploading_clients >= MAXCLIENTS) return send_page(connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE); - If the server is not busy, the `connection_info' structure is + + If the server is not busy, the 'connection_info' structure is initialized as usual, with the addition of a filepointer for each connection. @@ -1145,13 +1171,14 @@ return MHD_YES; } - For _POST_ requests, the postprocessor is created and we register a -new uploading client. From this point on, there are many possible + + For _POST_ requests, the postprocessor is created and we register a +new uploading client. From this point on, there are many possible places for errors to occur that make it necessary to interrupt the -uploading process. We need a means of having the proper response -message ready at all times. Therefore, the `connection_info' structure -is extended to hold the most current response message so that whenever -a response is sent, the client will get the most informative message. +uploading process. We need a means of having the proper response +message ready at all times. Therefore, the 'connection_info' structure +is extended to hold the most current response message so that whenever a +response is sent, the client will get the most informative message. Here, the structure is initialized to "no error". if (0 == strcmp (method, "POST")) { @@ -1172,10 +1199,11 @@ con_info->answerstring = completepage; } else con_info->connectiontype = GET; - If the connection handler is called for the second time, _GET_ -requests will be answered with the _form_. We can keep the buffer under -function scope, because we asked _MHD_ to make its own copy of it for -as long as it is needed. + + If the connection handler is called for the second time, _GET_ +requests will be answered with the _form_. We can keep the buffer under +function scope, because we asked _MHD_ to make its own copy of it for as +long as it is needed. if (0 == strcmp (method, "GET")) { int ret; @@ -1184,9 +1212,10 @@ sprintf (buffer, askpage, nr_of_uploading_clients); return send_page (connection, buffer, MHD_HTTP_OK); } - The rest of the `answer_to_connection' function is very similar to the -`simplepost.c' example, except the more flexible content of the -responses. The _POST_ data is processed until there is none left and + + The rest of the 'answer_to_connection' function is very similar to +the 'simplepost.c' example, except the more flexible content of the +responses. The _POST_ data is processed until there is none left and the execution falls through to return an error page if the connection constituted no expected request method. if (0 == strcmp (method, "POST")) @@ -1212,11 +1241,11 @@ Storing to data =============== -Unlike the `simplepost.c' example, here it is to be expected that post -iterator will be called several times now. This means that for any +Unlike the 'simplepost.c' example, here it is to be expected that post +iterator will be called several times now. This means that for any given connection (there might be several concurrent of them) the posted -data has to be written to the correct file. That is why we store a file -handle in every `connection_info', so that the it is preserved between +data has to be written to the correct file. That is why we store a file +handle in every 'connection_info', so that the it is preserved between successive iterations. static int iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, @@ -1226,19 +1255,22 @@ uint64_t off, size_t size) { struct connection_info_struct *con_info = coninfo_cls; - Because the following actions depend heavily on correct file -processing, which might be error prone, we default to reporting -internal errors in case anything will go wrong. + + Because the following actions depend heavily on correct file +processing, which might be error prone, we default to reporting internal +errors in case anything will go wrong. con_info->answerstring = servererrorpage; con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; - In the "askpage" _form_, we told the client to label its post data -with the "file" key. Anything else would be an error. + + In the "askpage" _form_, we told the client to label its post data +with the "file" key. Anything else would be an error. if (0 != strcmp (key, "file")) return MHD_NO; - If the iterator is called for the first time, no file will have been -opened yet. The `filename' string contains the name of the file -(without any paths) the user selected on his system. We want to take + + If the iterator is called for the first time, no file will have been +opened yet. The 'filename' string contains the name of the file +(without any paths) the user selected on his system. We want to take this as the name the file will be stored on the server and make sure no file of that name exists (or is being uploaded) before we create one (note that the code below technically contains a race between the two @@ -1256,23 +1288,26 @@ con_info->fp = fopen (filename, "ab"); if (!con_info->fp) return MHD_NO; } - Occasionally, the iterator function will be called even when there are -0 new bytes to process. The server only needs to write data to the file -if there is some. + + Occasionally, the iterator function will be called even when there +are 0 new bytes to process. The server only needs to write data to the +file if there is some. if (size > 0) { if (!fwrite (data, size, sizeof(char), con_info->fp)) return MHD_NO; } - If this point has been reached, everything worked well for this -iteration and the response can be set to success again. If the upload + + If this point has been reached, everything worked well for this +iteration and the response can be set to success again. If the upload has finished, this iterator function will not be called again. con_info->answerstring = completepage; con_info->answercode = MHD_HTTP_OK; return MHD_YES; } - The new client was registered when the postprocessor was created. + + The new client was registered when the postprocessor was created. Likewise, we unregister the client on destroying the postprocessor when the request is completed. void request_completed (void *cls, struct MHD_Connection *connection, @@ -1297,13 +1332,14 @@ free (con_info); *con_cls = NULL; } - This is essentially the whole example `largepost.c'. + + This is essentially the whole example 'largepost.c'. Remarks ======= Now that the clients are able to create files on the server, security -aspects are becoming even more important than before. Aside from proper +aspects are becoming even more important than before. Aside from proper client authentication, the server should always make sure explicitly that no files will be created outside of a dedicated upload directory. In particular, filenames must be checked to not contain strings like @@ -1324,8 +1360,8 @@ In order to track users, we use a simple session cookie. A session cookie expires when the user closes the browser. Changing from session -cookies to persistent cookies only requires adding an expiration time -to the cookie. The server creates a fresh session cookie whenever a +cookies to persistent cookies only requires adding an expiration time to +the cookie. The server creates a fresh session cookie whenever a request without a cookie is received, or if the supplied session cookie is not known to the server. @@ -1335,24 +1371,41 @@ Since MHD parses the HTTP cookie header for us, looking up an existing cookie is straightforward: -FIXME. +const char *value; + +value = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + "KEY"); - Here, FIXME is the name we chose for our session cookie. + Here, "KEY" is the name we chose for our session cookie. Setting the cookie header ========================= MHD requires the user to provide the full cookie format string in order to set cookies. In order to generate a unique cookie, our example -creates a random 64-character text string to be used as the value of -the cookie: +creates a random 64-character text string to be used as the value of the +cookie: -FIXME. +char value[128]; +char raw_value[65]; + +for (unsigned int i=0;i openssl genrsa -out server.key 1024 - In addition to the key, a certificate describing the server in human -readable tokens is also needed. This certificate will be attested with -our aforementioned key. In this way, we obtain a self-signed + + In addition to the key, a certificate describing the server in human +readable tokens is also needed. This certificate will be attested with +our aforementioned key. In this way, we obtain a self-signed certificate, valid for one year. > openssl req -days 365 -out server.pem -new -x509 -key server.key - To avoid unnecessary error messages in the browser, the certificate -needs to have a name that matches the _URI_, for example, "localhost" -or the domain. If you plan to have a publicly reachable server, you -will need to ask a trusted third party, called _Certificate Authority_, -or _CA_, to attest the certificate for you. This way, any visitor can -make sure the server's identity is real. + + To avoid unnecessary error messages in the browser, the certificate +needs to have a name that matches the _URI_, for example, "localhost" or +the domain. If you plan to have a publicly reachable server, you will +need to ask a trusted third party, called _Certificate Authority_, or +_CA_, to attest the certificate for you. This way, any visitor can make +sure the server's identity is real. Whether the server's certificate is signed by us or a third party, once it has been accepted by the client, both sides will be -communicating over encrypted channels. From this point on, it is the -client's turn to authenticate itself. But this has already been +communicating over encrypted channels. From this point on, it is the +client's turn to authenticate itself. But this has already been implemented in the basic authentication scheme. Changing the source code @@ -1454,7 +1509,8 @@ printf ("The key/certificate files could not be read.\n"); return 1; } - and then we point the _MHD_ daemon to it upon initalization. + + and then we point the _MHD_ daemon to it upon initalization. daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, PORT, NULL, NULL, @@ -1472,7 +1528,8 @@ return 1; } - The rest consists of little new besides some additional memory + + The rest consists of little new besides some additional memory cleanups. getchar (); @@ -1483,21 +1540,22 @@ return 0; } - The rather unexciting file loader can be found in the complete example -`tlsauthentication.c'. + + The rather unexciting file loader can be found in the complete +example 'tlsauthentication.c'. Remarks ======= * While the standard _HTTP_ port is 80, it is 443 for _HTTPS_. The common internet browsers assume standard _HTTP_ if they are asked - to access other ports than these. Therefore, you will have to type - `https://localhost:8888' explicitly when you test the example, or + to access other ports than these. Therefore, you will have to type + 'https://localhost:8888' explicitly when you test the example, or the browser will not know how to handle the answer properly. * The remaining weak point is the question how the server will be - trusted initially. Either a _CA_ signs the certificate or the - client obtains the key over secure means. Anyway, the clients have + trusted initially. Either a _CA_ signs the certificate or the + client obtains the key over secure means. Anyway, the clients have to be aware (or configured) that they should not accept certificates of unknown origin. @@ -1506,18 +1564,17 @@ in embedded devices. * The cryptographic facilities consume memory space and computing - time. For this reason, websites usually consists both of + time. For this reason, websites usually consists both of uncritically _HTTP_ parts and secured _HTTPS_. - Client authentication ===================== You can also use MHD to authenticate the client via SSL/TLS certificates (as an alternative to using the password-based Basic or Digest authentication). To do this, you will need to link your application -against _gnutls_. Next, when you start the MHD daemon, you must -specify the root CA that you're willing to trust: +against _gnutls_. Next, when you start the MHD daemon, you must specify +the root CA that you're willing to trust: daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, PORT, NULL, NULL, &answer_to_connection, NULL, @@ -1529,7 +1586,7 @@ With this, you can then obtain client certificates for each session. In order to obtain the identity of the client, you first need to obtain the raw GnuTLS session handle from _MHD_ using -`MHD_get_connection_info'. +'MHD_get_connection_info'. #include #include @@ -1689,7 +1746,7 @@ Using TLS Server Name Indication (SNI) ====================================== -SNI enables hosting multiple domains under one IP address with TLS. So +SNI enables hosting multiple domains under one IP address with TLS. So SNI is the TLS-equivalent of virtual hosting. To use SNI with MHD, you need at least GnuTLS 3.0. The main change compared to the simple hosting of one domain is that you need to provide a callback instead of @@ -1700,37 +1757,38 @@ &answer_to_connection, NULL, MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, MHD_OPTION_END); - Here, `sni_callback' is the name of a function that you will have to + Here, 'sni_callback' is the name of a function that you will have to implement to retrieve the X.509 certificate for an incoming connection. -The callback has type `gnutls_certificate_retrieve_function2' and is +The callback has type 'gnutls_certificate_retrieve_function2' and is documented in the GnuTLS API for the -`gnutls_certificate_set_retrieve_function2' as follows: +'gnutls_certificate_set_retrieve_function2' as follows: -- Function Pointer: int *gnutls_certificate_retrieve_function2 - (gnutls_session_t, const gnutls_datum_t* req_ca_dn, int - nreqs, const gnutls_pk_algorithm_t* pk_algos, int - pk_algos_length, gnutls_pcert_st** pcert, unsigned int - *pcert_length, gnutls_privkey_t * pkey) - REQ_CA_CERT - is only used in X.509 certificates. Contains a list with the - CA names that the server considers trusted. Normally we + (gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, + const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, + gnutls_pcert_st** pcert, unsigned int *pcert_length, + gnutls_privkey_t * pkey) + + REQ_CA_CERT + is only used in X.509 certificates. Contains a list with the + CA names that the server considers trusted. Normally we should send a certificate that is signed by one of these CAs. - These names are DER encoded. To get a more meaningful value - use the function `gnutls_x509_rdn_get()'. + These names are DER encoded. To get a more meaningful value + use the function 'gnutls_x509_rdn_get()'. - PK_ALGOS - contains a list with server’s acceptable signature - algorithms. The certificate returned should support the - server’s given algorithms. + PK_ALGOS + contains a list with server’s acceptable signature algorithms. + The certificate returned should support the server’s given + algorithms. - PCERT + PCERT should contain a single certificate and public or a list of them. - PCERT_LENGTH + PCERT_LENGTH is the size of the previous list. - PKEY + PKEY is the private key. A possible implementation of this callback would look like this: @@ -1793,7 +1851,7 @@ information to this callback, as the GnuTLS API unfortunately does not permit this at this point. - The `hosts' list can be initialized by loading the private keys and + The 'hosts' list can be initialized by loading the private keys and X.509 certificats from disk as follows: static void @@ -1854,7 +1912,7 @@ gnutls_free (data.data); } - The code above was largely lifted from GnuTLS. You can find other + The code above was largely lifted from GnuTLS. You can find other methods for initializing certificates and keys in the GnuTLS manual and source code. @@ -1868,27 +1926,26 @@ ============= * The _GNU libmicrohttpd_ manual by Marco Maggi and Christian - Grothoff 2008 `http://gnunet.org/libmicrohttpd/microhttpd.html' + Grothoff 2008 * All referenced RFCs can be found on the website of _The Internet - Engineering Task Force_ `http://www.ietf.org/' + Engineering Task Force_ * _RFC 2616_: Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and - T. Berners-Lee, "Hypertext Transfer Protocol - HTTP/1.1", RFC - 2016, January 1997. + T. Berners-Lee, "Hypertext Transfer Protocol - HTTP/1.1", RFC 2016, + January 1997. * _RFC 2617_: Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., Leach, P., Luotonen, A., and L. Stewart, "HTTP Authentication: Basic and Digest Access Authentication", RFC 2617, June 1999. * A well-structured _HTML_ reference can be found on - `http://www.echoecho.com/html.htm' + For those readers understanding German or French, there is an excellent document both for learning _HTML_ and for reference, whose English version unfortunately has been discontinued. - `http://de.selfhtml.org/' and `http://fr.selfhtml.org/' - + and  File: libmicrohttpd-tutorial.info, Node: License text, Next: Example programs, Prev: Bibliography, Up: Top @@ -1899,7 +1956,7 @@ Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. - `http://fsf.org/' + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -1924,21 +1981,21 @@ free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. - We recommend this License principally for works whose purpose is + of subject matter or whether it is published as a printed book. We + recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it - can be distributed under the terms of this License. Such a notice + that contains a notice placed by the copyright holder saying it can + be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You - accept the license if you copy, modify or distribute the work in a - way requiring permission under copyright law. + of the public is a licensee, and is addressed as "you". You accept + the license if you copy, modify or distribute the work in a way + requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with @@ -1956,12 +2013,12 @@ regarding them. The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in - the notice that says that the Document is released under this - License. If a section does not fit the above definition of - Secondary then it is not allowed to be designated as Invariant. - The Document may contain zero Invariant Sections. If the Document - does not identify any Invariant Sections then there are none. + titles are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this License. + If a section does not fit the above definition of Secondary then it + is not allowed to be designated as Invariant. The Document may + contain zero Invariant Sections. If the Document does not identify + any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice @@ -1972,27 +2029,27 @@ A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images - composed of pixels) generic paint programs or (for drawings) some - widely available drawing editor, and that is suitable for input to - text formatters or for automatic translation to a variety of - formats suitable for input to text formatters. A copy made in an - otherwise Transparent file format whose markup, or absence of - markup, has been arranged to thwart or discourage subsequent - modification by readers is not Transparent. An image format is - not Transparent if used for any substantial amount of text. A - copy that is not "Transparent" is called "Opaque". + straightforwardly with generic text editors or (for images composed + of pixels) generic paint programs or (for drawings) some widely + available drawing editor, and that is suitable for input to text + formatters or for automatic translation to a variety of formats + suitable for input to text formatters. A copy made in an otherwise + Transparent file format whose markup, or absence of markup, has + been arranged to thwart or discourage subsequent modification by + readers is not Transparent. An image format is not Transparent if + used for any substantial amount of text. A copy that is not + "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and - standard-conforming simple HTML, PostScript or PDF designed for - human modification. Examples of transparent image formats include - PNG, XCF and JPG. Opaque formats include proprietary formats that - can be read and edited only by proprietary word processors, SGML or - XML for which the DTD and/or processing tools are not generally - available, and the machine-generated HTML, PostScript or PDF - produced by some word processors for output purposes only. + SGML or XML using a publicly available DTD, and standard-conforming + simple HTML, PostScript or PDF designed for human modification. + Examples of transparent image formats include PNG, XCF and JPG. + Opaque formats include proprietary formats that can be read and + edited only by proprietary word processors, SGML or XML for which + the DTD and/or processing tools are not generally available, and + the machine-generated HTML, PostScript or PDF produced by some word + processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the @@ -2030,8 +2087,8 @@ may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow - the conditions in section 3. + distribute a large enough number of copies you must also follow the + conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. @@ -2045,12 +2102,11 @@ these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the - title equally prominent and visible. You may add other material - on the covers in addition. Copying with changes limited to the - covers, as long as they preserve the title of the Document and - satisfy these conditions, can be treated as verbatim copying in - other respects. + front cover must present the full title with all words of the title + equally prominent and visible. You may add other material on the + covers in addition. Copying with changes limited to the covers, as + long as they preserve the title of the Document and satisfy these + conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit @@ -2058,40 +2114,39 @@ adjacent pages. If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a - machine-readable Transparent copy along with each Opaque copy, or - state in or with each Opaque copy a computer-network location from - which the general network-using public has access to download - using public-standard network protocols a complete Transparent - copy of the Document, free of added material. If you use the - latter option, you must take reasonably prudent steps, when you - begin distribution of Opaque copies in quantity, to ensure that - this Transparent copy will remain thus accessible at the stated - location until at least one year after the last time you - distribute an Opaque copy (directly or through your agents or - retailers) of that edition to the public. + numbering more than 100, you must either include a machine-readable + Transparent copy along with each Opaque copy, or state in or with + each Opaque copy a computer-network location from which the general + network-using public has access to download using public-standard + network protocols a complete Transparent copy of the Document, free + of added material. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of - copies, to give them a chance to provide you with an updated - version of the Document. + the Document well before redistributing any large number of copies, + to give them a chance to provide you with an updated version of the + Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with - the Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version to - whoever possesses a copy of it. In addition, you must do these - things in the Modified Version: + release the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus licensing + distribution and modification of the Modified Version to whoever + possesses a copy of it. In addition, you must do these things in + the Modified Version: A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of - previous versions (which should, if there were any, be listed - in the History section of the Document). You may use the - same title as a previous version if the original publisher of - that version gives permission. + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that + version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in @@ -2121,31 +2176,30 @@ I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new - authors, and publisher of the Modified Version as given on - the Title Page. If there is no section Entitled "History" in - the Document, create one stating the title, year, authors, - and publisher of the Document as given on its Title Page, - then add an item describing the Modified Version as stated in - the previous sentence. + authors, and publisher of the Modified Version as given on the + Title Page. If there is no section Entitled "History" in the + Document, create one stating the title, year, authors, and + publisher of the Document as given on its Title Page, then add + an item describing the Modified Version as stated in the + previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for - previous versions it was based on. These may be placed in - the "History" section. You may omit a network location for a - work that was published at least four years before the - Document itself, or if the original publisher of the version - it refers to gives permission. + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the - section all the substance and tone of each of the contributor + Preserve the Title of the section, and preserve in the section + all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. - L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section - titles. + L. Preserve all the Invariant Sections of the Document, unaltered + in their text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. @@ -2158,11 +2212,11 @@ If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option - designate some or all of these sections as invariant. To do this, - add their titles to the list of Invariant Sections in the Modified - Version's license notice. These titles must be distinct from any - other section titles. + material copied from the Document, you may at your option designate + some or all of these sections as invariant. To do this, add their + titles to the list of Invariant Sections in the Modified Version's + license notice. These titles must be distinct from any other + section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various @@ -2171,15 +2225,15 @@ definition of a standard. You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end - of the list of Cover Texts in the Modified Version. Only one - passage of Front-Cover Text and one of Back-Cover Text may be - added by (or through arrangements made by) any one entity. If the - Document already includes a cover text for the same cover, - previously added by you or by arrangement made by the same entity - you are acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. + and a passage of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts in the Modified Version. Only one passage + of Front-Cover Text and one of Back-Cover Text may be added by (or + through arrangements made by) any one entity. If the Document + already includes a cover text for the same cover, previously added + by you or by arrangement made by the same entity you are acting on + behalf of, you may not add another; but you may replace the old + one, on explicit permission from the previous publisher that added + the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to @@ -2189,8 +2243,8 @@ You may combine the Document with other documents released under this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination - all of the Invariant Sections of all of the original documents, + modified versions, provided that you include in the combination all + of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. @@ -2217,20 +2271,20 @@ documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. + rules of this License for verbatim copying of each of the documents + in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow - this License in all other respects regarding verbatim copying of - that document. + a copy of this License into the extracted document, and follow this + License in all other respects regarding verbatim copying of that + document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of - a storage or distribution medium, is called an "aggregate" if the + separate and independent documents or works, in or on a volume of a + storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this @@ -2275,8 +2329,8 @@ However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly - and finally terminates your license, and (b) permanently, if the + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. @@ -2288,33 +2342,33 @@ after your receipt of the notice. Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from - you under this License. If your rights have been terminated and - not permanently reinstated, receipt of a copy of some or all of - the same material does not give you any rights to use it. + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, receipt of a copy of some or all of the + same material does not give you any rights to use it. - 10. FUTURE REVISIONS OF THIS LICENSE + 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See - `http://www.gnu.org/copyleft/'. + . Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by the - Free Software Foundation. If the Document specifies that a proxy - can decide which future versions of this License can be used, that + published (not as a draft) by the Free Software Foundation. If the + Document does not specify a version number of this License, you may + choose any version ever published (not as a draft) by the Free + Software Foundation. If the Document specifies that a proxy can + decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. - 11. RELICENSING + 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also @@ -2344,7 +2398,6 @@ site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. - ADDENDUM: How to use this License for your documents ==================================================== @@ -2361,7 +2414,7 @@ Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: +Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts @@ -2372,9 +2425,9 @@ situation. If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, to -permit their use in free software. +recommend releasing these examples in parallel under your choice of free +software license, such as the GNU General Public License, to permit +their use in free software.  File: libmicrohttpd-tutorial.info, Node: Example programs, Prev: License text, Up: Top @@ -2557,12 +2610,12 @@ if ( (-1 == (fd = open (FILENAME, O_RDONLY))) || (0 != fstat (fd, &sbuf)) ) { - /* error accessing file */ - if (fd != -1) - (void) close (fd); const char *errorstr = "An internal server error has occured!\ "; + /* error accessing file */ + if (fd != -1) + (void) close (fd); response = MHD_create_response_from_buffer (strlen (errorstr), (void *) errorstr, @@ -2580,7 +2633,7 @@ return MHD_NO; } response = - MHD_create_response_from_fd_at_offset (sbuf.st_size, fd, 0); + MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0); MHD_add_response_header (response, "Content-Type", MIMETYPE); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); @@ -2717,6 +2770,11 @@ #include #include + #if defined(_MSC_VER) && _MSC_VER+0 <= 1800 + /* Substitution is OK while return value is not used */ + #define snprintf _snprintf + #endif + #define PORT 8888 #define POSTBUFFERSIZE 512 #define MAXNAMESIZE 20 @@ -2735,7 +2793,7 @@ const char *askpage = "\ What's your name, Sir?
\
\ - \ \ "; @@ -2917,18 +2975,32 @@ #include #include + #ifdef _MSC_VER + #ifndef strcasecmp + #define strcasecmp(a,b) _stricmp((a),(b)) + #endif /* !strcasecmp */ + #endif /* _MSC_VER */ + + #if defined(_MSC_VER) && _MSC_VER+0 <= 1800 + /* Substitution is OK while return value is not used */ + #define snprintf _snprintf + #endif + #define PORT 8888 #define POSTBUFFERSIZE 512 #define MAXCLIENTS 2 - #define GET 0 - #define POST 1 + enum ConnectionType + { + GET = 0, + POST = 1 + }; static unsigned int nr_of_uploading_clients = 0; struct connection_info_struct { - int connectiontype; + enum ConnectionType connectiontype; struct MHD_PostProcessor *postprocessor; FILE *fp; const char *answerstring; @@ -2955,22 +3027,30 @@ "An internal server error has occured."; const char *fileexistspage = "This file already exists."; + const char* const postprocerror = + "ErrorError processing POST data"; static int - send_page (struct MHD_Connection *connection, const char *page, + send_page (struct MHD_Connection *connection, + const char *page, int status_code) { int ret; struct MHD_Response *response; response = - MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_create_response_from_buffer (strlen (page), + (void *) page, MHD_RESPMEM_MUST_COPY); if (!response) return MHD_NO; - MHD_add_response_header (response, MHD_HTTP_HEADER_CONTENT_TYPE, "text/html"); - ret = MHD_queue_response (connection, status_code, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); + ret = MHD_queue_response (connection, + status_code, + response); MHD_destroy_response (response); return ret; @@ -2978,9 +3058,14 @@ static int - iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, - const char *filename, const char *content_type, - const char *transfer_encoding, const char *data, uint64_t off, + iterate_post (void *coninfo_cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, size_t size) { struct connection_info_struct *con_info = coninfo_cls; @@ -2992,7 +3077,7 @@ if (0 != strcmp (key, "file")) return MHD_NO; - if (!con_info->fp) + if (! con_info->fp) { if (NULL != (fp = fopen (filename, "rb"))) { @@ -3009,7 +3094,7 @@ if (size > 0) { - if (!fwrite (data, size, sizeof (char), con_info->fp)) + if (! fwrite (data, sizeof (char), size, con_info->fp)) return MHD_NO; } @@ -3021,8 +3106,10 @@ static void - request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, enum MHD_RequestTerminationCode toe) + request_completed (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) { struct connection_info_struct *con_info = *con_cls; @@ -3047,17 +3134,23 @@ static int - answer_to_connection (void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - size_t *upload_data_size, void **con_cls) + answer_to_connection (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) { if (NULL == *con_cls) { struct connection_info_struct *con_info; if (nr_of_uploading_clients >= MAXCLIENTS) - return send_page (connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE); + return send_page (connection, + busypage, + MHD_HTTP_SERVICE_UNAVAILABLE); con_info = malloc (sizeof (struct connection_info_struct)); if (NULL == con_info) @@ -3065,11 +3158,13 @@ con_info->fp = NULL; - if (0 == strcmp (method, "POST")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) { con_info->postprocessor = - MHD_create_post_processor (connection, POSTBUFFERSIZE, - iterate_post, (void *) con_info); + MHD_create_post_processor (connection, + POSTBUFFERSIZE, + &iterate_post, + (void *) con_info); if (NULL == con_info->postprocessor) { @@ -3091,22 +3186,33 @@ return MHD_YES; } - if (0 == strcmp (method, "GET")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) { char buffer[1024]; - snprintf (buffer, sizeof (buffer), askpage, nr_of_uploading_clients); - return send_page (connection, buffer, MHD_HTTP_OK); + snprintf (buffer, + sizeof (buffer), + askpage, + nr_of_uploading_clients); + return send_page (connection, + buffer, + MHD_HTTP_OK); } - if (0 == strcmp (method, "POST")) + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) { struct connection_info_struct *con_info = *con_cls; if (0 != *upload_data_size) { - MHD_post_process (con_info->postprocessor, upload_data, - *upload_data_size); + if (MHD_post_process (con_info->postprocessor, + upload_data, + *upload_data_size) != MHD_YES) + { + return send_page (connection, + postprocerror, + MHD_HTTP_BAD_REQUEST); + } *upload_data_size = 0; return MHD_YES; @@ -3118,14 +3224,18 @@ fclose (con_info->fp); con_info->fp = NULL; } - /* Now it is safe to open and inspect the file before calling send_page with a response */ - return send_page (connection, con_info->answerstring, + /* Now it is safe to open and inspect the file before + calling send_page with a response */ + return send_page (connection, + con_info->answerstring, con_info->answercode); } } - return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST); + return send_page (connection, + errorpage, + MHD_HTTP_BAD_REQUEST); } @@ -3134,10 +3244,11 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, + PORT, NULL, NULL, &answer_to_connection, NULL, - MHD_OPTION_NOTIFY_COMPLETED, request_completed, - NULL, MHD_OPTION_END); + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, + MHD_OPTION_END); if (NULL == daemon) return 1; (void) getchar (); @@ -3794,7 +3905,7 @@ (void *) METHOD_ERROR, MHD_RESPMEM_PERSISTENT); ret = MHD_queue_response (connection, - MHD_HTTP_METHOD_NOT_ACCEPTABLE, + MHD_HTTP_NOT_ACCEPTABLE, response); MHD_destroy_response (response); return ret; @@ -3875,7 +3986,7 @@ fd_set rs; fd_set ws; fd_set es; - int max; + MHD_socket max; MHD_UNSIGNED_LONG_LONG mhd_timeout; if (argc != 2) @@ -4016,6 +4127,7 @@ return 0; } + static char * load_file (const char *filename) { @@ -4024,19 +4136,20 @@ long size; size = get_file_size (filename); - if (size == 0) + if (0 == size) return NULL; fp = fopen (filename, "rb"); - if (!fp) + if (! fp) return NULL; - buffer = malloc (size); - if (!buffer) + buffer = malloc (size + 1); + if (! buffer) { fclose (fp); return NULL; } + buffer[size] = '\0'; if (size != fread (buffer, 1, size, fp)) { @@ -4048,6 +4161,7 @@ return buffer; } + static int ask_for_authentication (struct MHD_Connection *connection, const char *realm) { @@ -4180,7 +4294,7 @@ } daemon = - MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, PORT, NULL, + MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_TLS, PORT, NULL, NULL, &answer_to_connection, NULL, MHD_OPTION_HTTPS_MEM_KEY, key_pem, MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END); @@ -4206,26 +4320,26 @@  Tag Table: -Node: Top866 -Node: Introduction1917 -Node: Hello browser example3223 -Node: Exploring requests14247 -Node: Response headers19643 -Node: Supporting basic authentication27522 -Node: Processing POST data34913 -Node: Improved processing of POST data43534 -Node: Session management54177 -Node: Adding a layer of security57072 -Node: Bibliography71602 -Node: License text72797 -Node: Example programs97972 -Node: hellobrowser.c98285 -Node: logging.c99828 -Node: responseheaders.c101411 -Node: basicauthentication.c104035 -Node: simplepost.c106574 -Node: largepost.c112254 -Node: sessions.c119619 -Node: tlsauthentication.c141964 +Node: Top858 +Node: Introduction1906 +Node: Hello browser example3211 +Node: Exploring requests14460 +Node: Response headers19876 +Node: Supporting basic authentication27782 +Node: Processing POST data35190 +Node: Improved processing of POST data43853 +Node: Session management54564 +Node: Adding a layer of security58078 +Node: Bibliography72643 +Node: License text73837 +Node: Example programs98993 +Node: hellobrowser.c99306 +Node: logging.c100849 +Node: responseheaders.c102432 +Node: basicauthentication.c105058 +Node: simplepost.c107597 +Node: largepost.c113433 +Node: sessions.c122430 +Node: tlsauthentication.c144775  End Tag Table diff -Nru libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd-tutorial.texi libmicrohttpd-0.9.55/doc/libmicrohttpd-tutorial.texi --- libmicrohttpd-0.9.44+dfsg/doc/libmicrohttpd-tutorial.texi 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/libmicrohttpd-tutorial.texi 2017-05-28 22:34:00.000000000 +0200 @@ -1,10 +1,10 @@ \input texinfo @c -*-texinfo-*- @finalout @setfilename libmicrohttpd-tutorial.info -@set UPDATED 17 November 2013 -@set UPDATED-MONTH November 2013 -@set EDITION 0.9.23 -@set VERSION 0.9.23 +@set UPDATED 2 April 2016 +@set UPDATED-MONTH April 2016 +@set EDITION 0.9.48 +@set VERSION 0.9.48 @settitle A tutorial for GNU libmicrohttpd @c Unify all the indices into concept index. @syncodeindex fn cp @@ -24,7 +24,7 @@ Copyright (c) 2008 Sebastian Gerhardt. -Copyright (c) 2010, 2011, 2012, 2013 Christian Grothoff. +Copyright (c) 2010, 2011, 2012, 2013, 2016 Christian Grothoff. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 diff -Nru libmicrohttpd-0.9.44+dfsg/doc/Makefile.am libmicrohttpd-0.9.55/doc/Makefile.am --- libmicrohttpd-0.9.44+dfsg/doc/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/doc/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -1,7 +1,11 @@ # This Makefile.am is in the public domain man_MANS = libmicrohttpd.3 -SUBDIRS = . examples doxygen +SUBDIRS = . doxygen + +if BUILD_EXAMPLES +SUBDIRS += examples +endif DISTCLEANFILES = \ libmicrohttpd.cps \ @@ -26,5 +30,8 @@ lgpl.texi \ ecos.texi -EXTRA_DIST = $(man_MANS) $(microhttpd_TEXINFOS) performance_data.png performance_data.eps - +EXTRA_DIST = \ + $(man_MANS) \ + $(microhttpd_TEXINFOS) \ + performance_data.png \ + performance_data.eps diff -Nru libmicrohttpd-0.9.44+dfsg/doc/Makefile.in libmicrohttpd-0.9.55/doc/Makefile.in --- libmicrohttpd-0.9.44+dfsg/doc/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -87,13 +87,13 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@BUILD_EXAMPLES_TRUE@am__append_1 = examples subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -101,8 +101,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ @@ -237,7 +240,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = . doxygen examples am__DIST_COMMON = $(srcdir)/Makefile.in mdate-sh texinfo.tex DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ @@ -290,8 +293,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -299,6 +304,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -314,9 +320,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -324,6 +327,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -338,9 +342,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -362,13 +363,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -376,6 +374,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -420,6 +419,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -431,7 +431,7 @@ # This Makefile.am is in the public domain man_MANS = libmicrohttpd.3 -SUBDIRS = . examples doxygen +SUBDIRS = . doxygen $(am__append_1) DISTCLEANFILES = \ libmicrohttpd.cps \ libmicrohttpd.dvi \ @@ -457,7 +457,12 @@ lgpl.texi \ ecos.texi -EXTRA_DIST = $(man_MANS) $(microhttpd_TEXINFOS) performance_data.png performance_data.eps +EXTRA_DIST = \ + $(man_MANS) \ + $(microhttpd_TEXINFOS) \ + performance_data.png \ + performance_data.eps + all: all-recursive .SUFFIXES: diff -Nru libmicrohttpd-0.9.44+dfsg/doc/stamp-vti libmicrohttpd-0.9.55/doc/stamp-vti --- libmicrohttpd-0.9.44+dfsg/doc/stamp-vti 2015-10-01 21:22:58.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/stamp-vti 2017-05-28 22:34:00.000000000 +0200 @@ -1,4 +1,4 @@ -@set UPDATED 22 September 2015 -@set UPDATED-MONTH September 2015 -@set EDITION 0.9.44 -@set VERSION 0.9.44 +@set UPDATED 15 May 2017 +@set UPDATED-MONTH May 2017 +@set EDITION 0.9.55 +@set VERSION 0.9.55 diff -Nru libmicrohttpd-0.9.44+dfsg/doc/version.texi libmicrohttpd-0.9.55/doc/version.texi --- libmicrohttpd-0.9.44+dfsg/doc/version.texi 2015-10-01 21:22:58.000000000 +0200 +++ libmicrohttpd-0.9.55/doc/version.texi 2017-05-28 22:34:00.000000000 +0200 @@ -1,4 +1,4 @@ -@set UPDATED 22 September 2015 -@set UPDATED-MONTH September 2015 -@set EDITION 0.9.44 -@set VERSION 0.9.44 +@set UPDATED 15 May 2017 +@set UPDATED-MONTH May 2017 +@set EDITION 0.9.55 +@set VERSION 0.9.55 diff -Nru libmicrohttpd-0.9.44+dfsg/libmicrospdy.pc.in libmicrohttpd-0.9.55/libmicrospdy.pc.in --- libmicrohttpd-0.9.44+dfsg/libmicrospdy.pc.in 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/libmicrospdy.pc.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libmicrospdy -Description: A library for creating an embedded SPDY server -Version: @VERSION@ -Requires: -Conflicts: -Libs: -L${libdir} -lmicrospdy -Libs.private: @SPDY_LIBDEPS@ -Cflags: -I${includedir} diff -Nru libmicrohttpd-0.9.44+dfsg/ltmain.sh libmicrohttpd-0.9.55/ltmain.sh --- libmicrohttpd-0.9.44+dfsg/ltmain.sh 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/ltmain.sh 2017-05-28 22:34:00.000000000 +0200 @@ -1,9 +1,12 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 -# libtool (GNU libtool) 2.4.2 +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -23,881 +26,2112 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.11 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.11" -TIMESTAMP="" -package_revision=1.3337 +VERSION="2.4.6 Debian-2.4.6-2" +package_revision=2.4.6 -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL -$lt_unset CDPATH +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + : ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` -# Make sure we have an absolute path for reexecution: +# Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) - progdir=$func_dirname_result + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" + progpath=$progdir/$progname ;; *) - save_IFS="$IFS" + _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do - IFS="$save_IFS" + IFS=$_G_IFS test -x "$progdir/$progname" && break done - IFS="$save_IFS" + IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" + progpath=$progdir/$progname ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. -# Standard options: opt_dry_run=false -opt_help=false opt_quiet=false opt_verbose=false -opt_warning=: -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: } -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () { - $opt_verbose && func_echo ${1+"$@"} + $debug_cmd - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS } -# func_echo_all arg... + +# func_echo_all ARG... +# -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } -# func_error arg... + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- # Echo program name prefixed message to standard error. func_error () { - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} + $debug_cmd -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + $require_term_colors - # bash bug again: - : + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } -# func_fatal_error arg... + +# func_fatal_error ARG... +# ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { - func_error ${1+"$@"} - exit $EXIT_FAILURE -} + $debug_cmd -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" + func_error "$*" + exit $EXIT_FAILURE } -help="Try \`$progname --help' for more information." ## default -# func_grep expression filename +# func_grep EXPRESSION FILENAME +# ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { + $debug_cmd + $GREP "$1" "$2" >/dev/null 2>&1 } -# func_mkdir_p directory-path +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { - my_directory_path="$1" - my_dir_list= + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do + while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" + _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac + case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : + $MKDIR "$_G_dir" 2>/dev/null || : done - IFS="$save_mkdir_p_IFS" + IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" fi } -# func_mktempdir [string] +# func_mktempdir [BASENAME] +# ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. +# given, BASENAME is the basename for that directory. func_mktempdir () { - my_template="${TMPDIR-/tmp}/${1-$progname}" + $debug_cmd - if test "$opt_dry_run" = ":"; then + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" + _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` - if test ! -d "$my_tmpdir"; then + if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" + _G_tmpdir=$_G_template-${RANDOM-0}$$ - save_mktempdir_umask=`umask` + func_mktempdir_umask=`umask` umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi - $ECHO "$my_tmpdir" + $ECHO "$_G_tmpdir" } -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () { - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac + $debug_cmd - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. ;; *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : } -# func_quote_for_expand arg +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# func_quote_for_expand ARG +# ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { + $debug_cmd + case $1 in *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) - my_arg="$1" ;; + _G_arg=$1 ;; esac - case $my_arg in + case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" + _G_arg=\"$_G_arg\" ;; esac - func_quote_for_expand_result="$my_arg" + func_quote_for_expand_result=$_G_arg } -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { - my_cmd="$1" - my_fail_exp="${2-:}" + $debug_cmd - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" fi - fi + } } -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { - my_cmd="$1" - my_fail_exp="${2-:}" + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" + $opt_quiet || { + func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" fi - fi + } } + # func_tr_sh +# ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac } -# func_version -# Echo version message to standard output and exit. -func_version () +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () { - $opt_debug + $debug_cmd - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? + $opt_verbose && func_echo "$*" + + : } -# func_usage -# Echo short help message to standard output and exit. -func_usage () + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () { - $opt_debug + $debug_cmd - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" } -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. func_help () { - $opt_debug + $debug_cmd - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi + func_usage_message + $ECHO "$long_help_message" + exit 0 } -# func_missing_arg argname + +# func_missing_arg ARGNAME +# ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { - $opt_debug + $debug_cmd - func_error "missing argument for $1." + func_error "Missing argument for '$1'." exit_cmd=exit } -# func_split_short_opt shortopt +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () { - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + $debug_cmd - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () { - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' + $debug_cmd - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} -exit_cmd=: +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + exit $? +} -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () { - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation + $debug_cmd -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} -# func_arith arithmetic-term... -func_arith () +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () { - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation + $debug_cmd + $warning_func ${1+"$@"} +} -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" -# func_lo2o object -func_lo2o () +# Additional text appended to 'usage_message' in response to '--help'. +func_help () { - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation + $debug_cmd + func_usage_message + $ECHO "$long_help_message -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation +MODE must be one of the following: + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname $scriptversion Debian-2.4.6-2 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' -# func_fatal_configuration arg... + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." } # func_config +# ----------- # Display the configuration for all the tags in this script. func_config () { @@ -915,17 +2149,19 @@ exit $? } + # func_features +# ------------- # Display the features supported by this script. func_features () { echo "host: $host" - if test "$build_libtool_libs" = yes; then + if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi - if test "$build_old_libs" = yes; then + if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" @@ -934,314 +2170,350 @@ exit $? } -# func_enable_tag tagname + +# func_enable_tag TAGNAME +# ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { - # Global variable: - tagname="$1" + # Global variable: + tagname=$1 - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac } + # func_check_version_match +# ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - else - cat >&2 <<_LT_EOF + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - fi - else - cat >&2 <<_LT_EOF + fi + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF - fi + fi - exit $EXIT_MISMATCH - fi + exit $EXIT_MISMATCH + fi } -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + nonopt= + preserve_args= -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_warning=: -opt_verbose=: -opt_silent=false -opt_verbose=false + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-warning|--no-warn) - opt_warning=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - # Validate options: +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - $opt_help || { - # Sanity checks first: - func_check_version_match + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift fi - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result } +func_add_hook func_validate_options libtool_validate_options +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + ## ----------- ## ## Main. ## ## ----------- ## +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + # func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. +# True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. +# True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. +# fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no @@ -1249,13 +2521,13 @@ for lalib_p_l in 1 2 3 4 do read lalib_p_line - case "$lalib_p_line" in + case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi - test "$lalib_p" = yes + test yes = "$lalib_p" } # func_ltwrapper_script_p file @@ -1264,7 +2536,8 @@ # determined imposters. func_ltwrapper_script_p () { - func_lalib_p "$1" + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file @@ -1289,7 +2562,7 @@ { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file @@ -1308,11 +2581,13 @@ # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { - $opt_debug + $debug_cmd + save_ifs=$IFS; IFS='~' for cmd in $1; do - IFS=$save_ifs + IFS=$sp$nl eval cmd=\"$cmd\" + IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs @@ -1324,10 +2599,11 @@ # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. +# 'FILE.' does not work on cygwin managed mounts. func_source () { - $opt_debug + $debug_cmd + case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; @@ -1354,10 +2630,10 @@ # store the result into func_replace_sysroot_result. func_replace_sysroot () { - case "$lt_sysroot:$1" in + case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" + func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. @@ -1374,7 +2650,8 @@ # arg is usually of the form 'gcc ...' func_infer_tag () { - $opt_debug + $debug_cmd + if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do @@ -1393,7 +2670,7 @@ for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. @@ -1418,7 +2695,7 @@ # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" + func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi @@ -1434,15 +2711,15 @@ # but don't create it if we're doing a dry run. func_write_libtool_object () { - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' else write_lobj=none fi - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' else write_oldobj=none fi @@ -1450,7 +2727,7 @@ $opt_dry_run || { cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` + $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi @@ -1514,18 +2792,19 @@ # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { - $opt_debug + $debug_cmd + # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" + func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi @@ -1554,7 +2833,8 @@ # environment variable; do not put it in $PATH. func_cygpath () { - $opt_debug + $debug_cmd + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then @@ -1563,7 +2843,7 @@ fi else func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath @@ -1574,10 +2854,11 @@ # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { - $opt_debug + $debug_cmd + # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 @@ -1588,13 +2869,14 @@ # func_to_host_file_result to ARG1). func_convert_file_check () { - $opt_debug - if test -z "$2" && test -n "$1" ; then + $debug_cmd + + if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" - func_error " \`$1'" + func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: - func_to_host_file_result="$1" + func_to_host_file_result=$1 fi } # end func_convert_file_check @@ -1606,10 +2888,11 @@ # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { - $opt_debug + $debug_cmd + if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" - func_error " \`$3'" + func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. @@ -1618,7 +2901,7 @@ func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else - func_to_host_path_result="$3" + func_to_host_path_result=$3 fi fi } @@ -1630,9 +2913,10 @@ # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { - $opt_debug + $debug_cmd + case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" + $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in @@ -1646,7 +2930,7 @@ ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## -# invoked via `$to_host_file_cmd ARG' +# invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. @@ -1657,7 +2941,8 @@ # in func_to_host_file_result. func_to_host_file () { - $opt_debug + $debug_cmd + $to_host_file_cmd "$1" } # end func_to_host_file @@ -1669,7 +2954,8 @@ # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { - $opt_debug + $debug_cmd + case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 @@ -1687,7 +2973,7 @@ # Copy ARG to func_to_host_file_result. func_convert_file_noop () { - func_to_host_file_result="$1" + func_to_host_file_result=$1 } # end func_convert_file_noop @@ -1698,11 +2984,12 @@ # func_to_host_file_result. func_convert_file_msys_to_w32 () { - $opt_debug - func_to_host_file_result="$1" + $debug_cmd + + func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -1714,8 +3001,9 @@ # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { - $opt_debug - func_to_host_file_result="$1" + $debug_cmd + + func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. @@ -1731,11 +3019,12 @@ # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { - $opt_debug - func_to_host_file_result="$1" + $debug_cmd + + func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -1747,12 +3036,13 @@ # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { - $opt_debug - func_to_host_file_result="$1" + $debug_cmd + + func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" + func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -1765,13 +3055,14 @@ # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { - $opt_debug - func_to_host_file_result="$1" + $debug_cmd + + func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" + func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -1781,7 +3072,7 @@ ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# -# invoked via `$to_host_path_cmd ARG' +# invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. @@ -1805,10 +3096,11 @@ to_host_path_cmd= func_init_to_host_path_cmd () { - $opt_debug + $debug_cmd + if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" + to_host_path_cmd=func_convert_path_$func_stripname_result fi } @@ -1818,7 +3110,8 @@ # in func_to_host_path_result. func_to_host_path () { - $opt_debug + $debug_cmd + func_init_to_host_path_cmd $to_host_path_cmd "$1" } @@ -1829,7 +3122,7 @@ # Copy ARG to func_to_host_path_result. func_convert_path_noop () { - func_to_host_path_result="$1" + func_to_host_path_result=$1 } # end func_convert_path_noop @@ -1840,8 +3133,9 @@ # func_to_host_path_result. func_convert_path_msys_to_w32 () { - $opt_debug - func_to_host_path_result="$1" + $debug_cmd + + func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; @@ -1849,7 +3143,7 @@ func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" @@ -1863,8 +3157,9 @@ # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { - $opt_debug - func_to_host_path_result="$1" + $debug_cmd + + func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" @@ -1883,14 +3178,15 @@ # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { - $opt_debug - func_to_host_path_result="$1" + $debug_cmd + + func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" @@ -1904,15 +3200,16 @@ # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { - $opt_debug - func_to_host_path_result="$1" + $debug_cmd + + func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" + func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" @@ -1927,8 +3224,9 @@ # func_to_host_file_result. func_convert_path_nix_to_cygwin () { - $opt_debug - func_to_host_path_result="$1" + $debug_cmd + + func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them @@ -1937,7 +3235,7 @@ func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" + func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" @@ -1946,13 +3244,31 @@ # end func_convert_path_nix_to_cygwin +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + # func_mode_compile arg... func_mode_compile () { - $opt_debug + $debug_cmd + # Get the compilation command and the source file. base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" + srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal @@ -1965,12 +3281,12 @@ case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile - lastarg="$arg" + lastarg=$arg arg_mode=normal ;; target ) - libobj="$arg" + libobj=$arg arg_mode=normal continue ;; @@ -1980,7 +3296,7 @@ case $arg in -o) test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" + func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; @@ -2009,12 +3325,12 @@ func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= - save_ifs="$IFS"; IFS=',' + save_ifs=$IFS; IFS=, for arg in $args; do - IFS="$save_ifs" + IFS=$save_ifs func_append_quoted lastarg "$arg" done - IFS="$save_ifs" + IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result @@ -2027,8 +3343,8 @@ # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # - lastarg="$srcfile" - srcfile="$arg" + lastarg=$srcfile + srcfile=$arg ;; esac # case $arg ;; @@ -2043,13 +3359,13 @@ func_fatal_error "you must specify an argument for -Xcompile" ;; target) - func_fatal_error "you must specify a target with \`-o'" + func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" - libobj="$func_basename_result" + libobj=$func_basename_result } ;; esac @@ -2069,7 +3385,7 @@ case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) - func_fatal_error "cannot determine name of library object from \`$libobj'" + func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac @@ -2078,8 +3394,8 @@ for arg in $later; do case $arg in -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; @@ -2105,17 +3421,17 @@ func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." + && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. - if test "$build_old_libs" = yes; then + if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" @@ -2127,16 +3443,16 @@ pic_mode=default ;; esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock else output_obj= need_locks=no @@ -2145,12 +3461,12 @@ # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then + if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done - elif test "$need_locks" = warn; then + elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: @@ -2158,7 +3474,7 @@ This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you +your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -2180,11 +3496,11 @@ qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then + if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile - if test "$pic_mode" != no; then + if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code @@ -2201,7 +3517,7 @@ func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - if test "$need_locks" = warn && + if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: @@ -2212,7 +3528,7 @@ This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you +your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -2228,20 +3544,20 @@ fi # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then + if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi - if test "$compiler_c_o" = yes; then + if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi @@ -2250,7 +3566,7 @@ func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - if test "$need_locks" = warn && + if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: @@ -2261,7 +3577,7 @@ This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you +your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -2281,7 +3597,7 @@ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked - if test "$need_locks" != no; then + if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi @@ -2291,7 +3607,7 @@ } $opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () @@ -2311,7 +3627,7 @@ Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated @@ -2330,16 +3646,16 @@ -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler -COMPILE-COMMAND is a command to be used in creating a \`standard' object file +COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." ;; execute) @@ -2352,7 +3668,7 @@ -dlopen FILE add the directory containing FILE to the library path -This mode sets the library path environment variable according to \`-dlopen' +This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated @@ -2371,7 +3687,7 @@ Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." +the '--dry-run' option if you just want to see what would be executed." ;; install) @@ -2381,7 +3697,7 @@ Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. +either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: @@ -2407,7 +3723,7 @@ -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE @@ -2421,7 +3737,8 @@ -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information @@ -2441,20 +3758,20 @@ -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) -All other options (arguments beginning with \`-') are ignored. +All other options (arguments beginning with '-') are ignored. -Every other argument is treated as a filename. Files ending in \`.la' are +Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; @@ -2465,7 +3782,7 @@ Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. @@ -2473,17 +3790,17 @@ ;; *) - func_fatal_help "invalid operation mode \`$opt_mode'" + func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo - $ECHO "Try \`$progname --help' for more information about other modes." + $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then - if test "$opt_help" = :; then + if test : = "$opt_help"; then func_mode_help else { @@ -2491,7 +3808,7 @@ for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do @@ -2499,7 +3816,7 @@ func_mode_help done } | - sed '1d + $SED '1d /^When reporting/,/^Report/{ H d @@ -2516,16 +3833,17 @@ # func_mode_execute arg... func_mode_execute () { - $opt_debug + $debug_cmd + # The first argument is the command name. - cmd="$nonopt" + cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ - || func_fatal_help "\`$file' is not a file" + || func_fatal_help "'$file' is not a file" dir= case $file in @@ -2535,7 +3853,7 @@ # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" + || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= @@ -2546,18 +3864,18 @@ if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" + func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; @@ -2565,18 +3883,18 @@ *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." - dir="$func_dirname_result" + dir=$func_dirname_result ;; *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" + test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then @@ -2588,7 +3906,7 @@ # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. - libtool_execute_magic="$magic" + libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= @@ -2601,12 +3919,12 @@ if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. - file="$progdir/$program" + file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. - file="$progdir/$program" + file=$progdir/$program fi ;; esac @@ -2614,7 +3932,15 @@ func_append_quoted args "$file" done - if test "X$opt_dry_run" = Xfalse; then + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" @@ -2631,25 +3957,18 @@ done # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS + exec_cmd=\$cmd$args fi } -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { - $opt_debug + $debug_cmd + libs= libdirs= admincmds= @@ -2663,11 +3982,11 @@ if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else - func_warning "\`$opt' is not a valid libtool archive" + func_warning "'$opt' is not a valid libtool archive" fi else - func_fatal_error "invalid argument \`$opt'" + func_fatal_error "invalid argument '$opt'" fi done @@ -2682,12 +4001,12 @@ # Remove sysroot references if $opt_dry_run; then for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done @@ -2712,7 +4031,7 @@ fi # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS + $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" @@ -2723,27 +4042,27 @@ echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $ECHO " - use the \`$flag' linker flag" + $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo @@ -2762,18 +4081,20 @@ exit $EXIT_SUCCESS } -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { - $opt_debug + $debug_cmd + # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then + case $nonopt in *shtool*) :;; *) false;; esac + then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -2800,7 +4121,7 @@ opts= prev= install_type= - isdir=no + isdir=false stripme= no_mode=: for arg @@ -2813,7 +4134,7 @@ fi case $arg in - -d) isdir=yes ;; + -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg @@ -2831,7 +4152,7 @@ *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi @@ -2856,7 +4177,7 @@ func_fatal_help "you must specify an install program" test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" + func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else @@ -2878,19 +4199,19 @@ dest=$func_stripname_result # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" + destdir=$func_dirname_result + destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" + func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -2899,7 +4220,7 @@ case $file in *.lo) ;; *) - func_fatal_help "\`$destdir' must be an absolute directory name" + func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done @@ -2908,7 +4229,7 @@ # This variable tells wrapper scripts just to set variables rather # than running their programs. - libtool_install_magic="$magic" + libtool_install_magic=$magic staticlibs= future_libdirs= @@ -2928,7 +4249,7 @@ # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" + || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= @@ -2950,7 +4271,7 @@ fi func_dirname "$file" "/" "" - dir="$func_dirname_result" + dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then @@ -2964,7 +4285,7 @@ # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. @@ -2973,29 +4294,36 @@ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi - func_warning "relinking \`$file'" + func_warning "relinking '$file'" func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then - realname="$1" + realname=$1 shift - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T + srcname=$realname + test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' - tstripme="$stripme" + tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) - tstripme="" + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= ;; esac ;; @@ -3006,7 +4334,7 @@ if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on + # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname @@ -3017,14 +4345,14 @@ fi # Do each command in the postinstall commands. - lib="$destdir/$realname" + lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i + name=$func_basename_result + instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. @@ -3036,11 +4364,11 @@ # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then - destfile="$destdir/$destname" + destfile=$destdir/$destname else func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" + destfile=$func_basename_result + destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. @@ -3050,11 +4378,11 @@ staticdest=$func_lo2o_result ;; *.$objext) - staticdest="$destfile" + staticdest=$destfile destfile= ;; *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" + func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac @@ -3063,7 +4391,7 @@ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. - if test "$build_old_libs" = yes; then + if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result @@ -3075,23 +4403,23 @@ *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then - destfile="$destdir/$destname" + destfile=$destdir/$destname else func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" + destfile=$func_basename_result + destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install - stripped_ext="" + stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result - stripped_ext=".exe" + stripped_ext=.exe fi ;; esac @@ -3119,19 +4447,19 @@ # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" + func_fatal_error "invalid libtool wrapper script '$wrapper'" - finalize=yes + finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false fi done @@ -3139,29 +4467,29 @@ func_source "$wrapper" outputname= - if test "$fast_install" = no && test -n "$relink_command"; then + if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { - if test "$finalize" = yes; then + if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" + file=$func_basename_result + outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - $opt_silent || { + $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else - func_error "error: relink \`$file' with the above command before installing it" + func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi - file="$outputname" + file=$outputname else - func_warning "cannot relink \`$file'" + func_warning "cannot relink '$file'" fi } else @@ -3198,10 +4526,10 @@ for file in $staticlibs; do func_basename "$file" - name="$func_basename_result" + name=$func_basename_result # Set up the ranlib parameters. - oldlib="$destdir/$name" + oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result @@ -3216,18 +4544,18 @@ done test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" + func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } -test "$opt_mode" = install && func_mode_install ${1+"$@"} +test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -3235,16 +4563,17 @@ # a dlpreopen symbol table. func_generate_dlsyms () { - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" + my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi @@ -3255,7 +4584,7 @@ "") ;; *.c) # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" + nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" @@ -3263,34 +4592,36 @@ func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST -#elif defined(__osf__) +#elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + /* External symbol declarations for the compiler. */\ " - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" @@ -3298,7 +4629,7 @@ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done @@ -3318,10 +4649,10 @@ # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" + export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' @@ -3331,7 +4662,7 @@ } else $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in @@ -3345,22 +4676,22 @@ fi for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" + func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" - name="$func_basename_result" + name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" + dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then + if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" + dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" @@ -3368,7 +4699,7 @@ fi fi $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then + if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" @@ -3424,6 +4755,11 @@ echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ @@ -3432,11 +4768,30 @@ void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi case $need_lib_prefix in no) @@ -3478,9 +4833,7 @@ *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi + $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; @@ -3497,10 +4850,10 @@ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" + symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then @@ -3518,7 +4871,7 @@ esac ;; *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" + func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else @@ -3532,6 +4885,32 @@ fi } +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + # func_win32_libid arg # return the library type of file 'arg' # @@ -3541,8 +4920,9 @@ # Despite the name, also deal with 64 bit binaries. func_win32_libid () { - $opt_debug - win32_libid_type="unknown" + $debug_cmd + + win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import @@ -3552,16 +4932,29 @@ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' 1,100{ / I /{ - s,.*,import, + s|.*|import| p q } }'` + ;; + esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; @@ -3593,7 +4986,8 @@ # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { - $opt_debug + $debug_cmd + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } @@ -3610,7 +5004,8 @@ # specified import library. func_cygming_dll_for_implib_fallback_core () { - $opt_debug + $debug_cmd + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ @@ -3646,8 +5041,8 @@ /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually @@ -3658,30 +5053,6 @@ $SED -e '/^\./d;/^.\./d;q' } -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified @@ -3695,16 +5066,17 @@ # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then + elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown - sharedlib_from_linklib_result="" + sharedlib_from_linklib_result= fi } @@ -3712,10 +5084,11 @@ # func_extract_an_archive dir oldlib func_extract_an_archive () { - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" @@ -3724,7 +5097,7 @@ fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then + if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then @@ -3738,22 +5111,23 @@ # func_extract_archives gentop oldlib ... func_extract_archives () { - $opt_debug - my_gentop="$1"; shift + $debug_cmd + + my_gentop=$1; shift my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" - my_xlib="$func_basename_result" + my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in @@ -3765,7 +5139,7 @@ esac done extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" @@ -3778,22 +5152,23 @@ cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do @@ -3815,7 +5190,7 @@ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done - func_extract_archives_result="$my_oldobjs" + func_extract_archives_result=$my_oldobjs } @@ -3830,7 +5205,7 @@ # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is +# will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () @@ -3841,7 +5216,7 @@ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. @@ -3898,9 +5273,9 @@ # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on +# /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match +# (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and @@ -3933,7 +5308,7 @@ # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } @@ -3944,7 +5319,7 @@ lt_dump_args_N=1; for lt_arg do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } @@ -3958,7 +5333,7 @@ *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} @@ -3968,7 +5343,7 @@ *) $ECHO "\ if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} @@ -4043,13 +5418,13 @@ test -n \"\$absdir\" && thisdir=\"\$absdir\" " - if test "$fast_install" = yes; then + if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" @@ -4066,7 +5441,7 @@ if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else - $ECHO \"\$relink_command_output\" >&2 + \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi @@ -4101,7 +5476,7 @@ fi # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" @@ -4121,7 +5496,7 @@ fi else # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 @@ -4140,7 +5515,7 @@ cat < #include +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + /* declarations of non-ANSI functions */ -#if defined(__MINGW32__) +#if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif -#elif defined(__CYGWIN__) +#elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif -/* #elif defined (other platforms) ... */ +/* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) +#if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) +#elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv -#elif defined(__CYGWIN__) +#elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ +/* #elif defined other platforms ... */ #endif -#if defined(PATH_MAX) +#if defined PATH_MAX # define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) +#elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 @@ -4234,8 +5607,8 @@ # define PATH_SEPARATOR ':' #endif -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 @@ -4268,10 +5641,10 @@ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ + if (stale) { free (stale); stale = 0; } \ } while (0) -#if defined(LT_DEBUGWRAPPER) +#if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; @@ -4300,11 +5673,16 @@ EOF cat < 0) && IS_PATH_SEPARATOR (new_value[len-1])) + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { - new_value[len-1] = '\0'; + new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); @@ -5082,27 +6460,47 @@ # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { - $opt_debug + $debug_cmd + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + # func_mode_link arg... func_mode_link () { - $opt_debug + $debug_cmd + case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra + # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not + # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. @@ -5146,10 +6544,11 @@ module=no no_install=no objs= + os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no - preload=no + preload=false prev= prevarg= release= @@ -5161,7 +6560,7 @@ vinfo= vinfo_number=no weak_libs= - single_module="${wl}-single_module" + single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. @@ -5169,15 +6568,15 @@ do case $arg in -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then @@ -5210,7 +6609,7 @@ # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do - arg="$1" + arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result @@ -5227,21 +6626,21 @@ case $prev in bindir) - bindir="$arg" + bindir=$arg prev= continue ;; dlfiles|dlprefiles) - if test "$preload" = no; then + $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" - preload=yes - fi + preload=: + } case $arg in *.la | *.lo) ;; # We handle these cases below. force) - if test "$dlself" = no; then + if test no = "$dlself"; then dlself=needless export_dynamic=yes fi @@ -5249,9 +6648,9 @@ continue ;; self) - if test "$prev" = dlprefiles; then + if test dlprefiles = "$prev"; then dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless @@ -5261,7 +6660,7 @@ continue ;; *) - if test "$prev" = dlfiles; then + if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" @@ -5272,14 +6671,14 @@ esac ;; expsyms) - export_symbols="$arg" + export_symbols=$arg test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" + || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) - export_symbols_regex="$arg" + export_symbols_regex=$arg prev= continue ;; @@ -5297,7 +6696,13 @@ continue ;; inst_prefix) - inst_prefix_dir="$arg" + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. prev= continue ;; @@ -5321,21 +6726,21 @@ if test -z "$pic_object" || test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir="$func_dirname_result" + xdir=$func_dirname_result - if test "$pic_object" != none; then + if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" + pic_object=$xdir$pic_object - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue @@ -5346,7 +6751,7 @@ fi # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then + if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= @@ -5354,23 +6759,23 @@ # A PIC object. func_append libobjs " $pic_object" - arg="$pic_object" + arg=$pic_object fi # Non-PIC object. - if test "$non_pic_object" != none; then + if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" + non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" + non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else @@ -5378,7 +6783,7 @@ if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir="$func_dirname_result" + xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result @@ -5386,24 +6791,29 @@ func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else - func_fatal_error "\`$arg' is not a valid libtool object" + func_fatal_error "'$arg' is not a valid libtool object" fi fi done else - func_fatal_error "link input file \`$arg' does not exist" + func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; precious_regex) - precious_files_regex="$arg" + precious_files_regex=$arg prev= continue ;; release) - release="-$arg" + release=-$arg prev= continue ;; @@ -5415,7 +6825,7 @@ func_fatal_error "only absolute run-paths are allowed" ;; esac - if test "$prev" = rpath; then + if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; @@ -5430,7 +6840,7 @@ continue ;; shrext) - shrext_cmds="$arg" + shrext_cmds=$arg prev= continue ;; @@ -5470,7 +6880,7 @@ esac fi # test -n "$prev" - prevarg="$arg" + prevarg=$arg case $arg in -all-static) @@ -5484,7 +6894,7 @@ -allow-undefined) # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" + func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) @@ -5516,7 +6926,7 @@ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi - if test "X$arg" = "X-export-symbols"; then + if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex @@ -5550,9 +6960,9 @@ func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" + func_fatal_error "require no space between '-L' and '$1'" else - func_fatal_error "need path for \`-L' option" + func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" @@ -5563,8 +6973,8 @@ *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir ;; esac case "$deplibs " in @@ -5599,7 +7009,7 @@ ;; -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) @@ -5607,11 +7017,11 @@ ;; *-*-os2*) # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue + test X-lc = "X$arg" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue + test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework @@ -5620,16 +7030,16 @@ ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype - test "X$arg" = "X-lc" && continue + test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue + test X-lc = "X$arg" && continue ;; esac - elif test "X$arg" = "X-lc_r"; then + elif test X-lc_r = "X$arg"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -5639,6 +7049,11 @@ continue ;; + -mllvm) + prev=mllvm + continue + ;; + -module) module=yes continue @@ -5668,7 +7083,7 @@ ;; -multi_module) - single_module="${wl}-multi_module" + single_module=$wl-multi_module continue ;; @@ -5682,8 +7097,8 @@ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; @@ -5701,6 +7116,11 @@ continue ;; + -os2dllname) + prev=os2dllname + continue + ;; + -o) prev=output ;; -precious-files-regex) @@ -5788,14 +7208,14 @@ func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= - save_ifs="$IFS"; IFS=',' + save_ifs=$IFS; IFS=, for flag in $args; do - IFS="$save_ifs" + IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done - IFS="$save_ifs" + IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; @@ -5804,15 +7224,15 @@ func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= - save_ifs="$IFS"; IFS=',' + save_ifs=$IFS; IFS=, for flag in $args; do - IFS="$save_ifs" + IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done - IFS="$save_ifs" + IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; @@ -5835,7 +7255,7 @@ # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" + arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: @@ -5847,25 +7267,49 @@ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*) func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" + arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" + arg=$func_quote_for_eval_result ;; *.$objext) @@ -5886,21 +7330,21 @@ if test -z "$pic_object" || test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir="$func_dirname_result" + xdir=$func_dirname_result - if test "$pic_object" != none; then + test none = "$pic_object" || { # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" + pic_object=$xdir$pic_object - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue @@ -5911,7 +7355,7 @@ fi # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then + if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= @@ -5919,23 +7363,23 @@ # A PIC object. func_append libobjs " $pic_object" - arg="$pic_object" - fi + arg=$pic_object + } # Non-PIC object. - if test "$non_pic_object" != none; then + if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" + non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" + non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else @@ -5943,7 +7387,7 @@ if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir="$func_dirname_result" + xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result @@ -5951,7 +7395,7 @@ func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else - func_fatal_error "\`$arg' is not a valid libtool object" + func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; @@ -5967,11 +7411,11 @@ # A libtool-controlled library. func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then + if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= - elif test "$prev" = dlprefiles; then + elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= @@ -5986,7 +7430,7 @@ # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" + arg=$func_quote_for_eval_result ;; esac # arg @@ -5998,9 +7442,9 @@ done # argument parsing loop test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" + func_fatal_help "the '$prevarg' option requires an argument" - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" @@ -6009,20 +7453,23 @@ oldlibs= # calculate the name of the file, without its directory func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" + outputname=$func_basename_result + libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" + output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. @@ -6045,7 +7492,7 @@ # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then + if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac @@ -6053,7 +7500,7 @@ func_append libs " $deplib" done - if test "$linkmode" = lib; then + if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps @@ -6085,7 +7532,7 @@ case $file in *.la) ;; *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done @@ -6093,7 +7540,7 @@ prog) compile_deplibs= finalize_deplibs= - alldeplibs=no + alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" @@ -6105,32 +7552,32 @@ for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then + if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done - deplibs="$tmp_deplibs" + deplibs=$tmp_deplibs fi - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs deplibs= fi - if test "$linkmode" = prog; then + if test prog = "$linkmode"; then case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then + if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs @@ -6151,26 +7598,26 @@ esac done done - libs="$dlprefiles" + libs=$dlprefiles fi - if test "$pass" = dlopen; then + if test dlopen = "$pass"; then # Collect dlpreopened libraries - save_deplibs="$deplibs" + save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= - found=no + found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test "$linkmode,$pass" = "prog,link"; then + if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then + if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; @@ -6180,13 +7627,13 @@ continue ;; -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result - if test "$linkmode" = lib; then + if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" @@ -6194,31 +7641,22 @@ for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" + lib=$searchdir/lib$name$search_ext if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes + if test .la = "$search_ext"; then + found=: else - found=no + found=false fi break 2 fi done done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library + if $found; then + # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then @@ -6226,19 +7664,19 @@ old_library= func_source "$lib" for l in $old_library $library_names; do - ll="$l" + ll=$l done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no + if test "X$ll" = "X$old_library"; then # only static version available + found=false func_dirname "$lib" "" "." - ladir="$func_dirname_result" + ladir=$func_dirname_result lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then + if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi @@ -6247,15 +7685,25 @@ *) ;; esac fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue fi ;; # -l *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then + if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then + if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; @@ -6268,18 +7716,18 @@ case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) - if test "$pass" = conv; then + if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -6290,13 +7738,13 @@ func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) - func_warning "\`-L' is ignored for archives/objects" + func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) - if test "$pass" = link; then + if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result @@ -6314,7 +7762,7 @@ lib=$func_resolve_sysroot_result ;; *.$libext) - if test "$pass" = conv; then + if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi @@ -6325,21 +7773,26 @@ case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) - valid_a_lib=no + valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes + valid_a_lib=: fi ;; pass_all) - valid_a_lib=yes + valid_a_lib=: ;; esac - if test "$valid_a_lib" != yes; then + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" @@ -6347,18 +7800,13 @@ echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) - if test "$pass" != link; then + if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -6369,10 +7817,10 @@ esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = conv; then + if test conv = "$pass"; then deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" @@ -6385,22 +7833,20 @@ continue ;; %DEPLIBS%) - alldeplibs=yes + alldeplibs=: continue ;; esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" + || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." - ladir="$func_dirname_result" + ladir=$func_dirname_result dlname= dlopen= @@ -6430,19 +7876,19 @@ done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi - if test "$pass" = conv; then + if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" + func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" @@ -6450,15 +7896,15 @@ tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then + if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv @@ -6467,26 +7913,26 @@ # Get the name of the library we link against. linklib= if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do - linklib="$l" + linklib=$l done fi if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" + func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't @@ -6500,40 +7946,40 @@ # We need an absolute path. case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" + abs_ladir=$ladir fi ;; esac func_basename "$lib" - laname="$func_basename_result" + laname=$func_basename_result # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then + if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" + dir=$ladir + absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi @@ -6542,11 +7988,11 @@ name=$func_stripname_result # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi - case "$host" in + case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both @@ -6590,9 +8036,9 @@ if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then + elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else @@ -6602,14 +8048,14 @@ fi - if test "$linkmode" = prog && test "$pass" != link; then + if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: fi tmp_libs= @@ -6621,14 +8067,14 @@ ;; esac # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then + if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_preserve_dup_deps ; then + if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac @@ -6638,15 +8084,15 @@ continue fi # $linkmode = prog... - if test "$linkmode,$pass" = "prog,link"; then + if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in + case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac @@ -6675,9 +8121,9 @@ esac fi # $linkmode,$pass = prog,link... - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue @@ -6686,19 +8132,19 @@ link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then + if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then + { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in - *cygwin* | *mingw* | *cegcc*) + *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) - if test "$installed" = no; then + if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi @@ -6708,24 +8154,24 @@ # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" + dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" + dlopenmodule=$dlpremoduletest break fi done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo - if test "$linkmode" = prog; then + if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -6753,43 +8199,43 @@ # figure out the soname set dummy $library_names shift - realname="$1" + realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then - soname="$dlname" + soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw* | *cegcc*) + *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result - versuffix="-$major" + versuffix=-$major ;; esac eval soname=\"$soname_spec\" else - soname="$realname" + soname=$realname fi # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" + soroot=$soname func_basename "$soroot" - soname="$func_basename_result" + soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else - func_verbose "extracting exported symbol list from \`$soname'" + func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" + func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library @@ -6797,58 +8243,58 @@ linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test "$linkmode" = prog || test "$opt_mode" != relink; then + if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" + if test no = "$hardcode_direct"; then + add=$dir/$linklib case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; + *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not + # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then + $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then + if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else - add="$dir/$old_library" + add=$dir/$old_library fi elif test -n "$old_library"; then - add="$dir/$old_library" + add=$dir/$old_library fi fi esac - elif test "$hardcode_minus_L" = no; then + elif test no = "$hardcode_minus_L"; then case $host in - *-*-sunos*) add_shlibpath="$dir" ;; + *-*-sunos*) add_shlibpath=$dir ;; esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name else lib_linked=no fi ;; relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in @@ -6857,10 +8303,10 @@ ;; esac fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name else lib_linked=no fi @@ -6868,7 +8314,7 @@ *) lib_linked=no ;; esac - if test "$lib_linked" != yes; then + if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi @@ -6878,15 +8324,15 @@ *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; @@ -6895,33 +8341,33 @@ fi fi - if test "$linkmode" = prog || test "$opt_mode" = relink; then + if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then + add=-l$name + elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib else - add="$libdir/$linklib" + add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" + add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in @@ -6930,10 +8376,10 @@ ;; esac fi - add="-l$name" + add=-l$name fi - if test "$linkmode" = prog; then + if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else @@ -6941,43 +8387,43 @@ test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi - elif test "$build_libtool_libs" = yes; then + elif test yes = "$build_libtool_libs"; then # Not a shared library - if test "$deplibs_check_method" != pass_all; then + if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then + if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo "*** 'nm' from GNU binutils and a full rebuild may help." fi - if test "$build_old_libs" = no; then + if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else @@ -6990,11 +8436,11 @@ fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test lib = "$linkmode"; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -7008,12 +8454,12 @@ *) func_append temp_deplibs " $libdir";; esac done - dependency_libs="$temp_deplibs" + dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do @@ -7023,7 +8469,7 @@ func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac - if $opt_preserve_dup_deps ; then + if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; @@ -7032,12 +8478,12 @@ func_append tmp_libs " $func_resolve_sysroot_result" done - if test "$link_all_deplibs" != no; then + if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in - -L*) path="$deplib" ;; + -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result @@ -7045,12 +8491,12 @@ dir=$func_dirname_result # We need an absolute path. case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir fi ;; esac @@ -7058,35 +8504,35 @@ case $host in *-*-darwin*) depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do depdepl=$tmp done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) - path="-L$absdir/$objdir" + path=-L$absdir/$objdir ;; esac else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" + func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" + func_warning "'$deplib' seems to be moved" - path="-L$absdir" + path=-L$absdir fi ;; esac @@ -7098,23 +8544,23 @@ fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then + if test link = "$pass"; then + if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then + if test dlopen != "$pass"; then + test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -7124,12 +8570,12 @@ esac done newlib_search_path= - fi + } - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else + if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" + else + vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order @@ -7187,62 +8633,93 @@ eval $var=\"$tmp_libs\" done # for var fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= - for i in $dependency_libs ; do + for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) - i="" + i= ;; esac - if test -n "$i" ; then + if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" + if test prog = "$linkmode"; then + dlfiles=$newdlfiles fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles fi case $linkmode in oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; + func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" + func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" + func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" + func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ - func_warning "\`-release' is ignored for archives" + func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" + func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no - oldlibs="$output" + oldlibs=$output func_append objs "$old_deplibs" ;; lib) - # Make sure we only generate libraries of the form `libNAME.la'. + # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" @@ -7251,10 +8728,10 @@ eval libname=\"$libname_spec\" ;; *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" - if test "$need_lib_prefix" != no; then + if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result @@ -7268,8 +8745,8 @@ esac if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" @@ -7278,21 +8755,21 @@ fi fi - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" - install_libdir="$1" + install_libdir=$1 oldlibs= if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then + if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so + # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" @@ -7301,20 +8778,20 @@ fi test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" + func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. - save_ifs="$IFS"; IFS=':' + save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift - IFS="$save_ifs" + IFS=$save_ifs test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" + func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts @@ -7322,45 +8799,45 @@ case $vinfo_number in yes) - number_major="$1" - number_minor="$2" - number_revision="$3" + number_major=$1 + number_minor=$2 + number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix - # which has an extra 1 added just for fun + # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|linux|osf|windows|none) + darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result - age="$number_minor" - revision="$number_revision" + age=$number_minor + revision=$number_revision ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result - age="$number_minor" - revision="$number_minor" + age=$number_minor + revision=$number_minor lt_irix_increment=no ;; *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" + func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) - current="$1" - revision="$2" - age="$3" + current=$1 + revision=$2 + age=$3 ;; esac @@ -7368,30 +8845,30 @@ case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. @@ -7406,26 +8883,36 @@ # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result - versuffix="$major.$age.$revision" + versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac ;; freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; + major=.$current + versuffix=.$current.$revision ;; freebsd-elf) - major=".$current" - versuffix=".$current" + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision ;; irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then + if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 @@ -7436,69 +8923,74 @@ nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac - verstring="$verstring_prefix$major.$revision" + verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision - while test "$loop" -ne 0; do + while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" + verstring=$verstring_prefix$major.$iface:$verstring done - # Before this point, $major must not contain `.'. + # Before this point, $major must not contain '.'. major=.$major - versuffix="$major.$revision" + versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result - versuffix="$major.$age.$revision" + versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age - while test "$loop" -ne 0; do + while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result - verstring="$verstring:${iface}.0" + verstring=$verstring:$iface.0 done # Make executables depend on our current version. - func_append verstring ":${current}.0" + func_append verstring ":$current.0" ;; qnx) - major=".$current" - versuffix=".$current" + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current ;; sunos) - major=".$current" - versuffix=".$current.$revision" + major=.$current + versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. + # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result - versuffix="-$major" + versuffix=-$major ;; *) - func_fatal_configuration "unknown library version type \`$version_type'" + func_fatal_configuration "unknown library version type '$version_type'" ;; esac @@ -7512,42 +9004,45 @@ verstring= ;; *) - verstring="0.0" + verstring=0.0 ;; esac - if test "$need_version" = no; then + if test no = "$need_version"; then versuffix= else - versuffix=".0.0" + versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then + if test yes,no = "$avoid_version,$need_version"; then major= versuffix= - verstring="" + verstring= fi # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi fi else # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" + allow_undefined_flag=$no_undefined_flag fi fi - func_generate_dlsyms "$libname" "$libname" "yes" + func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= + test " " = "$libobjs" && libobjs= - if test "$opt_mode" != relink; then + if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -7556,8 +9051,8 @@ case $p in *.$objext | *.gcno) ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue @@ -7573,11 +9068,11 @@ fi # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. @@ -7598,13 +9093,13 @@ *) func_append finalize_rpath " $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" + old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in @@ -7614,7 +9109,7 @@ done # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" + old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in @@ -7623,7 +9118,7 @@ esac done - if test "$build_libtool_libs" = yes; then + if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) @@ -7647,7 +9142,7 @@ ;; *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; @@ -7663,9 +9158,9 @@ # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? - release="" - versuffix="" - major="" + release= + versuffix= + major= newdeplibs= droppeddeps=no case $deplibs_check_method in @@ -7694,20 +9189,20 @@ -l*) func_stripname -l '' "$i" name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $i "*) func_append newdeplibs " $i" - i="" + i= ;; esac fi - if test -n "$i" ; then + if test -n "$i"; then libname=`eval "\\$ECHO \"$libname_spec\""` deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` set dummy $deplib_matches; shift deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then func_append newdeplibs " $i" else droppeddeps=yes @@ -7737,20 +9232,20 @@ $opt_dry_run || $RM conftest if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $i "*) func_append newdeplibs " $i" - i="" + i= ;; esac fi - if test -n "$i" ; then + if test -n "$i"; then libname=`eval "\\$ECHO \"$libname_spec\""` deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` set dummy $deplib_matches; shift deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then func_append newdeplibs " $i" else droppeddeps=yes @@ -7787,24 +9282,24 @@ -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" - a_deplib="" + a_deplib= ;; esac fi - if test -n "$a_deplib" ; then + if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` if test -n "$file_magic_glob"; then libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` else libnameglob=$libname fi - test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` + test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - if test "$want_nocaseglob" = yes; then + if test yes = "$want_nocaseglob"; then shopt -s nocaseglob potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` $nocaseglob @@ -7822,25 +9317,25 @@ # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? - potlib="$potent_lib" + potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" - a_deplib="" + a_deplib= break 2 fi done done fi - if test -n "$a_deplib" ; then + if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." @@ -7848,7 +9343,7 @@ echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then + if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" @@ -7871,30 +9366,30 @@ -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" - a_deplib="" + a_deplib= ;; esac fi - if test -n "$a_deplib" ; then + if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test + potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" - a_deplib="" + a_deplib= break 2 fi done done fi - if test -n "$a_deplib" ; then + if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." @@ -7902,7 +9397,7 @@ echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then + if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" @@ -7918,18 +9413,18 @@ done # Gone through all deplibs. ;; none | unknown | *) - newdeplibs="" + newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo - if test "X$deplibs_check_method" = "Xnone"; then + if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." @@ -7953,8 +9448,8 @@ ;; esac - if test "$droppeddeps" = yes; then - if test "$module" = yes; then + if test yes = "$droppeddeps"; then + if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" @@ -7963,12 +9458,12 @@ if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo "*** 'nm' from GNU binutils and a full rebuild may help." fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else @@ -7979,14 +9474,14 @@ echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." - if test "$allow_undefined" = no; then + if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else @@ -8032,7 +9527,7 @@ *) func_append new_libs " $deplib" ;; esac done - deplibs="$new_libs" + deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= @@ -8040,25 +9535,25 @@ dlname= # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Remove ${wl} instances when linking with ld. + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac - if test "$hardcode_into_libs" = yes; then + if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" + hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -8083,7 +9578,7 @@ # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" + libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then @@ -8097,8 +9592,8 @@ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -8108,19 +9603,19 @@ eval library_names=\"$library_names_spec\" set dummy $library_names shift - realname="$1" + realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else - soname="$realname" + soname=$realname fi if test -z "$dlname"; then dlname=$soname fi - lib="$output_objdir/$realname" + lib=$output_objdir/$realname linknames= for link do @@ -8134,7 +9629,7 @@ delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi @@ -8143,31 +9638,31 @@ cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. - orig_export_symbols="$export_symbols" + orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes - fi + } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' + save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do - IFS="$save_ifs" + IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in @@ -8181,7 +9676,7 @@ try_normal_branch=no ;; esac - if test "$try_normal_branch" = yes \ + if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then @@ -8192,7 +9687,7 @@ output_la=$func_basename_result save_libobjs=$libobjs save_output=$output - output=${output_objdir}/${output_la}.nm + output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" @@ -8215,8 +9710,8 @@ break fi done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi @@ -8224,16 +9719,16 @@ fi if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine + # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. @@ -8252,11 +9747,11 @@ ;; esac done - deplibs="$tmp_deplibs" + deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && + test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. @@ -8267,7 +9762,7 @@ eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else - gentop="$output_objdir/${outputname}x" + gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience @@ -8276,18 +9771,18 @@ fi fi - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then + if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then + if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds @@ -8305,7 +9800,7 @@ fi fi - if test "X$skipped_export" != "X:" && + if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then @@ -8338,8 +9833,8 @@ last_robj= k=1 - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs @@ -8351,14 +9846,14 @@ func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= - if test "$compiler_needs_object" = yes; then + if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi @@ -8373,7 +9868,7 @@ else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext + output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result @@ -8385,13 +9880,13 @@ func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result - if test "X$objlist" = X || + if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. - if test "$k" -eq 1 ; then + if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" @@ -8401,10 +9896,10 @@ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi - last_robj=$output_objdir/$output_la-${k}.$objext + last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext + output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result @@ -8416,9 +9911,9 @@ # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" @@ -8426,9 +9921,9 @@ output= fi - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. @@ -8437,16 +9932,16 @@ if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi - fi + } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' + save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { + IFS=$save_ifs + $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -8454,7 +9949,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -8463,7 +9958,7 @@ exit $lt_exit } done - IFS="$save_ifs" + IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' @@ -8471,18 +9966,18 @@ fi fi - if ${skipped_export-false}; then + ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine + # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. @@ -8491,7 +9986,7 @@ export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi - fi + } libobjs=$output # Restore the value of output. @@ -8505,7 +10000,7 @@ # value of $libobjs for piecewise linking. # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then + if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else @@ -8527,7 +10022,7 @@ # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" + gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles @@ -8535,11 +10030,12 @@ test "X$libobjs" = "X " && libobjs= fi - save_ifs="$IFS"; IFS='~' + save_ifs=$IFS; IFS='~' for cmd in $cmds; do - IFS="$save_ifs" + IFS=$sp$nl eval cmd=\"$cmd\" - $opt_silent || { + IFS=$save_ifs + $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -8547,7 +10043,7 @@ lt_exit=$? # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -8556,10 +10052,10 @@ exit $lt_exit } done - IFS="$save_ifs" + IFS=$save_ifs # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then + if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -8579,39 +10075,39 @@ done # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then + if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. - dlname="$soname" + dlname=$soname fi fi ;; obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; + func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" + func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" + func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" + func_warning "'-version-info' is ignored for objects" test -n "$release" && \ - func_warning "\`-release' is ignored for objects" + func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" + func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" @@ -8619,7 +10115,7 @@ ;; *) libobj= - obj="$output" + obj=$output ;; esac @@ -8632,17 +10128,19 @@ # the extraction. reload_conv_objs= gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else - gentop="$output_objdir/${obj}x" + gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience @@ -8651,12 +10149,12 @@ fi # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs - output="$obj" + output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. @@ -8668,7 +10166,7 @@ exit $EXIT_SUCCESS fi - if test "$build_libtool_libs" != yes; then + test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi @@ -8678,12 +10176,12 @@ # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS - fi + } - if test -n "$pic_flag" || test "$pic_mode" != default; then + if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" - output="$libobj" + output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi @@ -8700,16 +10198,14 @@ output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" + func_warning "'-version-info' is ignored for programs" test -n "$release" && \ - func_warning "\`-release' is ignored for programs" + func_warning "'-release' is ignored for programs" - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) @@ -8723,11 +10219,11 @@ *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then + if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" ;; esac fi @@ -8763,7 +10259,7 @@ *) func_append new_libs " $deplib" ;; esac done - compile_deplibs="$new_libs" + compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" @@ -8787,7 +10283,7 @@ if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" + hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -8810,7 +10306,7 @@ fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; @@ -8827,10 +10323,10 @@ # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" + libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi - compile_rpath="$rpath" + compile_rpath=$rpath rpath= hardcode_libdirs= @@ -8838,7 +10334,7 @@ if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" + hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -8863,45 +10359,43 @@ # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" + libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi - finalize_rpath="$rpath" + finalize_rpath=$rpath - if test -n "$libobjs" && test "$build_old_libs" = yes; then + if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi - wrappers_required=yes + wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no + wrappers_required=false ;; *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi + test yes = "$build_libtool_libs" || wrappers_required=false ;; *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false fi ;; esac - if test "$wrappers_required" = no; then + $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" + link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 @@ -8914,12 +10408,12 @@ fi # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status - fi + } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" @@ -8949,9 +10443,9 @@ fi fi - if test "$no_install" = yes; then + if test yes = "$no_install"; then # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" + link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. @@ -8968,27 +10462,28 @@ exit $EXIT_SUCCESS fi - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` @@ -9045,8 +10540,8 @@ func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 @@ -9067,7 +10562,7 @@ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then + if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result @@ -9090,25 +10585,27 @@ # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience build_libtool_libs=no - else + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" + gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs @@ -9116,13 +10613,13 @@ fi # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" + gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles @@ -9143,7 +10640,7 @@ : else echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" + gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs @@ -9152,7 +10649,7 @@ for obj in $save_oldobjs do func_basename "$obj" - objbase="$func_basename_result" + objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) @@ -9221,18 +10718,18 @@ else # the above command should be used before it gets too long oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then + if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist - if test "X$oldobjs" = "X" ; then + if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" @@ -9249,7 +10746,7 @@ case $output in *.la) old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" + test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior @@ -9264,31 +10761,31 @@ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then + if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do - if test "$installed" = yes; then + if test yes = "$installed"; then if test -z "$install_libdir"; then break fi - output="$output_objdir/$outputname"i + output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" - name="$func_basename_result" + name=$func_basename_result func_resolve_sysroot "$deplib" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" + func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) @@ -9304,23 +10801,23 @@ *) func_append newdependency_libs " $deplib" ;; esac done - dependency_libs="$newdependency_libs" + dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" + func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done - dlfiles="$newdlfiles" + dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in @@ -9330,34 +10827,34 @@ # didn't already link the preopened objects directly into # the library: func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" + func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done - dlprefiles="$newdlprefiles" + dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done - dlfiles="$newdlfiles" + dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done - dlprefiles="$newdlprefiles" + dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin @@ -9373,10 +10870,9 @@ case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then + if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname + tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname @@ -9385,7 +10881,7 @@ esac $ECHO > $output "\ # $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. @@ -9399,7 +10895,7 @@ # The name of the static archive. old_library='$old_library' -# Linker flags that can not go in dependency_libs. +# Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. @@ -9425,7 +10921,7 @@ # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi @@ -9440,27 +10936,29 @@ exit $EXIT_SUCCESS } -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi # func_mode_uninstall arg... func_mode_uninstall () { - $opt_debug - RM="$nonopt" + $debug_cmd + + RM=$nonopt files= - rmforce= + rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. - libtool_install_magic="$magic" + libtool_install_magic=$magic for arg do case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; + -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac @@ -9473,18 +10971,18 @@ for file in $files; do func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir else - odir="$dir/$objdir" + odir=$dir/$objdir fi func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then + if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; @@ -9499,11 +10997,11 @@ elif test -d "$file"; then exit_status=1 continue - elif test "$rmforce" = yes; then + elif $rmforce; then continue fi - rmfiles="$file" + rmfiles=$file case $name in *.la) @@ -9517,7 +11015,7 @@ done test -n "$old_library" && func_append rmfiles " $odir/$old_library" - case "$opt_mode" in + case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; @@ -9528,12 +11026,12 @@ uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; @@ -9549,21 +11047,19 @@ func_source $dir/$name # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then + if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then + if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test "$opt_mode" = clean ; then + if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) @@ -9590,12 +11086,12 @@ # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" fi fi fi @@ -9604,7 +11100,7 @@ func_show_eval "$RM $rmfiles" 'exit_status=1' done - # Try to remove the ${objdir}s in the directories where we deleted files + # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" @@ -9614,16 +11110,17 @@ exit $exit_status } -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi test -z "$opt_mode" && { - help="$generic_help" + help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" + func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" @@ -9634,7 +11131,7 @@ # The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting +# where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support @@ -9657,5 +11154,3 @@ # mode:shell-script # sh-indentation:2 # End: -# vi:sw=2 - diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_append_compile_flags.m4 libmicrohttpd-0.9.55/m4/ax_append_compile_flags.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_append_compile_flags.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_append_compile_flags.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,10 +1,10 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html -# =========================================================================== +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# ============================================================================ # # SYNOPSIS # -# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # @@ -20,6 +20,8 @@ # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# # NOTE: This macro depends on the AX_APPEND_FLAG and # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with # AX_APPEND_LINK_FLAGS. @@ -39,7 +41,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -54,12 +56,12 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 4 +#serial 6 AC_DEFUN([AX_APPEND_COMPILE_FLAGS], [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) for flag in $1; do - AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3]) + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) done ])dnl AX_APPEND_COMPILE_FLAGS diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_append_flag.m4 libmicrohttpd-0.9.55/m4/ax_append_flag.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_append_flag.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_append_flag.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html # =========================================================================== # # SYNOPSIS @@ -34,7 +34,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -49,21 +49,23 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 2 +#serial 7 AC_DEFUN([AX_APPEND_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl -AS_VAR_SET_IF(FLAGS, - [case " AS_VAR_GET(FLAGS) " in - *" $1 "*) - AC_RUN_LOG([: FLAGS already contains $1]) - ;; - *) - AC_RUN_LOG([: FLAGS="$FLAGS $1"]) - AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) - ;; - esac], - [AS_VAR_SET(FLAGS,["$1"])]) +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_APPEND_FLAG diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_check_compile_flag.m4 libmicrohttpd-0.9.55/m4/ax_check_compile_flag.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_check_compile_flag.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_check_compile_flag.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS @@ -40,7 +40,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -55,10 +55,10 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 3 +#serial 5 AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS @@ -67,7 +67,7 @@ [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], +AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_check_link_flag.m4 libmicrohttpd-0.9.55/m4/ax_check_link_flag.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_check_link_flag.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_check_link_flag.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html # =========================================================================== # # SYNOPSIS @@ -40,7 +40,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -55,10 +55,11 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 3 +#serial 5 AC_DEFUN([AX_CHECK_LINK_FLAG], -[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $4 $1" @@ -66,7 +67,7 @@ [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) LDFLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], +AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_check_openssl.m4 libmicrohttpd-0.9.55/m4/ax_check_openssl.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_check_openssl.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_check_openssl.m4 1970-01-01 01:00:00.000000000 +0100 @@ -1,124 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]]) -# -# DESCRIPTION -# -# Look for OpenSSL in a number of default spots, or in a user-selected -# spot (via --with-openssl). Sets -# -# OPENSSL_INCLUDES to the include directives required -# OPENSSL_LIBS to the -l directives required -# OPENSSL_LDFLAGS to the -L or -R flags required -# -# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately -# -# This macro sets OPENSSL_INCLUDES such that source files should use the -# openssl/ directory in include directives: -# -# #include -# -# LICENSE -# -# Copyright (c) 2009,2010 Zmanda Inc. -# Copyright (c) 2009,2010 Dustin J. Mitchell -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 8 - -AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL]) -AC_DEFUN([AX_CHECK_OPENSSL], [ - found=false - AC_ARG_WITH([openssl], - [AS_HELP_STRING([--with-openssl=DIR], - [root of the OpenSSL directory])], - [ - case "$withval" in - "" | y | ye | yes | n | no) - AC_MSG_ERROR([Invalid --with-openssl value]) - ;; - *) ssldirs="$withval" - ;; - esac - ], [ - # if pkg-config is installed and openssl has installed a .pc file, - # then use that information and don't search ssldirs - AC_PATH_PROG([PKG_CONFIG], [pkg-config]) - if test x"$PKG_CONFIG" != x""; then - OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null` - if test $? = 0; then - OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null` - OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null` - found=true - fi - fi - - # no such luck; use some default ssldirs - if ! $found; then - ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr" - fi - ] - ) - - - # note that we #include , so the OpenSSL headers have to be in - # an 'openssl' subdirectory - - if ! $found; then - OPENSSL_INCLUDES= - for ssldir in $ssldirs; do - AC_MSG_CHECKING([for openssl/ssl.h in $ssldir]) - if test -f "$ssldir/include/openssl/ssl.h"; then - OPENSSL_INCLUDES="-I$ssldir/include" - OPENSSL_LDFLAGS="-L$ssldir/lib" - OPENSSL_LIBS="-lssl -lcrypto" - found=true - AC_MSG_RESULT([yes]) - break - else - AC_MSG_RESULT([no]) - fi - done - - # if the file wasn't found, well, go ahead and try the link anyway -- maybe - # it will just work! - fi - - # try the preprocessor and linker with our new flags, - # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS - - AC_MSG_CHECKING([whether compiling and linking against OpenSSL works]) - echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \ - "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD - - save_LIBS="$LIBS" - save_LDFLAGS="$LDFLAGS" - save_CPPFLAGS="$CPPFLAGS" - LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" - LIBS="$OPENSSL_LIBS $LIBS" - CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([#include ], [SSL_new(NULL)])], - [ - AC_MSG_RESULT([yes]) - $1 - ], [ - AC_MSG_RESULT([no]) - $2 - ]) - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - - AC_SUBST([OPENSSL_INCLUDES]) - AC_SUBST([OPENSSL_LIBS]) - AC_SUBST([OPENSSL_LDFLAGS]) -]) diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_count_cpus.m4 libmicrohttpd-0.9.55/m4/ax_count_cpus.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_count_cpus.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_count_cpus.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,21 +1,24 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_count_cpus.html +# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html # =========================================================================== # # SYNOPSIS # -# AX_COUNT_CPUS +# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) # # DESCRIPTION # -# Attempt to count the number of processors present on the machine. If the -# detection fails, then a value of 1 is assumed. -# -# The value is placed in the CPU_COUNT variable. +# Attempt to count the number of logical processor cores (including +# virtual and HT cores) currently available to use on the machine and +# place detected value in CPU_COUNT variable. +# +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The +# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. # # LICENSE # -# Copyright (c) 2014 Karlson2k (Evgeny Grin) +# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) # Copyright (c) 2012 Brian Aker # Copyright (c) 2008 Michael Paul Bailey # Copyright (c) 2008 Christophe Tournayre @@ -25,42 +28,74 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 10 +#serial 22 - AC_DEFUN([AX_COUNT_CPUS],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_PROG_EGREP]) + AC_DEFUN([AX_COUNT_CPUS],[dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_EGREP])dnl AC_MSG_CHECKING([the number of available CPUs]) CPU_COUNT="0" - AS_CASE([$host_os],[ - *darwin*],[ - AS_IF([test -x /usr/sbin/sysctl],[ - sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` - AS_IF([test sysctl_a],[ - CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` - ]) - ])],[ - *linux*],[ - AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ - AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ - CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` - ]) - ])],[ - *mingw*],[ - AS_IF([test -n "$NUMBER_OF_PROCESSORS"],[ - CPU_COUNT="$NUMBER_OF_PROCESSORS" - ])],[ - *cygwin*],[ - AS_IF([test -n "$NUMBER_OF_PROCESSORS"],[ - CPU_COUNT="$NUMBER_OF_PROCESSORS" - ]) - ]) - - AS_IF([test "x$CPU_COUNT" = "x0"],[ - CPU_COUNT="1" - AC_MSG_RESULT( [unable to detect (assuming 1)] ) - ],[ - AC_MSG_RESULT( $CPU_COUNT ) - ]) - ]) + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl + [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl + )dnl + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl + [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl + [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl + [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl + [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl + )dnl + ])dnl + + AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl + AC_MSG_RESULT([[$CPU_COUNT]]) + m4_ifvaln([$1],[$1],)dnl + ],[dnl + m4_ifval([$2],[dnl + AS_UNSET([[CPU_COUNT]]) + AC_MSG_RESULT([[unable to detect]]) + $2 + ], [dnl + CPU_COUNT="1" + AC_MSG_RESULT([[unable to detect (assuming 1)]]) + ])dnl + ])dnl + ])dnl diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_have_epoll.m4 libmicrohttpd-0.9.55/m4/ax_have_epoll.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_have_epoll.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_have_epoll.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_have_epoll.html +# https://www.gnu.org/software/autoconf-archive/ax_have_epoll.html # =========================================================================== # # SYNOPSIS @@ -42,7 +42,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 10 +#serial 11 AC_DEFUN([AX_HAVE_EPOLL], [dnl ax_have_epoll_cppflags="${CPPFLAGS}" diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_pthread.m4 libmicrohttpd-0.9.55/m4/ax_pthread.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_pthread.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_pthread.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS @@ -19,10 +19,10 @@ # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. e.g. you should link with +# but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # -# If you are only building threads programs, you may wish to use these +# If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" @@ -30,8 +30,8 @@ # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name -# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with @@ -67,7 +67,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -82,35 +82,40 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 21 +#serial 24 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). +# requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) AC_MSG_RESULT([$ax_pthread_ok]) - if test x"$ax_pthread_ok" = xno; then + if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different @@ -123,7 +128,7 @@ # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: @@ -132,82 +137,225 @@ # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) -case ${host_os} in +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" ;; - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" ;; esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. - -AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], - [AC_MSG_RESULT([yes])], - [ax_pthread_extra_flags= - AC_MSG_RESULT([no])]) -CFLAGS="$save_CFLAGS" +fi # $ax_pthread_clang = yes -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do - case $flag in + case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - if test x"$ax_pthread_config" = xno; then continue; fi + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we @@ -218,7 +366,11 @@ # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; @@ -227,16 +379,14 @@ pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) + [ax_pthread_ok=yes], + []) - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = xyes; then - break; - fi + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" @@ -244,71 +394,74 @@ fi # Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $attr; return attr /* ; */])], - [attr_name=$attr; break], - []) - done - AC_MSG_RESULT([$attr_name]) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - AC_MSG_RESULT([$flag]) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then + if test "x$GCC" != "xyes"; then case $host_os in aix*) AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) ;; esac fi @@ -321,7 +474,7 @@ AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then +if test "x$ax_pthread_ok" = "xyes"; then ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ax_require_defined.m4 libmicrohttpd-0.9.55/m4/ax_require_defined.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ax_require_defined.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/ax_require_defined.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html # =========================================================================== # # SYNOPSIS @@ -30,7 +30,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 1 +#serial 2 AC_DEFUN([AX_REQUIRE_DEFINED], [dnl m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) diff -Nru libmicrohttpd-0.9.44+dfsg/m4/libcurl.m4 libmicrohttpd-0.9.55/m4/libcurl.m4 --- libmicrohttpd-0.9.44+dfsg/m4/libcurl.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/libcurl.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,3 +1,24 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2006, David Shaw +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], # [ACTION-IF-YES], [ACTION-IF-NO]) # ---------------------------------------------------------- @@ -61,7 +82,7 @@ AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) AC_ARG_WITH(libcurl, - AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), + AS_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) if test "$_libcurl_with" != "no" ; then @@ -153,11 +174,11 @@ curl_easy_setopt(NULL,CURLOPT_URL,NULL); x=CURL_ERROR_SIZE; x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_FILE; +x=CURLOPT_WRITEDATA; x=CURLOPT_ERRORBUFFER; x=CURLOPT_STDERR; x=CURLOPT_VERBOSE; -if (x) ; +if (x) {;} ]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) CPPFLAGS=$_libcurl_save_cppflags @@ -201,8 +222,6 @@ # protocols are available _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - test -z "$_libcurl_version" && _libcurl_version=0 - if test x$libcurl_feature_SSL = xyes ; then _libcurl_protocols="$_libcurl_protocols HTTPS" diff -Nru libmicrohttpd-0.9.44+dfsg/m4/libgcrypt.m4 libmicrohttpd-0.9.55/m4/libgcrypt.m4 --- libmicrohttpd-0.9.44+dfsg/m4/libgcrypt.m4 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/libgcrypt.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,47 +1,62 @@ -dnl Autoconf macros for libgcrypt -dnl Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc. -dnl Copyright (C) 2014 Karlson2k (Evgeny Grin) -dnl -dnl This file is free software; as a special exception the author gives -dnl unlimited permission to copy and/or distribute it, with or without -dnl modifications, as long as this notice is preserved. -dnl -dnl This file is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# libgcrypt.m4 - Autoconf macros to detect libgcrypt +# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Last-changed: 2014-10-02 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. -dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed +dnl MINIMUM-VERSION is a string with the version number optionalliy prefixed dnl with the API version to also check the API compatibility. Example: -dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed +dnl a MINIMUM-VERSION of 1:1.2.5 won't pass the test unless the installed dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using -dnl this features allows to prevent build against newer versions of libgcrypt +dnl this feature prevents building against newer versions of libgcrypt dnl with a changed API. dnl -dnl Updated by Karlson2k to be more tolerant to host tools variations. +dnl If a prefix option is not used, the config script is first +dnl searched in $SYSROOT/bin and then along $PATH. If the used +dnl config script does not match the host specification the script +dnl is added to the gpg_config_script_warn variable. dnl AC_DEFUN([AM_PATH_LIBGCRYPT], [ AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_PROG_GREP]) - AC_REQUIRE([AC_PROG_SED]) AC_ARG_WITH(libgcrypt-prefix, AC_HELP_STRING([--with-libgcrypt-prefix=PFX], [prefix where LIBGCRYPT is installed (optional)]), libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") - if test x$libgcrypt_config_prefix != x ; then - if test x${LIBGCRYPT_CONFIG+set} != xset ; then - LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config + if test x"${LIBGCRYPT_CONFIG}" = x ; then + if test x"${libgcrypt_config_prefix}" != x ; then + LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac fi fi - AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) + AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) tmp=ifelse([$1], ,1:1.2.0,$1) - if echo "$tmp" | $GREP ':' >/dev/null 2>/dev/null ; then - req_libgcrypt_api=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\1/'` - min_libgcrypt_version=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\2/'` + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_libgcrypt_api=0 min_libgcrypt_version="$tmp" @@ -51,18 +66,18 @@ ok=no if test "$LIBGCRYPT_CONFIG" != "no" ; then req_major=`echo $min_libgcrypt_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_libgcrypt_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_libgcrypt_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` major=`echo $libgcrypt_config_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` minor=`echo $libgcrypt_config_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` micro=`echo $libgcrypt_config_version | \ - $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` if test "$major" -gt "$req_major"; then ok=yes else @@ -113,8 +128,9 @@ *** built for $libgcrypt_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libgcrypt-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***]]) + gpg_config_script_warn="$gpg_config_script_warn libgcrypt" fi fi else diff -Nru libmicrohttpd-0.9.44+dfsg/m4/libtool.m4 libmicrohttpd-0.9.55/m4/libtool.m4 --- libmicrohttpd-0.9.44+dfsg/m4/libtool.m4 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/libtool.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,8 +1,6 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -10,36 +8,30 @@ # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. # -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. # -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# along with this program. If not, see . ]) -# serial 57 LT_INIT +# serial 58 LT_INIT # LT_PREREQ(VERSION) @@ -67,7 +59,7 @@ # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl @@ -91,7 +83,7 @@ _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" +LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' @@ -111,26 +103,43 @@ dnl AC_DEFUN([AM_PROG_LIBTOOL], []) +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + # _LT_CC_BASENAME(CC) # ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} @@ -177,15 +186,16 @@ m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our +# See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then +if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) -if test -n "${ZSH_VERSION+set}" ; then +if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi @@ -198,7 +208,7 @@ # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then + if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -209,14 +219,14 @@ ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except MSVC, +# All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a -with_gnu_ld="$lt_cv_prog_gnu_ld" +with_gnu_ld=$lt_cv_prog_gnu_ld -old_CC="$CC" -old_CFLAGS="$CFLAGS" +old_CC=$CC +old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc @@ -269,14 +279,14 @@ # _LT_PROG_LTMAIN # --------------- -# Note that this code is called both from `configure', and `config.status' +# Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" +ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN @@ -286,7 +296,7 @@ # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' +# in macros and then make a single call at the end using the 'libtool' # label. @@ -421,8 +431,8 @@ # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) @@ -446,7 +456,7 @@ # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl +available_tags='_LT_TAGS'dnl ]) @@ -474,7 +484,7 @@ # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], @@ -500,8 +510,8 @@ # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], @@ -547,7 +557,7 @@ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -560,7 +570,7 @@ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -576,7 +586,7 @@ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this +# '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). @@ -598,7 +608,7 @@ _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl +test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT @@ -621,7 +631,7 @@ } >&AS_MESSAGE_LOG_FD lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, +'$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. @@ -643,7 +653,7 @@ This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." -while test $[#] != 0 +while test 0 != $[#] do case $[1] in --version | --v* | -V ) @@ -656,10 +666,10 @@ lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; +Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; +Try '$[0] --help' for more information.]) ;; esac shift done @@ -685,7 +695,7 @@ # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: -test "$silent" = yes && +test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false @@ -705,27 +715,30 @@ _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our + # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then + if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi - cfgfile="${ofile}T" + cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. -# + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + _LT_COPYING _LT_LIBTOOL_TAGS +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS @@ -733,13 +746,24 @@ _LT_EOF + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then +if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -756,8 +780,6 @@ sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) - _LT_PROG_REPLACE_SHELLFNS - mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -775,7 +797,6 @@ [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS @@ -974,7 +995,7 @@ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then + if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the @@ -992,7 +1013,7 @@ cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -1010,7 +1031,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], @@ -1032,7 +1053,7 @@ _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -1042,32 +1063,32 @@ ]) case $host_os in rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then + if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -1087,29 +1108,29 @@ _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; + ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac - if test "$_lt_dar_can_shared" = "yes"; then + if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else @@ -1129,7 +1150,7 @@ # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then +if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], @@ -1147,7 +1168,7 @@ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) @@ -1167,8 +1188,8 @@ # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO @@ -1196,10 +1217,10 @@ # Invoke $ECHO with all args, space-separated. func_echo_all () { - $ECHO "$*" + $ECHO "$*" } -case "$ECHO" in +case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; @@ -1225,16 +1246,17 @@ AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= -case ${with_sysroot} in #( +case $with_sysroot in #( yes) - if test "$GCC" = yes; then + if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( @@ -1244,14 +1266,14 @@ no|'') ;; #( *) - AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) +[dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- @@ -1259,31 +1281,33 @@ [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes +test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) - HPUX_IA64_MODE="32" + HPUX_IA64_MODE=32 ;; *ELF-64*) - HPUX_IA64_MODE="64" + HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then + if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" @@ -1312,9 +1336,46 @@ rm -rf conftest* ;; +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in @@ -1333,10 +1394,10 @@ ;; esac ;; - powerpc64le-*) + powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; - powerpc64-*) + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -1355,10 +1416,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*) + powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; - powerpc-*) + powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -1376,19 +1437,20 @@ *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" + SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then + if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" + CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) - # Find out which ABI we are using. + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in @@ -1396,7 +1458,7 @@ case $lt_cv_prog_gnu_ld in yes*) case $host in - i?86-*-solaris*) + i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) @@ -1405,7 +1467,7 @@ esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" + LD=${LD-ld}_sol2 fi ;; *) @@ -1421,7 +1483,7 @@ ;; esac -need_locks="$enable_libtool_lock" +need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK @@ -1440,11 +1502,11 @@ [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then + if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then + if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi @@ -1452,7 +1514,7 @@ ]) ]) -if test "x$lt_cv_ar_at_file" = xno; then +if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file @@ -1483,7 +1545,7 @@ if test -n "$RANLIB"; then case $host_os in - openbsd*) + bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) @@ -1519,7 +1581,7 @@ [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -1546,7 +1608,7 @@ $RM conftest* ]) -if test x"[$]$2" = xyes; then +if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) @@ -1568,7 +1630,7 @@ m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -1587,10 +1649,10 @@ fi fi $RM -r conftest* - LDFLAGS="$save_LDFLAGS" + LDFLAGS=$save_LDFLAGS ]) -if test x"[$]$2" = xyes; then +if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) @@ -1611,7 +1673,7 @@ AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 - teststring="ABCD" + teststring=ABCD case $build_os in msdosdjgpp*) @@ -1651,7 +1713,7 @@ lt_cv_sys_max_cmd_len=8192; ;; - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -1702,22 +1764,22 @@ *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do + for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough + test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring @@ -1733,7 +1795,7 @@ ;; esac ]) -if test -n $lt_cv_sys_max_cmd_len ; then +if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) @@ -1761,7 +1823,7 @@ # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : +if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -1808,9 +1870,9 @@ # endif #endif -/* When -fvisbility=hidden is used, assume the code has been annotated +/* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -1836,7 +1898,7 @@ return status; }] _LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in @@ -1857,7 +1919,7 @@ # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then +if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown @@ -1867,44 +1929,52 @@ case $host_os in beos*) - lt_cv_dlopen="load_add_on" + lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) - lt_cv_dlopen="dlopen" + lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) - # if libdl is installed we need to link against it + # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + *) AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], + [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], + [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) @@ -1913,21 +1983,21 @@ ;; esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else + if test no = "$lt_cv_dlopen"; then enable_dlopen=no + else + enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS="$LIBS" + save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], @@ -1937,7 +2007,7 @@ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) - if test "x$lt_cv_dlopen_self" = xyes; then + if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl @@ -1947,9 +2017,9 @@ ]) fi - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS ;; esac @@ -2041,8 +2111,8 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -2052,8 +2122,8 @@ ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else @@ -2080,8 +2150,8 @@ _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR @@ -2093,15 +2163,15 @@ _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else @@ -2115,12 +2185,12 @@ fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi @@ -2144,7 +2214,7 @@ # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) - if test -n "$STRIP" ; then + if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) @@ -2162,6 +2232,47 @@ ])# _LT_CMD_STRIPLIB +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics @@ -2172,17 +2283,18 @@ m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ -if test "$GCC" = yes; then +if test yes = "$GCC"; then case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in @@ -2198,28 +2310,35 @@ ;; esac # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. + # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; + lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } @@ -2233,7 +2352,7 @@ # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else @@ -2242,7 +2361,7 @@ library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" +shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -2259,14 +2378,17 @@ # flags to be left without arguments need_version=unknown +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) @@ -2274,41 +2396,91 @@ need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac shlibpath_var=LIBPATH fi ;; @@ -2318,18 +2490,18 @@ powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -2337,8 +2509,8 @@ bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" @@ -2350,7 +2522,7 @@ cygwin* | mingw* | pw32* | cegcc*) version_type=windows - shrext_cmds=".dll" + shrext_cmds=.dll need_version=no need_lib_prefix=no @@ -2359,8 +2531,8 @@ # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ @@ -2376,17 +2548,17 @@ case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' @@ -2395,8 +2567,8 @@ *,cl*) # Native MSVC libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' case $build_os in mingw*) @@ -2423,7 +2595,7 @@ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) - sys_lib_search_path_spec="$LIB" + sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` @@ -2436,8 +2608,8 @@ esac # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' @@ -2450,7 +2622,7 @@ *) # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac @@ -2463,8 +2635,8 @@ version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' @@ -2477,8 +2649,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2496,12 +2668,13 @@ version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac @@ -2531,10 +2704,10 @@ need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes + shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -2552,14 +2725,15 @@ dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -2567,8 +2741,8 @@ dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; @@ -2577,8 +2751,8 @@ dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... @@ -2591,8 +2765,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2603,7 +2777,7 @@ case $host_os in nonstopux*) version_type=nonstopux ;; *) - if test "$lt_cv_prog_gnu_ld" = yes; then + if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix @@ -2611,8 +2785,8 @@ esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= @@ -2631,8 +2805,8 @@ esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; @@ -2641,13 +2815,33 @@ dynamic_linker=no ;; +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2672,7 +2866,12 @@ # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -2704,12 +2903,12 @@ need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2719,7 +2918,7 @@ newsos6) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2728,58 +2927,68 @@ version_type=qnx need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; -openbsd*) +openbsd* | bitrig*) version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" + sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no else - shlibpath_overrides_runpath=yes + need_version=yes fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' - shrext_cmds=".dll" + version_type=windows + shrext_cmds=.dll + need_version=no need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) @@ -2790,8 +2999,8 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -2801,11 +3010,11 @@ sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes @@ -2813,8 +3022,8 @@ sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -2835,24 +3044,24 @@ ;; sysv4*MP*) - if test -d /usr/nec ;then + if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf + version_type=sco need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' @@ -2870,7 +3079,7 @@ version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes @@ -2878,8 +3087,8 @@ uts4*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2888,20 +3097,30 @@ ;; esac AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no +test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then +if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) @@ -2934,39 +3153,41 @@ [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- -# find a file program which can recognize shared library +# find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -2989,11 +3210,11 @@ break fi done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else @@ -3011,7 +3232,7 @@ # _LT_PATH_MAGIC # -------------- -# find a file program which can recognize a shared library +# find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then @@ -3038,16 +3259,16 @@ AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], + [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld -if test "$GCC" = yes; then +if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw + # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; @@ -3061,7 +3282,7 @@ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done - test -z "$LD" && LD="$ac_prog" + test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. @@ -3072,37 +3293,37 @@ with_gnu_ld=unknown ;; esac -elif test "$with_gnu_ld" = yes; then +elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" + lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies @@ -3188,13 +3446,13 @@ # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. +# 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) @@ -3221,8 +3479,7 @@ # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -3318,8 +3575,8 @@ lt_cv_deplibs_check_method=pass_all ;; -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' @@ -3372,6 +3629,9 @@ tpf*) lt_cv_deplibs_check_method=pass_all ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; esac ]) @@ -3412,33 +3672,38 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. - lt_cv_path_NM="$NM" + lt_cv_path_NM=$NM else - lt_nm_to_check="${ac_tool_prefix}nm" + lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" - break + break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" - break + break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but @@ -3449,21 +3714,21 @@ esac fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) - DUMPBIN="$DUMPBIN -symbols" + DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: @@ -3471,8 +3736,8 @@ esac fi AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" + if test : != "$DUMPBIN"; then + NM=$DUMPBIN fi fi test -z "$NM" && NM=nm @@ -3518,8 +3783,8 @@ case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib @@ -3531,7 +3796,7 @@ ;; *) # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" + lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) @@ -3558,13 +3823,28 @@ lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then +if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + # LT_LIB_M # -------- # check for math library @@ -3576,11 +3856,11 @@ # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) - AC_CHECK_LIB(m, cos, LIBM="-lm") + AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) @@ -3599,7 +3879,7 @@ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -if test "$GCC" = yes; then +if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; @@ -3651,7 +3931,7 @@ symcode='[[ABCDGISTW]]' ;; hpux*) - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; @@ -3684,14 +3964,44 @@ symcode='[[ABCDGIRSTW]]' ;; esac +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -3709,21 +4019,24 @@ # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" @@ -3763,11 +4076,11 @@ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST -#elif defined(__osf__) +#elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else @@ -3793,7 +4106,7 @@ { { "@PROGRAM@", (void *) 0 }, _LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; @@ -3813,9 +4126,9 @@ mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" + LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS @@ -3836,7 +4149,7 @@ rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then + if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= @@ -3863,12 +4176,16 @@ [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -3884,17 +4201,18 @@ m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then + if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) @@ -3905,8 +4223,8 @@ ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -3922,6 +4240,11 @@ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -3971,7 +4294,7 @@ case $host_os in aix[[4-9]]*) # All AIX code is PIC. - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else @@ -4012,14 +4335,14 @@ case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default @@ -4056,7 +4379,7 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. + # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' @@ -4201,17 +4524,18 @@ fi ], [ - if test "$GCC" = yes; then + if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) @@ -4222,8 +4546,8 @@ ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -4240,6 +4564,11 @@ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac ;; darwin* | rhapsody*) @@ -4310,7 +4639,7 @@ case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else @@ -4318,11 +4647,30 @@ fi ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac ;; hpux9* | hpux10* | hpux11*) @@ -4338,7 +4686,7 @@ ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) @@ -4349,7 +4697,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. + # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' @@ -4374,6 +4722,12 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -4471,7 +4825,7 @@ ;; sysv4*MP*) - if test -d /usr/nec ;then + if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi @@ -4500,7 +4854,7 @@ fi ]) case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: + # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; @@ -4566,17 +4920,21 @@ case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in @@ -4625,9 +4983,9 @@ # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if @@ -4643,7 +5001,7 @@ # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. - if test "$GCC" != yes; then + if test yes != "$GCC"; then with_gnu_ld=no fi ;; @@ -4651,7 +5009,7 @@ # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; - openbsd*) + openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) @@ -4664,7 +5022,7 @@ # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then + if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility @@ -4686,24 +5044,24 @@ esac fi - if test "$lt_use_gnu_ld_interface" = yes; then + if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' + wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no - case `$LD -v 2>&1` in + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -4716,7 +5074,7 @@ case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then + if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 @@ -4735,7 +5093,7 @@ case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) @@ -4751,7 +5109,7 @@ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4761,7 +5119,7 @@ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -4769,61 +5127,89 @@ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no - if test "$host_os" = linux-dietlibc; then + if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no + && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -4834,42 +5220,47 @@ lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then + if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then + if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -4883,8 +5274,8 @@ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -4902,8 +5293,8 @@ _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4915,7 +5306,7 @@ _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify @@ -4930,9 +5321,9 @@ # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -4949,15 +5340,15 @@ *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= @@ -4973,7 +5364,7 @@ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported @@ -4981,34 +5372,57 @@ ;; aix[[4-9]]*) - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag="" + no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi ;; esac @@ -5027,13 +5441,21 @@ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac - if test "$GCC" = yes; then + if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` + collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -5052,62 +5474,80 @@ ;; esac shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' fi - _LT_TAGVAR(link_all_deplibs, $1)=no + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' else # not using gcc - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' else - shared_flag='${wl}-bM:SRE' + shared_flag='$wl-bM:SRE' fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' fi fi - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; @@ -5116,7 +5556,7 @@ case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) @@ -5146,16 +5586,17 @@ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" + shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -5164,18 +5605,18 @@ # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # Assume MSVC wrapper @@ -5184,7 +5625,7 @@ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" + shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -5234,33 +5675,33 @@ ;; hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes @@ -5268,25 +5709,25 @@ ;; hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then + if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ @@ -5294,14 +5735,14 @@ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in @@ -5312,7 +5753,7 @@ *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. @@ -5323,16 +5764,16 @@ ;; irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], @@ -5345,21 +5786,32 @@ end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + _LT_TAGVAR(link_all_deplibs, $1)=no else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out @@ -5374,7 +5826,7 @@ newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; @@ -5382,27 +5834,19 @@ *nto* | *qnx*) ;; - openbsd*) + openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no @@ -5413,33 +5857,53 @@ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5450,24 +5914,24 @@ solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi @@ -5477,11 +5941,11 @@ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', + # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi @@ -5491,10 +5955,10 @@ ;; sunos4*) - if test "x$host_vendor" = xsequent; then + if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi @@ -5543,43 +6007,43 @@ ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not + # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; @@ -5594,17 +6058,17 @@ ;; esac - if test x$host_vendor = xsni; then + if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld @@ -5621,7 +6085,7 @@ # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - if test "$enable_shared" = yes && test "$GCC" = yes; then + if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. @@ -5701,12 +6165,12 @@ _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the + "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR @@ -5747,10 +6211,10 @@ # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. +# the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" +lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. @@ -5790,18 +6254,18 @@ LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB - # Report which library types will actually be built + # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no + test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test "$enable_shared" = yes && enable_static=no + test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' @@ -5809,8 +6273,12 @@ ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac fi ;; esac @@ -5818,13 +6286,13 @@ AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes + test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP -CC="$lt_save_CC" +CC=$lt_save_CC ])# _LT_LANG_C_CONFIG @@ -5832,14 +6300,14 @@ # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. +# the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes @@ -5881,7 +6349,7 @@ # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then +if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" @@ -5923,35 +6391,35 @@ if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately - if test "$GXX" = yes; then + if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi - if test "$GXX" = yes; then + if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) - wlarc='${wl}' + wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi @@ -5987,18 +6455,30 @@ _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag="" + no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in @@ -6008,6 +6488,13 @@ ;; esac done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi ;; esac @@ -6026,13 +6513,21 @@ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac - if test "$GXX" = yes; then + if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` + collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -6050,64 +6545,84 @@ fi esac shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' else # not using gcc - if test "$host_cpu" = ia64; then + if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' else - shared_flag='${wl}-bM:SRE' + shared_flag='$wl-bM:SRE' fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' fi fi - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; @@ -6117,7 +6632,7 @@ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6145,57 +6660,58 @@ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" + shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6206,6 +6722,34 @@ _LT_DARWIN_LINKER_FEATURES($1) ;; + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + dgux*) case $cc_basename in ec++*) @@ -6241,14 +6785,14 @@ ;; haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default @@ -6260,7 +6804,7 @@ _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -6269,11 +6813,11 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -6283,15 +6827,15 @@ ;; hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi @@ -6317,13 +6861,13 @@ aCC*) case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists @@ -6334,20 +6878,20 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -6362,22 +6906,22 @@ interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -6386,17 +6930,17 @@ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; @@ -6409,8 +6953,8 @@ # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -6419,10 +6963,10 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. @@ -6436,59 +6980,59 @@ # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -6502,18 +7046,18 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) @@ -6521,10 +7065,10 @@ *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on @@ -6582,22 +7126,17 @@ _LT_TAGVAR(ld_shlibs, $1)=yes ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) + openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else @@ -6613,9 +7152,9 @@ # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using @@ -6633,17 +7172,17 @@ cxx*) case $host in osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac @@ -6658,21 +7197,21 @@ # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists @@ -6718,9 +7257,9 @@ # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -6728,7 +7267,7 @@ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. + # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; @@ -6745,30 +7284,30 @@ ;; gcx*) # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else - # g++ 2.7 appears to require `-G' NOT `-shared' on this + # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -6776,11 +7315,11 @@ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi @@ -6789,52 +7328,52 @@ ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not + # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" + '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; @@ -6865,10 +7404,10 @@ esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -6895,7 +7434,7 @@ lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes +fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG @@ -6917,13 +7456,14 @@ AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF + # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -7007,13 +7547,13 @@ pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in + case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. - if test $p = "-L" || - test $p = "-R"; then + if test x-L = "$p" || + test x-R = "$p"; then prev=$p continue fi @@ -7029,16 +7569,16 @@ case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in + if test no = "$pre_test_object_deps_done"; then + case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being @@ -7046,9 +7586,9 @@ esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" + _LT_TAGVAR(postdeps, $1)=$prev$p else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= @@ -7063,15 +7603,15 @@ continue fi - if test "$pre_test_object_deps_done" = no; then + if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" + _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" + _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi @@ -7102,51 +7642,6 @@ _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; esac ]) @@ -7155,7 +7650,7 @@ esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) @@ -7175,10 +7670,10 @@ # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. +# to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then +if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi @@ -7215,7 +7710,7 @@ # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then +if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t @@ -7237,7 +7732,7 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. - lt_save_CC="$CC" + lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} @@ -7251,21 +7746,25 @@ AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no + test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test "$enable_shared" = yes && enable_static=no + test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac fi ;; esac @@ -7273,11 +7772,11 @@ AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes + test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7294,9 +7793,9 @@ fi # test -n "$compiler" GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG @@ -7306,11 +7805,11 @@ # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. +# to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) -if test -z "$FC" || test "X$FC" = "Xno"; then +if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi @@ -7347,7 +7846,7 @@ # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then +if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t @@ -7369,7 +7868,7 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. - lt_save_CC="$CC" + lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} @@ -7385,21 +7884,25 @@ AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no + test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test "$enable_shared" = yes && enable_static=no + test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac fi ;; esac @@ -7407,11 +7910,11 @@ AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes + test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7431,7 +7934,7 @@ GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes +fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG @@ -7441,7 +7944,7 @@ # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. +# to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE @@ -7475,7 +7978,7 @@ CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" +_LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. @@ -7512,7 +8015,7 @@ # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. +# to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE @@ -7546,7 +8049,7 @@ CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" +_LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. @@ -7583,7 +8086,7 @@ # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. +# to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE @@ -7599,7 +8102,7 @@ lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" +lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER @@ -7609,7 +8112,7 @@ _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC="$CC" +lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= @@ -7638,7 +8141,7 @@ [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) @@ -7749,7 +8252,7 @@ # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue + test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -7766,9 +8269,9 @@ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break + test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then + if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi @@ -7792,27 +8295,7 @@ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false @@ -7836,102 +8319,9 @@ ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- -# Determine which file name conversion functions should be used by +# Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], diff -Nru libmicrohttpd-0.9.44+dfsg/m4/lt~obsolete.m4 libmicrohttpd-0.9.55/m4/lt~obsolete.m4 --- libmicrohttpd-0.9.44+dfsg/m4/lt~obsolete.m4 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/lt~obsolete.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,7 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives @@ -11,7 +12,7 @@ # These exist entirely to fool aclocal when bootstrapping libtool. # -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # @@ -25,7 +26,7 @@ # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ltoptions.m4 libmicrohttpd-0.9.55/m4/ltoptions.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ltoptions.m4 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/ltoptions.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,14 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 7 ltoptions.m4 +# serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -29,7 +29,7 @@ [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl + [m4_warning([Unknown $1 option '$2'])])[]dnl ]) @@ -75,13 +75,15 @@ dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS @@ -112,7 +114,7 @@ [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) +put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -148,7 +150,7 @@ _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) +put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -157,9 +159,9 @@ # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], @@ -172,14 +174,14 @@ *) enable_shared=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) @@ -211,9 +213,9 @@ # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], @@ -226,14 +228,14 @@ *) enable_static=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) @@ -265,9 +267,9 @@ # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], @@ -280,14 +282,14 @@ *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) @@ -304,14 +306,14 @@ [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) +the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) +the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -319,11 +321,64 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + # _LT_WITH_PIC([MODE]) # -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], @@ -334,19 +389,17 @@ *) pic_mode=default # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do - IFS="$lt_save_ifs" + IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done - IFS="$lt_save_ifs" + IFS=$lt_save_ifs ;; esac], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC @@ -359,7 +412,7 @@ [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) +put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ltsugar.m4 libmicrohttpd-0.9.55/m4/ltsugar.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ltsugar.m4 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/ltsugar.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,7 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives @@ -33,7 +34,7 @@ # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. +# Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], @@ -44,7 +45,7 @@ # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different diff -Nru libmicrohttpd-0.9.44+dfsg/m4/ltversion.m4 libmicrohttpd-0.9.55/m4/ltversion.m4 --- libmicrohttpd-0.9.44+dfsg/m4/ltversion.m4 2015-10-01 21:22:13.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/ltversion.m4 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -9,15 +9,15 @@ # @configure_input@ -# serial 3337 ltversion.m4 +# serial 4179 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.2]) -m4_define([LT_PACKAGE_REVISION], [1.3337]) +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.2' -macro_revision='1.3337' +[macro_version='2.4.6' +macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff -Nru libmicrohttpd-0.9.44+dfsg/m4/Makefile.in libmicrohttpd-0.9.55/m4/Makefile.in --- libmicrohttpd-0.9.44+dfsg/m4/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/m4/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -93,7 +93,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -101,8 +100,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -157,8 +159,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -166,6 +170,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -181,9 +186,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -191,6 +193,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -205,9 +208,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -229,13 +229,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -243,6 +240,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -287,6 +285,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff -Nru libmicrohttpd-0.9.44+dfsg/m4/mhd_shutdown_socket_trigger.m4 libmicrohttpd-0.9.55/m4/mhd_shutdown_socket_trigger.m4 --- libmicrohttpd-0.9.44+dfsg/m4/mhd_shutdown_socket_trigger.m4 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/mhd_shutdown_socket_trigger.m4 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,378 @@ +# SYNOPSIS +# +# MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([ACTION-IF-TRIGGER], [ACTION-IF-NOT], +# [ACTION-IF-UNKNOWN]) +# +# DESCRIPTION +# +# Check whether shutdown of listen socket triggers waiting select(). +# If cross-compiling, result may be unknown (third action). +# Result is cached in $mhd_cv_host_shtdwn_trgr_select variable. +# +# LICENSE +# +# Copyright (c) 2017 Karlson2k (Evgeny Grin) +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl + AC_PREREQ([2.64])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AX_PTHREAD])dnl + AC_CHECK_HEADERS([sys/time.h],[AC_CHECK_FUNCS([[gettimeofday]])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([time.h],[AC_CHECK_FUNCS([[nanosleep]])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([unistd.h],[AC_CHECK_FUNCS([[usleep]])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([string.h sys/types.h sys/socket.h netinet/in.h time.h sys/select.h netinet/tcp.h],[],[], [AC_INCLUDES_DEFAULT]) + AC_CACHE_CHECK([[whether shutdown of listen socket trigger select()]], + [[mhd_cv_host_shtdwn_trgr_select]], [dnl + _MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER([[mhd_cv_host_shtdwn_trgr_select]]) + AS_VAR_IF([mhd_cv_host_shtdwn_trgr_select], [["maybe"]], + [_MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER([[mhd_cv_host_shtdwn_trgr_select]])]) + ] + ) + AS_IF([[test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]], [$1], + [[test "x$mhd_cv_host_shtdwn_trgr_select" = "xno"]], [$2], [$3]) + ] +) + +# +# _MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER(VAR) +# +# Sets VAR to 'yes', 'no' or 'maybe'. + +AC_DEFUN([_MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER],[dnl +[#] On Linux shutdown of listen socket always trigger select(). +[#] On Windows select() always ignore shutdown of listen socket. +[#] On other paltforms result may vary depending on platform version. + AS_CASE([[$host_os]], + [[linux | linux-* | *-linux | *-linux-*]], [$1='yes'], + [[mingw*]], [$1='no'], + [[cygwin* | msys*]], [$1='no'], + [[winnt* | interix*]], [$1='no'], + [[mks]], [$1='no'], + [[uwin]], [$1='no'], + [$1='maybe'] + ) + ] +) + +# +# _MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER(VAR) +# +# Sets VAR to 'yes', 'no' or 'guessing no'. + +AC_DEFUN([_MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl + AC_LANG_PUSH([C]) + MHD_CST_SAVE_CC="$CC" + MHD_CST_SAVE_CFLAGS="$CFLAGS" + MHD_CST_SAVE_LIBS="$LIBS" + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_TIME_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# ifdef HAVE_NETINET_IN_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef HAVE_NETINET_TCP_H +# include +# endif + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# define MHD_POSIX_SOCKETS 1 +#else +# include +# include +# include + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# define MHD_WINSOCK_SOCKETS 1 +#endif + +#include + + #ifndef SHUT_RD +# define SHUT_RD 0 +#endif +#ifndef SHUT_WR +# define SHUT_WR 1 +#endif +#ifndef SHUT_RDWR +# define SHUT_RDWR 2 +#endif + +#ifndef NULL +# define NULL ((void*)0) +#endif + +#ifdef HAVE_GETTIMEOFDAY +# if defined(_WIN32) && !defined(__CYGWIN__) +# undef HAVE_GETTIMEOFDAY +# endif +#endif + + +#ifdef HAVE_NANOSLEEP +static const struct timespec sm_tmout = {0, 1000}; +# define short_sleep() nanosleep(&sm_tmout, NULL) +#elif defined(HAVE_USLEEP) +# define short_sleep() usleep(1) +#else +# define short_sleep() (void)0 +#endif + +static volatile int going_select = 0; +static volatile int select_ends = 0; +static volatile int gerror = 0; +static int timeout_mils; + +#ifndef HAVE_GETTIMEOFDAY +static volatile long long select_elapsed_time = 0; + +static long long time_chk(void) +{ + long long ret = time(NULL); + if (-1 == ret) + gerror = 4; + return ret; +} +#endif + + +static void* select_thrd_func(void* param) +{ +#ifndef HAVE_GETTIMEOFDAY + long long start, stop; +#endif + fd_set rs; + struct timeval tmot = {0, 0}; + MHD_socket fd = *((MHD_socket*)param); + + FD_ZERO(&rs); + FD_SET(fd, &rs); + tmot.tv_usec = timeout_mils * 1000; +#ifndef HAVE_GETTIMEOFDAY + start = time_chk(); +#endif + going_select = 1; + if (0 > select ((int)(fd) + 1, &rs, NULL, NULL, &tmot)) + gerror = 5; +#ifndef HAVE_GETTIMEOFDAY + stop = time_chk(); + select_elapsed_time = stop - start; +#endif + select_ends = 1; + return NULL; +} + + +static MHD_socket create_socket(void) +{ return socket (AF_INET, SOCK_STREAM, 0); } + +static void close_socket(MHD_socket fd) +{ +#ifdef MHD_POSIX_SOCKETS + close(fd); +#else + closesocket(fd); +#endif +} + +static MHD_socket +create_socket_listen(int port) +{ + MHD_socket fd; + struct sockaddr_in sock_addr; + fd = create_socket(); + if (MHD_INVALID_SOCKET == fd) + return fd; + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons(port); + sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind (fd, (const struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0 || + listen(fd, SOMAXCONN) < 0) + { + close_socket(fd); + return MHD_INVALID_SOCKET; + } + return fd; +} + +#ifdef HAVE_GETTIMEOFDAY +#define diff_time(tv1, tv2) ((long long)(tv1.tv_sec-tv2.tv_sec)*10000 + (long long)(tv1.tv_usec-tv2.tv_usec)/100) +#else +#define diff_time(tv1, tv2) ((long long)(tv1-tv2)) +#endif + +static long long test_run_select(int timeout_millsec, int use_shutdown, long long delay_before_shutdown) +{ + pthread_t select_thrd; + MHD_socket fd; +#ifdef HAVE_GETTIMEOFDAY + struct timeval start, stop; +#else + long long start; +#endif + + fd = create_socket_listen(0); + if (MHD_INVALID_SOCKET == fd) + return -7; + going_select = 0; + select_ends = 0; + gerror = 0; + timeout_mils = timeout_millsec; + if (0 != pthread_create (&select_thrd, NULL, select_thrd_func, (void*)&fd)) + return -8; + while (!going_select) {short_sleep();} +#ifdef HAVE_GETTIMEOFDAY + gettimeofday (&start, NULL); +#else + start = time_chk(); +#endif + if (use_shutdown) + { +#ifdef HAVE_GETTIMEOFDAY + struct timeval current; + do {short_sleep(); gettimeofday(¤t, NULL); } while (delay_before_shutdown > diff_time(current, start)); +#else + while (delay_before_shutdown > time_chk() - start) {short_sleep();} +#endif + shutdown(fd, SHUT_RDWR); + } +#ifdef HAVE_GETTIMEOFDAY + while (!select_ends) {short_sleep();} + gettimeofday (&stop, NULL); +#endif + if (0 != pthread_join(select_thrd, NULL)) + return -9; + close_socket(fd); + if (gerror) + return -10; +#ifdef HAVE_GETTIMEOFDAY + return (long long)diff_time(stop, start); +#else + return select_elapsed_time; +#endif +} + +static int test_it(void) +{ + long long duration2; +#ifdef HAVE_GETTIMEOFDAY + long long duration0, duration1; + duration0 = test_run_select(0, 0, 0); + if (0 > duration0) + return -duration0; + + duration1 = test_run_select(50, 0, 0); + if (0 > duration1) + return -duration1 + 20; + + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 40; + + if (duration1 * 2 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 60; + if (duration1 * 2 > duration2) + return 0; + } +#else + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 80; + + if (4 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 100; + if (4 > duration2) + return 0; + } +#endif + return 1; +} + + +static int init(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + { + WSACleanup(); + return 0; + } +#endif /* MHD_WINSOCK_SOCKETS */ + return 1; +} + +static void cleanup(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ +} + +int main(void) +{ + int res; + if (!init()) + return 19; + + res = test_it(); + + cleanup(); + if (gerror) + return gerror; + + return res; +} +]])], [$1='yes'], [$1='no'], [$1='guessing no']) + CC="$MHD_CST_SAVE_CC" + CFLAGS="$MHD_CST_SAVE_CFLAGS" + LIBS="$MHD_CST_SAVE_LIBS" + AS_UNSET([[MHD_CST_SAVE_CC]]) + AS_UNSET([[MHD_CST_SAVE_CFLAGS]]) + AS_UNSET([[MHD_CST_SAVE_LIBS]]) + AC_LANG_POP([C]) + ] +) diff -Nru libmicrohttpd-0.9.44+dfsg/m4/mhd_sys_extentions.m4 libmicrohttpd-0.9.55/m4/mhd_sys_extentions.m4 --- libmicrohttpd-0.9.44+dfsg/m4/mhd_sys_extentions.m4 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/mhd_sys_extentions.m4 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,1035 @@ +# SYNOPSIS +# +# MHD_SYS_EXT([VAR-ADD-CPPFLAGS]) +# +# DESCRIPTION +# +# This macro checks system headers and add defines that enable maximum +# number of exposed system interfaces. Macro verifies that added defines +# will not break basic headers, some defines are also checked against +# real recognition by headers. +# If VAR-ADD-CPPFLAGS is specified, defines will be added to this variable +# in form suitable for CPPFLAGS. Otherwise defines will be added to +# configuration header (usually 'config.h'). +# +# Example usage: +# +# MHD_SYS_EXT +# +# or +# +# MHD_SYS_EXT([CPPFLAGS]) +# +# Macro is not enforced to be called before AC_COMPILE_IFELSE, but it +# advisable to call macro before any compile and header tests since +# additional defines can change results of those tests. +# +# Defined in command line macros are always honored and cache variables +# used in all checks so if any test will not work correctly on some +# platform, user may simply fix it by giving correct defines in CPPFLAGS +# or by giving cache variable in configure parameters, for example: +# +# ./configure CPPFLAGS='-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED' +# +# or +# +# ./configure mhd_cv_define__xopen_source_sevenh_works=no +# +# This simplify building from source on exotic platforms as patching +# of configure.ac is not required to change results of tests. +# +# LICENSE +# +# Copyright (c) 2016 Karlson2k (Evgeny Grin) +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([MHD_SYS_EXT],[dnl + AC_PREREQ([2.64])dnl for AS_VAR_IF, m4_ifnblank + AC_LANG_PUSH([C])dnl Use C language for simplicity + mhd_mse_added_exts_flags="" + mhd_mse_added_prolog="" + MHD_CHECK_DEFINED([[_XOPEN_SOURCE]], [], [dnl + AC_CACHE_CHECK([[whether predefined value of _XOPEN_SOURCE is more or equal 500]], + [[mhd_cv_macro__xopen_source_def_fiveh]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if _XOPEN_SOURCE+0 < 500 +#error Value of _XOPEN_SOURCE is less than 500 +choke me now; +#endif + ]],[[int i = 0; i++]])],dnl + [[mhd_cv_macro__xopen_source_def_fiveh="yes"]], + [[mhd_cv_macro__xopen_source_def_fiveh="no"]] + ) + ]) + AS_VAR_IF([mhd_cv_macro__xopen_source_def_fiveh], [["no"]], [dnl + _MHD_XOPEN_ADD([]) + ]) + ], + [ + dnl Some platforms (namely: Solaris) use '==' checks instead of '>=' + dnl for _XOPEN_SOURCE, resulting that unknown for platform values are + dnl interpreted as oldest and platform expose reduced number of + dnl interfaces. Next checks will ensure that platform recognise + dnl requested mode instead of blindly define high number that can + dnl be simply ignored by platform. + MHD_CHECK_ACCEPT_DEFINE([[_XOPEN_SOURCE]], [[700]], [], [dnl + AC_CACHE_CHECK([[whether _XOPEN_SOURCE with value 700 really enable POSIX.1-2008/SUSv4 features]], + [[mhd_cv_define__xopen_source_sevenh_works]], [dnl + _MHD_CHECK_XOPEN_ENABLE([[700]], [ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are avalable + * and failed if ANY feature is not avalable. */ +int main() +{ + +#ifndef stpncpy + (void) stpncpy; +#endif +#ifndef strnlen + (void) strnlen; +#endif + +#if !defined(__NetBSD__) && !defined(__OpenBSD__) +/* NetBSD and OpenBSD didn't implement wcsnlen() for some reason. */ +#ifndef wcsnlen + (void) wcsnlen; +#endif +#endif + +#ifdef __CYGWIN__ +/* The only depend function on Cygwin, but missing on some other platforms */ +#ifndef strndup + (void) strndup; +#endif +#endif + +#ifndef __sun +/* illumos forget to uncomment some _XPG7 macros. */ +#ifndef renameat + (void) renameat; +#endif + +#ifndef getline + (void) getline; +#endif +#endif /* ! __sun */ + +/* gmtime_r() becomes mandatory only in POSIX.1-2008. */ +#ifndef gmtime_r + (void) gmtime_r; +#endif + +/* unsetenv() actually defined in POSIX.1-2001 so it + * must be present with _XOPEN_SOURCE == 700 too. */ +#ifndef unsetenv + (void) unsetenv; +#endif + + return 0; +} + ]], + [[mhd_cv_define__xopen_source_sevenh_works="yes"]], + [[mhd_cv_define__xopen_source_sevenh_works="no"]] + )dnl + ])dnl + ]) + AS_IF([[test "x$mhd_cv_define__xopen_source_accepted_700" = "xyes" && + test "x$mhd_cv_define__xopen_source_sevenh_works" = "xyes"]], [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_SOURCE]], [[700]]) + ], [dnl + MHD_CHECK_ACCEPT_DEFINE([[_XOPEN_SOURCE]], [[600]], [], [dnl + AC_CACHE_CHECK([[whether _XOPEN_SOURCE with value 600 really enable POSIX.1-2001/SUSv3 features]], + [[mhd_cv_define__xopen_source_sixh_works]], [dnl + _MHD_CHECK_XOPEN_ENABLE([[600]], [ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ + +#ifndef setenv + (void) setenv; +#endif + +#ifndef __NetBSD__ +#ifndef vsscanf + (void) vsscanf; +#endif +#endif + +/* Availability of next features varies, but they all must be present + * on platform with support for _XOPEN_SOURCE = 600. */ + +/* vsnprintf() should be available with _XOPEN_SOURCE >= 500, but some platforms + * provide it only with _POSIX_C_SOURCE >= 200112 (autodefined when + * _XOPEN_SOURCE >= 600) where specification of vsnprintf() is aligned with + * ISO C99 while others platforms defined it with even earlier standards. */ +#ifndef vsnprintf + (void) vsnprintf; +#endif + +/* On platforms that prefer POSIX over X/Open, fseeko() is available + * with _POSIX_C_SOURCE >= 200112 (autodefined when _XOPEN_SOURCE >= 600). + * On other platforms it should be available with _XOPEN_SOURCE >= 500. */ +#ifndef fseeko + (void) fseeko; +#endif + +/* F_GETOWN must be defined with _XOPEN_SOURCE >= 600, but some platforms + * define it with _XOPEN_SOURCE >= 500. */ +#ifndef F_GETOWN +#error F_GETOWN is not defined +choke me now; +#endif + return 0; +} + ]], + [[mhd_cv_define__xopen_source_sixh_works="yes"]], + [[mhd_cv_define__xopen_source_sixh_works="no"]] + )dnl + ])dnl + ]) + AS_IF([[test "x$mhd_cv_define__xopen_source_accepted_600" = "xyes" && + test "x$mhd_cv_define__xopen_source_sixh_works" = "xyes"]], [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_SOURCE]], [[600]]) + ], [dnl + MHD_CHECK_ACCEPT_DEFINE([[_XOPEN_SOURCE]], [[500]], [], [dnl + AC_CACHE_CHECK([[whether _XOPEN_SOURCE with value 500 really enable SUSv2/XPG5 features]], + [mhd_cv_define__xopen_source_fiveh_works], [dnl + _MHD_CHECK_XOPEN_ENABLE([[500]], [ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ +/* It's not easy to write reliable test for _XOPEN_SOURCE = 500 as + * platforms not always precisely follow this standard and some + * functions are already deprecated in later standards. */ + +/* Availability of next features varies, but they all must be present + * on platform with correct support for _XOPEN_SOURCE = 500. */ + +/* Mandatory with _XOPEN_SOURCE >= 500 but as XSI extension available + * with much older standards. */ +#ifndef ftruncate + (void) ftruncate; +#endif + +/* Added with _XOPEN_SOURCE >= 500 but was available in some standards + * before. XSI extension. */ +#ifndef pread + (void) pread; +#endif + +#ifndef __APPLE__ +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. */ +#ifndef symlink + (void) symlink; +#endif + +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. XSI extension. */ +#ifndef strdup + (void) strdup; +#endif +#endif /* ! __APPLE__ */ + return 0; +} + ]], + [[mhd_cv_define__xopen_source_fiveh_works="yes"]], + [[mhd_cv_define__xopen_source_fiveh_works="no"]] + )dnl + ])dnl + ]) + AS_IF([[test "x$mhd_cv_define__xopen_source_accepted_500" = "xyes" && ]dnl + [test "x$mhd_cv_define__xopen_source_fiveh_works" = "xyes"]], [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_SOURCE]], [[500]]) + ], + [ + [#] Earlier standards are widely supported, so just define macros to maximum value + [#] which do not break headers. + _MHD_XOPEN_ADD([[#define _XOPEN_SOURCE 1]]) + AC_CACHE_CHECK([[whether headers accept _XOPEN_SOURCE with value 1]], + [mhd_cv_define__xopen_source_accepted_1], [dnl + AS_IF([[test "x$mhd_cv_define__xopen_source_extended_accepted" = "xyes" || ]dnl + [test "x$mhd_cv_define__xopen_version_accepted" = "xyes"]], + [[mhd_cv_define__xopen_source_accepted_1="yes"]], + [ + MHD_CHECK_BASIC_HEADERS([[#define _XOPEN_SOURCE 1]], + [[mhd_cv_define__xopen_source_accepted_1="yes"]], + [[mhd_cv_define__xopen_source_accepted_1="no"]]) + ]) + ]) + AS_VAR_IF([[mhd_cv_define__xopen_source_accepted_1]], [["yes"]], [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_SOURCE]], [[1]]) + ]) + ]) + ]) + ]) + ]) + dnl Add other extensions. + dnl Use compiler-based test for determinig target. + + dnl Always add _GNU_SOURCE if headers allow. + MHD_CHECK_DEF_AND_ACCEPT([[_GNU_SOURCE]], [], + [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_GNU_SOURCE]])]) + + dnl __BSD_VISIBLE is actually a small hack for FreeBSD. + dnl Funny that it's used in Android headers too. + AC_CACHE_CHECK([[whether to try __BSD_VISIBLE macro]], + [[mhd_cv_macro_try___bsd_visible]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__FreeBSD__) && !defined (__ANDROID__) +#error Target is not FreeBSD or Android +choke me now; +#endif + ]],[])], + [[mhd_cv_macro_try___bsd_visible="yes"]], + [[mhd_cv_macro_try___bsd_visible="no"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro_try___bsd_visible]], [["yes"]], + [dnl + AC_CACHE_CHECK([[whether __BSD_VISIBLE is already defined]], + [[mhd_cv_macro___bsd_visible_defined]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +${mhd_mse_added_prolog} +/* Warning: test with inverted logic! */ +#ifdef __BSD_VISIBLE +#error __BSD_VISIBLE is defined +choke me now; +#endif +#ifdef __ANDROID__ +/* if __BSD_VISIBLE is not defined, Android usually defines it to 1 */ +#include +#if defined(__BSD_VISIBLE) && __BSD_VISIBLE == 1 +#error __BSD_VISIBLE is autodefined by headers to value 1 +choke me now; +#endif +#endif + ]],[]) + ], + [[mhd_cv_macro___bsd_visible_defined="no"]], + [[mhd_cv_macro___bsd_visible_defined="yes"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro___bsd_visible_defined]], [["yes"]], [[:]], + [dnl + MHD_CHECK_ACCEPT_DEFINE( + [[__BSD_VISIBLE]], [], [[${mhd_mse_added_prolog}]], + [_MHD_SYS_EXT_ADD_FLAG([[__BSD_VISIBLE]])] + )dnl + ]) + ]) + + + dnl _DARWIN_C_SOURCE enables additional functionality on Darwin. + MHD_CHECK_DEFINED_MSG([[__APPLE__]], [[${mhd_mse_added_prolog}]], + [[whether to try _DARWIN_C_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_DARWIN_C_SOURCE]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_DARWIN_C_SOURCE]])] + )dnl + ]) + + dnl __EXTENSIONS__ unlocks almost all interfaces on Solaris. + MHD_CHECK_DEFINED_MSG([[__sun]], [[${mhd_mse_added_prolog}]], + [[whether to try __EXTENSIONS__ macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[__EXTENSIONS__]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[__EXTENSIONS__]])] + )dnl + ]) + + dnl _NETBSD_SOURCE switch on almost all headers definitions on NetBSD. + MHD_CHECK_DEFINED_MSG([[__NetBSD__]], [[${mhd_mse_added_prolog}]], + [[whether to try _NETBSD_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_NETBSD_SOURCE]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_NETBSD_SOURCE]])] + )dnl + ]) + + dnl _BSD_SOURCE currently used only on OpenBSD to unhide functions. + MHD_CHECK_DEFINED_MSG([[__OpenBSD__]], [[${mhd_mse_added_prolog}]], + [[whether to try _BSD_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_BSD_SOURCE]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_BSD_SOURCE]])] + )dnl + ]) + + dnl _TANDEM_SOURCE unhides most functions on NonStop OS + dnl (which comes from Tandem Computers decades ago). + MHD_CHECK_DEFINED_MSG([[__TANDEM]], [[${mhd_mse_added_prolog}]], + [[whether to try _TANDEM_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_TANDEM_SOURCE]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_TANDEM_SOURCE]])] + )dnl + ]) + + dnl _ALL_SOURCE makes visible POSIX and non-POSIX symbols + dnl on z/OS, AIX and Interix. + AC_CACHE_CHECK([[whether to try _ALL_SOURCE macro]], + [[mhd_cv_macro_try__all_source]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__TOS_MVS__) && !defined (__INTERIX) +#error Target is not z/OS, AIX or Interix +choke me now; +#endif + ]],[])], + [[mhd_cv_macro_try__all_source="yes"]], + [[mhd_cv_macro_try__all_source="no"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro_try__all_source]], [["yes"]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_ALL_SOURCE]], [], [[${mhd_mse_added_prolog}]], [], + [_MHD_SYS_EXT_ADD_FLAG([[_TANDEM_SOURCE]])] + )dnl + ]) + + dnl Discard temporal prolog with set of defines. + AS_UNSET([[mhd_mse_added_prolog]]) + dnl Determined all required defines. + AC_MSG_CHECKING([[for final set of defined symbols]]) + m4_ifblank([$1], [dnl + AH_TEMPLATE([[_XOPEN_SOURCE]], [Define to maximum value supported by system headers])dnl + AH_TEMPLATE([[_XOPEN_SOURCE_EXTENDED]], [Define to 1 if _XOPEN_SOURCE is defined to value less than 500 ]dnl + [and system headers requre this symbol])dnl + AH_TEMPLATE([[_XOPEN_VERSION]], [Define to maximum value supported by system headers if _XOPEN_SOURCE ]dnl + [is defined to value less than 500 and headers do not support _XOPEN_SOURCE_EXTENDED])dnl + AH_TEMPLATE([[_GNU_SOURCE]], [Define to 1 to enable GNU-related header features])dnl + AH_TEMPLATE([[__BSD_VISIBLE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_DARWIN_C_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[__EXTENSIONS__]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_NETBSD_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_BSD_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_TANDEM_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_ALL_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + ]) + for mhd_mse_Flag in $mhd_mse_added_exts_flags + do + m4_ifnblank([$1], [dnl + AS_VAR_APPEND([$1],[[" -D$mhd_mse_Flag"]]) + ], [dnl + AS_CASE([[$mhd_mse_Flag]], [[*=*]], + [dnl + AC_DEFINE_UNQUOTED([[`echo $mhd_mse_Flag | cut -f 1 -d =`]], + [[`echo $mhd_mse_Flag | cut -f 2 -d = -s`]]) + ], [dnl + AC_DEFINE_UNQUOTED([[$mhd_mse_Flag]]) + ]) + ]) + done + dnl Trim whitespaces + mhd_mse_result=`echo $mhd_mse_added_exts_flags` + AC_MSG_RESULT([[$mhd_mse_result]]) + AS_UNSET([[mhd_mse_result]]) + + AS_UNSET([[mhd_mse_added_exts_flags]]) + AC_LANG_POP([C]) +]) + + +# +# _MHD_SYS_EXT_ADD_FLAG(FLAG, [FLAG-VALUE = 1]) +# +# Internal macro, only to be used from MHD_SYS_EXT, _MHD_XOPEN_ADD + +m4_define([_MHD_SYS_EXT_ADD_FLAG], [dnl + m4_ifnblank([$2],[dnl + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags m4_normalize($1)=m4_normalize($2)" + mhd_mse_added_prolog="${mhd_mse_added_prolog}[#define ]m4_normalize($1) m4_normalize($2) +" + ], [dnl + mhd_mse_added_exts_flags="$mhd_mse_added_exts_flags m4_normalize($1)" + mhd_mse_added_prolog="${mhd_mse_added_prolog}[#define ]m4_normalize($1) 1 +" + ])dnl +]) + +# +# _MHD_VAR_IF(VAR, VALUE, [IF-EQ], [IF-NOT-EQ]) +# +# Same as AS_VAR_IF, except that it expands to nothing if +# both IF-EQ and IF-NOT-EQ are empty. + +m4_define([_MHD_VAR_IF],[dnl +m4_ifnblank([$3][$4],[dnl +m4_ifblank([$4],[AS_VAR_IF([$1],[$2],[$3])],[dnl +AS_VAR_IF([$1],[$2],[$3],[$4])])])]) + +# SYNOPSIS +# +# _MHD_CHECK_XOPEN_ENABLE(_XOPEN_SOURCE-VALUE, FEATURES_TEST, +# [ACTION-IF-ENABLED-BY-XOPEN_SOURCE], +# [ACTION-IF-NOT], +# [ACTION-IF-FEATURES-AVALABLE], +# [ACTION-IF-FEATURES-NOT-AVALABLE], +# [ACTION-IF-ONLY-WITH-EXTENSIONS] +# [ACTION-IF-WITHOUT-ALL]) +# +# DESCRIPTION +# +# This macro determines whether the _XOPEN_SOURCE with +# _XOPEN_SOURCE-VALUE really enable some header features. FEATURES_TEST +# must contains required includes and main function. +# One of ACTION-IF-ENABLED-BY-XOPEN_SOURCE and ACTION-IF-NOT +# is always executed depending on test results. +# One of ACTION-IF-FEATURES-AVALABLE and is ACTION-IF-FEATURES-NOT-AVALABLE +# is executed if features can be enabled by _XOPEN_SOURCE, by currently +# defined (by compiler flags or by predefined macros) extensions or +# all checked combinations are failed to enable features. +# ACTION-IF-ONLY-WITH-EXTENSIONS is executed if features can be +# enabled with not undefined extension. +# ACTION-IF-WITHOUT-ALL is executed if features work with all +# disabled extensions (including _XOPEN_SOURCE). + +AC_DEFUN([_MHD_CHECK_XOPEN_ENABLE], [dnl + AS_VAR_PUSHDEF([src_Var], [[mhd_cxoe_tmp_src_variable]])dnl + AS_VAR_SET([src_Var],[" +$2 +"])dnl Reduce 'configure' size + + dnl Some platforms enable most features when no + dnl specific mode is requested by macro. + dnl Check whether features test works without _XOPEN_SOURCE and + dnl with disabled extensions (undefined most of + dnl predefined macros for specific requested mode). + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and without _XOPEN_SOURCE]]) + dnl Checked features is enabled in platform's "default" mode. + dnl Try to disable features by requesting oldest X/Open mode. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _XOPEN_SOURCE 1] +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _XOPEN_SOURCE=1]]) + dnl Features still work in oldest X/Open mode. + dnl Some platforms enable all XSI features for any _XOPEN_SOURCE value. + dnl Apply some fuzzy logic, try to use _POSIX_C_SOURCE with oldest number. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _POSIX_C_SOURCE 1] +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1]]) + dnl Features still work in oldest _POSIX_C_SOURCE mode. + dnl Try to disable features by requesting strict ANSI C mode. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _ANSI_SOURCE 1] +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _ANSI_SOURCE]]) + dnl Features still work in strict _ANSI_SOURCE mode. + dnl Assume that _XOPEN_SOURCE, _POSIX_C_SOURCE and _ANSI_SOURCE has no influence on + dnl enabling of features as features are enabled always unconditionally. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _ANSI_SOURCE]]) + dnl Features do not work in strict _ANSI_SOURCE mode. + dnl Try to enable features by _XOPEN_SOURCE with specified value. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _ANSI_SOURCE 1] +[#define _XOPEN_SOURCE] $1 +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=]$1]) + dnl Finally, features were disabled by strict ANSI mode and enabled by adding _XOPEN_SOURCE. + dnl Assume that _XOPEN_SOURCE can enable features. + m4_n([$3])dnl ACTION-IF-ENABLED-BY-XOPEN_SOURCE + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _ANSI_SOURCE and _XOPEN_SOURCE=]$1]) + dnl Features are not enabled in strict ANSI mode with _XOPEN_SOURCE. + dnl Actually this is not correct documented situation and _ANSI_SOURCE may have + dnl priority over _XOPEN_SOURCE or headers are not controlled by _XOPEN_SOURCE at all. + dnl As features work in all mode except strict ANSI regardless of _XOPEN_SOURCE, + dnl assume that _XOPEN_SOURCE do not control visibility of features. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + ]) + ]) + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1]]) + dnl Features do not work in oldest _POSIX_C_SOURCE mode. + dnl OK, features were disabled by _POSIX_C_SOURCE. + dnl Check whether headers controlled by _XOPEN_SOURCE too. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _POSIX_C_SOURCE 1] +[#define _XOPEN_SOURCE] $1 +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=]$1]) + dnl Features were enabled again after adding _XOPEN_SOURCE with value. + dnl Assume that headers can be controlled by _XOPEN_SOURCE with specified value. + m4_n([$3])dnl ACTION-IF-ENABLED-BY-XOPEN_SOURCE + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _POSIX_C_SOURCE=1 and _XOPEN_SOURCE=]$1]) + dnl Features still work after adding _XOPEN_SOURCE with value. + dnl It's unclear whether headers know only about _POSIX_C_SOURCE or + dnl _POSIX_C_SOURCE have priority over _XOPEN_SOURCE (standards are + dnl silent about priorities). + dnl Assume that it's unknown whether _XOPEN_SOURCE can turn on features. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + ]) + ]) + ], [dnl + _AS_ECHO_LOG([[Checked features does not work with undefined all extensions and with _XOPEN_SOURCE=1]]) + dnl Features disabled by oldest X/Open mode. + dnl Check whether requested _XOPEN_SOURCE value will turn on features. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _XOPEN_SOURCE] $1 +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _XOPEN_SOURCE=]$1]) + dnl Features work with _XOPEN_SOURCE requested value and do not work + dnl with value 1. + dnl Assume that _XOPEN_SOURCE really turn on features. + m4_n([$3])dnl ACTION-IF-ENABLED-BY-XOPEN_SOURCE + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=]$1]) + dnl Features do not work with _XOPEN_SOURCE, but work in "default" mode. + dnl Assume that features cannot be enabled by requested _XOPEN_SOURCE value. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + ]) + ]) + m4_n([$5])dnl ACTION-IF-FEATURES-AVALABLE + m4_n([$8])dnl ACTION-IF-WITHOUT-ALL + ], + [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and without _XOPEN_SOURCE]]) + dnl Features do not work with turned off extensions. + dnl Check whether they can be enabled by _XOPEN_SOURCE. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _XOPEN_SOURCE] $1 +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and with _XOPEN_SOURCE=]$1]) + dnl Features work with _XOPEN_SOURCE and do not work without _XOPEN_SOURCE. + dnl Assume that _XOPEN_SOURCE really turn on features. + m4_n([$3])dnl ACTION-IF-ENABLED-BY-XOPEN_SOURCE + m4_n([$5])dnl ACTION-IF-FEATURES-AVALABLE + ], + [dnl + _AS_ECHO_LOG([[Checked features do not work with undefined all extensions and with _XOPEN_SOURCE=]$1]) + dnl Features do not work with _XOPEN_SOURCE and turned off extensions. + dnl Retry without turning off known extensions. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +[#define _XOPEN_SOURCE] $1 +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with current extensions and with _XOPEN_SOURCE=]$1]) + dnl Features work with _XOPEN_SOURCE and without turning off extensions. + dnl Check whether features work with oldest _XOPEN_SOURCE or it was enabled only by extensions. + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +[#define _XOPEN_SOURCE 1] +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with current extensions and with _XOPEN_SOURCE=1]]) + dnl Features still work with oldest _XOPEN_SOURCE. + dnl Assume that _XOPEN_SOURCE has no influence on enabling of features. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with current extensions and with _XOPEN_SOURCE=1]]) + dnl Features do not work with oldest _XOPEN_SOURCE. + dnl Assume that _XOPEN_SOURCE really turn on features. + m4_n([$3])dnl ACTION-IF-ENABLED-BY-XOPEN_SOURCE + ]) + m4_n([$5])dnl ACTION-IF-FEATURES-AVALABLE + m4_n([$7])dnl ACTION-IF-ONLY-WITH-EXTENSIONS + ], [dnl + _AS_ECHO_LOG([[Checked features do not work with current extensions and with _XOPEN_SOURCE=]$1]) + dnl Features do not work in all checked conditions. + dnl Assume that _XOPEN_SOURCE cannot enable feature. + m4_n([$4])dnl ACTION-IF-NOT-ENABLED-BY-XOPEN_SOURCE + m4_n([$6])dnl ACTION-IF-FEATURE-NOT-AVALABLE + ]) + ]) + ]) + AS_UNSET([src_Var]) + AS_VAR_POPDEF([src_Var])dnl +]) + + +# +# MHD_CHECK_HEADER_PRESENCE(headername.h) +# +# Check only by preprocessor whether header file is present. + +AC_DEFUN([MHD_CHECK_HEADER_PRESENCE], [dnl + AC_PREREQ([2.64])dnl for AS_VAR_PUSHDEF, AS_VAR_SET + AS_VAR_PUSHDEF([mhd_cache_Var],[mhd_cv_header_[]$1[]_present])dnl + AC_CACHE_CHECK([for presence of $1], [mhd_cache_Var], [dnl + dnl Hack autoconf to get pure result of only single header presence + cat > conftest.$ac_ext <<_ACEOF +@%:@include <[]$1[]> +_ACEOF + AC_PREPROC_IFELSE([], + [AS_VAR_SET([mhd_cache_Var],[["yes"]])], + [AS_VAR_SET([mhd_cache_Var],[["no"]])] + ) + rm -f conftest.$ac_ext + ]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_HEADERS_PRESENCE(oneheader.h otherheader.h ...) +# +# Check each specified header in whitespace-separated list for presence. + +AC_DEFUN([MHD_CHECK_HEADERS_PRESENCE], [dnl + AC_PREREQ([2.60])dnl for m4_foreach_w + m4_foreach_w([mhd_chk_Header], [$1], + [MHD_CHECK_HEADER_PRESENCE(m4_defn([mhd_chk_Header]))] + )dnl +]) + + +# +# MHD_CHECK_HEADERS_PRESENCE_COMPACT(oneheader.h otherheader.h ...) +# +# Same as MHD_CHECK_HEADERS_PRESENCE, but a bit slower and produce more compact 'configure'. + +AC_DEFUN([MHD_CHECK_HEADERS_PRESENCE_COMPACT], [dnl + for mhd_chk_Header in $1 ; do + MHD_CHECK_HEADER_PRESENCE([[${mhd_chk_Header}]]) + done +]) + + +# +# MHD_CHECK_BASIC_HEADERS_PRESENCE +# +# Check basic headers for presence. + +AC_DEFUN([MHD_CHECK_BASIC_HEADERS_PRESENCE], [dnl + MHD_CHECK_HEADERS_PRESENCE([stdio.h wchar.h stdlib.h string.h strings.h stdint.h fcntl.h sys/types.h time.h unistd.h]) +]) + + +# +# _MHD_SET_BASIC_INCLUDES +# +# Internal preparatory macro. + +AC_DEFUN([_MHD_SET_BASIC_INCLUDES], [dnl + AC_REQUIRE([MHD_CHECK_BASIC_HEADERS_PRESENCE])dnl + AS_IF([[test -z "$mhd_basic_headers_includes"]], [dnl + AS_VAR_IF([mhd_cv_header_stdio_h_present], [["yes"]], + [[mhd_basic_headers_includes="\ +#include +" ]],[[mhd_basic_headers_includes=""]] + ) + AS_VAR_IF([mhd_cv_header_sys_types_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_wchar_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_stdlib_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_string_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_strings_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_stdint_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_fcntl_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_time_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_unistd_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + ])dnl +]) + + +# +# _MHD_BASIC_INCLUDES +# +# Internal macro. Output set of basic includes. + +AC_DEFUN([_MHD_BASIC_INCLUDES], [AC_REQUIRE([_MHD_SET_BASIC_INCLUDES])dnl +[ /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ +]]) + + +# +# MHD_CHECK_BASIC_HEADERS([PROLOG], [ACTION-IF-OK], [ACTION-IF-FAIL]) +# +# Check whether basic headers can be compiled with specified prolog. + +AC_DEFUN([MHD_CHECK_BASIC_HEADERS], [dnl + AC_COMPILE_IFELSE([dnl + AC_LANG_PROGRAM([m4_n([$1])dnl +_MHD_BASIC_INCLUDES + ], [[int i = 1; i++]]) + ], [$2], [$3]) +]) + + +# +# _MHD_SET_UNDEF_ALL_EXT +# +# Internal preparatory macro. + +AC_DEFUN([_MHD_SET_UNDEF_ALL_EXT], [m4_divert_text([INIT_PREPARE],[dnl +[mhd_undef_all_extensions=" +#ifdef _GNU_SOURCE +#undef _GNU_SOURCE +#endif +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif +#ifdef _XOPEN_SOURCE_EXTENDED +#undef _XOPEN_SOURCE_EXTENDED +#endif +#ifdef _XOPEN_VERSION +#undef _XOPEN_VERSION +#endif +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif +#ifdef _POSIX_SOURCE +#undef _POSIX_SOURCE +#endif +#ifdef _DEFAULT_SOURCE +#undef _DEFAULT_SOURCE +#endif +#ifdef _BSD_SOURCE +#undef _BSD_SOURCE +#endif +#ifdef _SVID_SOURCE +#undef _SVID_SOURCE +#endif +#ifdef __EXTENSIONS__ +#undef __EXTENSIONS__ +#endif +#ifdef _ALL_SOURCE +#undef _ALL_SOURCE +#endif +#ifdef _TANDEM_SOURCE +#undef _TANDEM_SOURCE +#endif +#ifdef _DARWIN_C_SOURCE +#undef _DARWIN_C_SOURCE +#endif +#ifdef __BSD_VISIBLE +#undef __BSD_VISIBLE +#endif +#ifdef _NETBSD_SOURCE +#undef _NETBSD_SOURCE +#endif +" +]])]) + + +# +# _MHD_UNDEF_ALL_EXT +# +# Output prolog that undefine all known extension and visibility macros. + +AC_DEFUN([_MHD_UNDEF_ALL_EXT], [dnl +AC_REQUIRE([_MHD_SET_UNDEF_ALL_EXT])dnl +$mhd_undef_all_extensions +]) + + +# +# _MHD_CHECK_DEFINED(SYMBOL, [PROLOG], +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED]) +# +# Silently checks for defined symbols. + +AC_DEFUN([_MHD_CHECK_DEFINED], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +m4_n([$2])dnl +[#ifndef ]$1[ +#error ]$1[ is not defined +choke me now; +#endif + ]],[]) + ], [$3], [$4] + ) +]) + + +# +# MHD_CHECK_DEFINED(SYMBOL, [PROLOG], +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED], +# [MESSAGE]) +# +# Cache-check for defined symbols with printing results. + +AC_DEFUN([MHD_CHECK_DEFINED], [dnl + AS_VAR_PUSHDEF([mhd_cache_Var], + [mhd_cv_macro_[]m4_tolower($1)_defined])dnl + AC_CACHE_CHECK([dnl +m4_ifnblank([$5], [$5], [whether $1 is already defined])], + [mhd_cache_Var], + [ + _MHD_CHECK_DEFINED([$1], [$2], + [mhd_cache_Var="yes"], + [mhd_cache_Var="no"] + ) + ]) + _MHD_VAR_IF([mhd_cache_Var], [["yes"]], [$3], [$4]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_DEFINED_MSG(SYMBOL, [PROLOG], [MESSAGE] +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED]) +# +# Cache-check for defined symbols with printing results. +# Reordered arguments for better readability. + +AC_DEFUN([MHD_CHECK_DEFINED_MSG],[dnl +MHD_CHECK_DEFINED([$1],[$2],[$4],[$5],[$3])]) + +# +# MHD_CHECK_ACCEPT_DEFINE(DEFINE-SYMBOL, [DEFINE-VALUE = 1], [PROLOG], +# [ACTION-IF-ACCEPTED], [ACTION-IF-NOT-ACCEPTED], +# [MESSAGE]) +# +# Cache-check whether specific defined symbol do not break basic headers. + +AC_DEFUN([MHD_CHECK_ACCEPT_DEFINE], [dnl + AC_PREREQ([2.64])dnl for AS_VAR_PUSHDEF, AS_VAR_SET, m4_ifnblank + AS_VAR_PUSHDEF([mhd_cache_Var], + [mhd_cv_define_[]m4_tolower($1)_accepted[]m4_ifnblank([$2],[_[]$2])])dnl + AC_CACHE_CHECK([dnl +m4_ifnblank([$6],[$6],[whether headers accept $1[]m4_ifnblank([$2],[ with value $2])])], + [mhd_cache_Var], [dnl + MHD_CHECK_BASIC_HEADERS([ +m4_n([$3])[#define ]$1 m4_default_nblank([$2],[[1]])], + [mhd_cache_Var="yes"], [mhd_cache_Var="no"] + ) + ]) + _MHD_VAR_IF([mhd_cache_Var], [["yes"]], [$4], [$5]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_DEF_AND_ACCEPT(DEFINE-SYMBOL, [DEFINE-VALUE = 1], [PROLOG], +# [ACTION-IF-DEFINED], +# [ACTION-IF-ACCEPTED], [ACTION-IF-NOT-ACCEPTED]) +# +# Combination of MHD_CHECK_DEFINED_ECHO and MHD_CHECK_ACCEPT_DEFINE. +# First check whether symbol is already defined and, if not defined, +# checks whether it can be defined. + +AC_DEFUN([MHD_CHECK_DEF_AND_ACCEPT], [dnl + MHD_CHECK_DEFINED([$1], [$3], [$4], [dnl + MHD_CHECK_ACCEPT_DEFINE([$1], [$2], [$3], [$5], [$6])dnl + ])dnl +]) + + +# +# _MHD_XOPEN_ADD([PROLOG]) +# +# Internal macro. Only to be used in MHD_SYS_EXT. + +AC_DEFUN([_MHD_XOPEN_ADD], [dnl + MHD_CHECK_DEF_AND_ACCEPT([[_XOPEN_SOURCE_EXTENDED]], [], + [[${mhd_mse_added_prolog}]m4_n([$1])], [], + [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_SOURCE_EXTENDED]])dnl + ], [dnl + MHD_CHECK_DEFINED([[_XOPEN_VERSION]], + [[${mhd_mse_added_prolog}]m4_n([$1])], [], + [dnl + AC_CACHE_CHECK([[for value of _XOPEN_VERSION accepted by headers]], + [mhd_cv_define__xopen_version_accepted], [dnl + MHD_CHECK_BASIC_HEADERS([ +[${mhd_mse_added_prolog}]m4_n([$1]) +[#define _XOPEN_VERSION 4]], + [[mhd_cv_define__xopen_version_accepted="4"]], + [ + MHD_CHECK_BASIC_HEADERS([ +[${mhd_mse_added_prolog}]m4_n([$1]) +[#define _XOPEN_VERSION 3]], + [[mhd_cv_define__xopen_version_accepted="3"]], + [[mhd_cv_define__xopen_version_accepted="no"]] + ) + ]) + ]) + AS_VAR_IF([mhd_cv_define__xopen_version_accepted], [["no"]], + [[:]], + [dnl + _MHD_SYS_EXT_ADD_FLAG([[_XOPEN_VERSION]], + [[${mhd_cv_define__xopen_version_accepted}]]dnl + ) + ]) + ]) + ]) +]) + diff -Nru libmicrohttpd-0.9.44+dfsg/m4/pkg.m4 libmicrohttpd-0.9.55/m4/pkg.m4 --- libmicrohttpd-0.9.44+dfsg/m4/pkg.m4 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/pkg.m4 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,275 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $2]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR diff -Nru libmicrohttpd-0.9.44+dfsg/m4/search_h.m4 libmicrohttpd-0.9.55/m4/search_h.m4 --- libmicrohttpd-0.9.44+dfsg/m4/search_h.m4 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/search_h.m4 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,60 @@ +# search_h.m4 serial 9 +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SEARCH_H], +[ + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([search.h]) + if test $ac_cv_header_search_h = yes; then + HAVE_SEARCH_H=1 + else + HAVE_SEARCH_H=0 + fi + AC_SUBST([HAVE_SEARCH_H]) + + if test $HAVE_SEARCH_H = 1; then + AC_CACHE_CHECK([for type VISIT], [gl_cv_type_VISIT], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if HAVE_SEARCH_H + #include + #endif + ]], + [[static VISIT x; x = postorder;]])], + [gl_cv_type_VISIT=yes], + [gl_cv_type_VISIT=no])]) + else + gl_cv_type_VISIT=no + fi + if test $gl_cv_type_VISIT = yes; then + HAVE_TYPE_VISIT=1 + else + HAVE_TYPE_VISIT=0 + fi + AC_SUBST([HAVE_TYPE_VISIT]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [tdelete tfind tsearch twalk]) +]) + +AC_DEFUN([gl_SEARCH_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SEARCH_H_DEFAULTS], +[ + GNULIB_TSEARCH=0; AC_SUBST([GNULIB_TSEARCH]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH]) + REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH]) +]) diff -Nru libmicrohttpd-0.9.44+dfsg/m4/tsearch.m4 libmicrohttpd-0.9.55/m4/tsearch.m4 --- libmicrohttpd-0.9.44+dfsg/m4/tsearch.m4 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/m4/tsearch.m4 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,59 @@ +# tsearch.m4 serial 6 +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_TSEARCH], +[ + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + AC_CHECK_FUNCS([tsearch]) + if test $ac_cv_func_tsearch = yes; then + dnl On OpenBSD 4.0, the return value of tdelete() is incorrect. + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether tdelete works], [gl_cv_func_tdelete_works], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +static int +cmp_fn (const void *a, const void *b) +{ + return *(const int *) a - *(const int *) b; +} +int +main () +{ + int result = 0; + int x = 0; + void *root = NULL; + if (!(tfind (&x, &root, cmp_fn) == NULL)) + result |= 1; + tsearch (&x, &root, cmp_fn); + if (!(tfind (&x, &root, cmp_fn) != NULL)) + result |= 2; + if (!(tdelete (&x, &root, cmp_fn) != NULL)) + result |= 4; + return result; +}]])], [gl_cv_func_tdelete_works=yes], [gl_cv_func_tdelete_works=no], + [case "$host_os" in + openbsd*) gl_cv_func_tdelete_works="guessing no";; + *) gl_cv_func_tdelete_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_tdelete_works" in + *no) + REPLACE_TSEARCH=1 + ;; + esac + else + HAVE_TSEARCH=0 + fi +]) + +# Prerequisites of lib/tsearch.c. +AC_DEFUN([gl_PREREQ_TSEARCH], [ + : +]) diff -Nru libmicrohttpd-0.9.44+dfsg/Makefile.am libmicrohttpd-0.9.55/Makefile.am --- libmicrohttpd-0.9.44+dfsg/Makefile.am 2015-07-15 19:40:38.000000000 +0200 +++ libmicrohttpd-0.9.55/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -1,17 +1,109 @@ # This Makefile.am is in the public domain ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = contrib src m4 . -EXTRA_DIST = acinclude.m4 libmicrohttpd.pc.in libmicrospdy.pc.in \ - w32/VS2013/libmicrohttpd.sln w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ - w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters w32/VS2013/MHD_config.h \ - w32/VS2013/gen_dll_res.ps1 w32/VS2013/microhttpd_dll_res_vc.rc.in w32/VS2013/microhttpd_dll_res_vc.rc +SUBDIRS = contrib m4 src . +DIST_SUBDIRS = $(SUBDIRS) po +EXTRA_PO_DIST = po/ABOUT-NLS $(top_srcdir)/po/configure.ac po/configure +W32COMMON = w32/common/gen_dll_res.ps1 w32/common/microhttpd_dll_res_vc.rc.in w32/common/microhttpd_dll_res_vc.rc \ + w32/common/MHD_config.h w32/common/vs_dirs.props w32/common/common-build-settings.vcxproj \ + w32/common/libmicrohttpd-build-settings.vcxproj w32/common/libmicrohttpd-files.vcxproj w32/common/libmicrohttpd-filters.vcxproj \ + w32/common/hellobrowser-files.vcxproj w32/common/hellobrowser-filters.vcxproj \ + w32/common/apps-build-settings.vcxproj +W32VS2013 = w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ + w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters \ + w32/VS2013/simplepost.vcxproj w32/VS2013/largepost.vcxproj \ + w32/VS2013/libmicrohttpd.sln +W32VS2015 = w32/VS2015/libmicrohttpd.vcxproj w32/VS2015/libmicrohttpd.vcxproj.filters \ + w32/VS2015/hellobrowser.vcxproj w32/VS2015/hellobrowser.vcxproj.filters \ + w32/VS2015/simplepost.vcxproj w32/VS2015/largepost.vcxproj \ + w32/VS2015/libmicrohttpd.sln +W32VS2017 = w32/VS2017/libmicrohttpd.vcxproj w32/VS2017/libmicrohttpd.vcxproj.filters \ + w32/VS2017/hellobrowser.vcxproj w32/VS2017/hellobrowser.vcxproj.filters \ + w32/VS2017/simplepost.vcxproj w32/VS2017/largepost.vcxproj \ + w32/VS2017/libmicrohttpd.sln +EXTRA_DIST = \ + acinclude.m4 \ + libmicrohttpd.pc.in \ + $(EXTRA_PO_DIST) \ + $(W32COMMON) $(W32VS2013) $(W32VS2015) $(W32VS2017) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libmicrohttpd.pc -if ENABLE_SPDY -pkgconfig_DATA += libmicrospdy.pc -endif +pkgconfig_DATA = libmicrohttpd.pc if BUILD_DOC SUBDIRS += doc endif + +.PHONY: po-files update-po-files po-files-pre-distdir renew-po-configure.ac update-POTFILES.in + +# Do not override automake rule, only add prerequisite +distdir@EMPTY_VAR@: po-files-pre-distdir + +# Do not override automake rule, only add prerequisite +distclean-recursive@EMPTY_VAR@: po/Makefile + +srcdir_po = $(top_srcdir)/po + +# Test target: build main po file +po-files: $(srcdir_po)/libmicrohttpd.pot + +# Test target: force update all po files +update-po-files: po-files-pre-distdir Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot-update + +# Update po-related files before make distdir +po-files-pre-distdir: update-POTFILES.in renew-po-configure.ac + @$(MAKE) $(AM_MAKEFLAGS) po/Makefile + +# Clean in po directory only if po/Makefile was generated to avoid +# useless generation of po/Makefile only for 'clean' target +clean-local: + @ if test -f po/Makefile; then \ + $(MAKE) $(AM_MAKEFLAGS) po/Makefile && \ + $(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) clean || exit 1; \ + fi; + +po/Makefile: $(srcdir_po)/Makefile.in.in $(srcdir_po)/Makevars $(srcdir_po)/POTFILES.in po/config.status + @$(am__cd) po && @SHELL@ ./config.status ./Makefile.in po-directories + +# Regenerate po/config.status if this Makefile is changed as configure parameters may be updated +po/config.status: $(srcdir_po)/configure Makefile + @$(MKDIR_P) po && $(am__cd) po && echo "cd po && @SHELL@ ./configure @ac_configure_args@" && \ + @SHELL@ $(abs_top_srcdir)/po/configure @ac_configure_args@ --srcdir=$(abs_top_srcdir)/po \ + --disable-option-checking --no-create --no-recursion + +# Next rules actually create files in source tree, not in build tree, but those files should +# stay in source tree and should be distributed in tarball, i.e. should not be created during +# normal builds. +$(srcdir_po)/libmicrohttpd.pot: po/Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot + +# This target doesn't depend on po/configure.acT so po/configure.ac (and po/configure) will not be +# forced to regenerate after each run of main configure. +# If po/configure.ac is missing - it will be generated. +$(srcdir_po)/configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) renew-po-configure.ac + +# Update po/configure.ac only if po/configure.acT (generated by main configure) is different. +# If po/configure.ac is unchanged then po/configure will not be regenerated +renew-po-configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) po/configure.acT && \ + if ! test -f $(srcdir_po)/configure.ac || \ + ! cmp -s po/configure.acT $(srcdir_po)/configure.ac ; then \ + echo "cp po/configure.acT $(srcdir_po)/configure.ac" && \ + cp po/configure.acT $(srcdir_po)/configure.ac || exit 1; \ + fi + +$(srcdir_po)/configure: $(srcdir_po)/configure.ac + @$(am__cd) $(srcdir_po) && echo "Creating po/configure..." && \ + echo "@ACLOCAL@" && @ACLOCAL@ && \ + echo "@AUTOCONF@" && @AUTOCONF@ + +# Generate po/POTFILES.in if po/POTFILES.in is missing +$(srcdir_po)/POTFILES.in: + @$(MAKE) $(AM_MAKEFLAGS) update-POTFILES.in + +update-POTFILES.in: + @$(am__cd) $(srcdir_po) && echo @ECHO_N@ "Creating po/POTFILES.in... @ECHO_C@" && chmod o+w . && \ + find '../src/include' ! -name 'include' -prune -name '*.h' ! -name 'mhd_options.h' > POTFILES.in && \ + find '../src/microhttpd' ! -name 'microhttpd' -prune \( -name '*.h' -o -name '*.c' \) ! -name 'test_*' >> POTFILES.in && \ + echo "@ECHO_T@done." || (rm -f POTFILES.in ; echo "@ECHO_T@failed." && false) diff -Nru libmicrohttpd-0.9.44+dfsg/Makefile.in libmicrohttpd-0.9.55/Makefile.in --- libmicrohttpd-0.9.44+dfsg/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -88,15 +88,13 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@ENABLE_SPDY_TRUE@am__append_1 = libmicrospdy.pc -@BUILD_DOC_TRUE@am__append_2 = doc +@BUILD_DOC_TRUE@am__append_1 = doc subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -104,8 +102,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -114,8 +115,8 @@ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = MHD_config.h -CONFIG_CLEAN_FILES = libmicrohttpd.pc libmicrospdy.pc \ - w32/VS2013/microhttpd_dll_res_vc.rc +CONFIG_CLEAN_FILES = libmicrohttpd.pc \ + w32/common/microhttpd_dll_res_vc.rc po/configure.acT CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -202,12 +203,11 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope -DIST_SUBDIRS = contrib src m4 . doc am__DIST_COMMON = $(srcdir)/MHD_config.h.in $(srcdir)/Makefile.in \ - $(srcdir)/libmicrohttpd.pc.in $(srcdir)/libmicrospdy.pc.in \ - $(top_srcdir)/w32/VS2013/microhttpd_dll_res_vc.rc.in AUTHORS \ + $(srcdir)/libmicrohttpd.pc.in $(top_srcdir)/po/configure.ac.in \ + $(top_srcdir)/w32/common/microhttpd_dll_res_vc.rc.in AUTHORS \ COPYING ChangeLog INSTALL NEWS README compile config.guess \ - config.sub depcomp install-sh ltmain.sh missing + config.rpath config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -275,8 +275,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -284,6 +286,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -299,9 +302,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -309,6 +309,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -323,9 +324,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -347,13 +345,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -361,6 +356,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -405,6 +401,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -416,14 +413,39 @@ # This Makefile.am is in the public domain ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = contrib src m4 . $(am__append_2) -EXTRA_DIST = acinclude.m4 libmicrohttpd.pc.in libmicrospdy.pc.in \ - w32/VS2013/libmicrohttpd.sln w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ - w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters w32/VS2013/MHD_config.h \ - w32/VS2013/gen_dll_res.ps1 w32/VS2013/microhttpd_dll_res_vc.rc.in w32/VS2013/microhttpd_dll_res_vc.rc +SUBDIRS = contrib m4 src . $(am__append_1) +DIST_SUBDIRS = $(SUBDIRS) po +EXTRA_PO_DIST = po/ABOUT-NLS $(top_srcdir)/po/configure.ac po/configure +W32COMMON = w32/common/gen_dll_res.ps1 w32/common/microhttpd_dll_res_vc.rc.in w32/common/microhttpd_dll_res_vc.rc \ + w32/common/MHD_config.h w32/common/vs_dirs.props w32/common/common-build-settings.vcxproj \ + w32/common/libmicrohttpd-build-settings.vcxproj w32/common/libmicrohttpd-files.vcxproj w32/common/libmicrohttpd-filters.vcxproj \ + w32/common/hellobrowser-files.vcxproj w32/common/hellobrowser-filters.vcxproj \ + w32/common/apps-build-settings.vcxproj + +W32VS2013 = w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ + w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters \ + w32/VS2013/simplepost.vcxproj w32/VS2013/largepost.vcxproj \ + w32/VS2013/libmicrohttpd.sln + +W32VS2015 = w32/VS2015/libmicrohttpd.vcxproj w32/VS2015/libmicrohttpd.vcxproj.filters \ + w32/VS2015/hellobrowser.vcxproj w32/VS2015/hellobrowser.vcxproj.filters \ + w32/VS2015/simplepost.vcxproj w32/VS2015/largepost.vcxproj \ + w32/VS2015/libmicrohttpd.sln + +W32VS2017 = w32/VS2017/libmicrohttpd.vcxproj w32/VS2017/libmicrohttpd.vcxproj.filters \ + w32/VS2017/hellobrowser.vcxproj w32/VS2017/hellobrowser.vcxproj.filters \ + w32/VS2017/simplepost.vcxproj w32/VS2017/largepost.vcxproj \ + w32/VS2017/libmicrohttpd.sln + +EXTRA_DIST = \ + acinclude.m4 \ + libmicrohttpd.pc.in \ + $(EXTRA_PO_DIST) \ + $(W32COMMON) $(W32VS2013) $(W32VS2015) $(W32VS2017) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libmicrohttpd.pc $(am__append_1) +pkgconfig_DATA = libmicrohttpd.pc +srcdir_po = $(top_srcdir)/po all: MHD_config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -478,9 +500,9 @@ -rm -f MHD_config.h stamp-h1 libmicrohttpd.pc: $(top_builddir)/config.status $(srcdir)/libmicrohttpd.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ -libmicrospdy.pc: $(top_builddir)/config.status $(srcdir)/libmicrospdy.pc.in +w32/common/microhttpd_dll_res_vc.rc: $(top_builddir)/config.status $(top_srcdir)/w32/common/microhttpd_dll_res_vc.rc.in cd $(top_builddir) && $(SHELL) ./config.status $@ -w32/VS2013/microhttpd_dll_res_vc.rc: $(top_builddir)/config.status $(top_srcdir)/w32/VS2013/microhttpd_dll_res_vc.rc.in +po/configure.acT: $(top_builddir)/config.status $(top_srcdir)/po/configure.ac.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: @@ -847,7 +869,7 @@ @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -919,24 +941,98 @@ .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ - clean-libtool cscope cscopelist-am ctags ctags-am dist \ - dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-pkgconfigDATA + clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ + dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkgconfigDATA .PRECIOUS: Makefile +.PHONY: po-files update-po-files po-files-pre-distdir renew-po-configure.ac update-POTFILES.in + +# Do not override automake rule, only add prerequisite +distdir@EMPTY_VAR@: po-files-pre-distdir + +# Do not override automake rule, only add prerequisite +distclean-recursive@EMPTY_VAR@: po/Makefile + +# Test target: build main po file +po-files: $(srcdir_po)/libmicrohttpd.pot + +# Test target: force update all po files +update-po-files: po-files-pre-distdir Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot-update + +# Update po-related files before make distdir +po-files-pre-distdir: update-POTFILES.in renew-po-configure.ac + @$(MAKE) $(AM_MAKEFLAGS) po/Makefile + +# Clean in po directory only if po/Makefile was generated to avoid +# useless generation of po/Makefile only for 'clean' target +clean-local: + @ if test -f po/Makefile; then \ + $(MAKE) $(AM_MAKEFLAGS) po/Makefile && \ + $(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) clean || exit 1; \ + fi; + +po/Makefile: $(srcdir_po)/Makefile.in.in $(srcdir_po)/Makevars $(srcdir_po)/POTFILES.in po/config.status + @$(am__cd) po && @SHELL@ ./config.status ./Makefile.in po-directories + +# Regenerate po/config.status if this Makefile is changed as configure parameters may be updated +po/config.status: $(srcdir_po)/configure Makefile + @$(MKDIR_P) po && $(am__cd) po && echo "cd po && @SHELL@ ./configure @ac_configure_args@" && \ + @SHELL@ $(abs_top_srcdir)/po/configure @ac_configure_args@ --srcdir=$(abs_top_srcdir)/po \ + --disable-option-checking --no-create --no-recursion + +# Next rules actually create files in source tree, not in build tree, but those files should +# stay in source tree and should be distributed in tarball, i.e. should not be created during +# normal builds. +$(srcdir_po)/libmicrohttpd.pot: po/Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot + +# This target doesn't depend on po/configure.acT so po/configure.ac (and po/configure) will not be +# forced to regenerate after each run of main configure. +# If po/configure.ac is missing - it will be generated. +$(srcdir_po)/configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) renew-po-configure.ac + +# Update po/configure.ac only if po/configure.acT (generated by main configure) is different. +# If po/configure.ac is unchanged then po/configure will not be regenerated +renew-po-configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) po/configure.acT && \ + if ! test -f $(srcdir_po)/configure.ac || \ + ! cmp -s po/configure.acT $(srcdir_po)/configure.ac ; then \ + echo "cp po/configure.acT $(srcdir_po)/configure.ac" && \ + cp po/configure.acT $(srcdir_po)/configure.ac || exit 1; \ + fi + +$(srcdir_po)/configure: $(srcdir_po)/configure.ac + @$(am__cd) $(srcdir_po) && echo "Creating po/configure..." && \ + echo "@ACLOCAL@" && @ACLOCAL@ && \ + echo "@AUTOCONF@" && @AUTOCONF@ + +# Generate po/POTFILES.in if po/POTFILES.in is missing +$(srcdir_po)/POTFILES.in: + @$(MAKE) $(AM_MAKEFLAGS) update-POTFILES.in + +update-POTFILES.in: + @$(am__cd) $(srcdir_po) && echo @ECHO_N@ "Creating po/POTFILES.in... @ECHO_C@" && chmod o+w . && \ + find '../src/include' ! -name 'include' -prune -name '*.h' ! -name 'mhd_options.h' > POTFILES.in && \ + find '../src/microhttpd' ! -name 'microhttpd' -prune \( -name '*.h' -o -name '*.c' \) ! -name 'test_*' >> POTFILES.in && \ + echo "@ECHO_T@done." || (rm -f POTFILES.in ; echo "@ECHO_T@failed." && false) + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/MHD_config.h.in libmicrohttpd-0.9.55/MHD_config.h.in --- libmicrohttpd-0.9.44+dfsg/MHD_config.h.in 2015-10-01 21:22:16.000000000 +0200 +++ libmicrohttpd-0.9.55/MHD_config.h.in 2017-05-28 22:34:00.000000000 +0200 @@ -1,20 +1,18 @@ /* MHD_config.h.in. Generated from configure.ac by autoheader. */ -#define _GNU_SOURCE 1 - /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD -/* disable basic Auth support */ +/* Define to 1 if libmicrohttpd is compiled with basic Auth support. */ #undef BAUTH_SUPPORT /* This is a Cygwin system */ #undef CYGWIN -/* disable digest Auth support */ +/* Define to 1 if libmicrohttpd is compiled with digest Auth support. */ #undef DAUTH_SUPPORT -/* define to 0 to disable epoll support */ +/* Define to 1 to enable epoll support */ #undef EPOLL_SUPPORT /* This is a FreeBSD system */ @@ -26,6 +24,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H +/* Define to 1 if you have the `gmtime_s' function in C11 form. */ +#undef HAVE_C11_GMTIME_S + +/* Define to 1 if you have the usable `calloc' function. */ +#undef HAVE_CALLOC + /* Have clock_gettime */ #undef HAVE_CLOCK_GETTIME @@ -37,14 +41,6 @@ don't. */ #undef HAVE_DECL_SOCK_NONBLOCK -/* Define to 1 if you have the declaration of `TCP_CORK', and to 0 if you - don't. */ -#undef HAVE_DECL_TCP_CORK - -/* Define to 1 if you have the declaration of `TCP_NOPUSH', and to 0 if you - don't. */ -#undef HAVE_DECL_TCP_NOPUSH - /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -60,6 +56,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* Define to 1 if you have the usable `fork' function. */ +#undef HAVE_FORK + /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -69,8 +68,11 @@ /* Define to 1 if you have `gethrtime' function. */ #undef HAVE_GETHRTIME -/* Define to 1 if you have `gmtime_s' function (only for W32). */ -#undef HAVE_GMTIME_S +/* Define to 1 if you have the `[gettimeofday]' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R /* Define to 1 if you have the header file. */ #undef HAVE_GNUTLS_GNUTLS_H @@ -78,6 +80,9 @@ /* Provides IPv6 headers */ #undef HAVE_INET6 +/* Define to 1 if you have the header file. */ +#undef HAVE_INETLIB_H + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -102,7 +107,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_PARAM_H -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the <[magic.h]> header file. */ #undef HAVE_MAGIC_H /* Define to 1 if you have the header file. */ @@ -114,38 +119,29 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Disable error messages */ +/* Define to 1 to enable support for error messages. */ #undef HAVE_MESSAGES +/* Define to 1 if you have the `[nanosleep]' function. */ +#undef HAVE_NANOSLEEP + /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_ENGINE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_ERR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_EVP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_PEM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_RAND_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_RSA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_SHA_H +/* Define if you have usable pipe2(2) function */ +#undef HAVE_PIPE2_FUNC /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -153,32 +149,78 @@ /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H -/* define to 1 if MHD was build with postprocessor.c */ +/* Define to 1 if libmicrohttpd is compiled with postprocessor support. */ #undef HAVE_POSTPROCESSOR +/* Define to 1 if you have the `pread' function. */ +#undef HAVE_PREAD + +/* Define to 1 if you have the `pread64' function. */ +#undef HAVE_PREAD64 + +/* Define if you have IBM i form of pthread_attr_setname_np(3) function. */ +#undef HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI + +/* Define if you have NetBSD form (or OSF1 form) of pthread_attr_setname_np(3) + function. */ +#undef HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD + /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_NP_H + /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT -/* Define if you have pthread_setname_np function. */ -#undef HAVE_PTHREAD_SETNAME_NP +/* Define if you have Darwin form of pthread_setname_np(3) function. */ +#undef HAVE_PTHREAD_SETNAME_NP_DARWIN -/* Define to 1 if you have the header file. */ +/* Define if you have GNU/Linux form of pthread_setname_np(3) function. */ +#undef HAVE_PTHREAD_SETNAME_NP_GNU + +/* Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) + function. */ +#undef HAVE_PTHREAD_SETNAME_NP_NETBSD + +/* Define if you have FreeBSD form of pthread_set_name_np(3) function. */ +#undef HAVE_PTHREAD_SET_NAME_NP_FREEBSD + +/* Define to 1 if you have the `rand' function. */ +#undef HAVE_RAND + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the real boolean type. */ +#undef HAVE_REAL_BOOL + +/* Define to 1 if you have the header file and your system have + properly functioning tsearch(), tfind() and tdelete() functions */ #undef HAVE_SEARCH_H /* Define to 1 if you have the `sendfile64' function. */ #undef HAVE_SENDFILE64 +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + /* Do we have sockaddr_in.sin_len? */ #undef HAVE_SOCKADDR_IN_SIN_LEN +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKLIB_H + /* SOCK_NONBLOCK is defined in a socket header */ #undef HAVE_SOCK_NONBLOCK -/* Define to 1 if you have the header file. */ -#undef HAVE_SPDYLAY_SPDYLAY_H +/* Define to 1 if you have the header file and defines + 'bool' type. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -201,6 +243,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ENDIAN_H +/* Define to 1 if you have the <[sys/eventfd.h]> header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ISA_DEFS_H @@ -234,21 +282,33 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H +/* Define to 1 if you have the `tsearch' function. */ +#undef HAVE_TSEARCH + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `[usleep]' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `gmtime_s' function in W32 form. */ +#undef HAVE_W32_GMTIME_S + +/* Define to 1 if you have the usable `waitpid' function. */ +#undef HAVE_WAITPID + /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H /* Define to 1 if you have the header file. */ #undef HAVE_WS2TCPIP_H -/* Define to 1 if you have the `_lseeki64' function. */ -#undef HAVE__LSEEKI64 - -/* disable HTTPS support */ +/* Define to 1 if libmicrohttpd is compiled with HTTPS support. */ #undef HTTPS_SUPPORT +/* Define to 1 if your C compiler supports inline functions. */ +#undef INLINE_FUNC + /* Defined if libcurl supports AsynchDNS */ #undef LIBCURL_FEATURE_ASYNCHDNS @@ -315,12 +375,11 @@ /* This is a Linux kernel */ #undef LINUX -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR -/* Define to use pair of sockets instead of pipes for signaling */ -#undef MHD_DONT_USE_PIPES +/* Define to 1 to disable setting name on generated threads */ +#undef MHD_NO_THREAD_NAMES /* gnuTLS lib version - used in conjunction with cURL */ #undef MHD_REQ_CURL_GNUTLS_VERSION @@ -389,12 +448,12 @@ /* This is a BSD system */ #undef SOMEBSD -/* disable libmicrospdy support */ -#undef SPDY_SUPPORT - /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support. */ +#undef UPGRADE_SUPPORT + /* Version number of package */ #undef VERSION @@ -413,6 +472,15 @@ # endif #endif +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _ALL_SOURCE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _BSD_SOURCE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _DARWIN_C_SOURCE + /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 @@ -421,6 +489,9 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS +/* Define to 1 to enable GNU-related header features */ +#undef _GNU_SOURCE + /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE @@ -430,8 +501,55 @@ /* defines how to decorate public symbols while building */ #undef _MHD_EXTERN +/* Define to use eventFD for inter-thread communication */ +#undef _MHD_ITC_EVENTFD + +/* Define to use pipe for inter-thread communication */ +#undef _MHD_ITC_PIPE + +/* Define to use socketpair for inter-thread communication */ +#undef _MHD_ITC_SOCKETPAIR + +/* Define to prefix which will be used with MHD inline functions. */ +#undef _MHD_inline + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _NETBSD_SOURCE + /* Need with solaris or errno doesnt work */ #undef _REENTRANT +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _TANDEM_SOURCE + +/* Define to maximum value supported by system headers */ +#undef _XOPEN_SOURCE + +/* Define to 1 if _XOPEN_SOURCE is defined to value less than 500 and system + headers requre this symbol */ +#undef _XOPEN_SOURCE_EXTENDED + +/* Define to maximum value supported by system headers if _XOPEN_SOURCE is + defined to value less than 500 and headers do not support + _XOPEN_SOURCE_EXTENDED */ +#undef _XOPEN_VERSION + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef __BSD_VISIBLE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef __EXTENSIONS__ + +/* Define to type name which will be used as boolean type. */ +#undef bool + /* Define curl_free() as free() if our version of curl lacks curl_free. */ #undef curl_free + +/* Define to value interpreted by compiler as boolean "false", if "false" is + not defined by system headers. */ +#undef false + +/* Define to value interpreted by compiler as boolean "true", if "true" is not + defined by system headers. */ +#undef true diff -Nru libmicrohttpd-0.9.44+dfsg/po/ABOUT-NLS libmicrohttpd-0.9.55/po/ABOUT-NLS --- libmicrohttpd-0.9.44+dfsg/po/ABOUT-NLS 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/ABOUT-NLS 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,1379 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is a +way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this 'ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU 'gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU 'gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + +1.1 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU 'gettext'. Other packages have their own ways to +internationalization, predating GNU 'gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU 'gettext' functions. Installers may use special +options at configuration time for changing the default behaviour. The +command: + + ./configure --disable-nls + +will _totally_ disable translation of messages. + + When you already have GNU 'gettext' installed on your system and run +configure without an option for your new package, 'configure' will +probably detect the previously built and installed 'libintl' library and +will decide to use it. If not, you may have to to use the +'--with-libintl-prefix' option to tell 'configure' where to look for it. + + Internationalized packages usually have many 'po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at 'configure' time by using the +'--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable 'LINGUAS' +may be set, prior to configuration, to limit the installed set. +'LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.2 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the 'LANG' environment variable to the appropriate +'LL_CC' combination. If you happen to have the 'LC_ALL' or some other +'LC_xxx' environment variables set, you should unset them before setting +'LANG', otherwise the setting of 'LANG' will not have the desired +effect. Here 'LL' is an ISO 639 two-letter language code, and 'CC' is +an ISO 3166 two-letter country code. For example, let's suppose that +you speak German and live in Germany. At the shell prompt, merely +execute 'setenv LANG de_DE' (in 'csh'), 'export LANG; LANG=de_DE' (in +'sh') or 'export LANG=de_DE' (in 'bash'). This can be done from your +'.login' or '.profile' file, once and for all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, 'de_AT' is used for Austria, and 'pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of 'LL_CC', with 'LL' denoting the +language and 'CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are used, +such as 'LL' or 'LL_CC.ENCODING'. You can get the list of locales +supported by your system for your language by running the command +'locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +'LANGUAGE'. GNU 'gettext' gives preference to 'LANGUAGE' over 'LANG' +for the purpose of message handling, but you still need to have 'LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather read +translations in German than English for when Swedish is not available, +set 'LANGUAGE' to 'sv:de' while leaving 'LANG' to 'sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from 'no' to 'nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under 'nb' and some older ones under 'no', it's recommended +for Norwegian users to set 'LANGUAGE' to 'nb:no' so that both newer and +older translations are used. + + In the 'LANGUAGE' environment variable, but not in the 'LANG' +environment variable, 'LL_CC' combinations can be abbreviated as 'LL' to +denote the language's main dialect. For example, 'de' is equivalent to +'de_DE' (German as spoken in Germany), and 'pt' to 'pt_PT' (Portuguese +as spoken in Portugal) in this context. + +1.3 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +'http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +'-request' appended. For example, speakers of Swedish can send a +message to 'sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate _actively_ +in translations, or at solving translational difficulties, rather than +merely lurking around. If your team does not exist yet and you want to +start one, or if you are unsure about what to do or how to get started, +please write to 'coordinator@translationproject.org' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.4 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of Jun 2014. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am an ar as ast az be bg bn bn_IN bs ca crh cs + +---------------------------------------------------+ + a2ps | [] [] [] | + aegis | | + anubis | | + aspell | [] [] [] | + bash | [] [] [] | + bfd | | + binutils | [] | + bison | | + bison-runtime | [] | + buzztrax | [] | + ccd2cue | | + ccide | | + cflow | | + clisp | | + coreutils | [] [] | + cpio | | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | | + denemo | [] [] | + dfarc | [] | + dialog | [] [] [] | + dico | | + diffutils | [] | + dink | [] | + direvent | | + doodle | [] | + dos2unix | | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] | + exif | [] | + fetchmail | [] [] | + findutils | [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | [] | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gjay | | + glunarclock | [] [] [] | + gnubiff | [] | + gnubik | [] | + gnucash | () () [] | + gnuchess | | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] | + gramadoir | | + grep | [] [] [] | + grub | [] | + gsasl | | + gss | | + gst-plugins-bad | [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] | + gst-plugins-ugly | [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] | + help2man | | + help2man-texi | | + hylafax | | + idutils | | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | | + kbd | [] | + klavaro | [] [] [] [] [] | + ld | [] | + leafpad | [] [] [] [] | + libc | [] [] [] | + libexif | () | + libextractor | | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] [] | + lilypond | [] [] | + lordsawar | [] | + lprng | | + lynx | [] [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] | + man-db | [] [] | + man-db-manpages | | + midi-instruments | [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | [] | + nano | [] [] [] | + opcodes | | + parted | [] | + pies | | + pnmixer | | + popt | [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] | + pushover | [] | + pwdutils | | + pyspread | | + radius | [] | + recode | [] [] [] | + recutils | | + rpm | | + rush | | + sarg | | + sed | [] [] [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] | + sudoers | [] [] | + sysstat | [] | + tar | [] [] [] | + texinfo | [] [] | + texinfo_document | [] [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | | + trader | | + util-linux | [] | + ve | | + vice | | + vmm | | + vorbis-tools | [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] | + wget | [] | + wyslij-po | | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +---------------------------------------------------+ + af am an ar as ast az be bg bn bn_IN bs ca crh cs + 4 0 2 5 3 11 0 8 25 3 3 1 55 4 74 + + da de el en en_GB en_ZA eo es et eu fa fi fr + +--------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] [] [] | + aegis | [] [] [] [] | + anubis | [] [] [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] | + bfd | [] [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] [] [] [] | + ccd2cue | [] [] [] [] | + ccide | [] [] [] [] [] [] | + cflow | [] [] [] [] [] | + clisp | [] [] [] [] [] | + coreutils | [] [] [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] [] [] [] [] | + cryptsetup | [] [] [] [] [] | + datamash | [] [] [] [] | + denemo | [] | + dfarc | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + dico | [] [] [] [] | + diffutils | [] [] [] [] [] [] | + dink | [] [] [] [] [] [] | + direvent | [] [] [] [] | + doodle | [] [] [] [] | + dos2unix | [] [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] () [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] | + flex | [] [] [] [] [] [] | + freedink | [] [] [] [] [] [] [] [] | + fusionforge | [] [] [] | + gas | [] [] [] | + gawk | [] [] [] [] [] | + gcal | [] [] [] [] | + gcc | [] | + gdbm | [] [] [] [] [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] [] | + glunarclock | [] [] [] [] [] | + gnubiff | () [] [] () | + gnubik | [] [] [] [] [] | + gnucash | [] () () () () () () | + gnuchess | [] [] [] [] | + gnulib | [] [] [] [] [] [] [] | + gnunet | [] | + gnunet-gtk | [] | + gold | [] [] [] | + gphoto2 | [] () [] [] | + gprof | [] [] [] [] [] [] | + gramadoir | [] [] [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () [] [] [] | + gtkam | [] () [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] | + guix | [] [] | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] [] [] | + help2man | [] [] [] [] [] [] [] | + help2man-texi | [] [] [] | + hylafax | [] [] | + idutils | [] [] [] [] [] | + iso_15924 | [] () [] [] () [] () | + iso_3166 | [] () [] [] [] [] () [] () | + iso_3166_2 | [] () () () | + iso_4217 | [] () [] [] [] () [] () | + iso_639 | [] () [] [] () [] () | + iso_639_3 | () () () | + iso_639_5 | () () () | + jwhois | [] [] [] [] [] | + kbd | [] [] [] [] [] [] | + klavaro | [] [] [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () [] [] | + libextractor | [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] () [] | + libgphoto2_port | [] () [] [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] [] | + liferea | [] () [] [] [] [] [] | + lilypond | [] [] [] [] [] [] | + lordsawar | [] [] | + lprng | | + lynx | [] [] [] [] [] [] | + m4 | [] [] [] [] [] [] | + mailfromd | [] | + mailutils | [] [] [] [] | + make | [] [] [] [] [] | + man-db | [] [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] [] [] | + nano | [] [] [] [] [] [] [] | + opcodes | [] [] [] [] [] | + parted | [] [] [] | + pies | [] | + pnmixer | [] [] | + popt | [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] [] | + psmisc | [] [] [] [] [] [] [] | + pspp | [] [] [] | + pushover | () [] [] [] | + pwdutils | [] [] [] | + pyspread | [] [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + recutils | [] [] [] [] | + rpm | [] [] [] [] [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] [] | + skribilo | [] [] [] | + solfege | [] [] [] [] [] [] [] [] | + solfege-manual | [] [] [] [] [] | + spotmachine | [] [] [] [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] [] [] | + sysstat | [] [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] [] [] [] | + texinfo_document | [] [] [] [] | + tigervnc | [] [] [] [] [] [] | + tin | [] [] [] [] | + tin-man | [] | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] [] [] [] [] [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] [] | + vice | () () () | + vmm | [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | [] | + wcd | [] [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] [] | + +--------------------------------------------------+ + da de el en en_GB en_ZA eo es et eu fa fi fr + 119 131 32 1 6 0 94 95 22 13 4 102 139 + + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + +-------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] | + binutils | [] [] [] | + bison | [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | | + ccd2cue | [] | + ccide | [] [] | + cflow | [] [] [] | + clisp | | + coreutils | [] [] | + cpio | [] [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] | + cryptsetup | [] | + datamash | | + denemo | [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] | + dink | [] | + direvent | [] | + doodle | [] [] | + dos2unix | [] [] | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] [] | + flex | [] | + freedink | [] [] [] [] | + fusionforge | | + gas | [] | + gawk | [] () [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] [] () | + gnubik | [] [] [] | + gnucash | () () () () () | + gnuchess | | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] | + hello | [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | | + hylafax | [] | + idutils | [] [] | + iso_15924 | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | [] [] | + iso_4217 | [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | [] [] [] [] | + kbd | [] [] [] | + klavaro | [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] () | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | | + libgnutls | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | | + mailutils | | + make | [] [] [] [] | + man-db | [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] | + mkisofs | [] [] | + myserver | [] | + nano | [] [] [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | | + pnmixer | [] [] | + popt | [] [] [] [] [] [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | [] | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] [] [] [] [] [] | + recutils | | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] [] [] [] [] [] | + sharutils | | + shishi | | + skribilo | [] | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] [] [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] [] | + tigervnc | | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] | + ve | [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | [] | + wcd | | + wcd-man | | + wdiff | [] [] [] | + wget | [] [] [] [] | + wyslij-po | [] [] [] | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] | + +-------------------------------------------------+ + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + 35 2 47 4 8 2 60 71 2 6 81 11 87 57 0 3 + + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + +--------------------------------------------------+ + a2ps | [] [] | + aegis | [] | + anubis | [] [] [] | + aspell | [] [] | + bash | [] [] | + bfd | | + binutils | | + bison | [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | | + ccd2cue | | + ccide | [] [] | + cflow | [] | + clisp | [] | + coreutils | [] [] | + cpio | [] | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | [] [] | + denemo | | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] | + dink | [] | + direvent | [] | + doodle | [] | + dos2unix | [] [] | + dos2unix-man | [] | + e2fsprogs | [] | + enscript | [] | + exif | [] [] [] | + fetchmail | [] | + findutils | [] [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] | + gjay | | + glunarclock | [] [] | + gnubiff | [] | + gnubik | [] [] | + gnucash | () () () () () () () [] | + gnuchess | [] [] | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] [] | + gramadoir | [] | + grep | [] [] | + grub | [] [] [] | + gsasl | [] | + gss | | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] [] [] | + help2man | [] | + help2man-texi | | + hylafax | [] | + idutils | [] | + iso_15924 | () [] [] | + iso_3166 | [] [] [] () [] [] [] [] [] [] | + iso_3166_2 | () [] | + iso_4217 | () [] [] [] | + iso_639 | [] [] () [] [] [] [] | + iso_639_3 | [] () [] | + iso_639_5 | () | + jwhois | [] [] | + kbd | [] | + klavaro | [] [] | + ld | | + leafpad | [] [] [] [] [] | + libc | [] [] | + libexif | [] | + libextractor | [] | + libgnutls | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] | + lilypond | [] | + lordsawar | | + lprng | | + lynx | [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] [] | + man-db | [] | + man-db-manpages | [] | + midi-instruments | [] [] [] [] [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pies | | + pnmixer | [] | + popt | [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] | + recutils | [] | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | [] | + spotmachine | [] | + sudo | [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] | + tar | [] [] [] | + texinfo | [] | + texinfo_document | [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] | + trader | [] | + util-linux | [] | + ve | [] | + vice | [] | + vmm | [] | + vorbis-tools | [] | + wastesedge | [] | + wcd | [] | + wcd-man | [] | + wdiff | [] | + wget | [] [] | + wyslij-po | [] | + xboard | [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +--------------------------------------------------+ + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + 5 15 4 6 0 13 23 3 3 3 4 11 2 42 1 125 + + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + +------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] | + aegis | [] [] | + anubis | [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] [] [] [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] | + ccd2cue | [] [] | + ccide | [] [] [] | + cflow | [] [] [] | + clisp | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cppi | [] [] [] | + cpplib | [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] | + denemo | | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] | + dink | | + direvent | [] [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] | + e2fsprogs | [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + freedink | [] [] [] [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | [] [] [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] | + gnubik | [] [] [] [] | + gnucash | () () () () () [] | + gnuchess | [] [] | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] | + gss | [] [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] [] | + help2man-texi | [] | + hylafax | | + idutils | [] [] [] | + iso_15924 | [] () [] [] [] [] | + iso_3166 | [] [] [] [] () [] [] [] [] [] [] [] [] | + iso_3166_2 | [] () [] | + iso_4217 | [] [] () [] [] [] [] [] | + iso_639 | [] [] [] () [] [] [] [] [] [] | + iso_639_3 | [] () | + iso_639_5 | () [] | + jwhois | [] [] [] [] | + kbd | [] [] | + klavaro | [] [] [] [] [] | + ld | | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] | + libexif | [] () [] | + libextractor | [] | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | [] [] [] | + liferea | [] [] [] [] () [] [] | + lilypond | | + lordsawar | | + lprng | [] | + lynx | [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] | + make | [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] [] | + midi-instruments | [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] | + nano | [] [] [] [] [] [] | + opcodes | | + parted | [] [] [] [] [] [] | + pies | [] | + pnmixer | [] | + popt | [] [] [] [] [] [] | + procps-ng | [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + recutils | [] [] | + rpm | [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] | + shishi | [] [] | + skribilo | [] | + solfege | [] [] [] | + solfege-manual | [] [] | + spotmachine | [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] [] | + ve | [] [] [] | + vice | | + vmm | | + vorbis-tools | [] [] [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] [] [] [] | + wget | [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +------------------------------------------------+ + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + 7 3 6 114 1 12 88 32 82 3 40 45 7 101 + + sv sw ta te tg th tr uk ur vi wa wo zh_CN + +----------------------------------------------+ + a2ps | [] [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | [] [] [] | + ccd2cue | [] [] [] | + ccide | [] [] [] [] | + cflow | [] [] [] [] | + clisp | | + coreutils | [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] | + cpplib | [] [] [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] [] | + denemo | [] | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] [] [] | + dink | [] | + direvent | [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] | + enscript | [] [] [] [] | + exif | [] [] [] [] [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] | + freedink | [] [] [] | + fusionforge | | + gas | [] | + gawk | [] [] [] | + gcal | [] [] [] | + gcc | [] | + gdbm | [] [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] | + glunarclock | [] [] [] [] | + gnubiff | [] [] | + gnubik | [] [] [] [] | + gnucash | () () () () [] | + gnuchess | [] [] [] | + gnulib | [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] | + grub | [] [] [] [] | + gsasl | [] [] [] [] | + gss | [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | [] | + hylafax | [] | + idutils | [] [] [] | + iso_15924 | [] () [] [] () [] | + iso_3166 | [] [] () [] [] () [] [] | + iso_3166_2 | () [] [] () [] | + iso_4217 | [] () [] [] () [] | + iso_639 | [] [] [] () [] [] () [] [] | + iso_639_3 | [] () [] [] () | + iso_639_5 | () [] () | + jwhois | [] [] [] [] | + kbd | [] [] [] [] | + klavaro | [] [] [] [] [] [] | + ld | [] [] [] [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () | + libextractor | [] [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | () [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] | + mailfromd | [] [] | + mailutils | [] | + make | [] [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] | + minicom | [] [] | + mkisofs | [] [] [] | + myserver | [] | + nano | [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | [] [] | + pnmixer | [] [] [] | + popt | [] [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] [] | + pushover | [] | + pwdutils | [] [] | + pyspread | [] | + radius | [] [] | + recode | [] [] [] [] | + recutils | [] [] [] | + rpm | [] [] [] [] | + rush | [] [] | + sarg | | + sed | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] | + skribilo | [] [] | + solfege | [] [] [] [] | + solfege-manual | [] | + spotmachine | [] [] [] | + sudo | [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | | + wcd | [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] | + wget | [] [] [] | + wyslij-po | [] [] | + xboard | [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +----------------------------------------------+ + sv sw ta te tg th tr uk ur vi wa wo zh_CN + 106 1 4 3 0 13 51 115 1 125 7 1 100 + + zh_HK zh_TW + +-------------+ + a2ps | | 30 + aegis | | 9 + anubis | | 19 + aspell | | 29 + bash | [] | 23 + bfd | | 11 + binutils | | 12 + bison | [] | 18 + bison-runtime | [] | 38 + buzztrax | | 9 + ccd2cue | | 10 + ccide | | 17 + cflow | | 16 + clisp | | 10 + coreutils | | 18 + cpio | | 20 + cppi | | 17 + cpplib | [] | 19 + cryptsetup | | 14 + datamash | | 11 + denemo | | 5 + dfarc | | 17 + dialog | [] | 42 + dico | | 6 + diffutils | | 22 + dink | | 10 + direvent | | 11 + doodle | | 12 + dos2unix | [] | 18 + dos2unix-man | | 9 + e2fsprogs | | 15 + enscript | | 21 + exif | | 27 + fetchmail | | 19 + findutils | | 29 + flex | [] | 19 + freedink | | 24 + fusionforge | | 3 + gas | | 5 + gawk | | 13 + gcal | | 8 + gcc | | 2 + gdbm | | 10 + gettext-examples | [] [] | 40 + gettext-runtime | [] [] | 35 + gettext-tools | [] | 24 + gjay | | 9 + glunarclock | [] | 27 + gnubiff | | 9 + gnubik | | 19 + gnucash | () | 6 + gnuchess | | 11 + gnulib | | 23 + gnunet | | 1 + gnunet-gtk | | 1 + gold | | 7 + gphoto2 | [] | 19 + gprof | | 21 + gramadoir | | 14 + grep | [] | 31 + grub | | 21 + gsasl | [] | 19 + gss | | 17 + gst-plugins-bad | | 21 + gst-plugins-base | | 27 + gst-plugins-good | | 32 + gst-plugins-ugly | | 34 + gstreamer | [] | 32 + gtick | | 19 + gtkam | | 24 + gtkspell | [] [] | 48 + guix | | 2 + guix-packages | | 0 + gutenprint | | 15 + hello | [] | 30 + help2man | | 18 + help2man-texi | | 5 + hylafax | | 5 + idutils | | 14 + iso_15924 | [] | 23 + iso_3166 | [] [] | 58 + iso_3166_2 | | 9 + iso_4217 | [] [] | 28 + iso_639 | [] [] | 46 + iso_639_3 | | 10 + iso_639_5 | | 2 + jwhois | [] | 20 + kbd | | 17 + klavaro | | 30 + ld | [] | 15 + leafpad | [] | 39 + libc | [] | 24 + libexif | | 10 + libextractor | | 5 + libgnutls | | 13 + libgphoto2 | | 10 + libgphoto2_port | [] | 19 + libgsasl | | 18 + libiconv | [] | 29 + libidn | | 17 + liferea | | 29 + lilypond | | 11 + lordsawar | | 3 + lprng | | 3 + lynx | | 19 + m4 | [] | 22 + mailfromd | | 4 + mailutils | | 6 + make | | 19 + man-db | | 15 + man-db-manpages | | 10 + midi-instruments | [] | 43 + minicom | [] | 17 + mkisofs | | 13 + myserver | | 9 + nano | [] | 30 + opcodes | | 12 + parted | [] | 23 + pies | | 4 + pnmixer | | 9 + popt | [] | 36 + procps-ng | | 5 + procps-ng-man | | 4 + psmisc | [] | 22 + pspp | | 13 + pushover | | 6 + pwdutils | | 8 + pyspread | | 6 + radius | | 9 + recode | | 31 + recutils | | 10 + rpm | [] | 13 + rush | | 10 + sarg | | 4 + sed | [] | 35 + sharutils | | 13 + shishi | | 7 + skribilo | | 7 + solfege | | 21 + solfege-manual | | 9 + spotmachine | | 11 + sudo | | 26 + sudoers | | 22 + sysstat | | 23 + tar | [] | 30 + texinfo | | 17 + texinfo_document | | 13 + tigervnc | | 14 + tin | [] | 7 + tin-man | | 1 + tracgoogleappsa... | [] | 22 + trader | | 12 + util-linux | | 13 + ve | | 14 + vice | | 1 + vmm | | 3 + vorbis-tools | | 13 + wastesedge | | 3 + wcd | | 8 + wcd-man | | 3 + wdiff | [] | 23 + wget | | 21 + wyslij-po | | 14 + xboard | | 10 + xdg-user-dirs | [] [] | 68 + xkeyboard-config | [] | 28 + +-------------+ + 89 teams zh_HK zh_TW + 166 domains 7 42 2809 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and distributed +as such by its maintainer. There might be an observable lag between the +mere existence a PO file and its wide availability in a distribution. + + If Jun 2014 seems to be old, you may fetch a more recent copy of this +'ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix +with full percentage details can be found at +'http://translationproject.org/extra/matrix.html'. + +1.5 Using 'gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU 'gettext' in your +package. Of course you have to respect the GNU Lesser General Public +License which covers the use of the GNU 'gettext' library. This means +in particular that even non-free programs can use 'libintl' as a shared +library, whereas only free software can use 'libintl' as a static +library or use modified versions of 'libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of 'gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +'coordinator@translationproject.org' to make the '.pot' files available +to the translation teams. diff -Nru libmicrohttpd-0.9.44+dfsg/po/boldquot.sed libmicrohttpd-0.9.55/po/boldquot.sed --- libmicrohttpd-0.9.44+dfsg/po/boldquot.sed 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/boldquot.sed 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff -Nru libmicrohttpd-0.9.44+dfsg/po/ChangeLog libmicrohttpd-0.9.55/po/ChangeLog --- libmicrohttpd-0.9.44+dfsg/po/ChangeLog 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/ChangeLog 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,5 @@ +2016-09-05 gettextize + + * Makefile.in.in: Upgrade to gettext-0.19.8.1. + * Rules-quot: Upgrade to gettext-0.19.8.1. + diff -Nru libmicrohttpd-0.9.44+dfsg/po/configure libmicrohttpd-0.9.55/po/configure --- libmicrohttpd-0.9.44+dfsg/po/configure 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/configure 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,7615 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for GNU Libmicrohttpd 0.9.55. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libmicrohttpd@gnu.org about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='GNU Libmicrohttpd' +PACKAGE_TARNAME='libmicrohttpd' +PACKAGE_VERSION='0.9.55' +PACKAGE_STRING='GNU Libmicrohttpd 0.9.55' +PACKAGE_BUGREPORT='libmicrohttpd@gnu.org' +PACKAGE_URL='http://www.gnu.org/software/libmicrohttpd/' + +ac_unique_file="Makevars" +gt_needs= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +POSUB +LTLIBINTL +LIBINTL +INTLLIBS +LTLIBICONV +LIBICONV +INTL_MACOSX_LIBS +EGREP +GREP +CPP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +XGETTEXT_EXTRA_OPTIONS +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +GETTEXT_MACRO_VERSION +USE_NLS +SED +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_nls +enable_dependency_tracking +with_gnu_ld +enable_rpath +with_libiconv_prefix +with_libintl_prefix +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures GNU Libmicrohttpd 0.9.55 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libmicrohttpd] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU Libmicrohttpd 0.9.55:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --disable-nls do not use Native Language Support + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-rpath do not hardcode runtime library paths + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +GNU Libmicrohttpd home page: . +General help using GNU software: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +GNU Libmicrohttpd configure 0.9.55 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GNU Libmicrohttpd $as_me 0.9.55, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +gt_needs="$gt_needs " +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +ac_aux_dir= +for ac_dir in .. "$srcdir"/..; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in .. \"$srcdir\"/.." "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +am__api_version='1.15' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libmicrohttpd' + VERSION='0.9.55' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.19 + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 +$as_echo_n "checking for ld... " >&6; } +elif test "$GCC" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + if ${acl_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + fi + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext +/* end confdefs.h. */ +#if defined __powerpc64__ || defined _ARCH_PPC64 + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + # The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + +fi +rm -f conftest* + + ;; + esac + +fi + + LD="$acl_cv_path_LD" +fi +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${acl_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if ${acl_cv_rpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 +$as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } +if ${acl_cv_libdirstems+:} false; then : + $as_echo_n "(cached) " >&6 +else + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if ${gl_cv_solaris_64bit+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(if test -f /usr/bin/gcc \ + && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ + LC_ALL=C /usr/bin/gcc -print-search-dirs; \ + else \ + LC_ALL=C $CC -print-search-dirs; \ + fi) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 +$as_echo "$acl_cv_libdirstems" >&6; } + # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if eval \${$gt_func_gnugettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libc=yes" +else + eval "$gt_func_gnugettext_libc=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if ${am_cv_func_iconv_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main () +{ +int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then : + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + HAVE_LIBINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if eval \${$gt_func_gnugettext_libintl+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libintl=yes" +else + eval "$gt_func_gnugettext_libintl=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + +$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +ac_config_files="$ac_config_files ./Makefile.in" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by GNU Libmicrohttpd $as_me 0.9.55, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to . +GNU Libmicrohttpd home page: . +General help using GNU software: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +GNU Libmicrohttpd config.status 0.9.55 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "./Makefile.in") CONFIG_FILES="$CONFIG_FILES ./Makefile.in" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff -Nru libmicrohttpd-0.9.44+dfsg/po/configure.ac libmicrohttpd-0.9.55/po/configure.ac --- libmicrohttpd-0.9.44+dfsg/po/configure.ac 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/configure.ac 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,17 @@ +# This configure.ac.in is in the public domain + +# Use versions from parent configure +AC_INIT([GNU Libmicrohttpd], [0.9.55], [libmicrohttpd@gnu.org]) + +AC_CONFIG_SRCDIR([Makevars]) +AC_CONFIG_MACRO_DIR([../m4]) +AC_CONFIG_AUX_DIR([..]) +AM_INIT_AUTOMAKE([silent-rules]) + +AM_GNU_GETTEXT([external]) + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +AC_OUTPUT([./Makefile.in]) diff -Nru libmicrohttpd-0.9.44+dfsg/po/configure.ac.in libmicrohttpd-0.9.55/po/configure.ac.in --- libmicrohttpd-0.9.44+dfsg/po/configure.ac.in 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/configure.ac.in 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,17 @@ +# This configure.ac.in is in the public domain + +# Use versions from parent configure +AC_INIT([@PACKAGE_NAME@], [@PACKAGE_VERSION@], [@PACKAGE_BUGREPORT@]) + +AC_CONFIG_SRCDIR([Makevars]) +AC_CONFIG_MACRO_DIR([../m4]) +AC_CONFIG_AUX_DIR([..]) +AM_INIT_AUTOMAKE([silent-rules]) + +AM_GNU_GETTEXT([external]) + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +AC_OUTPUT([./Makefile.in]) diff -Nru libmicrohttpd-0.9.44+dfsg/po/en@boldquot.header libmicrohttpd-0.9.55/po/en@boldquot.header --- libmicrohttpd-0.9.44+dfsg/po/en@boldquot.header 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/en@boldquot.header 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff -Nru libmicrohttpd-0.9.44+dfsg/po/en@quot.header libmicrohttpd-0.9.55/po/en@quot.header --- libmicrohttpd-0.9.44+dfsg/po/en@quot.header 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/en@quot.header 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff -Nru libmicrohttpd-0.9.44+dfsg/po/insert-header.sin libmicrohttpd-0.9.55/po/insert-header.sin --- libmicrohttpd-0.9.44+dfsg/po/insert-header.sin 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/insert-header.sin 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff -Nru libmicrohttpd-0.9.44+dfsg/po/libmicrohttpd.pot libmicrohttpd-0.9.55/po/libmicrohttpd.pot --- libmicrohttpd-0.9.44+dfsg/po/libmicrohttpd.pot 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/libmicrohttpd.pot 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,719 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Christian Grothoff +# This file is distributed under the same license as the GNU libmicrohttpd package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: GNU libmicrohttpd 0.9.55\n" +"Report-Msgid-Bugs-To: libmicrohttpd@gnu.org\n" +"POT-Creation-Date: 2017-05-28 23:34+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../src/microhttpd/connection.c:645 ../src/microhttpd/connection.c:664 +#: ../src/microhttpd/daemon.c:2758 ../src/microhttpd/daemon.c:3231 +#: ../src/microhttpd/daemon.c:6134 +msgid "Failed to remove FD from epoll set\n" +msgstr "" + +#: ../src/microhttpd/connection.c:766 +msgid "Closing connection (application reported error generating data)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:812 +msgid "Closing connection (out of memory)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:856 +msgid "Closing connection (application error generating response)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1418 +#, c-format +msgid "" +"Error processing request (HTTP response code is %u (`%s')). Closing " +"connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1441 ../src/microhttpd/connection.c:3142 +#: ../src/microhttpd/connection.c:3254 +msgid "Closing connection (failed to create response header)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1468 ../src/microhttpd/connection.c:2577 +#: ../src/microhttpd/connection.c:2641 ../src/microhttpd/connection.c:2907 +#: ../src/microhttpd/connection_https.c:139 +#, c-format +msgid "In function %s handling connection at state: %s\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1691 +msgid "Not enough memory in pool to allocate header record!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1733 +msgid "Not enough memory in pool to parse cookies!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1938 ../src/microhttpd/connection.c:2123 +msgid "Application reported internal error, closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1991 ../src/microhttpd/connection.c:2068 +msgid "" +"Received malformed HTTP request (bad chunked encoding). Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2131 +msgid "libmicrohttpd API violation" +msgstr "" + +#: ../src/microhttpd/connection.c:2146 +msgid "" +"WARNING: incomplete upload processing and connection not suspended may " +"result in hung connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2250 +#, c-format +msgid "Sent response: `%.*s'\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2311 +msgid "Received malformed line (no colon). Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2463 +msgid "Received HTTP 1.1 request without `Host' header.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2670 +#, c-format +msgid "Failed to send data in request for %s: %s\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2680 +#, c-format +msgid "Sent 100 continue response: `%.*s'\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2721 +msgid "Data offset exceeds limit" +msgstr "" + +#: ../src/microhttpd/connection.c:2730 +#, c-format +msgid "Sent %d-byte DATA response: `%.*s'\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2746 +#, c-format +msgid "Failed to send data in request for `%s': %s\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2806 +msgid "Internal error\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2877 +msgid "" +"Failed to signal end of connection via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/connection.c:3419 ../src/microhttpd/daemon.c:2653 +#: ../src/microhttpd/daemon.c:4208 ../src/microhttpd/daemon.c:4239 +#: ../src/microhttpd/daemon.c:5314 ../src/microhttpd/daemon.c:5331 +#: ../src/microhttpd/response.c:899 ../src/microhttpd/response.c:925 +#, c-format +msgid "Call to epoll_ctl failed: %s\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3600 +msgid "" +"Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3609 +msgid "Application used invalid status code for 'upgrade' response!\n" +msgstr "" + +#: ../src/microhttpd/internal.h:78 +msgid "Failed to close FD.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:137 +#, c-format +msgid "Fatal error in GNU libmicrohttpd %s:%u: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:353 +msgid "Failed to add IP connection count node\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:411 +msgid "Failed to find previously-added IP address\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:417 +msgid "Previously-added IP address had counter of zero\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:597 +msgid "" +"Failed to setup x509 certificate/key: pre 3.X.X version of GnuTLS does not " +"support setting key password" +msgstr "" + +#: ../src/microhttpd/daemon.c:647 +#, c-format +msgid "Error: invalid credentials type %d specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1035 +#, c-format +msgid "Maximum socket in select set: %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1088 +msgid "" +"MHD_get_fdset2() called with except_fd_set set to NULL. Such behavior is " +"unsupported.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1294 ../src/microhttpd/daemon.c:6230 +msgid "" +"Initiated daemon shutdown while \"upgraded\" connection was not closed.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1308 ../src/microhttpd/daemon.c:1543 +msgid "Failed to forward to application " +msgstr "" + +#: ../src/microhttpd/daemon.c:1475 ../src/microhttpd/daemon.c:1597 +msgid "Failed to forward to remote client " +msgstr "" + +#: ../src/microhttpd/daemon.c:1662 +msgid "Error preparing select\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1696 ../src/microhttpd/daemon.c:1846 +#: ../src/microhttpd/daemon.c:1990 +#, c-format +msgid "Error during select (%d): `%s'\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1745 ../src/microhttpd/daemon.c:1867 +#: ../src/microhttpd/daemon.c:2059 +#, c-format +msgid "Error during poll: `%s'\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1830 ../src/microhttpd/daemon.c:1972 +msgid "Failed to add FD to fd_set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2113 +msgid "Processing thread terminating. Closing connection\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2392 ../src/microhttpd/daemon.c:5907 +#, c-format +msgid "Socket descriptor larger than FD_SETSIZE: %d > %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2408 +#, c-format +msgid "Failed to set SO_NOSIGPIPE on accepted socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2425 ../src/microhttpd/daemon.c:3148 +#, c-format +msgid "Accepted connection on socket %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2437 +msgid "Server reached connection limit. Closing inbound connection.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2455 +msgid "Connection rejected by application. Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2488 ../src/microhttpd/daemon.c:2508 +#: ../src/microhttpd/daemon.c:3718 +#, c-format +msgid "Error allocating memory: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2558 +#, c-format +msgid "Failed to setup TLS credentials: unknown credential type %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2567 +msgid "Unknown credential type" +msgstr "" + +#: ../src/microhttpd/daemon.c:2633 +msgid "Failed to signal new connection via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:2805 +msgid "Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2811 +msgid "Error: connection scheduled for \"upgrade\" cannot be suspended" +msgstr "" + +#: ../src/microhttpd/daemon.c:2835 +msgid "Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2845 +msgid "Failed to signal resume via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:2958 +msgid "" +"Failed to signal resume of connection via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:3006 +#, c-format +msgid "Failed to set nonblocking mode on new client socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3019 +msgid "Failed to set noninheritable mode on new client socket.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3092 +#, c-format +msgid "Error accepting connection: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3109 +msgid "" +"Hit process or system resource limit at FIRST connection. This is really bad " +"as there is no sane way to proceed. Will try busy waiting for system " +"resources to become magically available.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3117 +#, c-format +msgid "" +"Hit process or system resource limit at %u connections, temporarily " +"suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3129 +#, c-format +msgid "Failed to set nonblocking mode on incoming connection socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3141 +msgid "Failed to set noninheritable mode on incoming connection socket.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3187 ../src/microhttpd/daemon.c:6271 +#: ../src/microhttpd/daemon.c:6301 ../src/microhttpd/daemon.c:6358 +#: ../src/microhttpd/daemon.c:6393 +msgid "Failed to join a thread\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3282 +msgid "Illegal call to MHD_get_timeout\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3478 +msgid "" +"MHD_run_from_select() called with except_fd_set set to NULL. Such behavior " +"is deprecated.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3555 +msgid "Could not obtain daemon fdsets" +msgstr "" + +#: ../src/microhttpd/daemon.c:3572 +msgid "Could not add listen socket to fdset" +msgstr "" + +#: ../src/microhttpd/daemon.c:3600 +msgid "Could not add control inter-thread communication channel FD to fdset" +msgstr "" + +#: ../src/microhttpd/daemon.c:3656 +#, c-format +msgid "select failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3800 ../src/microhttpd/daemon.c:3946 +#, c-format +msgid "poll failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4079 ../src/microhttpd/daemon.c:4306 +#, c-format +msgid "Call to epoll_wait failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4258 ../src/microhttpd/daemon.c:4698 +msgid "Failed to remove listen FD from epoll set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4706 +msgid "Failed to signal quiesce via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:4725 +msgid "failed to signal quiesce via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:4827 +msgid "Warning: Too large timeout value, ignored.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4867 +msgid "" +"Warning: Zero size, specified for thread pool size, is ignored. Thread pool " +"is not used.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4875 +msgid "" +"Warning: \"1\", specified for thread pool size, is ignored. Thread pool is " +"not used.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4884 +#, c-format +msgid "Specified thread pool size (%u) too big\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4895 +msgid "" +"MHD_OPTION_THREAD_POOL_SIZE option is specified but " +"MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4904 +msgid "" +"Both MHD_OPTION_THREAD_POOL_SIZE option and MHD_USE_THREAD_PER_CONNECTION " +"flag are specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4919 ../src/microhttpd/daemon.c:4930 +#: ../src/microhttpd/daemon.c:4941 ../src/microhttpd/daemon.c:4952 +#: ../src/microhttpd/daemon.c:4994 +#, c-format +msgid "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4971 +msgid "Error initializing DH parameters\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4983 +msgid "Bad Diffie-Hellman parameters format\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5011 +#, c-format +msgid "Setting priorities to `%s' failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5024 +msgid "" +"MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5051 +msgid "" +"MHD_OPTION_LISTEN_SOCKET specified for daemon with MHD_USE_NO_LISTEN_SOCKET " +"flag set.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5098 +msgid "" +"Flag MHD_USE_PEDANTIC_CHECKS is ignored because another behavior is " +"specified by MHD_OPTION_STRICT_CLIENT.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5226 +#, c-format +msgid "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5232 +#, c-format +msgid "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5258 +#, c-format +msgid "Call to epoll_create1 failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5268 +msgid "Failed to set noninheritable mode on epoll FD.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5504 +msgid "" +"Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " +"MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was " +"added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5551 +#, c-format +msgid "Failed to create inter-thread communication channel: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5567 +msgid "" +"file descriptor for inter-thread communication channel exceeds maximum " +"value\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5587 +msgid "Specified value for NC_SIZE too large\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5601 +#, c-format +msgid "Failed to allocate memory for nonce-nc map: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5617 +msgid "MHD failed to initialize nonce-nc mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5635 +msgid "MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5645 +msgid "Threaded operations are not supported on Symbian.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5659 +#, c-format +msgid "Failed to create socket for listening: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5680 ../src/microhttpd/daemon.c:5699 +#: ../src/microhttpd/daemon.c:5722 ../src/microhttpd/daemon.c:5759 +#: ../src/microhttpd/daemon.c:5828 ../src/microhttpd/daemon.c:5859 +#, c-format +msgid "setsockopt failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5732 +msgid "Cannot allow listening address reuse: SO_REUSEPORT not defined\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5767 +msgid "" +"Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5839 +#, c-format +msgid "Failed to bind to port %u: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5870 +#, c-format +msgid "Failed to listen for connections: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5887 +#, c-format +msgid "Failed to set nonblocking mode on listening socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5924 +msgid "" +"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5937 ../src/microhttpd/daemon.c:5947 +msgid "MHD failed to initialize IP connection limit mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5962 +msgid "Failed to initialize TLS support\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5983 +#, c-format +msgid "Failed to create listen thread: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6031 +#, c-format +msgid "Failed to create worker inter-thread communication channel: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6042 +msgid "" +"File descriptor for worker inter-thread communication channel exceeds " +"maximum value\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6067 +msgid "MHD failed to initialize cleanup connection mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6081 +#, c-format +msgid "Failed to create pool thread: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6217 ../src/microhttpd/daemon.c:6248 +msgid "MHD_stop_daemon() called while we have suspended connections.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6257 ../src/microhttpd/daemon.c:6379 +msgid "Failed to signal shutdown via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:6342 +msgid "Failed to signal shutdown via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:6761 +msgid "Failed to initialize winsock\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6764 +msgid "Winsock version 2.2 is not available\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6771 ../src/microhttpd/daemon.c:6775 +msgid "Failed to initialise multithreading in libgcrypt\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6780 +msgid "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n" +msgstr "" + +#: ../src/microhttpd/mhd_sockets.h:248 +msgid "Close socket failed.\n" +msgstr "" + +#: ../src/microhttpd/connection_https.c:70 +msgid "Error: received handshake message out of context\n" +msgstr "" + +#: ../src/microhttpd/mhd_itc.h:347 +msgid "Failed to destroy ITC.\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:67 +msgid "Error decoding basic authentication\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:77 +msgid "Basic authentication doesn't contain ':' separator\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:95 +msgid "Failed to allocate memory for password\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:158 +msgid "Failed to add Basic auth header\n" +msgstr "" + +#: ../src/microhttpd/response.c:761 +msgid "" +"Invalid response for upgrade: application failed to set the 'Upgrade' " +"header!\n" +msgstr "" + +#: ../src/microhttpd/response.c:802 +msgid "Failed to make loopback sockets non-blocking.\n" +msgstr "" + +#: ../src/microhttpd/response.c:821 +msgid "Failed to set SO_NOSIGPIPE on loopback sockets.\n" +msgstr "" + +#: ../src/microhttpd/response.c:841 +#, c-format +msgid "Socketpair descriptor larger than FD_SETSIZE: %d > %d\n" +msgstr "" + +#: ../src/microhttpd/response.c:922 +msgid "Error cleaning up while handling epoll error" +msgstr "" + +#: ../src/microhttpd/digestauth.c:443 +msgid "" +"Stale nonce received. If this happens a lot, you should probably increase " +"the size of the nonce array.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:630 +msgid "Failed to allocate memory for copy of URI arguments\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:759 +msgid "Authentication failed, invalid timestamp format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:820 +msgid "Authentication failed, invalid format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:830 +msgid "Authentication failed, invalid nc format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:856 +msgid "Failed to allocate memory for auth header processing\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:896 +msgid "Authentication failed, URI does not match.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:916 +msgid "Authentication failed, arguments do not match.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:971 +msgid "Could not register nonce (is the nonce array size zero?).\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:994 +msgid "Failed to allocate memory for auth response header\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:1028 +msgid "Failed to add Digest auth header\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:111 +msgid "Failed to destroy mutex.\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:144 +msgid "Failed to lock mutex.\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:170 +msgid "Failed to unlock mutex.\n" +msgstr "" diff -Nru libmicrohttpd-0.9.44+dfsg/po/Makefile.in.in libmicrohttpd-0.9.55/po/Makefile.in.in --- libmicrohttpd-0.9.44+dfsg/po/Makefile.in.in 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/Makefile.in.in 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,516 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. +# +# Origin: gettext-0.19.8 +GETTEXT_MACRO_VERSION = 0.19 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SED = @SED@ +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +# Modified to fit MHD needs +top_po_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. +top_po_builddir = $(top_builddir)/po +# See '$(POTFILES):' rule +VPATH = @srcdir@:@srcdir@/po + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +# When building gettext-tools, we prefer to use the built programs +# rather than installed programs. However, we can't do that when we +# are cross compiling. +CROSS_COMPILING = @CROSS_COMPILING@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot +POFILESDEPS_yes = $(POFILESDEPS_) +POFILESDEPS_no = +POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT)) + +DISTFILESDEPS_ = update-po +DISTFILESDEPS_yes = $(DISTFILESDEPS_) +DISTFILESDEPS_no = +DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO)) + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# Ensure that the gettext macros and this Makefile.in.in are in sync. +CHECK_MACRO_VERSION = \ + test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + @$(CHECK_MACRO_VERSION) + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +# The determination of whether the package xyz is a GNU one is based on the +# heuristic whether some file in the top level directory mentions "GNU xyz". +# If GNU 'find' is available, we avoid grepping through monster files. +# Modified to fit MHD needs +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + package_gnu="$(PACKAGE_GNU)"; \ + test -n "$$package_gnu" || { \ + if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ + LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \ + -size -10000000c -exec grep 'GNU @PACKAGE@' \ + /dev/null '{}' ';' 2>/dev/null; \ + else \ + LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ + fi; \ + } | grep -v 'libtool:' >/dev/null; then \ + package_gnu=yes; \ + else \ + package_gnu=no; \ + fi; \ + }; \ + if test "$$package_gnu" = "yes"; then \ + package_prefix='GNU '; \ + else \ + package_prefix=''; \ + fi; \ + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_po_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_po_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_prefix}@PACKAGE@" \ + --package-version='$(VERSION)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot-header; then \ + sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \ + cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po; \ + rm -f $(DOMAIN).1po; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(POFILESDEPS) + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) \ + && { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ + esac; \ + }; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +# Modified for MHD +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + rm -fr po + +clean: mostlyclean + +# Modified to fit MHD needs +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + rm -f config.status config.cache config.log configure.lineno config.status.lineno stamp-po + +# Modified to fit MHD needs +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +# Added for MHD +# If source path is in absolute form, POTFILES generated with correct path, +# but if source path in relative form (forced by 'configure' for inplace builds) +# then POTFILES is generated with extra '..' ('po-directories' in config.status +# think that '.' is subdirectory and add additional '..' to path to source files) +# This rule create additional 'po' subdirectory which is included in VPATH. +$(POTFILES): + @ case "$(srcdir)" in \ + /* ) : ;; \ + * ) @mkdir_p@ po ;; \ + esac + +# Modified to fit MHD needs +mkdistdir: + @ $(mkdir_p) $(distdir) + @ case "$(srcdir)" in \ + /* ) : ;; \ + * ) @mkdir_p@ po ;; \ + esac + +# Modified to fit MHD needs +dist distdir: mkdistdir + test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS) + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + esac; \ + }; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +# Recreate Makefile by invoking config.status. Explicitly invoke the shell, +# because execution permission bits may not work on the current file system. +# Use @SHELL@, which is the shell determined by autoconf for the use by its +# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. +# Note: Fixed missging 'srcdir', Modified to fit MHD needs +Makefile: $(srcdir)/Makefile.in.in $(srcdir)/Makevars $(top_po_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_po_builddir) \ + && @SHELL@ ./config.status ./$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/po/Makevars libmicrohttpd-0.9.55/po/Makevars --- libmicrohttpd-0.9.44+dfsg/po/Makevars 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/Makevars 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,78 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Christian Grothoff + +# This tells whether or not to prepend "GNU " prefix to the package +# name that gets inserted into the header of the $(DOMAIN).pot file. +# Possible values are "yes", "no", or empty. If it is empty, try to +# detect it automatically by scanning the files in $(top_srcdir) for +# "GNU packagename" string. +PACKAGE_GNU = yes + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = libmicrohttpd@gnu.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = + +# These options get passed to msginit. +# If you want to disable line wrapping when writing PO files, add +# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and +# MSGINIT_OPTIONS. +MSGINIT_OPTIONS = + +# This tells whether or not to regenerate a PO file when $(DOMAIN).pot +# has changed. Possible values are "yes" and "no". Set this to no if +# the POT file is checked in the repository and the version control +# program ignores timestamps. +PO_DEPENDS_ON_POT = yes + +# This tells whether or not to forcibly update $(DOMAIN).pot and +# regenerate PO files on "make dist". Possible values are "yes" and +# "no". Set this to no if the POT file and PO files are maintained +# externally. +DIST_DEPENDS_ON_UPDATE_PO = yes diff -Nru libmicrohttpd-0.9.44+dfsg/po/POTFILES.in libmicrohttpd-0.9.55/po/POTFILES.in --- libmicrohttpd-0.9.44+dfsg/po/POTFILES.in 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/POTFILES.in 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,42 @@ +../src/include/autoinit_funcs.h +../src/include/microhttpd.h +../src/include/platform.h +../src/microhttpd/connection.c +../src/microhttpd/internal.h +../src/microhttpd/tsearch.h +../src/microhttpd/sysfdsetsize.h +../src/microhttpd/mhd_byteorder.h +../src/microhttpd/base64.c +../src/microhttpd/md5.h +../src/microhttpd/sysfdsetsize.c +../src/microhttpd/memorypool.c +../src/microhttpd/memorypool.h +../src/microhttpd/mhd_threads.c +../src/microhttpd/internal.c +../src/microhttpd/mhd_str.c +../src/microhttpd/mhd_itc_types.h +../src/microhttpd/connection_https.h +../src/microhttpd/mhd_compat.c +../src/microhttpd/mhd_sockets.c +../src/microhttpd/daemon.c +../src/microhttpd/mhd_mono_clock.c +../src/microhttpd/mhd_sockets.h +../src/microhttpd/md5.c +../src/microhttpd/tsearch.c +../src/microhttpd/mhd_str.h +../src/microhttpd/postprocessor.c +../src/microhttpd/base64.h +../src/microhttpd/mhd_itc.c +../src/microhttpd/connection_https.c +../src/microhttpd/connection.h +../src/microhttpd/response.h +../src/microhttpd/mhd_itc.h +../src/microhttpd/mhd_mono_clock.h +../src/microhttpd/basicauth.c +../src/microhttpd/mhd_compat.h +../src/microhttpd/reason_phrase.c +../src/microhttpd/response.c +../src/microhttpd/mhd_limits.h +../src/microhttpd/digestauth.c +../src/microhttpd/mhd_locks.h +../src/microhttpd/mhd_threads.h diff -Nru libmicrohttpd-0.9.44+dfsg/po/quot.sed libmicrohttpd-0.9.55/po/quot.sed --- libmicrohttpd-0.9.44+dfsg/po/quot.sed 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/quot.sed 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff -Nru libmicrohttpd-0.9.44+dfsg/po/remove-potcdate.sin libmicrohttpd-0.9.55/po/remove-potcdate.sin --- libmicrohttpd-0.9.44+dfsg/po/remove-potcdate.sin 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/remove-potcdate.sin 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff -Nru libmicrohttpd-0.9.44+dfsg/po/Rules-quot libmicrohttpd-0.9.55/po/Rules-quot --- libmicrohttpd-0.9.44+dfsg/po/Rules-quot 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/Rules-quot 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,58 @@ +# This file, Rules-quot, can be copied and used freely without restrictions. +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ + | $(SED) -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | \ + { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ + $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ + ;; \ + *) \ + $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ + ;; \ + esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ + ; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff -Nru libmicrohttpd-0.9.44+dfsg/po/stamp-po libmicrohttpd-0.9.55/po/stamp-po --- libmicrohttpd-0.9.44+dfsg/po/stamp-po 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/po/stamp-po 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1 @@ +timestamp diff -Nru libmicrohttpd-0.9.44+dfsg/README libmicrohttpd-0.9.55/README --- libmicrohttpd-0.9.44+dfsg/README 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/README 2017-05-28 22:34:00.000000000 +0200 @@ -7,11 +7,6 @@ protocol. The main application must still provide the application logic to generate the content. -Additionally, a second, still very experimental library is provided -for SPDY (the base for HTTP 2.0) support. libmicrospdy provides a -compact API and implementation of SPDY server. libmicrospdy currently -only implements partially version 3 of SPDY. - Installation ============ @@ -21,25 +16,10 @@ In order to run the testcases, you need a recent version of libcurl. libcurl is not required if you just want to install the library. -Especially for development, do use the MHD_USE_DEBUG option to get +Especially for development, do use the MHD_USE_ERROR_LOG option to get error messages. -Requirements for libmicrospdy -============================= - -The following packages are needed to build libmicrospdy: - -* zlib -* OpenSSL >= 1.0.1 - -To run the test cases, involving requests, version of Spdylay, supporting -SPDY v3, is required. Spdylay is still under development and can be -found here: - -http://spdylay.sourceforge.net/ - - Configure options ================= @@ -78,8 +58,7 @@ ================== This is a beta release for libmicrohttpd. Before declaring the -library stable, we should implement support for HTTP "Upgrade" -requests and have testcases for the following features: +library stable, we should have testcases for the following features: - HTTP/1.1 pipelining (need to figure out how to ensure curl pipelines -- and it seems libcurl has issues with pipelining, @@ -95,49 +74,3 @@ - parse_options (daemon.c) - MHD_set_panic_func (daemon.c) - MHD_get_version (daemon.c) - - -This is an early alpha release for libmicrospdy. The following things -should be implemented (in order of importance) before we can claim to -be reasonably complete: -- 8 different output queues (one for each priority) have to be implemented -together with a suitable algorithm for utilizing them. Otherwise, downloading -a file will block all responses with same or smaller priority -- SPDY RST_STREAM sending on each possible error (DONE?) -- SPDY_close_session -- Find the best way for closing still opened stream (new call or existing) -- SPDY_is_stream_opened -- SPDY PING (used often by browsers) -- receiving SPDY WINDOW_UPDATE -- SPDY Settings -- SPDY PUSH -- SPDY HEADERS -- SPDY Credentials - -Additional ideas for features include: -- Individual callbacks for each session -- Individual timeout for each session - -Unimplemented API functions of libmicrospdy: -- SPDY_settings_create (); -- SPDY_settings_add (...); -- SPDY_settings_lookup (...); -- SPDY_settings_iterate (...); -- SPDY_settings_destroy (...); -- SPDY_close_session(...); -- SPDY_send_ping(...); -- SPDY_send_settings (...); - -In particular, we should write tests for: -- Enqueueing responses while considering request priorities. -- HTTP methods other than GET - - - - - -Missing documentation: -====================== - -- libmicrospdy manual: - * missing entirely diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/authorization_example.c libmicrohttpd-0.9.55/src/examples/authorization_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/authorization_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/authorization_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -71,38 +71,48 @@ if (fail) { response = MHD_create_response_from_buffer (strlen (DENIED), - (void *) DENIED, + (void *) DENIED, MHD_RESPMEM_PERSISTENT); ret = MHD_queue_basic_auth_fail_response (connection,"TestRealm",response); } else { response = MHD_create_response_from_buffer (strlen (me), - (void *) me, + (void *) me, MHD_RESPMEM_PERSISTENT); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); } - + if (NULL != user) + free (user); + if (NULL != pass) + free (pass); MHD_destroy_response (response); return ret; } + int main (int argc, char *const *argv) { struct MHD_Daemon *d; + unsigned int port; - if (argc != 3) + if ( (argc != 2) || + (1 != sscanf (argv[1], "%u", &port)) || + (UINT16_MAX < port) ) { - printf ("%s PORT SECONDS-TO-RUN\n", argv[0]); + fprintf (stderr, + "%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); if (d == NULL) return 1; - sleep (atoi (argv[2])); + fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n"); + (void) getc (stdin); MHD_stop_daemon (d); return 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/benchmark.c libmicrohttpd-0.9.55/src/examples/benchmark.c --- libmicrohttpd-0.9.44+dfsg/src/examples/benchmark.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/benchmark.c 2017-05-28 22:34:00.000000000 +0200 @@ -134,9 +134,9 @@ MHD_HTTP_HEADER_CONNECTION, "close"); #endif - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_SUPPRESS_DATE_NO_CLOCK -#if EPOLL_SUPPORT - | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SUPPRESS_DATE_NO_CLOCK +#ifdef EPOLL_SUPPORT + | MHD_USE_EPOLL | MHD_USE_TURBO #endif , atoi (argv[1]), diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/benchmark_https.c libmicrohttpd-0.9.55/src/examples/benchmark_https.c --- libmicrohttpd-0.9.44+dfsg/src/examples/benchmark_https.c 2015-04-12 21:27:54.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/benchmark_https.c 2017-05-28 22:34:00.000000000 +0200 @@ -180,9 +180,9 @@ response = MHD_create_response_from_buffer (strlen (PAGE), (void *) PAGE, MHD_RESPMEM_PERSISTENT); - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL -#if EPOLL_SUPPORT - | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS +#ifdef EPOLL_SUPPORT + | MHD_USE_EPOLL | MHD_USE_TURBO #endif , atoi (argv[1]), diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/chunked_example.c libmicrohttpd-0.9.55/src/examples/chunked_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/chunked_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/chunked_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -78,10 +78,11 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (// MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_POLL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, - // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | MHD_USE_POLL, - // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (// MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + // MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, + // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, + // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, NULL, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/demo.c libmicrohttpd-0.9.55/src/examples/demo.c --- libmicrohttpd-0.9.44+dfsg/src/examples/demo.c 2015-08-02 19:01:48.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/demo.c 2017-05-28 22:34:00.000000000 +0200 @@ -693,12 +693,19 @@ if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) return MHD_NO; /* unexpected method (we're not polite...) */ - if ( (0 == stat (&url[1], &buf)) && - (NULL == strstr (&url[1], "..")) && - ('/' != url[1])) - fd = open (&url[1], O_RDONLY); - else - fd = -1; + fd = -1; + if ( (NULL == strstr (&url[1], "..")) && + ('/' != url[1]) ) + { + fd = open (&url[1], O_RDONLY); + if ( (-1 != fd) && + ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) ) + { + (void) close (fd); + fd = -1; + } + } if (-1 == fd) return MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, @@ -856,9 +863,9 @@ "%s PORT\n", argv[0]); return 1; } - #ifndef MINGW +#ifndef MINGW ignore_sigpipe (); - #endif +#endif magic = magic_open (MAGIC_MIME_TYPE); (void) magic_load (magic, NULL); @@ -876,11 +883,7 @@ MHD_RESPMEM_PERSISTENT); mark_as_html (internal_error_response); update_directory (); - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG -#if EPOLL_SUPPORT - | MHD_USE_EPOLL_LINUX_ONLY -#endif - , + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, port, NULL, NULL, &generate_page, NULL, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/demo_https.c libmicrohttpd-0.9.55/src/examples/demo_https.c --- libmicrohttpd-0.9.44+dfsg/src/examples/demo_https.c 2015-04-12 21:24:01.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/demo_https.c 2017-05-28 22:34:00.000000000 +0200 @@ -668,7 +668,7 @@ * @param upload_data data from upload (PUT/POST) * @param upload_data_size number of bytes in "upload_data" * @param ptr our context - * @return MHD_YES on success, MHD_NO to drop connection + * @return #MHD_YES on success, #MHD_NO to drop connection */ static int generate_page (void *cls, @@ -693,12 +693,19 @@ if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method (we're not polite...) */ - if ( (0 == stat (&url[1], &buf)) && - (NULL == strstr (&url[1], "..")) && - ('/' != url[1])) - fd = open (&url[1], O_RDONLY); - else - fd = -1; + fd = -1; + if ( (NULL == strstr (&url[1], "..")) && + ('/' != url[1]) ) + { + fd = open (&url[1], O_RDONLY); + if ( (-1 != fd) && + ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) ) + { + (void) close (fd); + fd = -1; + } + } if (-1 == fd) return MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, @@ -925,11 +932,7 @@ MHD_RESPMEM_PERSISTENT); mark_as_html (internal_error_response); update_directory (); - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_SSL -#if EPOLL_SUPPORT - | MHD_USE_EPOLL_LINUX_ONLY -#endif - , + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_TLS, port, NULL, NULL, &generate_page, NULL, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/digest_auth_example.c libmicrohttpd-0.9.55/src/examples/digest_auth_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/digest_auth_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/digest_auth_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -123,7 +123,7 @@ off += len; } (void) close(fd); - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof(rnd), rnd, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/dual_stack_example.c libmicrohttpd-0.9.55/src/examples/dual_stack_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/dual_stack_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/dual_stack_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -68,7 +68,7 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_DUAL_STACK, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_DUAL_STACK, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example.c libmicrohttpd-0.9.55/src/examples/fileserver_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example.c 2015-06-26 22:56:32.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/fileserver_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -24,31 +24,21 @@ #include "platform.h" #include +#ifdef HAVE_UNISTD_H #include +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_SYS_STAT_H +#include +#endif /* HAVE_SYS_STAT_H */ +#ifdef HAVE_FCNTL_H +#include +#endif /* HAVE_FCNTL_H */ #define PAGE "File not foundFile not found" - -static ssize_t -file_reader (void *cls, - uint64_t pos, - char *buf, - size_t max) -{ - FILE *file = cls; - - (void) fseek (file, pos, SEEK_SET); - return fread (buf, 1, max, file); -} - - -static void -free_callback (void *cls) -{ - FILE *file = cls; - fclose (file); -} - +#ifndef S_ISREG +#define S_ISREG(x) (S_IFREG == (x & S_IFREG)) +#endif /* S_ISREG */ static int ahc_echo (void *cls, @@ -62,7 +52,7 @@ static int aptr; struct MHD_Response *response; int ret; - FILE *file; + int fd; struct stat buf; if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && @@ -75,11 +65,26 @@ return MHD_YES; } *ptr = NULL; /* reset when done */ - if (0 == stat (&url[1], &buf)) - file = fopen (&url[1], "rb"); + /* WARNING: direct usage of url as filename is for example only! + * NEVER pass received data directly as parameter to file manipulation + * functions. Always check validity of data before using. + */ + if (NULL != strstr(url, "../")) /* Very simplified check! */ + fd = -1; /* Do not allow usage of parent directories. */ else - file = NULL; - if (NULL == file) + fd = open (url + 1, O_RDONLY); + if (-1 != fd) + { + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + if (0 != close (fd)) + abort (); + fd = -1; + } + } + if (-1 == fd) { response = MHD_create_response_from_buffer (strlen (PAGE), (void *) PAGE, @@ -89,13 +94,11 @@ } else { - response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k page size */ - &file_reader, - file, - &free_callback); + response = MHD_create_response_from_fd64 (buf.st_size, fd); if (NULL == response) { - fclose (file); + if (0 != close (fd)) + abort (); return MHD_NO; } ret = MHD_queue_response (connection, MHD_HTTP_OK, response); @@ -115,7 +118,7 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); if (d == NULL) diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example_dirs.c libmicrohttpd-0.9.55/src/examples/fileserver_example_dirs.c --- libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example_dirs.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/fileserver_example_dirs.c 2017-05-28 22:34:00.000000000 +0200 @@ -18,7 +18,7 @@ */ /** - * @file fileserver_example.c + * @file fileserver_example_dirs.c * @brief example for how to use libmicrohttpd to serve files (with directory support) * @author Christian Grothoff */ @@ -30,6 +30,7 @@ #define PAGE "File not foundFile not found" + static ssize_t file_reader (void *cls, uint64_t pos, char *buf, size_t max) { @@ -39,6 +40,7 @@ return fread (buf, 1, max, file); } + static void file_free_callback (void *cls) { @@ -46,6 +48,7 @@ fclose (file); } + static void dir_free_callback (void *cls) { @@ -54,6 +57,7 @@ closedir (dir); } + static ssize_t dir_reader (void *cls, uint64_t pos, char *buf, size_t max) { @@ -88,6 +92,7 @@ struct MHD_Response *response; int ret; FILE *file; + int fd; DIR *dir; struct stat buf; char emsg[1024]; @@ -101,17 +106,31 @@ return MHD_YES; } *ptr = NULL; /* reset when done */ - if ( (0 == stat (&url[1], &buf)) && - (S_ISREG (buf.st_mode)) ) - file = fopen (&url[1], "rb"); - else - file = NULL; - if (file == NULL) + + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) { dir = opendir ("."); - if (dir == NULL) + if (NULL == dir) { - /* most likely cause: more concurrent requests than + /* most likely cause: more concurrent requests than available file descriptors / 2 */ snprintf (emsg, sizeof (emsg), @@ -120,9 +139,11 @@ response = MHD_create_response_from_buffer (strlen (emsg), emsg, MHD_RESPMEM_MUST_COPY); - if (response == NULL) - return MHD_NO; - ret = MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE, response); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_response (connection, + MHD_HTTP_SERVICE_UNAVAILABLE, + response); MHD_destroy_response (response); } else @@ -132,7 +153,7 @@ &dir_reader, dir, &dir_free_callback); - if (response == NULL) + if (NULL == response) { closedir (dir); return MHD_NO; @@ -147,7 +168,7 @@ &file_reader, file, &file_free_callback); - if (response == NULL) + if (NULL == response) { fclose (file); return MHD_NO; @@ -158,6 +179,7 @@ return ret; } + int main (int argc, char *const *argv) { @@ -168,10 +190,10 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); - if (d == NULL) + if (NULL == d) return 1; (void) getc (stdin); MHD_stop_daemon (d); diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example_external_select.c libmicrohttpd-0.9.55/src/examples/fileserver_example_external_select.c --- libmicrohttpd-0.9.44+dfsg/src/examples/fileserver_example_external_select.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/fileserver_example_external_select.c 2017-05-28 22:34:00.000000000 +0200 @@ -38,6 +38,7 @@ return fread (buf, 1, max, file); } + static void free_callback (void *cls) { @@ -45,6 +46,7 @@ fclose (file); } + static int ahc_echo (void *cls, struct MHD_Connection *connection, @@ -58,6 +60,7 @@ struct MHD_Response *response; int ret; FILE *file; + int fd; struct stat buf; if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) @@ -69,12 +72,26 @@ return MHD_YES; } *ptr = NULL; /* reset when done */ - if ( (0 == stat (&url[1], &buf)) && - (S_ISREG (buf.st_mode)) ) - file = fopen (&url[1], "rb"); - else - file = NULL; - if (file == NULL) + + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) { response = MHD_create_response_from_buffer (strlen (PAGE), (void *) PAGE, @@ -88,7 +105,7 @@ &file_reader, file, &free_callback); - if (response == NULL) + if (NULL == response) { fclose (file); return MHD_NO; @@ -99,6 +116,7 @@ return ret; } + int main (int argc, char *const *argv) { @@ -117,7 +135,7 @@ printf ("%s PORT SECONDS-TO-RUN\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); if (d == NULL) @@ -141,7 +159,11 @@ tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000LL)) * 1000LL; } } - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } MHD_run (d); } MHD_stop_daemon (d); diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/https_fileserver_example.c libmicrohttpd-0.9.55/src/examples/https_fileserver_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/https_fileserver_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/https_fileserver_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -125,6 +125,7 @@ struct MHD_Response *response; int ret; FILE *file; + int fd; struct stat buf; if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) @@ -137,12 +138,25 @@ } *ptr = NULL; /* reset when done */ - if ( (0 == stat (&url[1], &buf)) && - (S_ISREG (buf.st_mode)) ) - file = fopen (&url[1], "rb"); - else - file = NULL; - if (file == NULL) + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) { response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE), (void *) EMPTY_PAGE, @@ -155,7 +169,7 @@ response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k PAGE_NOT_FOUND size */ &file_reader, file, &file_free_callback); - if (response == NULL) + if (NULL == response) { fclose (file); return MHD_NO; @@ -166,6 +180,7 @@ return ret; } + int main (int argc, char *const *argv) { @@ -176,8 +191,8 @@ /* TODO check if this is truly necessary - disallow usage of the blocking /dev/random */ /* gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0); */ TLS_daemon = - MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | - MHD_USE_SSL, atoi (argv[1]), NULL, NULL, &http_ahc, + MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | + MHD_USE_TLS, atoi (argv[1]), NULL, NULL, &http_ahc, NULL, MHD_OPTION_CONNECTION_TIMEOUT, 256, MHD_OPTION_HTTPS_MEM_KEY, key_pem, MHD_OPTION_HTTPS_MEM_CERT, cert_pem, diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/Makefile.am libmicrohttpd-0.9.55/src/examples/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/examples/Makefile.am 2015-07-12 02:11:26.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -13,17 +13,6 @@ AM_CFLAGS += --coverage endif -if ENABLE_SPDY -spdyex = \ - spdy_event_loop \ - spdy_fileserver \ - spdy_response_with_callback - -if HAVE_SPDYLAY -spdyex += mhd2spdy -endif -endif - # example programs noinst_PROGRAMS = \ @@ -34,12 +23,14 @@ dual_stack_example \ minimal_example_comet \ querystring_example \ + timeout \ fileserver_example \ fileserver_example_dirs \ fileserver_example_external_select \ - refuse_post_example \ - $(spdyex) + refuse_post_example +EXTRA_DIST = msgs_i18n.c +noinst_EXTRA_DIST = msgs_i18n.c if ENABLE_HTTPS noinst_PROGRAMS += https_fileserver_example @@ -64,6 +55,11 @@ authorization_example endif +if ENABLE_UPGRADE +noinst_PROGRAMS += \ + upgrade_example +endif + if HAVE_W32 AM_CFLAGS += -DWINDOWS endif @@ -73,6 +69,16 @@ minimal_example_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +upgrade_example_SOURCES = \ + upgrade_example.c +upgrade_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +timeout_SOURCES = \ + timeout.c +timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + chunked_example_SOURCES = \ chunked_example.c chunked_example_LDADD = \ @@ -98,15 +104,6 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) -lmagic -mhd2spdy_SOURCES = \ - mhd2spdy.c \ - mhd2spdy_spdy.c mhd2spdy_spdy.h \ - mhd2spdy_http.c mhd2spdy_http.h \ - mhd2spdy_structures.c mhd2spdy_structures.h -mhd2spdy_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - -lssl -lcrypto -lspdylay - benchmark_SOURCES = \ benchmark.c benchmark_CPPFLAGS = \ @@ -177,22 +174,3 @@ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) https_fileserver_example_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la - - -spdy_event_loop_SOURCES = \ - spdy_event_loop.c -spdy_event_loop_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -spdy_fileserver_SOURCES = \ - spdy_fileserver.c -spdy_fileserver_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -spdy_response_with_callback_SOURCES = \ - spdy_response_with_callback.c -spdy_response_with_callback_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/Makefile.in libmicrohttpd-0.9.55/src/examples/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/examples/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -89,30 +89,32 @@ build_triplet = @build@ host_triplet = @host@ @USE_COVERAGE_TRUE@am__append_1 = --coverage -@ENABLE_SPDY_TRUE@@HAVE_SPDYLAY_TRUE@am__append_2 = mhd2spdy noinst_PROGRAMS = benchmark$(EXEEXT) benchmark_https$(EXEEXT) \ chunked_example$(EXEEXT) minimal_example$(EXEEXT) \ dual_stack_example$(EXEEXT) minimal_example_comet$(EXEEXT) \ - querystring_example$(EXEEXT) fileserver_example$(EXEEXT) \ - fileserver_example_dirs$(EXEEXT) \ + querystring_example$(EXEEXT) timeout$(EXEEXT) \ + fileserver_example$(EXEEXT) fileserver_example_dirs$(EXEEXT) \ fileserver_example_external_select$(EXEEXT) \ - refuse_post_example$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \ - $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \ - $(am__EXEEXT_7) -@ENABLE_HTTPS_TRUE@am__append_3 = https_fileserver_example -@HAVE_POSTPROCESSOR_TRUE@am__append_4 = \ + refuse_post_example$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) \ + $(am__EXEEXT_6) +@ENABLE_HTTPS_TRUE@am__append_2 = https_fileserver_example +@HAVE_POSTPROCESSOR_TRUE@am__append_3 = \ @HAVE_POSTPROCESSOR_TRUE@ post_example -@HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_5 = \ +@HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_4 = \ @HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@ demo \ @HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@ demo_https -@ENABLE_DAUTH_TRUE@am__append_6 = \ +@ENABLE_DAUTH_TRUE@am__append_5 = \ @ENABLE_DAUTH_TRUE@ digest_auth_example -@ENABLE_BAUTH_TRUE@am__append_7 = \ +@ENABLE_BAUTH_TRUE@am__append_6 = \ @ENABLE_BAUTH_TRUE@ authorization_example +@ENABLE_UPGRADE_TRUE@am__append_7 = \ +@ENABLE_UPGRADE_TRUE@ upgrade_example + @HAVE_W32_TRUE@am__append_8 = -DWINDOWS subdir = src/examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -120,7 +122,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -128,8 +129,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -137,18 +141,14 @@ CONFIG_HEADER = $(top_builddir)/MHD_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -@ENABLE_SPDY_TRUE@@HAVE_SPDYLAY_TRUE@am__EXEEXT_1 = mhd2spdy$(EXEEXT) -@ENABLE_SPDY_TRUE@am__EXEEXT_2 = spdy_event_loop$(EXEEXT) \ -@ENABLE_SPDY_TRUE@ spdy_fileserver$(EXEEXT) \ -@ENABLE_SPDY_TRUE@ spdy_response_with_callback$(EXEEXT) \ -@ENABLE_SPDY_TRUE@ $(am__EXEEXT_1) -@ENABLE_HTTPS_TRUE@am__EXEEXT_3 = https_fileserver_example$(EXEEXT) -@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_4 = post_example$(EXEEXT) -@HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_5 = \ +@ENABLE_HTTPS_TRUE@am__EXEEXT_1 = https_fileserver_example$(EXEEXT) +@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_2 = post_example$(EXEEXT) +@HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_3 = \ @HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@ demo$(EXEEXT) \ @HAVE_MAGIC_TRUE@@HAVE_POSTPROCESSOR_TRUE@ demo_https$(EXEEXT) -@ENABLE_DAUTH_TRUE@am__EXEEXT_6 = digest_auth_example$(EXEEXT) -@ENABLE_BAUTH_TRUE@am__EXEEXT_7 = authorization_example$(EXEEXT) +@ENABLE_DAUTH_TRUE@am__EXEEXT_4 = digest_auth_example$(EXEEXT) +@ENABLE_BAUTH_TRUE@am__EXEEXT_5 = authorization_example$(EXEEXT) +@ENABLE_UPGRADE_TRUE@am__EXEEXT_6 = upgrade_example$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am_authorization_example_OBJECTS = authorization_example.$(OBJEXT) authorization_example_OBJECTS = $(am_authorization_example_OBJECTS) @@ -217,11 +217,6 @@ $(am_https_fileserver_example_OBJECTS) https_fileserver_example_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la -am_mhd2spdy_OBJECTS = mhd2spdy.$(OBJEXT) mhd2spdy_spdy.$(OBJEXT) \ - mhd2spdy_http.$(OBJEXT) mhd2spdy_structures.$(OBJEXT) -mhd2spdy_OBJECTS = $(am_mhd2spdy_OBJECTS) -mhd2spdy_DEPENDENCIES = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la am_minimal_example_OBJECTS = minimal_example.$(OBJEXT) minimal_example_OBJECTS = $(am_minimal_example_OBJECTS) minimal_example_DEPENDENCIES = \ @@ -242,20 +237,14 @@ refuse_post_example_OBJECTS = $(am_refuse_post_example_OBJECTS) refuse_post_example_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la -am_spdy_event_loop_OBJECTS = spdy_event_loop.$(OBJEXT) -spdy_event_loop_OBJECTS = $(am_spdy_event_loop_OBJECTS) -spdy_event_loop_DEPENDENCIES = \ - $(top_builddir)/src/microspdy/libmicrospdy.la -am_spdy_fileserver_OBJECTS = spdy_fileserver.$(OBJEXT) -spdy_fileserver_OBJECTS = $(am_spdy_fileserver_OBJECTS) -spdy_fileserver_DEPENDENCIES = \ - $(top_builddir)/src/microspdy/libmicrospdy.la -am_spdy_response_with_callback_OBJECTS = \ - spdy_response_with_callback.$(OBJEXT) -spdy_response_with_callback_OBJECTS = \ - $(am_spdy_response_with_callback_OBJECTS) -spdy_response_with_callback_DEPENDENCIES = \ - $(top_builddir)/src/microspdy/libmicrospdy.la +am_timeout_OBJECTS = timeout.$(OBJEXT) +timeout_OBJECTS = $(am_timeout_OBJECTS) +timeout_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_upgrade_example_OBJECTS = upgrade_example.$(OBJEXT) +upgrade_example_OBJECTS = $(am_upgrade_example_OBJECTS) +upgrade_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -297,12 +286,10 @@ $(fileserver_example_SOURCES) \ $(fileserver_example_dirs_SOURCES) \ $(fileserver_example_external_select_SOURCES) \ - $(https_fileserver_example_SOURCES) $(mhd2spdy_SOURCES) \ - $(minimal_example_SOURCES) $(minimal_example_comet_SOURCES) \ - $(post_example_SOURCES) $(querystring_example_SOURCES) \ - $(refuse_post_example_SOURCES) $(spdy_event_loop_SOURCES) \ - $(spdy_fileserver_SOURCES) \ - $(spdy_response_with_callback_SOURCES) + $(https_fileserver_example_SOURCES) $(minimal_example_SOURCES) \ + $(minimal_example_comet_SOURCES) $(post_example_SOURCES) \ + $(querystring_example_SOURCES) $(refuse_post_example_SOURCES) \ + $(timeout_SOURCES) $(upgrade_example_SOURCES) DIST_SOURCES = $(authorization_example_SOURCES) $(benchmark_SOURCES) \ $(benchmark_https_SOURCES) $(chunked_example_SOURCES) \ $(demo_SOURCES) $(demo_https_SOURCES) \ @@ -310,12 +297,10 @@ $(fileserver_example_SOURCES) \ $(fileserver_example_dirs_SOURCES) \ $(fileserver_example_external_select_SOURCES) \ - $(https_fileserver_example_SOURCES) $(mhd2spdy_SOURCES) \ - $(minimal_example_SOURCES) $(minimal_example_comet_SOURCES) \ - $(post_example_SOURCES) $(querystring_example_SOURCES) \ - $(refuse_post_example_SOURCES) $(spdy_event_loop_SOURCES) \ - $(spdy_fileserver_SOURCES) \ - $(spdy_response_with_callback_SOURCES) + $(https_fileserver_example_SOURCES) $(minimal_example_SOURCES) \ + $(minimal_example_comet_SOURCES) $(post_example_SOURCES) \ + $(querystring_example_SOURCES) $(refuse_post_example_SOURCES) \ + $(timeout_SOURCES) $(upgrade_example_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ @@ -409,8 +394,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -418,6 +405,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -433,9 +421,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -443,6 +428,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -457,9 +443,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -481,13 +464,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -495,6 +475,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -539,6 +520,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -556,14 +538,26 @@ AM_CFLAGS = @LIBGCRYPT_CFLAGS@ $(am__append_1) $(am__append_8) CPU_COUNT_DEF = -DCPU_COUNT=$(CPU_COUNT) -@ENABLE_SPDY_TRUE@spdyex = spdy_event_loop spdy_fileserver \ -@ENABLE_SPDY_TRUE@ spdy_response_with_callback $(am__append_2) +EXTRA_DIST = msgs_i18n.c +noinst_EXTRA_DIST = msgs_i18n.c minimal_example_SOURCES = \ minimal_example.c minimal_example_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +upgrade_example_SOURCES = \ + upgrade_example.c + +upgrade_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +timeout_SOURCES = \ + timeout.c + +timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + chunked_example_SOURCES = \ chunked_example.c @@ -596,16 +590,6 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) -lmagic -mhd2spdy_SOURCES = \ - mhd2spdy.c \ - mhd2spdy_spdy.c mhd2spdy_spdy.h \ - mhd2spdy_http.c mhd2spdy_http.h \ - mhd2spdy_structures.c mhd2spdy_structures.h - -mhd2spdy_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - -lssl -lcrypto -lspdylay - benchmark_SOURCES = \ benchmark.c @@ -693,27 +677,6 @@ https_fileserver_example_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la -spdy_event_loop_SOURCES = \ - spdy_event_loop.c - -spdy_event_loop_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -spdy_fileserver_SOURCES = \ - spdy_fileserver.c - -spdy_fileserver_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -spdy_response_with_callback_SOURCES = \ - spdy_response_with_callback.c - -spdy_response_with_callback_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - all: all-recursive .SUFFIXES: @@ -805,10 +768,6 @@ @rm -f https_fileserver_example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(https_fileserver_example_OBJECTS) $(https_fileserver_example_LDADD) $(LIBS) -mhd2spdy$(EXEEXT): $(mhd2spdy_OBJECTS) $(mhd2spdy_DEPENDENCIES) $(EXTRA_mhd2spdy_DEPENDENCIES) - @rm -f mhd2spdy$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(mhd2spdy_OBJECTS) $(mhd2spdy_LDADD) $(LIBS) - minimal_example$(EXEEXT): $(minimal_example_OBJECTS) $(minimal_example_DEPENDENCIES) $(EXTRA_minimal_example_DEPENDENCIES) @rm -f minimal_example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(minimal_example_OBJECTS) $(minimal_example_LDADD) $(LIBS) @@ -829,17 +788,13 @@ @rm -f refuse_post_example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(refuse_post_example_OBJECTS) $(refuse_post_example_LDADD) $(LIBS) -spdy_event_loop$(EXEEXT): $(spdy_event_loop_OBJECTS) $(spdy_event_loop_DEPENDENCIES) $(EXTRA_spdy_event_loop_DEPENDENCIES) - @rm -f spdy_event_loop$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(spdy_event_loop_OBJECTS) $(spdy_event_loop_LDADD) $(LIBS) - -spdy_fileserver$(EXEEXT): $(spdy_fileserver_OBJECTS) $(spdy_fileserver_DEPENDENCIES) $(EXTRA_spdy_fileserver_DEPENDENCIES) - @rm -f spdy_fileserver$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(spdy_fileserver_OBJECTS) $(spdy_fileserver_LDADD) $(LIBS) - -spdy_response_with_callback$(EXEEXT): $(spdy_response_with_callback_OBJECTS) $(spdy_response_with_callback_DEPENDENCIES) $(EXTRA_spdy_response_with_callback_DEPENDENCIES) - @rm -f spdy_response_with_callback$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(spdy_response_with_callback_OBJECTS) $(spdy_response_with_callback_LDADD) $(LIBS) +timeout$(EXEEXT): $(timeout_OBJECTS) $(timeout_DEPENDENCIES) $(EXTRA_timeout_DEPENDENCIES) + @rm -f timeout$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(timeout_OBJECTS) $(timeout_LDADD) $(LIBS) + +upgrade_example$(EXEEXT): $(upgrade_example_OBJECTS) $(upgrade_example_DEPENDENCIES) $(EXTRA_upgrade_example_DEPENDENCIES) + @rm -f upgrade_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(upgrade_example_OBJECTS) $(upgrade_example_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -859,18 +814,13 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileserver_example_dirs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileserver_example_external_select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/https_fileserver_example-https_fileserver_example.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd2spdy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd2spdy_http.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd2spdy_spdy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd2spdy_structures.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimal_example.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimal_example_comet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post_example.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/querystring_example.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/refuse_post_example.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spdy_event_loop.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spdy_fileserver.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spdy_response_with_callback.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upgrade_example.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy.c libmicrohttpd-0.9.55/src/examples/mhd2spdy.c --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,322 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy.c - * @brief The main file of the HTTP-to-SPDY proxy with the 'main' function - * and event loop. No threads are used. - * Currently only GET is supported. - * TODOs: - * - non blocking SSL connect - * - check certificate - * - on closing spdy session, close sockets for all requests - * @author Andrey Uzunov - */ - - -#include "mhd2spdy_structures.h" -#include "mhd2spdy_spdy.h" -#include "mhd2spdy_http.h" - - -static int run = 1; -//static int spdy_close = 0; - - -static void -catch_signal(int signal) -{ - (void)signal; - //spdy_close = 1; - run = 0; -} - - -void -print_stat() -{ - if(!glob_opt.statistics) - return; - - printf("--------------------------\n"); - printf("Statistics (TLS overhead is ignored when used):\n"); - //printf("HTTP bytes received: %lld\n", glob_stat.http_bytes_received); - //printf("HTTP bytes sent: %lld\n", glob_stat.http_bytes_sent); - printf("SPDY bytes sent: %lld\n", glob_stat.spdy_bytes_sent); - printf("SPDY bytes received: %lld\n", glob_stat.spdy_bytes_received); - printf("SPDY bytes received and dropped: %lld\n", glob_stat.spdy_bytes_received_and_dropped); -} - - -int -run_everything () -{ - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set rs; - fd_set ws; - fd_set es; - int maxfd = -1; - int maxfd_s = -1; - struct MHD_Daemon *daemon; - nfds_t spdy_npollfds = 1; - struct URI * spdy2http_uri = NULL; - struct SPDY_Connection *connection; - struct SPDY_Connection *connections[MAX_SPDY_CONNECTIONS]; - struct SPDY_Connection *connection_for_delete; - - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) - PRINT_INFO("signal failed"); - - if (signal(SIGINT, catch_signal) == SIG_ERR) - PRINT_INFO("signal failed"); - - glob_opt.streams_opened = 0; - glob_opt.responses_pending = 0; - //glob_opt.global_memory = 0; - - srand(time(NULL)); - - if(init_parse_uri(&glob_opt.uri_preg)) - DIE("Regexp compilation failed"); - - if(NULL != glob_opt.spdy2http_str) - { - ret = parse_uri(&glob_opt.uri_preg, glob_opt.spdy2http_str, &spdy2http_uri); - if(ret != 0) - DIE("spdy_parse_uri failed"); - } - - SSL_load_error_strings(); - SSL_library_init(); - glob_opt.ssl_ctx = SSL_CTX_new(SSLv23_client_method()); - if(glob_opt.ssl_ctx == NULL) { - PRINT_INFO2("SSL_CTX_new %s", ERR_error_string(ERR_get_error(), NULL)); - abort(); - } - spdy_ssl_init_ssl_ctx(glob_opt.ssl_ctx, &glob_opt.spdy_proto_version); - - daemon = MHD_start_daemon ( - MHD_SUPPRESS_DATE_NO_CLOCK, - glob_opt.listen_port, - NULL, NULL, &http_cb_request, NULL, - MHD_OPTION_URI_LOG_CALLBACK, &http_cb_log, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &http_cb_request_completed, NULL, - MHD_OPTION_END); - if(NULL==daemon) - DIE("MHD_start_daemon failed"); - - do - { - timeout.tv_sec = 0; - timeout.tv_usec = 0; - - if(NULL == glob_opt.spdy_connection && NULL != glob_opt.spdy2http_str) - { - glob_opt.spdy_connection = spdy_connect(spdy2http_uri, spdy2http_uri->port, strcmp("https", spdy2http_uri->scheme)==0); - if(NULL == glob_opt.spdy_connection && glob_opt.only_proxy) - PRINT_INFO("cannot connect to the proxy"); - } - - FD_ZERO(&rs); - FD_ZERO(&ws); - FD_ZERO(&es); - - ret = MHD_get_timeout(daemon, &timeoutlong); - if(MHD_NO == ret || timeoutlong > 5000) - timeout.tv_sec = 5; - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - if(MHD_NO == MHD_get_fdset (daemon, - &rs, - &ws, - &es, - &maxfd)) - { - PRINT_INFO("MHD_get_fdset error"); - } - assert(-1 != maxfd); - - maxfd_s = spdy_get_selectfdset( - &rs, - &ws, - &es, - connections, MAX_SPDY_CONNECTIONS, &spdy_npollfds); - if(maxfd_s > maxfd) - maxfd = maxfd_s; - - PRINT_INFO2("MHD timeout %lld %lld", (unsigned long long)timeout.tv_sec, (unsigned long long)timeout.tv_usec); - - glob_opt.spdy_data_received = false; - - ret = select(maxfd+1, &rs, &ws, &es, &timeout); - PRINT_INFO2("timeout now %lld %lld ret is %i", (unsigned long long)timeout.tv_sec, (unsigned long long)timeout.tv_usec, ret); - - switch(ret) - { - case -1: - PRINT_INFO2("select error: %i", errno); - break; - case 0: - //break; - default: - PRINT_INFO("run"); - //MHD_run_from_select(daemon,&rs, &ws, &es); //not closing FDs at some time in past - MHD_run(daemon); - spdy_run_select(&rs, &ws, &es, connections, spdy_npollfds); - if(glob_opt.spdy_data_received) - { - PRINT_INFO("MHD run again"); - //MHD_run_from_select(daemon,&rs, &ws, &es); //not closing FDs at some time in past - MHD_run(daemon); - } - break; - } - } - while(run); - - MHD_stop_daemon (daemon); - - //TODO SSL_free brakes - spdy_free_connection(glob_opt.spdy_connection); - - connection = glob_opt.spdy_connections_head; - while(NULL != connection) - { - connection_for_delete = connection; - connection = connection_for_delete->next; - glob_opt.streams_opened -= connection_for_delete->streams_opened; - DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection_for_delete); - spdy_free_connection(connection_for_delete); - } - - free_uri(spdy2http_uri); - - deinit_parse_uri(&glob_opt.uri_preg); - - SSL_CTX_free(glob_opt.ssl_ctx); - ERR_free_strings(); - EVP_cleanup(); - - PRINT_INFO2("spdy streams: %i; http requests: %i", glob_opt.streams_opened, glob_opt.responses_pending); - //PRINT_INFO2("memory allocated %zu bytes", glob_opt.global_memory); - - print_stat(); - - return 0; -} - - -void -display_usage() -{ - printf( - "Usage: mhd2spdy [-ovs] [-b ] -p \n\n" - "OPTIONS:\n" - " -p, --port Listening port.\n" - " -b, --backend-proxy If set, he proxy will send requests to\n" - " that SPDY server or proxy. Set the address\n" - " in the form 'http://host:port'. Use 'https'\n" - " for SPDY over TLS, or 'http' for plain SPDY\n" - " communication with the backend.\n" - " -o, --only-proxy If set, the proxy will always forward the\n" - " requests to the backend proxy. If not set,\n" - " the proxy will first try to establsh SPDY\n" - " connection to the requested server. If the\n" - " server does not support SPDY and TLS, the\n" - " backend proxy will be used for the request.\n" - " -v, --verbose Print debug information.\n" - " -s, --statistics Print simple statistics on exit.\n\n" - - ); -} - - -int -main (int argc, - char *const *argv) -{ - int getopt_ret; - int option_index; - struct option long_options[] = { - {"port", required_argument, 0, 'p'}, - {"backend-proxy", required_argument, 0, 'b'}, - {"verbose", no_argument, 0, 'v'}, - {"only-proxy", no_argument, 0, 'o'}, - {"statistics", no_argument, 0, 's'}, - {0, 0, 0, 0} - }; - - while (1) - { - getopt_ret = getopt_long( argc, argv, "p:b:vos", long_options, &option_index); - if (getopt_ret == -1) - break; - - switch(getopt_ret) - { - case 'p': - glob_opt.listen_port = atoi(optarg); - break; - - case 'b': - glob_opt.spdy2http_str = strdup(optarg); - if(NULL == glob_opt.spdy2http_str) - return 1; - break; - - case 'v': - glob_opt.verbose = true; - break; - - case 'o': - glob_opt.only_proxy = true; - break; - - case 's': - glob_opt.statistics = true; - break; - - case 0: - PRINT_INFO("0 from getopt"); - break; - - case '?': - display_usage(); - return 1; - - default: - DIE("default from getopt"); - } - } - - if( - 0 == glob_opt.listen_port - || (glob_opt.only_proxy && NULL == glob_opt.spdy2http_str) - ) - { - display_usage(); - return 1; - } - - return run_everything(); -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_http.c libmicrohttpd-0.9.55/src/examples/mhd2spdy_http.c --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_http.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_http.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,422 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy_http.c - * @brief HTTP part of the proxy. libmicrohttpd is used for the server side. - * @author Andrey Uzunov - */ - -#include "mhd2spdy_structures.h" -#include "mhd2spdy_http.h" -#include "mhd2spdy_spdy.h" - - -void * -http_cb_log(void * cls, -const char * uri) -{ - (void)cls; - - struct HTTP_URI * http_uri; - - PRINT_INFO2("log uri '%s'\n", uri); - - //TODO not freed once in a while - if(NULL == (http_uri = au_malloc(sizeof(struct HTTP_URI )))) - return NULL; - http_uri->uri = strdup(uri); - return http_uri; -} - - -static int -http_cb_iterate(void *cls, - enum MHD_ValueKind kind, - const char *name, - const char *value) -{ - (void)kind; - - static char * const forbidden[] = {"Transfer-Encoding", - "Proxy-Connection", - "Keep-Alive", - "Connection"}; - static int forbidden_size = 4; - int i; - struct SPDY_Headers *spdy_headers = (struct SPDY_Headers *)cls; - - if(0 == strcasecmp(name, "Host")) - spdy_headers->nv[9] = (char *)value; - else - { - for(i=0; inv[spdy_headers->cnt++] = (char *)name; - spdy_headers->nv[spdy_headers->cnt++] = (char *)value; - } - - return MHD_YES; -} - - -static ssize_t -http_cb_response (void *cls, - uint64_t pos, - char *buffer, - size_t max) -{ - (void)pos; - - int ret; - struct Proxy *proxy = (struct Proxy *)cls; - void *newbody; - const union MHD_ConnectionInfo *info; - int val = 1; - - PRINT_INFO2("http_cb_response for %s", proxy->url); - - if(proxy->spdy_error) - return MHD_CONTENT_READER_END_WITH_ERROR; - - if(0 == proxy->http_body_size && (proxy->done || !proxy->spdy_active)) - { - PRINT_INFO("sent end of stream"); - return MHD_CONTENT_READER_END_OF_STREAM; - } - - if(!proxy->http_body_size)//nothing to write now - { - //flush data - info = MHD_get_connection_info (proxy->http_connection, - MHD_CONNECTION_INFO_CONNECTION_FD); - ret = setsockopt(info->connect_fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(ret == -1) { - DIE("setsockopt"); - } - - PRINT_INFO("FLUSH data"); - return 0; - } - - if(max >= proxy->http_body_size) - { - ret = proxy->http_body_size; - newbody = NULL; - } - else - { - ret = max; - if(NULL == (newbody = au_malloc(proxy->http_body_size - max))) - { - PRINT_INFO("no memory"); - return MHD_CONTENT_READER_END_WITH_ERROR; - } - memcpy(newbody, proxy->http_body + max, proxy->http_body_size - max); - } - memcpy(buffer, proxy->http_body, ret); - free(proxy->http_body); - proxy->http_body = newbody; - proxy->http_body_size -= ret; - - if(proxy->length >= 0) - { - proxy->length -= ret; - } - - PRINT_INFO2("response_callback, size: %i",ret); - - return ret; -} - - -static void -http_cb_response_done(void *cls) -{ - (void)cls; - //TODO remove -} - -int -http_cb_request (void *cls, - struct MHD_Connection *connection, - const char *url, - const char *method, - const char *version, - const char *upload_data, - size_t *upload_data_size, - void **ptr) -{ - (void)cls; - (void)url; - (void)upload_data; - (void)upload_data_size; - - int ret; - struct Proxy *proxy; - struct SPDY_Headers spdy_headers; - bool with_body = false; - struct HTTP_URI *http_uri; - const char *header_value; - - if (NULL == ptr || NULL == *ptr) - return MHD_NO; - - http_uri = (struct HTTP_URI *)*ptr; - - if(NULL == http_uri->proxy) - { - //first call for this request - if (0 != strcmp (method, MHD_HTTP_METHOD_GET) && 0 != strcmp (method, MHD_HTTP_METHOD_POST)) - { - free(http_uri->uri); - free(http_uri); - PRINT_INFO2("unexpected method %s", method); - return MHD_NO; - } - - if(NULL == (proxy = au_malloc(sizeof(struct Proxy)))) - { - free(http_uri->uri); - free(http_uri); - PRINT_INFO("No memory"); - return MHD_NO; - } - - ++glob_opt.responses_pending; - proxy->id = rand(); - proxy->http_active = true; - proxy->http_connection = connection; - http_uri->proxy = proxy; - return MHD_YES; - } - - proxy = http_uri->proxy; - - if(proxy->spdy_error || proxy->http_error) - return MHD_NO; // handled at different place TODO? leaks? - - if(proxy->spdy_active) - { - if(0 == strcmp (method, MHD_HTTP_METHOD_POST)) - { - PRINT_INFO("POST processing"); - - int rc= spdylay_session_resume_data(proxy->spdy_connection->session, proxy->stream_id); - PRINT_INFO2("rc is %i stream is %i", rc, proxy->stream_id); - proxy->spdy_connection->want_io |= WANT_WRITE; - - if(0 == *upload_data_size) - { - PRINT_INFO("POST http EOF"); - proxy->receiving_done = true; - return MHD_YES; - } - - if(!copy_buffer(upload_data, *upload_data_size, &proxy->received_body, &proxy->received_body_size)) - { - //TODO handle it better? - PRINT_INFO("not enough memory (malloc/realloc returned NULL)"); - return MHD_NO; - } - - *upload_data_size = 0; - - return MHD_YES; - } - - //already handled - PRINT_INFO("unnecessary call to http_cb_request"); - return MHD_YES; - } - - //second call for this request - - PRINT_INFO2("received request for '%s %s %s'", method, http_uri->uri, version); - - proxy->url = http_uri->uri; - - header_value = MHD_lookup_connection_value(connection, - MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_LENGTH); - - with_body = 0 == strcmp (method, MHD_HTTP_METHOD_POST) - && (NULL == header_value || 0 != strcmp ("0", header_value)); - - PRINT_INFO2("body will be sent %i", with_body); - - ret = parse_uri(&glob_opt.uri_preg, proxy->url, &proxy->uri); - if(ret != 0) - DIE("parse_uri failed"); - proxy->http_uri = http_uri; - - spdy_headers.num = MHD_get_connection_values (connection, - MHD_HEADER_KIND, - NULL, - NULL); - if(NULL == (spdy_headers.nv = au_malloc(((spdy_headers.num + 5) * 2 + 1) * sizeof(char *)))) - DIE("no memory"); - spdy_headers.nv[0] = ":method"; spdy_headers.nv[1] = method; - spdy_headers.nv[2] = ":path"; spdy_headers.nv[3] = proxy->uri->path_and_more; - spdy_headers.nv[4] = ":version"; spdy_headers.nv[5] = (char *)version; - spdy_headers.nv[6] = ":scheme"; spdy_headers.nv[7] = proxy->uri->scheme; - spdy_headers.nv[8] = ":host"; spdy_headers.nv[9] = NULL; - //nv[14] = NULL; - spdy_headers.cnt = 10; - MHD_get_connection_values (connection, - MHD_HEADER_KIND, - &http_cb_iterate, - &spdy_headers); - - spdy_headers.nv[spdy_headers.cnt] = NULL; - if(NULL == spdy_headers.nv[9]) - spdy_headers.nv[9] = proxy->uri->host_and_port; - - if(0 != spdy_request(spdy_headers.nv, proxy, with_body)) - { - free(spdy_headers.nv); - //free_proxy(proxy); - - return MHD_NO; - } - free(spdy_headers.nv); - - proxy->http_response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, - 4096, - &http_cb_response, - proxy, - &http_cb_response_done); - - if (NULL == proxy->http_response) - DIE("no response"); - - if(MHD_NO == MHD_add_response_header (proxy->http_response, - "Proxy-Connection", "keep-alive")) - PRINT_INFO("SPDY_name_value_add failed: "); - if(MHD_NO == MHD_add_response_header (proxy->http_response, - "Connection", "Keep-Alive")) - PRINT_INFO("SPDY_name_value_add failed: "); - if(MHD_NO == MHD_add_response_header (proxy->http_response, - "Keep-Alive", "timeout=5, max=100")) - PRINT_INFO("SPDY_name_value_add failed: "); - - proxy->spdy_active = true; - - return MHD_YES; -} - - -void -http_create_response(struct Proxy* proxy, - char **nv) -{ - size_t i; - - if(!proxy->http_active) - return; - - for(i = 0; nv[i]; i += 2) { - if(0 == strcmp(":status", nv[i])) - { - char tmp[4]; - memcpy(&tmp,nv[i+1],3); - tmp[3]=0; - proxy->status = atoi(tmp); - continue; - } - else if(0 == strcmp(":version", nv[i])) - { - proxy->version = nv[i+1]; - continue; - } - else if(0 == strcmp("content-length", nv[i])) - { - continue; - } - - char *header = *(nv+i); - if(MHD_NO == MHD_add_response_header (proxy->http_response, - header, nv[i+1])) - { - PRINT_INFO2("SPDY_name_value_add failed: '%s' '%s'", header, nv[i+1]); - } - PRINT_INFO2("adding '%s: %s'",header, nv[i+1]); - } - - if(MHD_NO == MHD_queue_response (proxy->http_connection, proxy->status, proxy->http_response)){ - PRINT_INFO("No queue"); - //TODO - //abort(); - proxy->http_error = true; - } - - MHD_destroy_response (proxy->http_response); - proxy->http_response = NULL; -} - -void -http_cb_request_completed (void *cls, - struct MHD_Connection *connection, - void **con_cls, - enum MHD_RequestTerminationCode toe) -{ - (void)cls; - (void)connection; - struct HTTP_URI *http_uri; - struct Proxy *proxy; - - http_uri = (struct HTTP_URI *)*con_cls; - if(NULL == http_uri) - return; - proxy = (struct Proxy *)http_uri->proxy; - assert(NULL != proxy); - - PRINT_INFO2("http_cb_request_completed %i for %s; id %i",toe, http_uri->uri, proxy->id); - - if(NULL != proxy->http_response) - { - MHD_destroy_response (proxy->http_response); - proxy->http_response = NULL; - } - - if(proxy->spdy_active) - { - proxy->http_active = false; - if(MHD_REQUEST_TERMINATED_COMPLETED_OK != toe) - { - proxy->http_error = true; - if(proxy->stream_id > 0 /*&& NULL != proxy->spdy_connection->session*/) - { - //send RST_STREAM_STATUS_CANCEL - PRINT_INFO2("send rst_stream %i %i",proxy->spdy_active, proxy->stream_id ); - spdylay_submit_rst_stream(proxy->spdy_connection->session, proxy->stream_id, 5); - } - /*else - { - DLL_remove(proxy->spdy_connection->proxies_head, proxy->spdy_connection->proxies_tail, proxy); - free_proxy(proxy); - }*/ - } - } - else - { - PRINT_INFO2("proxy free http id %i ", proxy->id); - free_proxy(proxy); - } - - --glob_opt.responses_pending; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_http.h libmicrohttpd-0.9.55/src/examples/mhd2spdy_http.h --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_http.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_http.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,54 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy_http.h - * @brief HTTP part of the proxy. libmicrohttpd is used for the server side. - * @author Andrey Uzunov - */ - -#ifndef HTTP_H -#define HTTP_H - -#include "mhd2spdy_structures.h" - - -int -http_cb_request (void *cls, - struct MHD_Connection *connection, - const char *url, - const char *method, - const char *version, - const char *upload_data, - size_t *upload_data_size, - void **ptr); - - -void * http_cb_log(void * cls, const char * uri); - - -void -http_create_response(struct Proxy* proxy, char **nv); - - -void -http_cb_request_completed (void *cls, - struct MHD_Connection *connection, - void **con_cls, - enum MHD_RequestTerminationCode toe); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_spdy.c libmicrohttpd-0.9.55/src/examples/mhd2spdy_spdy.c --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_spdy.c 2015-08-02 19:08:12.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_spdy.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1150 +0,0 @@ -/* - * - * Copyright (c) 2012 Tatsuhiro Tsujikawa - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * @file mhd2spdy_spdy.c - * @brief SPDY part of the proxy. libspdylay is used for the client side. - * The example spdycli.c from spdylay was used as basis; - * however, multiple changes were made. - * @author Tatsuhiro Tsujikawa - * @author Andrey Uzunov - */ - -#include "mhd2spdy_structures.h" -#include "mhd2spdy_spdy.h" -#include "mhd2spdy_http.h" - - -/* - * Prints error containing the function name |func| and message |msg| - * and exit. - */ -static void -spdy_dief(const char *func, - const char *msg) -{ - fprintf(stderr, "FATAL: %s: %s\n", func, msg); - exit(EXIT_FAILURE); -} - - -/* - * Prints error containing the function name |func| and error code - * |error_code| and exit. - */ -void -spdy_diec(const char *func, - int error_code) -{ - fprintf(stderr, "FATAL: %s: error_code=%d, msg=%s\n", func, error_code, - spdylay_strerror(error_code)); - exit(EXIT_FAILURE); -} - - -static ssize_t -spdy_cb_data_source_read(spdylay_session *session, int32_t stream_id, uint8_t *buf, size_t length, int *eof, spdylay_data_source *source, void *user_data) -{ - (void)session; - (void)stream_id; - (void)user_data; - - ssize_t ret; - assert(NULL != source); - assert(NULL != source->ptr); - struct Proxy *proxy = (struct Proxy *)(source->ptr); - void *newbody; - - - if(length < 1) - { - PRINT_INFO("spdy_cb_data_source_read: length is 0"); - return 0; - } - - if(!proxy->received_body_size)//nothing to write now - { - if(proxy->receiving_done) - { - PRINT_INFO("POST spdy EOF"); - *eof = 1; - } - PRINT_INFO("POST SPDYLAY_ERR_DEFERRED"); - return SPDYLAY_ERR_DEFERRED;//TODO SPDYLAY_ERR_DEFERRED should be used - } - - if(length >= proxy->received_body_size) - { - ret = proxy->received_body_size; - newbody = NULL; - } - else - { - ret = length; - if(NULL == (newbody = malloc(proxy->received_body_size - length))) - { - PRINT_INFO("no memory"); - return SPDYLAY_ERR_TEMPORAL_CALLBACK_FAILURE; - } - memcpy(newbody, proxy->received_body + length, proxy->received_body_size - length); - } - memcpy(buf, proxy->received_body, ret); - free(proxy->received_body); - proxy->received_body = newbody; - proxy->received_body_size -= ret; - - if(0 == proxy->received_body_size && proxy->receiving_done) - { - PRINT_INFO("POST spdy EOF"); - *eof = 1; - } - - PRINT_INFO2("given POST bytes to spdylay: %zd", ret); - - return ret; -} - - -/* - * The implementation of spdylay_send_callback type. Here we write - * |data| with size |length| to the network and return the number of - * bytes actually written. See the documentation of - * spdylay_send_callback for the details. - */ -static ssize_t -spdy_cb_send(spdylay_session *session, - const uint8_t *data, - size_t length, - int flags, - void *user_data) -{ - (void)session; - (void)flags; - - //PRINT_INFO("spdy_cb_send called"); - struct SPDY_Connection *connection; - ssize_t rv; - connection = (struct SPDY_Connection*)user_data; - connection->want_io = IO_NONE; - - if(glob_opt.ignore_rst_stream - && 16 == length - && 0x80 == data[0] - && 0x00 == data[2] - && 0x03 == data[3] - ) - { - PRINT_INFO2("ignoring RST_STREAM for stream_id %i %i %i %i", data[8], data[9], data[10], data[11]); - glob_opt.ignore_rst_stream = false; - return 16; - } - glob_opt.ignore_rst_stream = false; - - if(connection->is_tls) - { - ERR_clear_error(); - rv = SSL_write(connection->ssl, data, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io |= (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - } - else - { - rv = write(connection->fd, - data, - length); - - if (rv < 0) - { - switch(errno) - { - case EAGAIN: - #if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: - #endif - connection->want_io |= WANT_WRITE; - rv = SPDYLAY_ERR_WOULDBLOCK; - break; - - default: - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - } - - PRINT_INFO2("%zd bytes written by spdy", rv); - - if(rv > 0) - UPDATE_STAT(glob_stat.spdy_bytes_sent, rv); - - return rv; -} - - -/* - * The implementation of spdylay_recv_callback type. Here we read data - * from the network and write them in |buf|. The capacity of |buf| is - * |length| bytes. Returns the number of bytes stored in |buf|. See - * the documentation of spdylay_recv_callback for the details. - */ -static ssize_t -spdy_cb_recv(spdylay_session *session, - uint8_t *buf, - size_t length, - int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct SPDY_Connection *connection; - ssize_t rv; - - connection = (struct SPDY_Connection*)user_data; - //prevent monopolizing everything - if(!(++connection->counter % 10)) return SPDYLAY_ERR_WOULDBLOCK; - connection->want_io = IO_NONE; - if(connection->is_tls) - { - ERR_clear_error(); - rv = SSL_read(connection->ssl, buf, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io |= (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } else if(rv == 0) { - rv = SPDYLAY_ERR_EOF; - } - } - else - { - rv = read(connection->fd, - buf, - length); - - if (rv < 0) - { - switch(errno) - { - case EAGAIN: - #if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: - #endif - connection->want_io |= WANT_READ; - rv = SPDYLAY_ERR_WOULDBLOCK; - break; - - default: - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - else if(rv == 0) - rv = SPDYLAY_ERR_EOF; - } - - if(rv > 0) - UPDATE_STAT(glob_stat.spdy_bytes_received, rv); - - return rv; -} - - -static void -spdy_cb_before_ctrl_send(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, - void *user_data) -{ - (void)user_data; - - int32_t stream_id; - struct Proxy *proxy; - - switch(type) { - case SPDYLAY_SYN_STREAM: - stream_id = frame->syn_stream.stream_id; - proxy = spdylay_session_get_stream_user_data(session, stream_id); - proxy->stream_id = stream_id; - ++glob_opt.streams_opened; - ++proxy->spdy_connection->streams_opened; - PRINT_INFO2("opening stream: str open %i; %s", glob_opt.streams_opened, proxy->url); - break; - case SPDYLAY_RST_STREAM: - //try to ignore duplicate RST_STREAMs - //TODO this will ignore RST_STREAMs also for bogus data - glob_opt.ignore_rst_stream = NULL==spdylay_session_get_stream_user_data(session, frame->rst_stream.stream_id); - PRINT_INFO2("sending RST_STREAM for %i; ignore %i; status %i", - frame->rst_stream.stream_id, - glob_opt.ignore_rst_stream, - frame->rst_stream.status_code); - break; - default: - break; - } -} - - -void -spdy_cb_on_ctrl_recv(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, - void *user_data) -{ - (void)user_data; - - char **nv; - int32_t stream_id; - struct Proxy * proxy; - - switch(type) { - case SPDYLAY_SYN_REPLY: - nv = frame->syn_reply.nv; - stream_id = frame->syn_reply.stream_id; - break; - case SPDYLAY_RST_STREAM: - stream_id = frame->rst_stream.stream_id; - break; - case SPDYLAY_HEADERS: - nv = frame->headers.nv; - stream_id = frame->headers.stream_id; - break; - default: - return; - break; - } - - proxy = spdylay_session_get_stream_user_data(session, stream_id); - if(NULL == proxy) - { - PRINT_INFO2("received frame type %i for unkonwn stream id %i", type, stream_id); - return; - //DIE("no proxy obj"); - } - - switch(type) { - case SPDYLAY_SYN_REPLY: - PRINT_INFO2("received headers for %s", proxy->url); - http_create_response(proxy, nv); - break; - case SPDYLAY_RST_STREAM: - PRINT_INFO2("received reset stream for %s", proxy->url); - proxy->spdy_error = true; - break; - case SPDYLAY_HEADERS: - PRINT_INFO2("received headers for %s", proxy->url); - http_create_response(proxy, nv); - break; - default: - return; - break; - } - - glob_opt.spdy_data_received = true; -} - - -/* - * The implementation of spdylay_on_stream_close_callback type. We use - * this function to know the response is fully received. Since we just - * fetch 1 resource in this program, after reception of the response, - * we submit GOAWAY and close the session. - */ -static void -spdy_cb_on_stream_close(spdylay_session *session, - int32_t stream_id, - spdylay_status_code status_code, - void *user_data) -{ - (void)status_code; - (void)user_data; - - struct Proxy * proxy = spdylay_session_get_stream_user_data(session, stream_id); - - assert(NULL != proxy); - - --glob_opt.streams_opened; - --proxy->spdy_connection->streams_opened; - PRINT_INFO2("closing stream: str opened %i; remove proxy %i", glob_opt.streams_opened, proxy->id); - - DLL_remove(proxy->spdy_connection->proxies_head, proxy->spdy_connection->proxies_tail, proxy); - if(proxy->http_active) - { - proxy->spdy_active = false; - } - else - { - free_proxy(proxy); - } -} - - -/* - * The implementation of spdylay_on_data_chunk_recv_callback type. We - * use this function to print the received response body. - */ -static void -spdy_cb_on_data_chunk_recv(spdylay_session *session, - uint8_t flags, - int32_t stream_id, - const uint8_t *data, - size_t len, - void *user_data) -{ - (void)flags; - (void)user_data; - - struct Proxy *proxy; - proxy = spdylay_session_get_stream_user_data(session, stream_id); - - if(NULL == proxy) - { - PRINT_INFO("proxy in spdy_cb_on_data_chunk_recv is NULL)"); - return; - } - - if(!copy_buffer(data, len, &proxy->http_body, &proxy->http_body_size)) - { - //TODO handle it better? - PRINT_INFO("not enough memory (malloc/realloc returned NULL)"); - return; - } - /* - if(NULL == proxy->http_body) - proxy->http_body = au_malloc(len); - else - proxy->http_body = realloc(proxy->http_body, proxy->http_body_size + len); - if(NULL == proxy->http_body) - { - PRINT_INFO("not enough memory (realloc returned NULL)"); - return ; - } - - memcpy(proxy->http_body + proxy->http_body_size, data, len); - proxy->http_body_size += len; - */ - PRINT_INFO2("received data for %s; %zu bytes", proxy->url, len); - glob_opt.spdy_data_received = true; -} - - -static void -spdy_cb_on_data_recv(spdylay_session *session, - uint8_t flags, - int32_t stream_id, - int32_t length, - void *user_data) -{ - (void)length; - (void)user_data; - - if(flags & SPDYLAY_DATA_FLAG_FIN) - { - struct Proxy *proxy; - proxy = spdylay_session_get_stream_user_data(session, stream_id); - proxy->done = true; - PRINT_INFO2("last data frame received for %s", proxy->url); - } -} - - -/* - * Setup callback functions. Spdylay API offers many callback - * functions, but most of them are optional. The send_callback is - * always required. Since we use spdylay_session_recv(), the - * recv_callback is also required. - */ -static void -spdy_setup_spdylay_callbacks(spdylay_session_callbacks *callbacks) -{ - memset(callbacks, 0, sizeof(spdylay_session_callbacks)); - callbacks->send_callback = spdy_cb_send; - callbacks->recv_callback = spdy_cb_recv; - callbacks->before_ctrl_send_callback = spdy_cb_before_ctrl_send; - callbacks->on_ctrl_recv_callback = spdy_cb_on_ctrl_recv; - callbacks->on_stream_close_callback = spdy_cb_on_stream_close; - callbacks->on_data_chunk_recv_callback = spdy_cb_on_data_chunk_recv; - callbacks->on_data_recv_callback = spdy_cb_on_data_recv; -} - - -/* - * Callback function for SSL/TLS NPN. Since this program only supports - * SPDY protocol, if server does not offer SPDY protocol the Spdylay - * library supports, we terminate program. - */ -static int -spdy_cb_ssl_select_next_proto(SSL* ssl, - unsigned char **out, - unsigned char *outlen, - const unsigned char *in, - unsigned int inlen, - void *arg) -{ - (void)ssl; - - int rv; - uint16_t *spdy_proto_version; - - /* spdylay_select_next_protocol() selects SPDY protocol version the - Spdylay library supports. */ - rv = spdylay_select_next_protocol(out, outlen, in, inlen); - if(rv <= 0) { - PRINT_INFO("Server did not advertise spdy/2 or spdy/3 protocol."); - return rv; - } - spdy_proto_version = (uint16_t*)arg; - *spdy_proto_version = rv; - return SSL_TLSEXT_ERR_OK; -} - - -/* - * Setup SSL context. We pass |spdy_proto_version| to get negotiated - * SPDY protocol version in NPN callback. - */ -void -spdy_ssl_init_ssl_ctx(SSL_CTX *ssl_ctx, - uint16_t *spdy_proto_version) -{ - /* Disable SSLv2 and enable all workarounds for buggy servers */ - SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL|SSL_OP_NO_SSLv2 | SSL_OP_NO_COMPRESSION); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_AUTO_RETRY); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); - /* Set NPN callback */ - SSL_CTX_set_next_proto_select_cb(ssl_ctx, spdy_cb_ssl_select_next_proto, - spdy_proto_version); -} - - -static int -spdy_ssl_handshake(SSL *ssl, - int fd) -{ - int rv; - - if(SSL_set_fd(ssl, fd) == 0) - spdy_dief("SSL_set_fd", ERR_error_string(ERR_get_error(), NULL)); - - ERR_clear_error(); - rv = SSL_connect(ssl); - if(rv <= 0) - PRINT_INFO2("SSL_connect %s", ERR_error_string(ERR_get_error(), NULL)); - - return rv; -} - - -/* - * Connects to the host |host| and port |port|. This function returns - * the file descriptor of the client socket. - */ -static int -spdy_socket_connect_to(const char *host, - uint16_t port) -{ - struct addrinfo hints; - int fd = -1; - int rv; - char service[NI_MAXSERV]; - struct addrinfo *res, *rp; - - //TODO checks - snprintf(service, sizeof(service), "%u", port); - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - rv = getaddrinfo(host, service, &hints, &res); - if(rv != 0) - { - printf("%s\n",host); - spdy_dief("getaddrinfo", gai_strerror(rv)); - } - for(rp = res; rp; rp = rp->ai_next) - { - fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) - continue; - while((rv = connect(fd, rp->ai_addr, rp->ai_addrlen)) == -1 && - errno == EINTR); - if(rv == 0) - break; - MHD_socket_close_ (fd); - fd = -1; - } - freeaddrinfo(res); - - return fd; -} - - -static void -spdy_socket_make_non_block(int fd) -{ - int flags; - int rv; - - while((flags = fcntl(fd, F_GETFL, 0)) == -1 && errno == EINTR); - - if(flags == -1) - spdy_dief("fcntl", strerror(errno)); - - while((rv = fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1 && errno == EINTR); - - if(rv == -1) - spdy_dief("fcntl", strerror(errno)); -} - - -/* - * Setting TCP_NODELAY is not mandatory for the SPDY protocol. - */ -static void -spdy_socket_set_tcp_nodelay(int fd) -{ - int val = 1; - int rv; - - rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(rv == -1) - spdy_dief("setsockopt", strerror(errno)); -} - -/* - * Update |pollfd| based on the state of |connection|. - */ - /* -void -spdy_ctl_poll(struct pollfd *pollfd, - struct SPDY_Connection *connection) -{ - pollfd->events = 0; - if(spdylay_session_want_read(connection->session) || - connection->want_io & WANT_READ) - { - pollfd->events |= POLLIN; - } - if(spdylay_session_want_write(connection->session) || - connection->want_io & WANT_WRITE) - { - pollfd->events |= POLLOUT; - } -}*/ - - -/* - * Update |selectfd| based on the state of |connection|. - */ -bool -spdy_ctl_select(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connection) -{ - (void)except_fd_set; - - bool ret = false; - - if(spdylay_session_want_read(connection->session) || - connection->want_io & WANT_READ) - { - FD_SET(connection->fd, read_fd_set); - ret = true; - } - if(spdylay_session_want_write(connection->session) || - connection->want_io & WANT_WRITE) - { - FD_SET(connection->fd, write_fd_set); - ret = true; - } - - return ret; -} - - -/* - * Performs the network I/O. - */ -int -spdy_exec_io(struct SPDY_Connection *connection) -{ - int rv; - - rv = spdylay_session_recv(connection->session); - if(rv != 0) - { - PRINT_INFO2("spdylay_session_recv %i", rv); - return rv; - } - rv = spdylay_session_send(connection->session); - if(rv != 0) - PRINT_INFO2("spdylay_session_send %i", rv); - - return rv; -} - - -/* - * Fetches the resource denoted by |uri|. - */ -struct SPDY_Connection * -spdy_connect(const struct URI *uri, - uint16_t port, - bool is_tls) -{ - spdylay_session_callbacks callbacks; - int fd; - SSL *ssl=NULL; - struct SPDY_Connection * connection = NULL; - int rv; - - spdy_setup_spdylay_callbacks(&callbacks); - - /* Establish connection and setup SSL */ - PRINT_INFO2("connecting to %s:%i", uri->host, port); - fd = spdy_socket_connect_to(uri->host, port); - if(fd == -1) - { - PRINT_INFO("Could not open file descriptor"); - return NULL; - } - - if(is_tls) - { - ssl = SSL_new(glob_opt.ssl_ctx); - if(ssl == NULL) { - spdy_dief("SSL_new", ERR_error_string(ERR_get_error(), NULL)); - } - - //TODO non-blocking - /* To simplify the program, we perform SSL/TLS handshake in blocking - I/O. */ - glob_opt.spdy_proto_version = 0; - rv = spdy_ssl_handshake(ssl, fd); - if(rv <= 0 || (glob_opt.spdy_proto_version != 3 && glob_opt.spdy_proto_version != 2)) - { - PRINT_INFO("Closing SSL"); - //no spdy on the other side - goto free_and_fail; - } - } - else - { - glob_opt.spdy_proto_version = 3; - } - - if(NULL == (connection = au_malloc(sizeof(struct SPDY_Connection)))) - goto free_and_fail; - - connection->is_tls = is_tls; - connection->ssl = ssl; - connection->want_io = IO_NONE; - if(NULL == (connection->host = strdup(uri->host))) - goto free_and_fail; - - /* Here make file descriptor non-block */ - spdy_socket_make_non_block(fd); - spdy_socket_set_tcp_nodelay(fd); - - PRINT_INFO2("[INFO] SPDY protocol version = %d\n", glob_opt.spdy_proto_version); - rv = spdylay_session_client_new(&(connection->session), glob_opt.spdy_proto_version, - &callbacks, connection); - if(rv != 0) { - spdy_diec("spdylay_session_client_new", rv); - } - - connection->fd = fd; - - return connection; - - //for GOTO - free_and_fail: - if(NULL != connection) - { - free(connection->host); - free(connection); - } - - if(is_tls) - SSL_shutdown(ssl); - - MHD_socket_close_ (fd); - - if(is_tls) - SSL_free(ssl); - - return NULL; -} - - -void -spdy_free_connection(struct SPDY_Connection * connection) -{ - struct Proxy *proxy; - struct Proxy *proxy_next; - - if(NULL != connection) - { - for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy_next) - { - proxy_next = proxy->next; - DLL_remove(connection->proxies_head, connection->proxies_tail, proxy); - proxy->spdy_active = false; - proxy->spdy_error = true; - PRINT_INFO2("spdy_free_connection for id %i", proxy->id); - if(!proxy->http_active) - { - free_proxy(proxy); - } - } - spdylay_session_del(connection->session); - SSL_free(connection->ssl); - free(connection->host); - free(connection); - //connection->session = NULL; - } -} - - -int -spdy_request(const char **nv, - struct Proxy *proxy, - bool with_body) -{ - int ret; - uint16_t port; - struct SPDY_Connection *connection; - spdylay_data_provider post_data; - - if(glob_opt.only_proxy) - { - connection = glob_opt.spdy_connection; - } - else - { - connection = glob_opt.spdy_connections_head; - while(NULL != connection) - { - if(0 == strcasecmp(proxy->uri->host, connection->host)) - break; - connection = connection->next; - } - - if(NULL == connection) - { - //connect to host - port = proxy->uri->port; - if(0 == port) port = 443; - connection = spdy_connect(proxy->uri, port, true); - if(NULL != connection) - { - DLL_insert(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection); - glob_opt.total_spdy_connections++; - } - else - connection = glob_opt.spdy_connection; - } - } - - if(NULL == connection) - { - PRINT_INFO("there is no proxy!"); - return -1; - } - - proxy->spdy_connection = connection; - if(with_body) - { - post_data.source.ptr = proxy; - post_data.read_callback = &spdy_cb_data_source_read; - ret = spdylay_submit_request(connection->session, 0, nv, &post_data, proxy); - } - else - ret = spdylay_submit_request(connection->session, 0, nv, NULL, proxy); - - if(ret != 0) { - spdy_diec("spdylay_spdy_submit_request", ret); - } - PRINT_INFO2("adding proxy %i", proxy->id); - if(NULL != connection->proxies_head) - PRINT_INFO2("before proxy %i", connection->proxies_head->id); - DLL_insert(connection->proxies_head, connection->proxies_tail, proxy); - - return ret; -} - -/* -void -spdy_get_pollfdset(struct pollfd fds[], - struct SPDY_Connection *connections[], - unsigned int max_size, - nfds_t *real_size) -{ - struct SPDY_Connection *connection; - struct Proxy *proxy; - - *real_size = 0; - if(max_size<1) - return; - - if(NULL != glob_opt.spdy_connection) - { - spdy_ctl_poll(&(fds[*real_size]), glob_opt.spdy_connection); - if(!fds[*real_size].events) - { - //PRINT_INFO("TODO drop connection"); - glob_opt.streams_opened -= glob_opt.spdy_connection->streams_opened; - - for(proxy = glob_opt.spdy_connection->proxies_head; NULL != proxy; proxy=proxy->next) - { - abort(); - DLL_remove(glob_opt.spdy_connection->proxies_head, glob_opt.spdy_connection->proxies_tail, proxy); - proxy->spdy_active = false; - } - spdy_free_connection(glob_opt.spdy_connection); - glob_opt.spdy_connection = NULL; - } - else - { - fds[*real_size].fd = glob_opt.spdy_connection->fd; - connections[*real_size] = glob_opt.spdy_connection; - ++(*real_size); - } - } - - connection = glob_opt.spdy_connections_head; - - while(NULL != connection && *real_size < max_size) - { - assert(!glob_opt.only_proxy); - spdy_ctl_poll(&(fds[*real_size]), connection); - if(!fds[*real_size].events) - { - //PRINT_INFO("TODO drop connection"); - glob_opt.streams_opened -= connection->streams_opened; - DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection); - glob_opt.total_spdy_connections--; - - for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy->next) - { - abort(); - DLL_remove(connection->proxies_head, connection->proxies_tail, proxy); - proxy->spdy_active = false; - } - spdy_free_connection(connection); - } - else - { - fds[*real_size].fd = connection->fd; - connections[*real_size] = connection; - ++(*real_size); - } - connection = connection->next; - } - - //, "TODO max num of conn reached; close something" - assert(NULL == connection); -} -*/ - -int -spdy_get_selectfdset(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connections[], - unsigned int max_size, - nfds_t *real_size) -{ - struct SPDY_Connection *connection; - struct SPDY_Connection *next_connection; - bool ret; - int maxfd = 0; - - *real_size = 0; - if(max_size<1) - return 0; - - if(NULL != glob_opt.spdy_connection) - { - ret = spdy_ctl_select(read_fd_set, - write_fd_set, - except_fd_set, glob_opt.spdy_connection); - if(!ret) - { - glob_opt.streams_opened -= glob_opt.spdy_connection->streams_opened; - - PRINT_INFO("spdy_free_connection in spdy_get_selectfdset"); - spdy_free_connection(glob_opt.spdy_connection); - glob_opt.spdy_connection = NULL; - } - else - { - connections[*real_size] = glob_opt.spdy_connection; - ++(*real_size); - if(maxfd < glob_opt.spdy_connection->fd) maxfd = glob_opt.spdy_connection->fd; - } - } - - connection = glob_opt.spdy_connections_head; - - while(NULL != connection && *real_size < max_size) - { - assert(!glob_opt.only_proxy); - ret = spdy_ctl_select(read_fd_set, - write_fd_set, - except_fd_set, connection); - - next_connection = connection->next; - if(!ret) - { - glob_opt.streams_opened -= connection->streams_opened; - DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connection); - glob_opt.total_spdy_connections--; - - PRINT_INFO("spdy_free_connection in spdy_get_selectfdset"); - spdy_free_connection(connection); - } - else - { - connections[*real_size] = connection; - ++(*real_size); - if(maxfd < connection->fd) maxfd = connection->fd; - } - connection = next_connection; - } - - //, "TODO max num of conn reached; close something" - assert(NULL == connection); - - return maxfd; -} - -/* -void -spdy_run(struct pollfd fds[], - struct SPDY_Connection *connections[], - int size) -{ - int i; - int ret; - struct Proxy *proxy; - - for(i=0; ihost); - if(fds[i].revents & (POLLIN | POLLOUT)) - { - ret = spdy_exec_io(connections[i]); - //PRINT_INFO2("%i",ret); - //if((spdy_pollfds[i].revents & POLLHUP) || (spdy_pollfds[0].revents & POLLERR)) - // PRINT_INFO("SPDY SPDY_Connection error"); - - //TODO POLLRDHUP - // always close on ret != 0? - - if(0 != ret) - { - glob_opt.streams_opened -= connections[i]->streams_opened; - if(connections[i] == glob_opt.spdy_connection) - { - glob_opt.spdy_connection = NULL; - } - else - { - DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connections[i]); - glob_opt.total_spdy_connections--; - } - for(proxy = connections[i]->proxies_head; NULL != proxy; proxy=proxy->next) - { - abort(); - DLL_remove(connections[i]->proxies_head, connections[i]->proxies_tail, proxy); - proxy->spdy_active = false; - proxy->spdy_error = true; - PRINT_INFO2("spdy_free_connection for id %i", proxy->id); - } - PRINT_INFO("spdy_free_connection in loop"); - spdy_free_connection(connections[i]); - } - } - else - PRINT_INFO("not called"); - } -} -*/ - -void -spdy_run_select(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connections[], - int size) -{ - int i; - int ret; - - for(i=0; ihost); - if(FD_ISSET(connections[i]->fd, read_fd_set) || FD_ISSET(connections[i]->fd, write_fd_set) || FD_ISSET(connections[i]->fd, except_fd_set)) - { - //raise(SIGINT); - ret = spdy_exec_io(connections[i]); - - if(0 != ret) - { - glob_opt.streams_opened -= connections[i]->streams_opened; - if(connections[i] == glob_opt.spdy_connection) - { - glob_opt.spdy_connection = NULL; - } - else - { - DLL_remove(glob_opt.spdy_connections_head, glob_opt.spdy_connections_tail, connections[i]); - glob_opt.total_spdy_connections--; - } - PRINT_INFO("in spdy_run_select"); - spdy_free_connection(connections[i]); - } - } - else - { - PRINT_INFO("not called"); - //PRINT_INFO2("connection->want_io %i",connections[i]->want_io); - //PRINT_INFO2("read %i",spdylay_session_want_read(connections[i]->session)); - //PRINT_INFO2("write %i",spdylay_session_want_write(connections[i]->session)); - //raise(SIGINT); - } - } -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_spdy.h libmicrohttpd-0.9.55/src/examples/mhd2spdy_spdy.h --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_spdy.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_spdy.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,102 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy_spdy.h - * @brief SPDY part of the proxy. libspdylay is used for the client side. - * @author Andrey Uzunov - */ - -#ifndef SPDY_H -#define SPDY_H - -#include "mhd2spdy_structures.h" - - -struct SPDY_Connection * -spdy_connect(const struct URI *uri, - uint16_t port, - bool is_tls); - - -void -spdy_ctl_poll(struct pollfd *pollfd, - struct SPDY_Connection *connection); - - -bool -spdy_ctl_select(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connection); - - -int -spdy_exec_io(struct SPDY_Connection *connection); - - -void -spdy_diec(const char *func, - int error_code); - - -int -spdy_request(const char **nv, - struct Proxy *proxy, - bool with_body); - - -void -spdy_ssl_init_ssl_ctx(SSL_CTX *ssl_ctx, - uint16_t *spdy_proto_version); - - -void -spdy_free_connection(struct SPDY_Connection * connection); - - -void -spdy_get_pollfdset(struct pollfd fds[], - struct SPDY_Connection *connections[], - unsigned int max_size, - nfds_t *real_size); - - -int -spdy_get_selectfdset(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connections[], - unsigned int max_size, - nfds_t *real_size); - - -void -spdy_run(struct pollfd fds[], - struct SPDY_Connection *connections[], - int size); - - -void -spdy_run_select(fd_set * read_fd_set, - fd_set * write_fd_set, - fd_set * except_fd_set, - struct SPDY_Connection *connections[], - int size); - - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_structures.c libmicrohttpd-0.9.55/src/examples/mhd2spdy_structures.c --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_structures.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_structures.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,162 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy_structures.h - * @brief Common functions, macros. - * @author Andrey Uzunov - */ - -#include "mhd2spdy_structures.h" - - -void -free_uri(struct URI * uri) -{ - if(NULL != uri) - { - free(uri->full_uri); - free(uri->scheme); - free(uri->host_and_port); - free(uri->host); - free(uri->path); - free(uri->path_and_more); - free(uri->query); - free(uri->fragment); - uri->port = 0; - free(uri); - } -} - - -int -init_parse_uri(regex_t * preg) -{ - // RFC 2396 - // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? - /* - scheme = $2 - authority = $4 - path = $5 - query = $7 - fragment = $9 - */ - - return regcomp(preg, "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", REG_EXTENDED); -} - -void -deinit_parse_uri(regex_t * preg) -{ - regfree(preg); -} - -int -parse_uri(regex_t * preg, - char * full_uri, - struct URI ** uri) -{ - int ret; - char *colon; - long long port; - size_t nmatch = 10; - regmatch_t pmatch[10]; - - if (0 != (ret = regexec(preg, full_uri, nmatch, pmatch, 0))) - return ret; - - *uri = au_malloc(sizeof(struct URI)); - if(NULL == *uri) - return -200; - - (*uri)->full_uri = strdup(full_uri); - - asprintf(&((*uri)->scheme), "%.*s",pmatch[2].rm_eo - pmatch[2].rm_so, &full_uri[pmatch[2].rm_so]); - asprintf(&((*uri)->host_and_port), "%.*s",pmatch[4].rm_eo - pmatch[4].rm_so, &full_uri[pmatch[4].rm_so]); - asprintf(&((*uri)->path), "%.*s",pmatch[5].rm_eo - pmatch[5].rm_so, &full_uri[pmatch[5].rm_so]); - asprintf(&((*uri)->path_and_more), "%.*s",pmatch[9].rm_eo - pmatch[5].rm_so, &full_uri[pmatch[5].rm_so]); - asprintf(&((*uri)->query), "%.*s",pmatch[7].rm_eo - pmatch[7].rm_so, &full_uri[pmatch[7].rm_so]); - asprintf(&((*uri)->fragment), "%.*s",pmatch[9].rm_eo - pmatch[9].rm_so, &full_uri[pmatch[9].rm_so]); - - colon = strrchr((*uri)->host_and_port, ':'); - if(NULL == colon) - { - (*uri)->host = strdup((*uri)->host_and_port); - (*uri)->port = 0; - - return 0; - } - - port = atoi(colon + 1); - if(port<1 || port >= 256 * 256) - { - free_uri(*uri); - return -100; - } - (*uri)->port = port; - asprintf(&((*uri)->host), "%.*s", (int)(colon - (*uri)->host_and_port), (*uri)->host_and_port); - - return 0; -} - - -void -free_proxy(struct Proxy *proxy) -{ - PRINT_INFO2("free proxy called for '%s'", proxy->url); - if(NULL != proxy->http_body && proxy->http_body_size > 0) - UPDATE_STAT(glob_stat.spdy_bytes_received_and_dropped, proxy->http_body_size); - free(proxy->http_body); - free_uri(proxy->uri); - free(proxy->url); - free(proxy->http_uri); - free(proxy); -} - - -void *au_malloc(size_t size) -{ - void *new_memory; - - new_memory = malloc(size); - if(NULL != new_memory) - { - glob_opt.global_memory += size; - memset(new_memory, 0, size); - } - return new_memory; -} - - -bool -copy_buffer(const void *src, size_t src_size, void **dst, size_t *dst_size) -{ - if(0 == src_size) - return true; - - if(NULL == *dst) - *dst = malloc(src_size); - else - *dst = realloc(*dst, src_size + *dst_size); - if(NULL == *dst) - return false; - - memcpy(*dst + *dst_size, src, src_size); - *dst_size += src_size; - - return true; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_structures.h libmicrohttpd-0.9.55/src/examples/mhd2spdy_structures.h --- libmicrohttpd-0.9.44+dfsg/src/examples/mhd2spdy_structures.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/mhd2spdy_structures.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,296 +0,0 @@ -/* - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file mhd2spdy_structures.h - * @brief Common structures, functions, macros and global variables. - * @author Andrey Uzunov - */ -#ifndef STRUCTURES_H -#define STRUCTURES_H - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* WANT_READ if SSL connection needs more input; or WANT_WRITE if it - needs more output; or IO_NONE. This is necessary because SSL/TLS - re-negotiation is possible at any time. Spdylay API offers - similar functions like spdylay_session_want_read() and - spdylay_session_want_write() but they do not take into account - SSL connection. */ -enum -{ - IO_NONE, - WANT_READ, - WANT_WRITE -}; - - -struct Proxy; - - -struct SPDY_Connection { - SSL *ssl; - spdylay_session *session; - struct SPDY_Connection *prev; - struct SPDY_Connection *next; - struct Proxy *proxies_head; - struct Proxy *proxies_tail; - char *host; - int fd; - int want_io; - uint counter; - uint streams_opened; - bool is_tls; -}; - - -struct URI -{ - char * full_uri; - char * scheme; - char * host_and_port; - char * host; - char * path; - char * path_and_more; - char * query; - char * fragment; - uint16_t port; -}; - - -struct HTTP_URI; - - -struct Proxy -{ - struct MHD_Connection *http_connection; - struct MHD_Response *http_response; - struct URI *uri; - struct HTTP_URI *http_uri; - struct SPDY_Connection *spdy_connection; - struct Proxy *next; - struct Proxy *prev; - char *url; - char *version; - void *http_body; - void *received_body; - size_t http_body_size; - size_t received_body_size; - ssize_t length; - int status; - int id; - int32_t stream_id; - bool done; - bool http_error; - bool spdy_error; - bool http_active; - bool spdy_active; - bool receiving_done; -}; - - -struct HTTP_URI -{ - char * uri; - struct Proxy * proxy; -}; - - -struct SPDY_Headers -{ - const char **nv; - int num; - int cnt; -}; - - -struct global_options -{ - char *spdy2http_str; - struct SPDY_Connection *spdy_connection; - struct SPDY_Connection *spdy_connections_head; - struct SPDY_Connection *spdy_connections_tail; - int streams_opened; - int responses_pending; - regex_t uri_preg; - size_t global_memory; - SSL_CTX *ssl_ctx; - uint32_t total_spdy_connections; - uint16_t spdy_proto_version; - uint16_t listen_port; - bool verbose; - bool only_proxy; - bool spdy_data_received; - bool statistics; - bool ignore_rst_stream; -} -glob_opt; - - -struct global_statistics -{ - //unsigned long long http_bytes_sent; - //unsigned long long http_bytes_received; - unsigned long long spdy_bytes_sent; - unsigned long long spdy_bytes_received; - unsigned long long spdy_bytes_received_and_dropped; -} -glob_stat; - - -//forbidden headers -#define SPDY_HTTP_HEADER_TRANSFER_ENCODING "transfer-encoding" -#define SPDY_HTTP_HEADER_PROXY_CONNECTION "proxy-connection" -#define SPDY_HTTP_HEADER_KEEP_ALIVE "keep-alive" -#define SPDY_HTTP_HEADER_CONNECTION "connection" - -#define MAX_SPDY_CONNECTIONS 100 - -#define SPDY_MAX_OUTLEN 4096 - -/** - * Insert an element at the head of a DLL. Assumes that head, tail and - * element are structs with prev and next fields. - * - * @param head pointer to the head of the DLL (struct ? *) - * @param tail pointer to the tail of the DLL (struct ? *) - * @param element element to insert (struct ? *) - */ -#define DLL_insert(head,tail,element) do { \ - (element)->next = (head); \ - (element)->prev = NULL; \ - if ((tail) == NULL) \ - (tail) = element; \ - else \ - (head)->prev = element; \ - (head) = (element); } while (0) - - -/** - * Remove an element from a DLL. Assumes - * that head, tail and element are structs - * with prev and next fields. - * - * @param head pointer to the head of the DLL (struct ? *) - * @param tail pointer to the tail of the DLL (struct ? *) - * @param element element to remove (struct ? *) - */ -#define DLL_remove(head,tail,element) do { \ - if ((element)->prev == NULL) \ - (head) = (element)->next; \ - else \ - (element)->prev->next = (element)->next; \ - if ((element)->next == NULL) \ - (tail) = (element)->prev; \ - else \ - (element)->next->prev = (element)->prev; \ - (element)->next = NULL; \ - (element)->prev = NULL; } while (0) - - -#define PRINT_INFO(msg) do{\ - if(glob_opt.verbose){\ - printf("%i:%s\n", __LINE__, msg);\ - fflush(stdout);\ - }\ - }\ - while(0) - - -#define PRINT_INFO2(fmt, ...) do{\ - if(glob_opt.verbose){\ - printf("%i\n", __LINE__);\ - printf(fmt,##__VA_ARGS__);\ - printf("\n");\ - fflush(stdout);\ - }\ - }\ - while(0) - - -#define DIE(msg) do{\ - printf("FATAL ERROR (line %i): %s\n", __LINE__, msg);\ - fflush(stdout);\ - exit(EXIT_FAILURE);\ - }\ - while(0) - - -#define UPDATE_STAT(stat, value) do{\ - if(glob_opt.statistics)\ - {\ - stat += value;\ - }\ - }\ - while(0) - - -void -free_uri(struct URI * uri); - - -int -init_parse_uri(regex_t * preg); - - -void -deinit_parse_uri(regex_t * preg); - - -int -parse_uri(regex_t * preg, - char * full_uri, - struct URI ** uri); - - -void -free_proxy(struct Proxy *proxy); - - -void * -au_malloc(size_t size); - - -bool -copy_buffer(const void *src, size_t src_size, void **dst, size_t *dst_size); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/minimal_example.c libmicrohttpd-0.9.55/src/examples/minimal_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/minimal_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/minimal_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -67,13 +67,15 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (// MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_POLL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, - // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | MHD_USE_POLL, - // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (// MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + // MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, + // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, + // MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, MHD_OPTION_END); if (d == NULL) return 1; diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/minimal_example_comet.c libmicrohttpd-0.9.55/src/examples/minimal_example_comet.c --- libmicrohttpd-0.9.44+dfsg/src/examples/minimal_example_comet.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/minimal_example_comet.c 2017-05-28 22:34:00.000000000 +0200 @@ -74,7 +74,7 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); if (d == NULL) diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/msgs_i18n.c libmicrohttpd-0.9.55/src/examples/msgs_i18n.c --- libmicrohttpd-0.9.44+dfsg/src/examples/msgs_i18n.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/msgs_i18n.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,95 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Christian Grothoff, Silvio Clecio (silvioprog) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file msgs_i18n.c + * @brief example for how to use translate libmicrohttpd messages + * @author Christian Grothoff + * @author Silvio Clecio (silvioprog) + */ + +/* + * suposing you are in Brazil: + * + * # generate the PO file + * $ msginit --input=po/libmicrohttpd.pot --locale=pt_BR --output=libmicrohttpd.po + * # open the generated .po in any program like Poedit and translate the MHD messages; once done, let's go to the test: + * mkdir -p src/examples/locale/pt_BR/LC_MESSAGES + * mv libmicrohttpd.mo libmicrohttpd.po src/examples/locale/pt_BR/LC_MESSAGES + * cd src/examples/ + * gcc -o msgs_i18n msgs_i18n.c -lmicrohttpd + * export LANGUAGE=pt_BR + * ./msgs_i18n + * # it may print: Opção inválida 4196490! (Você terminou a lista com MHD_OPTION_END?) + */ +#include +#include +#include +#include + + +static int +ahc_echo (void *cls, + struct MHD_Connection *cnc, + const char *url, + const char *mt, + const char *ver, + const char *upd, + size_t *upsz, + void **ptr) +{ + return MHD_NO; +} + + +static void +error_handler (void *cls, + const char *fm, + va_list ap) +{ + /* Here we do the translation using GNU gettext. + As the error message is from libmicrohttpd, we specify + "libmicrohttpd" as the translation domain here. */ + vprintf (dgettext ("libmicrohttpd", + fm), + ap); +} + + +int +main (int argc, + char **argv) +{ + setlocale(LC_ALL, ""); + + /* The example uses PO files in the directory + "libmicrohttpd/src/examples/locale". This + needs to be adapted to match + where the MHD PO files are installed. */ + bindtextdomain ("libmicrohttpd", + "locale"); + MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_FEATURE_MESSAGES | MHD_USE_ERROR_LOG, + 8080, + NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL, + 99999 /* invalid option, to raise the error + "Invalid option ..." which we are going + to translate */); + return 1; /* This program won't "succeed"... */ +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/post_example.c libmicrohttpd-0.9.55/src/examples/post_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/post_example.c 2015-07-15 19:40:38.000000000 +0200 +++ libmicrohttpd-0.9.55/src/examples/post_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -715,7 +715,7 @@ } /* initialize PRNG */ srand ((unsigned int) time (NULL)); - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &create_response, NULL, @@ -741,7 +741,11 @@ } else tvp = NULL; - select (max + 1, &rs, &ws, &es, tvp); + if (-1 == select (max + 1, &rs, &ws, &es, tvp)) + { + if (EINTR != errno) + abort (); + } MHD_run (d); } MHD_stop_daemon (d); diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/querystring_example.c libmicrohttpd-0.9.55/src/examples/querystring_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/querystring_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/querystring_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -79,7 +79,7 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); if (d == NULL) diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/refuse_post_example.c libmicrohttpd-0.9.55/src/examples/refuse_post_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/refuse_post_example.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/refuse_post_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -86,7 +86,7 @@ printf ("%s PORT\n", argv[0]); return 1; } - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, atoi (argv[1]), NULL, NULL, &ahc_echo, (void *) askpage, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/spdy_event_loop.c libmicrohttpd-0.9.55/src/examples/spdy_event_loop.c --- libmicrohttpd-0.9.44+dfsg/src/examples/spdy_event_loop.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/spdy_event_loop.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,487 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file event_loop.c - * @brief shows how to use the daemon. THIS IS MAINLY A TEST AND DEBUG - * PROGRAM - * @author Andrey Uzunov - */ - -#include "platform.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "microspdy.h" -#include -#include -#ifndef MINGW -#include -#endif -//#include "../framinglayer/structures.h" -//#include "../applicationlayer/alstructures.h" - -static int run = 1; - -static int run2 = 1; - - -static uint64_t loops; - -static time_t start; - - -static void -new_session_callback (void *cls, - struct SPDY_Session * session) -{ - (void)cls; - - char ipstr[1024]; - - struct sockaddr *addr; - socklen_t addr_len = SPDY_get_remote_addr(session, &addr); - - if(!addr_len) - { - printf("SPDY_get_remote_addr"); - abort(); - } - - if(AF_INET == addr->sa_family) - { - struct sockaddr_in * addr4 = (struct sockaddr_in *) addr; - if(NULL == inet_ntop(AF_INET, &(addr4->sin_addr), ipstr, sizeof(ipstr))) - { - printf("inet_ntop"); - abort(); - } - printf("New connection from: %s:%i\n", ipstr, ntohs(addr4->sin_port)); - - } - else if(AF_INET6 == addr->sa_family) - { - struct sockaddr_in6 * addr6 = (struct sockaddr_in6 *) addr; - if(NULL == inet_ntop(AF_INET6, &(addr6->sin6_addr), ipstr, sizeof(ipstr))) - { - printf("inet_ntop"); - abort(); - } - printf("New connection from: %s:%i\n", ipstr, ntohs(addr6->sin6_port)); - - } -} - - -static void -session_closed_handler (void *cls, - struct SPDY_Session * session, - int by_client) -{ - (void)cls; - (void)session; - - //printf("session_closed_handler called\n"); - - if(SPDY_YES != by_client) - { - //killchild(child,"wrong by_client"); - printf("session closed by server\n"); - } - else - { - printf("session closed by client\n"); - } - - //session_closed_called = 1; -} - - -static void -response_done_callback(void *cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)streamopened; - if(strcmp(cls, "/close (daemon1)") == 0) - run = 0; - else { - if(strcmp(cls, "/close (daemon2)") == 0) run2 = 0; - loops = 0; - start = time(NULL); - } - if(SPDY_RESPONSE_RESULT_SUCCESS != status) - { - printf("not sent frame cause %i", status); - } - printf("answer for %s was sent\n", (char*)cls); - //printf("raw sent headers %s\n", (char *)(response->headers)+8); - - SPDY_destroy_request(request); - SPDY_destroy_response(response); - free(cls); -} - -/* -static int -print_headers (void *cls, - const char *name, const char *value) -{ - (void)cls; - printf("%s: %s\n",name,value); - return SPDY_YES; -} - */ - - -/* -void -new_request_cb (void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers) -{ - (void)cls; - (void)request; - printf("Priority: %i\nHTTP headers, scheme: %s\n\n%s %s %s\nHost: %s\n", priority,scheme,method,path,version,host); - SPDY_name_value_iterate(headers, &print_headers, NULL); -} -*/ - - -static int -append_headers_to_data (void *cls, - const char *name, const char * const *value, int num_values) -{ - char **data = cls; - void *tofree = *data; - int i; - - if(num_values) - for(i=0;i" - "Closing now!
This is an answer to the following " - "request:


%s
",data); - } - else - { - asprintf(&html,"" - "This is an answer to the following " - "request:

%s
",data); - } - - free(data); - - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,html,strlen(html)); - free(html); - } - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - abort(); - } - - char *pathcls; - asprintf(&pathcls, "%s (daemon%i)",path,NULL==cls ? 1 : 2); - if(SPDY_queue_response(request,response,true,false,&response_done_callback,pathcls)!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - abort(); - } -} - - -static int -new_post_data_cb (void * cls, - struct SPDY_Request *request, - const void * buf, - size_t size, - bool more) -{ - (void)cls; - (void)request; - (void)more; - - printf("DATA:\n===============================\n"); - write(0, buf, size); - printf("\n===============================\n"); - return SPDY_YES; -} - - -static void -sig_handler(int signo) -{ - (void)signo; - - printf("received signal\n"); -} - - -int -main (int argc, char *const *argv) -{ - if(argc != 2) return 1; - - #ifndef MINGW - if (signal(SIGPIPE, sig_handler) == SIG_ERR) - printf("\ncan't catch SIGPIPE\n"); - #endif - - SPDY_init(); - - /* - struct sockaddr_in addr4; - struct in_addr inaddr4; - inaddr4.s_addr = htonl(INADDR_ANY); - addr4.sin_family = AF_INET; - addr4.sin_addr = inaddr4; - addr4.sin_port = htons(atoi(argv[1])); - */ - - struct SPDY_Daemon *daemon = SPDY_start_daemon(atoi(argv[1]), - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - &new_session_callback,&session_closed_handler,&standard_request_handler,&new_post_data_cb,NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, 10, - //SPDY_DAEMON_OPTION_SOCK_ADDR, (struct sockaddr *)&addr4, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - /* - struct sockaddr_in6 addr6; - addr6.sin6_family = AF_INET6; - addr6.sin6_addr = in6addr_any; - addr6.sin6_port = htons(atoi(argv[1]) + 1); - */ - - struct SPDY_Daemon *daemon2 = SPDY_start_daemon(atoi(argv[1]) + 1, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - &new_session_callback,NULL,&standard_request_handler,&new_post_data_cb,&main, - //SPDY_DAEMON_OPTION_SESSION_TIMEOUT, 0, - //SPDY_DAEMON_OPTION_SOCK_ADDR, (struct sockaddr *)&addr6, - //SPDY_DAEMON_OPTION_FLAGS, SPDY_DAEMON_FLAG_ONLY_IPV6, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon2){ - printf("no daemon\n"); - return 1; - } - - do - { - unsigned long long timeoutlong=0; - struct timeval timeout; - volatile int rc; /* select() return code */ - volatile int ret; - - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - - if(run && daemon != NULL) - { - loops++; - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - printf("ret=%i; timeoutlong=%llu; sec=%llu; usec=%llu\n", ret, timeoutlong, (long long unsigned)timeout.tv_sec, (long long unsigned)timeout.tv_usec); - //raise(SIGINT); - - /* get file descriptors from the transfers */ - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - -//struct timeval ts1,ts2; - //gettimeofday(&ts1, NULL); - rc = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - //gettimeofday(&ts2, NULL); - printf("rc %i\n",rc); - // printf("time for select %i\n",ts2.tv_usec - ts1.tv_usec); - // printf("%i %i %i %i\n",ts1.tv_sec, ts1.tv_usec,ts2.tv_sec, ts2.tv_usec); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - else if(daemon != NULL){ - - printf("%lu loops in %llu secs\n", loops, (long long unsigned)(time(NULL) - start)); - SPDY_stop_daemon(daemon); - daemon=NULL; - } - - if(run2) - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon2, &timeoutlong); - //printf("tout %i\n",timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1) - { - //do sth else - //sleep(1); - - //try new connection - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong; - timeout.tv_usec = 0;//(timeoutlong % 1000) * 1000; - } - - //printf("ret=%i; timeoutlong=%i; sec=%i; usec=%i\n", ret, timeoutlong, timeout.tv_sec, timeout.tv_usec); - //raise(SIGINT); - - /* get file descriptors from the transfers */ - maxfd = SPDY_get_fdset (daemon2, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - rc = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(rc) { - case -1: - /* select error */ - break; - case 0: - - break; - default: - SPDY_run(daemon2); - - break; - } - } - else if(daemon2 != NULL){ - SPDY_stop_daemon(daemon2); - daemon2=NULL; - } - } - while(run || run2); - - if(daemon != NULL){ - SPDY_stop_daemon(daemon); - } - if(daemon2 != NULL){ - SPDY_stop_daemon(daemon2); - } - - SPDY_deinit(); - - return 0; -} - diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/spdy_fileserver.c libmicrohttpd-0.9.55/src/examples/spdy_fileserver.c --- libmicrohttpd-0.9.44+dfsg/src/examples/spdy_fileserver.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/spdy_fileserver.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,353 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file fileserver.c - * @brief Simple example how the lib can be used for serving - * files directly read from the system - * @author Andrey Uzunov - */ - -//for asprintf -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include "microspdy.h" -#include "time.h" - - -int run = 1; -char* basedir; - - -#define GET_MIME_TYPE(fname, mime) do {\ - unsigned int __len = strlen(fname);\ - if (__len < 4 || '.' != (fname)[__len - 4]) \ - { \ - (mime) = strdup("application/octet-stream");\ - printf("MIME for %s is applic...\n", (fname));\ - }\ - else {\ - const char * __ext = &(fname)[__len - 3];\ - if(0 == strcmp(__ext, "jpg")) (mime) = strdup("image/jpeg");\ - else if(0 == strcmp(__ext, "png")) (mime) = strdup("image/png");\ - else if(0 == strcmp(__ext, "css")) (mime) = strdup("text/css");\ - else if(0 == strcmp(__ext, "gif")) (mime) = strdup("image/gif");\ - else if(0 == strcmp(__ext, "htm")) (mime) = strdup("text/html");\ - else \ - { \ - (mime) = strdup("application/octet-stream");\ - printf("MIME for %s is applic...\n", (fname));\ - }\ - }\ - if(NULL == (mime))\ - {\ - printf("no memory\n");\ - abort();\ - }\ - } while (0) - - -static const char *DAY_NAMES[] = - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - -static const char *MONTH_NAMES[] = - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - -//taken from http://stackoverflow.com/questions/2726975/how-can-i-generate-an-rfc1123-date-string-from-c-code-win32 -//and modified for linux -char *Rfc1123_DateTimeNow() -{ - const int RFC1123_TIME_LEN = 29; - time_t t; - struct tm tm; - char * buf = malloc(RFC1123_TIME_LEN+1); - - if (NULL == buf) - return NULL; - time(&t); - gmtime_r( &t, &tm); - - strftime(buf, RFC1123_TIME_LEN+1, "---, %d --- %Y %H:%M:%S GMT", &tm); - memcpy(buf, DAY_NAMES[tm.tm_wday], 3); - memcpy(buf+8, MONTH_NAMES[tm.tm_mon], 3); - - return buf; -} - - -ssize_t -response_callback (void *cls, - void *buffer, - size_t max, - bool *more) -{ - FILE *fd =(FILE*)cls; - - int ret = fread(buffer,1,max,fd); - *more = feof(fd) == 0; - - //if(!(*more)) - // fclose(fd); - - return ret; -} - - -void -response_done_callback(void *cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)streamopened; - (void)status; - //printf("answer for %s was sent\n", (char *)cls); - - /*if(SPDY_RESPONSE_RESULT_SUCCESS != status) - { - printf("answer for %s was NOT sent, %i\n", (char *)cls,status); - }*/ - - SPDY_destroy_request(request); - SPDY_destroy_response(response); - if(NULL!=cls)fclose(cls); -} - -void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)method; - (void)version; - (void)more; - - struct SPDY_Response *response=NULL; - struct SPDY_NameValue *resp_headers; - char *fname; - char *fsize; - char *mime=NULL; - char *date=NULL; - ssize_t filesize = -666; - FILE *fd = NULL; - int ret = -666; - - //printf("received request for '%s %s %s'\n", method, path, version); - if(strlen(path) > 1 && NULL == strstr(path, "..") && '/' == path[0]) - { - asprintf(&fname,"%s%s",basedir,path); - if(0 == access(fname, R_OK)) - { - if(NULL == (fd = fopen(fname,"r")) - || 0 != (ret = fseek(fd, 0L, SEEK_END)) - || -1 == (filesize = ftell(fd)) - || 0 != (ret = fseek(fd, 0L, SEEK_SET))) - { - printf("Error on opening %s\n%p %i %zd\n",fname, fd, ret, filesize); - response = SPDY_build_response(SPDY_HTTP_INTERNAL_SERVER_ERROR,NULL,SPDY_HTTP_VERSION_1_1,NULL,NULL,0); - } - else - { - if(NULL == (resp_headers = SPDY_name_value_create())) - { - printf("SPDY_name_value_create failed\n"); - abort(); - } - - date = Rfc1123_DateTimeNow(); - if(NULL == date - || SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_DATE,date)) - { - printf("SPDY_name_value_add or Rfc1123_DateTimeNow failed\n"); - abort(); - } - free(date); - - if(-1 == asprintf(&fsize, "%zd", filesize) - || SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_LENGTH,fsize)) - { - printf("SPDY_name_value_add or asprintf failed\n"); - abort(); - } - free(fsize); - - GET_MIME_TYPE(path,mime); - if(SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_TYPE,mime)) - { - printf("SPDY_name_value_add failed\n"); - abort(); - } - free(mime); - - if(SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_SERVER,"libmicrospdy/fileserver")) - { - printf("SPDY_name_value_add failed\n"); - abort(); - } - - response = SPDY_build_response_with_callback(200,NULL, - SPDY_HTTP_VERSION_1_1,resp_headers,&response_callback,fd,SPDY_MAX_SUPPORTED_FRAME_SIZE); - SPDY_name_value_destroy(resp_headers); - } - - if(NULL==response){ - printf("no response obj\n"); - abort(); - } - - if(SPDY_queue_response(request,response,true,false,&response_done_callback,fd)!=SPDY_YES) - { - printf("queue\n"); - abort(); - } - - free(fname); - return; - } - free(fname); - } - - if(strcmp(path,"/close")==0) - { - run = 0; - } - - response = SPDY_build_response(SPDY_HTTP_NOT_FOUND,NULL,SPDY_HTTP_VERSION_1_1,NULL,NULL,0); - printf("Not found %s\n",path); - - if(NULL==response){ - printf("no response obj\n"); - abort(); - } - - if(SPDY_queue_response(request,response,true,false,&response_done_callback,NULL)!=SPDY_YES) - { - printf("queue\n"); - abort(); - } -} - -int -main (int argc, char *const *argv) -{ - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - if(argc != 5) - { - printf("Usage: %s cert-file key-file base-dir port\n", argv[0]); - return 1; - } - - SPDY_init(); - - daemon = SPDY_start_daemon(atoi(argv[4]), - argv[1], - argv[2], - NULL, - NULL, - &standard_request_handler, - NULL, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - basedir = argv[3]; - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(run); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return 0; -} - diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/spdy_response_with_callback.c libmicrohttpd-0.9.55/src/examples/spdy_response_with_callback.c --- libmicrohttpd-0.9.44+dfsg/src/examples/spdy_response_with_callback.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/spdy_response_with_callback.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,236 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file response_with_callback.c - * @brief shows how to create responses with callbacks - * @author Andrey Uzunov - */ - -//for asprintf -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include "microspdy.h" - -static int run = 1; - - -static ssize_t -response_callback (void *cls, - void *buffer, - size_t max, - bool *more) -{ - FILE *fd =(FILE*)cls; - - int ret = fread(buffer,1,max,fd); - *more = feof(fd) == 0; - - if(!(*more)) - fclose(fd); - - return ret; -} - - -static void -response_done_callback(void *cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)streamopened; - (void)status; - - printf("answer for %s was sent\n", (char *)cls); - - SPDY_destroy_request(request); - SPDY_destroy_response(response); - free(cls); -} - - -static void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)more; - - char *html; - struct SPDY_Response *response=NULL; - struct SPDY_NameValue *resp_headers; - - printf("received request for '%s %s %s'\n", method, path, version); - if(strcmp(path,"/spdy-draft.txt")==0) - { - FILE *fd = fopen(DATA_DIR "spdy-draft.txt","r"); - - if(NULL == (resp_headers = SPDY_name_value_create())) - { - fprintf(stdout,"SPDY_name_value_create failed\n"); - abort(); - } - if(SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_TYPE,"text/plain")) - { - fprintf(stdout,"SPDY_name_value_add failed\n"); - abort(); - } - - response = SPDY_build_response_with_callback(200,NULL, - SPDY_HTTP_VERSION_1_1,resp_headers,&response_callback,fd,SPDY_MAX_SUPPORTED_FRAME_SIZE); - SPDY_name_value_destroy(resp_headers); - } - else - { - if(strcmp(path,"/close")==0) - { - asprintf(&html,"" - "Closing now!"); - run = 0; - } - else - { - asprintf(&html,"" - "/spdy-draft.txt
"); - } - - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,html,strlen(html)); - free(html); - } - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - abort(); - } - - void *clspath = strdup(path); - - if(SPDY_queue_response(request,response,true,false,&response_done_callback,clspath)!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - abort(); - } -} - - -int -main (int argc, char *const *argv) -{ - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - if(argc != 2) - { - return 1; - } - - SPDY_init(); - - daemon = SPDY_start_daemon(atoi(argv[1]), - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - NULL, - NULL, - &standard_request_handler, - NULL, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(run); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return 0; -} - diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/timeout.c libmicrohttpd-0.9.55/src/examples/timeout.c --- libmicrohttpd-0.9.44+dfsg/src/examples/timeout.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/timeout.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,78 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016, 2017 Christian Grothoff, + Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file timeout.c + * @brief example for how to use libmicrohttpd request timeout + * @author Christian Grothoff, Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin) + */ + +#include +#include +#include + +#define PORT 8080 + +static int +answer_to_connection(void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + const char *page = "Hello timeout!"; + struct MHD_Response *response; + int ret; + + response = MHD_create_response_from_buffer (strlen(page), + (void *) page, + MHD_RESPMEM_PERSISTENT); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response(response); + return ret; +} + + +int +main (int argc, + char **argv) +{ + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, + PORT, + NULL, NULL, + &answer_to_connection, NULL, + /* 3 seconds */ + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 3, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + getchar(); + MHD_stop_daemon(daemon); + return 0; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/examples/upgrade_example.c libmicrohttpd-0.9.55/src/examples/upgrade_example.c --- libmicrohttpd-0.9.44+dfsg/src/examples/upgrade_example.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/examples/upgrade_example.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,298 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file upgrade_example.c + * @brief example for how to use libmicrohttpd upgrade + * @author Christian Grothoff + * + * Telnet to the HTTP server, use this in the request: + * GET / http/1.1 + * Connection: Upgrade + * + * After this, whatever you type will be echo'ed back to you. + */ + +#include "platform.h" +#include +#include + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + + +/** + * Change socket to blocking. + * + * @param fd the socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +static void +make_blocking (MHD_socket fd) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (fd, F_GETFL); + if (-1 == flags) + return; + if ((flags & ~O_NONBLOCK) != flags) + if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK)) + abort (); +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + ioctlsocket (fd, FIONBIO, &flags); +#endif /* MHD_WINSOCK_SOCKETS */ + +} + + +static void +send_all (MHD_socket sock, + const char *buf, + size_t len) +{ + ssize_t ret; + size_t off; + + make_blocking (sock); + for (off = 0; off < len; off += ret) + { + ret = send (sock, + &buf[off], + len - off, + 0); + if (0 > ret) + { + if (EAGAIN == errno) + { + ret = 0; + continue; + } + break; + } + if (0 == ret) + break; + } +} + + +struct MyData +{ + struct MHD_UpgradeResponseHandle *urh; + char *extra_in; + size_t extra_in_size; + MHD_socket sock; +}; + + +/** + * Main function for the thread that runs the interaction with + * the upgraded socket. Writes what it reads. + * + * @param cls the `struct MyData` + */ +static void * +run_usock (void *cls) +{ + struct MyData *md = cls; + struct MHD_UpgradeResponseHandle *urh = md->urh; + char buf[128]; + ssize_t got; + + make_blocking (md->sock); + /* start by sending extra data MHD may have already read, if any */ + if (0 != md->extra_in_size) + { + send_all (md->sock, + md->extra_in, + md->extra_in_size); + free (md->extra_in); + } + /* now echo in a loop */ + while (1) + { + got = recv (md->sock, + buf, + sizeof (buf), + 0); + if (0 >= got) + break; + send_all (md->sock, + buf, + got); + } + free (md); + MHD_upgrade_action (urh, + MHD_UPGRADE_ACTION_CLOSE); + return NULL; +} + + +/** + * Function called after a protocol "upgrade" response was sent + * successfully and the socket should now be controlled by some + * protocol other than HTTP. + * + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Data forwarding to "upgraded" @a sock will be started as soon + * as this function return. + * + * Except when in 'thread-per-connection' mode, implementations + * of this function should never block (as it will still be called + * from within the main event loop). + * + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). + * @param connection original HTTP connection handle, + * giving the function a last chance + * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in + * @param sock socket to use for bi-directional communication + * with the client. For HTTPS, this may not be a socket + * that is directly connected to the client and thus certain + * operations (TCP-specific setsockopt(), getsockopt(), etc.) + * may not work as expected (as the socket could be from a + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. + */ +static void +uh_cb (void *cls, + struct MHD_Connection *connection, + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh) +{ + struct MyData *md; + pthread_t pt; + + md = malloc (sizeof (struct MyData)); + if (NULL == md) + abort (); + memset (md, 0, sizeof (struct MyData)); + if (0 != extra_in_size) + { + md->extra_in = malloc (extra_in_size); + if (NULL == md->extra_in) + abort (); + memcpy (md->extra_in, + extra_in, + extra_in_size); + } + md->extra_in_size = extra_in_size; + md->sock = sock; + md->urh = urh; + if (0 != pthread_create (&pt, + NULL, + &run_usock, + md)) + abort (); + /* Note that by detaching like this we make it impossible to ensure + a clean shutdown, as the we stop the daemon even if a worker thread + is still running. Alas, this is a simple example... */ + pthread_detach (pt); + + /* This callback must return as soon as possible. */ + + /* Data forwarding to "upgraded" socket will be started + * after return from this callback. */ +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_for_upgrade (&uh_cb, + NULL); + + MHD_add_response_header (response, + MHD_HTTP_HEADER_UPGRADE, + "Echo Server"); + ret = MHD_queue_response (connection, + MHD_HTTP_SWITCHING_PROTOCOLS, + response); + MHD_destroy_response (response); + return ret; +} + + +int +main (int argc, + char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_ALLOW_UPGRADE | MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/autoinit_funcs.h libmicrohttpd-0.9.55/src/include/autoinit_funcs.h --- libmicrohttpd-0.9.44+dfsg/src/include/autoinit_funcs.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/include/autoinit_funcs.h 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* * AutoinitFuncs: Automatic Initialization and Deinitialization Functions - * CopyrightCopyright (C) 2014 Karlson2k (Evgeny Grin) + * Copyright(C) 2014-2017 Karlson2k (Evgeny Grin) * * This header is free software; you can redistribute it and / or * modify it under the terms of the GNU Lesser General Public @@ -47,11 +47,13 @@ _SET_INIT_AND_DEINIT_FUNCS(libInit,libDeinit); ------------------------------------------------- - - If initializer or deinitializer functions is not needed, just define + + If initializer or deinitializer function is not needed, just define it as empty function. - - This header should work with GCC, clang, MSVC (2010 or later). + + This header should work with GCC, clang, MSVC (2010 or later) and + SunPro / Sun Studio / Oracle Solaris Studio / Oracle Developer Studio + compiler. Supported C and C++ languages; application, static and dynamic (DLL) libraries; non-optimized (Debug) and optimized (Release) compilation and linking. @@ -65,10 +67,10 @@ * Current version of the header. * 0x01093001 = 1.9.30-1. */ -#define AUTOINIT_FUNCS_VERSION 0x01000001 +#define AUTOINIT_FUNCS_VERSION 0x01000100 #if defined(__GNUC__) -#/* if possible - check for supported attribute */ + /* if possible - check for supported attribute */ #ifdef __has_attribute #if !__has_attribute(constructor) || !__has_attribute(destructor) #define _GNUC_ATTR_CONSTR_NOT_SUPPORTED 1 @@ -76,7 +78,10 @@ #endif /* __has_attribute */ #endif /* __GNUC__ */ -#if defined(__GNUC__) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED) +/* "_attribute__ ((constructor))" is supported by GCC, clang and + Sun/Oracle compiler starting from version 12.1. */ +#if (defined(__GNUC__) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED)) || \ + (defined(__SUNPRO_C) && __SUNPRO_C+0 >= 0x5100) #define GNUC_SET_INIT_AND_DEINIT(FI,FD) \ void __attribute__ ((constructor)) _GNUC_init_helper_##FI(void) \ diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/Makefile.am libmicrohttpd-0.9.55/src/include/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/include/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/include/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -1,10 +1,6 @@ # This Makefile.am is in the public domain SUBDIRS = . -if ENABLE_SPDY -microspdy = microspdy.h -endif +include_HEADERS = microhttpd.h -include_HEADERS = microhttpd.h $(microspdy) - -EXTRA_DIST = platform.h platform_interface.h w32functions.h autoinit_funcs.h +EXTRA_DIST = platform.h autoinit_funcs.h mhd_options.h diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/Makefile.in libmicrohttpd-0.9.55/src/include/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/include/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/include/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -94,7 +94,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -102,11 +101,14 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__include_HEADERS_DIST) \ +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/MHD_config.h @@ -139,7 +141,6 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__include_HEADERS_DIST = microhttpd.h microspdy.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -249,8 +250,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -258,6 +261,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -273,9 +277,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -283,6 +284,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -297,9 +299,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -321,13 +320,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -335,6 +331,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -379,6 +376,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -390,9 +388,8 @@ # This Makefile.am is in the public domain SUBDIRS = . -@ENABLE_SPDY_TRUE@microspdy = microspdy.h -include_HEADERS = microhttpd.h $(microspdy) -EXTRA_DIST = platform.h platform_interface.h w32functions.h autoinit_funcs.h +include_HEADERS = microhttpd.h +EXTRA_DIST = platform.h autoinit_funcs.h mhd_options.h all: all-recursive .SUFFIXES: diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/mhd_options.h libmicrohttpd-0.9.55/src/include/mhd_options.h --- libmicrohttpd-0.9.44+dfsg/src/include/mhd_options.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/include/mhd_options.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,124 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file include/mhd_options.h + * @brief additional automatic macros for MHD_config.h + * @author Karlson2k (Evgeny Grin) + * + * This file includes MHD_config.h and adds automatic macros based on values + * in MHD_config.h, compiler built-in macros and commandline-defined macros + * (but not based on values defined in other headers). Works also as a guard + * to prevent double inclusion of MHD_config.h + */ + +#ifndef MHD_OPTIONS_H +#define MHD_OPTIONS_H 1 + +#include "MHD_config.h" + +/** + * Macro to make it easy to mark text for translation. Note that + * we do not actually call gettext() in MHD, but we do make it + * easy to create a ".po" file so that applications that do want + * to translate error messages can do so. + */ +#define _(String) (String) + + + +#ifndef _MHD_EXTERN +#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \ + (defined(DLL_EXPORT) || defined(MHD_W32DLL)) +#define _MHD_EXTERN __declspec(dllexport) extern +#else /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */ +#define _MHD_EXTERN extern +#endif /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */ +#endif /* ! _MHD_EXTERN */ + +/* Some platforms (FreeBSD, Solaris, W32) allow to override + default FD_SETSIZE by defining it before including + headers. */ +#ifdef FD_SETSIZE +/* FD_SETSIZE defined in command line or in MHD_config.h */ +#elif defined(_WIN32) && !defined(__CYGWIN__) +/* Platform with WinSock and without overridden FD_SETSIZE */ +#define FD_SETSIZE 2048 /* Override default small value */ +#else /* !FD_SETSIZE && !WinSock*/ +/* System default value of FD_SETSIZE is used */ +#define _MHD_FD_SETSIZE_IS_DEFAULT 1 +#endif /* !FD_SETSIZE && !WinSock*/ + +#if OS390 +#define _OPEN_THREADS +#define _OPEN_SYS_SOCK_IPV6 +#define _OPEN_MSGQ_EXT +#define _LP64 +#endif + +#if defined(_WIN32) +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#else /* _WIN32_WINNT */ +#if _WIN32_WINNT < 0x0501 +#error "Headers for Windows XP or later are required" +#endif /* _WIN32_WINNT < 0x0501 */ +#endif /* _WIN32_WINNT */ +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#endif /* _WIN32 */ + +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +#define RESTRICT __restrict__ +#endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */ + +#if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE) +/* On Linux, special macro is required to enable definitions of some xxx64 functions */ +#define _LARGEFILE64_SOURCE 1 +#endif + +#ifdef HAVE_C11_GMTIME_S +/* Special macro is required to enable C11 definition of gmtime_s() function */ +#define __STDC_WANT_LIB_EXT1__ 1 +#endif /* HAVE_C11_GMTIME_S */ + +#if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE) +#error MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time. +#endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */ + +/* Define MHD_FAVOR_FAST_CODE to force fast code path or + define MHD_FAVOR_SMALL_CODE to choose compact code path */ +#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE) +/* Try to detect user preferences */ +/* Defined by GCC and many compatible compilers */ +#ifdef __OPTIMIZE_SIZE__ +#define MHD_FAVOR_SMALL_CODE 1 +#elif __OPTIMIZE__ +#define MHD_FAVOR_FAST_CODE 1 +#endif /* __OPTIMIZE__ */ +#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */ + +#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE) +/* Use faster code by default */ +#define MHD_FAVOR_FAST_CODE 1 +#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */ + +#endif /* MHD_OPTIONS_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/microhttpd.h libmicrohttpd-0.9.55/src/include/microhttpd.h --- libmicrohttpd-0.9.44+dfsg/src/include/microhttpd.h 2015-10-01 21:22:00.000000000 +0200 +++ libmicrohttpd-0.9.55/src/include/microhttpd.h 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2006-2015 Christian Grothoff (and other contributing authors) + Copyright (C) 2006-2017 Christian Grothoff (and other contributing authors) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ * @file microhttpd.h * @brief public interface to libmicrohttpd * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) * @author Chris GauthierDickey * * All symbols defined in this header start with MHD. MHD is a small @@ -59,14 +60,6 @@ * thread-safe (with the exception of #MHD_set_connection_value, * which must only be used in a particular context). * - * NEW: Before including "microhttpd.h" you should add the necessary - * includes to define the `uint64_t`, `size_t`, `fd_set`, `socklen_t` - * and `struct sockaddr` data types (which headers are needed may - * depend on your platform; for possible suggestions consult - * "platform.h" in the MHD distribution). If you have done so, you - * should also have a line with "#define MHD_PLATFORM_H" which will - * prevent this header from trying (and, depending on your platform, - * failing) to include the right headers. * * @defgroup event event-loop control * MHD API to start and stop the HTTP server and manage the event loop. @@ -99,11 +92,14 @@ hence works on any platform, we use "standard" includes here to build out-of-the-box for beginning users on common systems. - Once you have a proper build system and go for more exotic - platforms, you should define MHD_PLATFORM_H in some header that - you always include *before* "microhttpd.h". Then the following - "standard" includes won't be used (which might be a good - idea, especially on platforms where they do not exist). */ + If generic headers don't work on your platform, include headers + which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', + 'uint16_t', 'uint32_t', 'uint64_t', 'off_t', 'struct sockaddr', + 'socklen_t', 'fd_set' and "#define MHD_PLATFORM_H" before + including "microhttpd.h". Then the following "standard" + includes won't be used (which might be a good idea, especially + on platforms where they do not exist). + */ #ifndef MHD_PLATFORM_H #include #include @@ -130,7 +126,7 @@ * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00094400 +#define MHD_VERSION 0x00095500 /** * MHD-internal return code for "YES". @@ -198,47 +194,75 @@ */ #ifdef MHD_NO_DEPRECATION #define _MHD_DEPR_MACRO(msg) +#define _MHD_NO_DEPR_IN_MACRO 1 +#define _MHD_DEPR_IN_MACRO(msg) +#define _MHD_NO_DEPR_FUNC 1 #define _MHD_DEPR_FUNC(msg) #endif /* MHD_NO_DEPRECATION */ #ifndef _MHD_DEPR_MACRO #if defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1500 +/* VS 2008 or later */ /* Stringify macros */ #define _MHD_INSTRMACRO(a) #a #define _MHD_STRMACRO(a) _MHD_INSTRMACRO(a) +/* deprecation message */ #define _MHD_DEPR_MACRO(msg) __pragma(message(__FILE__ "(" _MHD_STRMACRO(__LINE__)"): warning: " msg)) +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) #elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__) +/* clang or GCC since 3.0 */ #define _MHD_GCC_PRAG(x) _Pragma (#x) #if __clang_major__+0 >= 5 || \ (!defined(__apple_build_version__) && (__clang_major__+0 > 3 || (__clang_major__+0 == 3 && __clang_minor__ >= 3))) || \ __GNUC__+0 > 4 || (__GNUC__+0 == 4 && __GNUC_MINOR__+0 >= 8) +/* clang >= 3.3 (or XCode's clang >= 5.0) or + GCC >= 4.8 */ #define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG(GCC warning msg) +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) #else /* older clang or GCC */ +/* clang < 3.3, XCode's clang < 5.0, 3.0 <= GCC < 4.8 */ #define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG(message msg) -#endif +#if (__clang_major__+0 > 2 || (__clang_major__+0 == 2 && __clang_minor__ >= 9)) /* FIXME: clang >= 2.9, earlier versions not tested */ +/* clang handles inline pragmas better than GCC */ +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) +#endif /* clang >= 2.9 */ +#endif /* older clang or GCC */ /* #elif defined(SOMEMACRO) */ /* add compiler-specific macros here if required */ -#else /* other compilers */ +#endif /* clang || GCC >= 3.0 */ +#endif /* !_MHD_DEPR_MACRO */ + +#ifndef _MHD_DEPR_MACRO #define _MHD_DEPR_MACRO(msg) -#endif -#endif /* _MHD_DEPR_MACRO */ +#endif /* !_MHD_DEPR_MACRO */ + +#ifndef _MHD_DEPR_IN_MACRO +#define _MHD_NO_DEPR_IN_MACRO 1 +#define _MHD_DEPR_IN_MACRO(msg) +#endif /* !_MHD_DEPR_IN_MACRO */ #ifndef _MHD_DEPR_FUNC #if defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1400 +/* VS 2005 or later */ #define _MHD_DEPR_FUNC(msg) __declspec(deprecated(msg)) #elif defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1310 /* VS .NET 2003 deprecation do not support custom messages */ #define _MHD_DEPR_FUNC(msg) __declspec(deprecated) -#elif defined (__clang__) && \ - (__clang_major__+0 >= 4 || (!defined(__apple_build_version__) && __clang_major__+0 >= 3)) +#elif (__GNUC__+0 >= 5) || (defined (__clang__) && \ + (__clang_major__+0 > 2 || (__clang_major__+0 == 2 && __clang_minor__ >= 9))) /* FIXME: earlier versions not tested */ +/* GCC >= 5.0 or clang >= 2.9 */ #define _MHD_DEPR_FUNC(msg) __attribute__((deprecated(msg))) #elif defined (__clang__) || __GNUC__+0 > 3 || (__GNUC__+0 == 3 && __GNUC_MINOR__+0 >= 1) -/* GCC-style deprecation do not support custom messages */ +/* 3.1 <= GCC < 5.0 or clang < 2.9 */ +/* old GCC-style deprecation do not support custom messages */ #define _MHD_DEPR_FUNC(msg) __attribute__((__deprecated__)) /* #elif defined(SOMEMACRO) */ /* add compiler-specific macros here if required */ -#else /* other compilers */ +#endif /* clang < 2.9 || GCC >= 3.1 */ +#endif /* !_MHD_DEPR_FUNC */ + +#ifndef _MHD_DEPR_FUNC +#define _MHD_NO_DEPR_FUNC 1 #define _MHD_DEPR_FUNC(msg) -#endif -#endif /* _MHD_DEPR_FUNC */ +#endif /* !_MHD_DEPR_FUNC */ /** * Not all architectures and `printf()`'s support the `long long` type. @@ -274,6 +298,8 @@ * These are the status codes defined for HTTP responses. * @{ */ +/* See http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml */ + #define MHD_HTTP_CONTINUE 100 #define MHD_HTTP_SWITCHING_PROTOCOLS 101 #define MHD_HTTP_PROCESSING 102 @@ -286,6 +312,9 @@ #define MHD_HTTP_RESET_CONTENT 205 #define MHD_HTTP_PARTIAL_CONTENT 206 #define MHD_HTTP_MULTI_STATUS 207 +#define MHD_HTTP_ALREADY_REPORTED 208 + +#define MHD_HTTP_IM_USED 226 #define MHD_HTTP_MULTIPLE_CHOICES 300 #define MHD_HTTP_MOVED_PERMANENTLY 301 @@ -295,6 +324,7 @@ #define MHD_HTTP_USE_PROXY 305 #define MHD_HTTP_SWITCH_PROXY 306 #define MHD_HTTP_TEMPORARY_REDIRECT 307 +#define MHD_HTTP_PERMANENT_REDIRECT 308 #define MHD_HTTP_BAD_REQUEST 400 #define MHD_HTTP_UNAUTHORIZED 401 @@ -305,24 +335,41 @@ #define MHD_HTTP_NOT_ACCEPTABLE 406 /** @deprecated */ #define MHD_HTTP_METHOD_NOT_ACCEPTABLE \ - _MHD_DEPR_MACRO("Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") 406 + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") 406 #define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407 #define MHD_HTTP_REQUEST_TIMEOUT 408 #define MHD_HTTP_CONFLICT 409 #define MHD_HTTP_GONE 410 #define MHD_HTTP_LENGTH_REQUIRED 411 #define MHD_HTTP_PRECONDITION_FAILED 412 -#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE 413 -#define MHD_HTTP_REQUEST_URI_TOO_LONG 414 +#define MHD_HTTP_PAYLOAD_TOO_LARGE 413 +/** @deprecated */ +#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUEST_ENTITY_TOO_LARGE is deprecated, use MHD_HTTP_PAYLOAD_TOO_LARGE") 413 +#define MHD_HTTP_URI_TOO_LONG 414 +/** @deprecated */ +#define MHD_HTTP_REQUEST_URI_TOO_LONG \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUEST_URI_TOO_LONG is deprecated, use MHD_HTTP_URI_TOO_LONG") 414 #define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415 -#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416 +#define MHD_HTTP_RANGE_NOT_SATISFIABLE 416 +/** @deprecated */ +#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE is deprecated, use MHD_HTTP_RANGE_NOT_SATISFIABLE") 416 #define MHD_HTTP_EXPECTATION_FAILED 417 + +#define MHD_HTTP_MISDIRECTED_REQUEST 421 #define MHD_HTTP_UNPROCESSABLE_ENTITY 422 #define MHD_HTTP_LOCKED 423 #define MHD_HTTP_FAILED_DEPENDENCY 424 #define MHD_HTTP_UNORDERED_COLLECTION 425 #define MHD_HTTP_UPGRADE_REQUIRED 426 + +#define MHD_HTTP_PRECONDITION_REQUIRED 428 +#define MHD_HTTP_TOO_MANY_REQUESTS 429 +#define MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431 + #define MHD_HTTP_NO_RESPONSE 444 + #define MHD_HTTP_RETRY_WITH 449 #define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450 #define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451 @@ -335,8 +382,10 @@ #define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505 #define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506 #define MHD_HTTP_INSUFFICIENT_STORAGE 507 +#define MHD_HTTP_LOOP_DETECTED 508 #define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 #define MHD_HTTP_NOT_EXTENDED 510 +#define MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED 511 /** @} */ /* end of group httpcode */ @@ -346,7 +395,7 @@ * If we don't have a string for a status code, we give the first * message in that status code class. */ -const char * +_MHD_EXTERN const char * MHD_get_reason_phrase_for (unsigned int code); @@ -361,63 +410,319 @@ /** * @defgroup headers HTTP headers * These are the standard headers found in HTTP requests and responses. + * See: http://www.iana.org/assignments/message-headers/message-headers.xml + * Registry Version 2017-01-27 * @{ */ -/* See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ + +/* Main HTTP headers. */ +/* Standard. RFC7231, Section 5.3.2 */ #define MHD_HTTP_HEADER_ACCEPT "Accept" +/* Standard. RFC7231, Section 5.3.3 */ #define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" +/* Standard. RFC7231, Section 5.3.4; RFC7694, Section 3 */ #define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding" +/* Standard. RFC7231, Section 5.3.5 */ #define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language" +/* Standard. RFC7233, Section 2.3 */ #define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges" +/* Standard. RFC7234, Section 5.1 */ #define MHD_HTTP_HEADER_AGE "Age" +/* Standard. RFC7231, Section 7.4.1 */ #define MHD_HTTP_HEADER_ALLOW "Allow" +/* Standard. RFC7235, Section 4.2 */ #define MHD_HTTP_HEADER_AUTHORIZATION "Authorization" +/* Standard. RFC7234, Section 5.2 */ #define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control" +/* Reserved. RFC7230, Section 8.1 */ +#define MHD_HTTP_HEADER_CLOSE "Close" +/* Standard. RFC7230, Section 6.1 */ #define MHD_HTTP_HEADER_CONNECTION "Connection" +/* Standard. RFC7231, Section 3.1.2.2 */ #define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding" +/* Standard. RFC7231, Section 3.1.3.2 */ #define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language" +/* Standard. RFC7230, Section 3.3.2 */ #define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length" +/* Standard. RFC7231, Section 3.1.4.2 */ #define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location" -#define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5" +/* Standard. RFC7233, Section 4.2 */ #define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range" +/* Standard. RFC7231, Section 3.1.1.5 */ #define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type" -#define MHD_HTTP_HEADER_COOKIE "Cookie" +/* Standard. RFC7231, Section 7.1.1.2 */ #define MHD_HTTP_HEADER_DATE "Date" +/* Standard. RFC7232, Section 2.3 */ #define MHD_HTTP_HEADER_ETAG "ETag" +/* Standard. RFC7231, Section 5.1.1 */ #define MHD_HTTP_HEADER_EXPECT "Expect" +/* Standard. RFC7234, Section 5.3 */ #define MHD_HTTP_HEADER_EXPIRES "Expires" +/* Standard. RFC7231, Section 5.5.1 */ #define MHD_HTTP_HEADER_FROM "From" +/* Standard. RFC7230, Section 5.4 */ #define MHD_HTTP_HEADER_HOST "Host" +/* Standard. RFC7232, Section 3.1 */ #define MHD_HTTP_HEADER_IF_MATCH "If-Match" +/* Standard. RFC7232, Section 3.3 */ #define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since" +/* Standard. RFC7232, Section 3.2 */ #define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match" +/* Standard. RFC7233, Section 3.2 */ #define MHD_HTTP_HEADER_IF_RANGE "If-Range" +/* Standard. RFC7232, Section 3.4 */ #define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" +/* Standard. RFC7232, Section 2.2 */ #define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified" +/* Standard. RFC7231, Section 7.1.2 */ #define MHD_HTTP_HEADER_LOCATION "Location" +/* Standard. RFC7231, Section 5.1.2 */ #define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards" +/* Standard. RFC7231, Appendix A.1 */ +#define MHD_HTTP_HEADER_MIME_VERSION "MIME-Version" +/* Standard. RFC7234, Section 5.4 */ #define MHD_HTTP_HEADER_PRAGMA "Pragma" +/* Standard. RFC7235, Section 4.3 */ #define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate" +/* Standard. RFC7235, Section 4.4 */ #define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization" +/* Standard. RFC7233, Section 3.1 */ #define MHD_HTTP_HEADER_RANGE "Range" -/* This is not a typo, see HTTP spec */ +/* Standard. RFC7231, Section 5.5.2 */ #define MHD_HTTP_HEADER_REFERER "Referer" +/* Standard. RFC7231, Section 7.1.3 */ #define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After" +/* Standard. RFC7231, Section 7.4.2 */ #define MHD_HTTP_HEADER_SERVER "Server" -#define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie" -#define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2" +/* Standard. RFC7230, Section 4.3 */ #define MHD_HTTP_HEADER_TE "TE" +/* Standard. RFC7230, Section 4.4 */ #define MHD_HTTP_HEADER_TRAILER "Trailer" +/* Standard. RFC7230, Section 3.3.1 */ #define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding" +/* Standard. RFC7230, Section 6.7 */ #define MHD_HTTP_HEADER_UPGRADE "Upgrade" +/* Standard. RFC7231, Section 5.5.3 */ #define MHD_HTTP_HEADER_USER_AGENT "User-Agent" +/* Standard. RFC7231, Section 7.1.4 */ #define MHD_HTTP_HEADER_VARY "Vary" +/* Standard. RFC7230, Section 5.7.1 */ #define MHD_HTTP_HEADER_VIA "Via" -#define MHD_HTTP_HEADER_WARNING "Warning" +/* Standard. RFC7235, Section 4.1 */ #define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" -#define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN "Access-Control-Allow-Origin" +/* Standard. RFC7234, Section 5.5 */ +#define MHD_HTTP_HEADER_WARNING "Warning" + +/* Additional HTTP headers. */ +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_A_IM "A-IM" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ACCEPT_ADDITIONS "Accept-Additions" +/* Informational. RFC7089 */ +#define MHD_HTTP_HEADER_ACCEPT_DATETIME "Accept-Datetime" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ACCEPT_FEATURES "Accept-Features" +/* No category. RFC5789 */ +#define MHD_HTTP_HEADER_ACCEPT_PATCH "Accept-Patch" +/* Standard. RFC7639, Section 2 */ +#define MHD_HTTP_HEADER_ALPN "ALPN" +/* Standard. RFC7838 */ +#define MHD_HTTP_HEADER_ALT_SVC "Alt-Svc" +/* Standard. RFC7838 */ +#define MHD_HTTP_HEADER_ALT_USED "Alt-Used" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ALTERNATES "Alternates" +/* No category. RFC4437 */ +#define MHD_HTTP_HEADER_APPLY_TO_REDIRECT_REF "Apply-To-Redirect-Ref" +/* Experimental. RFC8053, Section 4 */ +#define MHD_HTTP_HEADER_AUTHENTICATION_CONTROL "Authentication-Control" +/* Standard. RFC7615, Section 3 */ +#define MHD_HTTP_HEADER_AUTHENTICATION_INFO "Authentication-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_EXT "C-Ext" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_MAN "C-Man" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_OPT "C-Opt" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_PEP "C-PEP" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_PEP_INFO "C-PEP-Info" +/* Standard. RFC7809, Section 7.1 */ +#define MHD_HTTP_HEADER_CALDAV_TIMEZONES "CalDAV-Timezones" +/* Obsoleted. RFC2068; RFC2616 */ +#define MHD_HTTP_HEADER_CONTENT_BASE "Content-Base" +/* Standard. RFC6266 */ #define MHD_HTTP_HEADER_CONTENT_DISPOSITION "Content-Disposition" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_ID "Content-ID" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_SCRIPT_TYPE "Content-Script-Type" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_STYLE_TYPE "Content-Style-Type" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_VERSION "Content-Version" +/* Standard. RFC6265 */ +#define MHD_HTTP_HEADER_COOKIE "Cookie" +/* Obsoleted. RFC2965; RFC6265 */ +#define MHD_HTTP_HEADER_COOKIE2 "Cookie2" +/* Standard. RFC5323 */ +#define MHD_HTTP_HEADER_DASL "DASL" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DAV "DAV" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DEFAULT_STYLE "Default-Style" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DELTA_BASE "Delta-Base" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DEPTH "Depth" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DERIVED_FROM "Derived-From" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DESTINATION "Destination" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DIFFERENTIAL_ID "Differential-ID" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DIGEST "Digest" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_EXT "Ext" +/* Standard. RFC7239 */ +#define MHD_HTTP_HEADER_FORWARDED "Forwarded" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_GETPROFILE "GetProfile" +/* Experimental. RFC7486, Section 6.1.1 */ +#define MHD_HTTP_HEADER_HOBAREG "Hobareg" +/* Standard. RFC7540, Section 3.2.1 */ +#define MHD_HTTP_HEADER_HTTP2_SETTINGS "HTTP2-Settings" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_IM "IM" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_IF "If" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_IF_SCHEDULE_TAG_MATCH "If-Schedule-Tag-Match" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_KEEP_ALIVE "Keep-Alive" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_LABEL "Label" +/* No category. RFC5988 */ +#define MHD_HTTP_HEADER_LINK "Link" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_LOCK_TOKEN "Lock-Token" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_MAN "Man" +/* Informational. RFC7089 */ +#define MHD_HTTP_HEADER_MEMENTO_DATETIME "Memento-Datetime" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_METER "Meter" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_NEGOTIATE "Negotiate" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_OPT "Opt" +/* Experimental. RFC8053, Section 3 */ +#define MHD_HTTP_HEADER_OPTIONAL_WWW_AUTHENTICATE "Optional-WWW-Authenticate" +/* Standard. RFC4229 */ +#define MHD_HTTP_HEADER_ORDERING_TYPE "Ordering-Type" +/* Standard. RFC6454 */ +#define MHD_HTTP_HEADER_ORIGIN "Origin" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_OVERWRITE "Overwrite" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_P3P "P3P" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PEP "PEP" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PICS_LABEL "PICS-Label" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PEP_INFO "Pep-Info" +/* Standard. RFC4229 */ +#define MHD_HTTP_HEADER_POSITION "Position" +/* Standard. RFC7240 */ +#define MHD_HTTP_HEADER_PREFER "Prefer" +/* Standard. RFC7240 */ +#define MHD_HTTP_HEADER_PREFERENCE_APPLIED "Preference-Applied" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROFILEOBJECT "ProfileObject" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL "Protocol" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_INFO "Protocol-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_QUERY "Protocol-Query" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_REQUEST "Protocol-Request" +/* Standard. RFC7615, Section 4 */ +#define MHD_HTTP_HEADER_PROXY_AUTHENTICATION_INFO "Proxy-Authentication-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROXY_FEATURES "Proxy-Features" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROXY_INSTRUCTION "Proxy-Instruction" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PUBLIC "Public" +/* Standard. RFC7469 */ +#define MHD_HTTP_HEADER_PUBLIC_KEY_PINS "Public-Key-Pins" +/* Standard. RFC7469 */ +#define MHD_HTTP_HEADER_PUBLIC_KEY_PINS_REPORT_ONLY "Public-Key-Pins-Report-Only" +/* No category. RFC4437 */ +#define MHD_HTTP_HEADER_REDIRECT_REF "Redirect-Ref" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SAFE "Safe" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_SCHEDULE_REPLY "Schedule-Reply" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_SCHEDULE_TAG "Schedule-Tag" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT "Sec-WebSocket-Accept" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_EXTENSIONS "Sec-WebSocket-Extensions" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY "Sec-WebSocket-Key" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_PROTOCOL "Sec-WebSocket-Protocol" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION "Sec-WebSocket-Version" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SECURITY_SCHEME "Security-Scheme" +/* Standard. RFC6265 */ +#define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie" +/* Obsoleted. RFC2965; RFC6265 */ +#define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SETPROFILE "SetProfile" +/* Standard. RFC5023 */ +#define MHD_HTTP_HEADER_SLUG "SLUG" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SOAPACTION "SoapAction" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_STATUS_URI "Status-URI" +/* Standard. RFC6797 */ +#define MHD_HTTP_HEADER_STRICT_TRANSPORT_SECURITY "Strict-Transport-Security" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SURROGATE_CAPABILITY "Surrogate-Capability" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SURROGATE_CONTROL "Surrogate-Control" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_TCN "TCN" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_TIMEOUT "Timeout" +/* Standard. RFC8030, Section 5.4 */ +#define MHD_HTTP_HEADER_TOPIC "Topic" +/* Standard. RFC8030, Section 5.2 */ +#define MHD_HTTP_HEADER_TTL "TTL" +/* Standard. RFC8030, Section 5.3 */ +#define MHD_HTTP_HEADER_URGENCY "Urgency" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_URI "URI" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_VARIANT_VARY "Variant-Vary" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_WANT_DIGEST "Want-Digest" +/* Informational. RFC7034 */ +#define MHD_HTTP_HEADER_X_FRAME_OPTIONS "X-Frame-Options" +/* Some provisional headers. */ +#define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN "Access-Control-Allow-Origin" /** @} */ /* end of group headers */ /** @@ -433,19 +738,93 @@ /** * @defgroup methods HTTP methods - * Standard HTTP methods (as strings). + * HTTP methods (as strings). + * See: http://www.iana.org/assignments/http-methods/http-methods.xml + * Registry Version 2015-05-19 * @{ */ +/* Main HTTP methods. */ +/* Not safe. Not idempotent. RFC7231, Section 4.3.6. */ #define MHD_HTTP_METHOD_CONNECT "CONNECT" +/* Not safe. Idempotent. RFC7231, Section 4.3.5. */ #define MHD_HTTP_METHOD_DELETE "DELETE" +/* Safe. Idempotent. RFC7231, Section 4.3.1. */ #define MHD_HTTP_METHOD_GET "GET" +/* Safe. Idempotent. RFC7231, Section 4.3.2. */ #define MHD_HTTP_METHOD_HEAD "HEAD" +/* Safe. Idempotent. RFC7231, Section 4.3.7. */ #define MHD_HTTP_METHOD_OPTIONS "OPTIONS" +/* Not safe. Not idempotent. RFC7231, Section 4.3.3. */ #define MHD_HTTP_METHOD_POST "POST" +/* Not safe. Idempotent. RFC7231, Section 4.3.4. */ #define MHD_HTTP_METHOD_PUT "PUT" -#define MHD_HTTP_METHOD_PATCH "PATCH" +/* Safe. Idempotent. RFC7231, Section 4.3.8. */ #define MHD_HTTP_METHOD_TRACE "TRACE" +/* Additional HTTP methods. */ +/* Not safe. Idempotent. RFC3744, Section 8.1. */ +#define MHD_HTTP_METHOD_ACL "ACL" +/* Not safe. Idempotent. RFC3253, Section 12.6. */ +#define MHD_HTTP_METHOD_BASELINE_CONTROL "BASELINE-CONTROL" +/* Not safe. Idempotent. RFC5842, Section 4. */ +#define MHD_HTTP_METHOD_BIND "BIND" +/* Not safe. Idempotent. RFC3253, Section 4.4, Section 9.4. */ +#define MHD_HTTP_METHOD_CHECKIN "CHECKIN" +/* Not safe. Idempotent. RFC3253, Section 4.3, Section 8.8. */ +#define MHD_HTTP_METHOD_CHECKOUT "CHECKOUT" +/* Not safe. Idempotent. RFC4918, Section 9.8. */ +#define MHD_HTTP_METHOD_COPY "COPY" +/* Not safe. Idempotent. RFC3253, Section 8.2. */ +#define MHD_HTTP_METHOD_LABEL "LABEL" +/* Not safe. Idempotent. RFC2068, Section 19.6.1.2. */ +#define MHD_HTTP_METHOD_LINK "LINK" +/* Not safe. Not idempotent. RFC4918, Section 9.10. */ +#define MHD_HTTP_METHOD_LOCK "LOCK" +/* Not safe. Idempotent. RFC3253, Section 11.2. */ +#define MHD_HTTP_METHOD_MERGE "MERGE" +/* Not safe. Idempotent. RFC3253, Section 13.5. */ +#define MHD_HTTP_METHOD_MKACTIVITY "MKACTIVITY" +/* Not safe. Idempotent. RFC4791, Section 5.3.1. */ +#define MHD_HTTP_METHOD_MKCALENDAR "MKCALENDAR" +/* Not safe. Idempotent. RFC4918, Section 9.3. */ +#define MHD_HTTP_METHOD_MKCOL "MKCOL" +/* Not safe. Idempotent. RFC4437, Section 6. */ +#define MHD_HTTP_METHOD_MKREDIRECTREF "MKREDIRECTREF" +/* Not safe. Idempotent. RFC3253, Section 6.3. */ +#define MHD_HTTP_METHOD_MKWORKSPACE "MKWORKSPACE" +/* Not safe. Idempotent. RFC4918, Section 9.9. */ +#define MHD_HTTP_METHOD_MOVE "MOVE" +/* Not safe. Idempotent. RFC3648, Section 7. */ +#define MHD_HTTP_METHOD_ORDERPATCH "ORDERPATCH" +/* Not safe. Not idempotent. RFC5789, Section 2. */ +#define MHD_HTTP_METHOD_PATCH "PATCH" +/* Safe. Idempotent. RFC7540, Section 3.5. */ +#define MHD_HTTP_METHOD_PRI "PRI" +/* Safe. Idempotent. RFC4918, Section 9.1. */ +#define MHD_HTTP_METHOD_PROPFIND "PROPFIND" +/* Not safe. Idempotent. RFC4918, Section 9.2. */ +#define MHD_HTTP_METHOD_PROPPATCH "PROPPATCH" +/* Not safe. Idempotent. RFC5842, Section 6. */ +#define MHD_HTTP_METHOD_REBIND "REBIND" +/* Safe. Idempotent. RFC3253, Section 3.6. */ +#define MHD_HTTP_METHOD_REPORT "REPORT" +/* Safe. Idempotent. RFC5323, Section 2. */ +#define MHD_HTTP_METHOD_SEARCH "SEARCH" +/* Not safe. Idempotent. RFC5842, Section 5. */ +#define MHD_HTTP_METHOD_UNBIND "UNBIND" +/* Not safe. Idempotent. RFC3253, Section 4.5. */ +#define MHD_HTTP_METHOD_UNCHECKOUT "UNCHECKOUT" +/* Not safe. Idempotent. RFC2068, Section 19.6.1.3. */ +#define MHD_HTTP_METHOD_UNLINK "UNLINK" +/* Not safe. Idempotent. RFC4918, Section 9.11. */ +#define MHD_HTTP_METHOD_UNLOCK "UNLOCK" +/* Not safe. Idempotent. RFC3253, Section 7.1. */ +#define MHD_HTTP_METHOD_UPDATE "UPDATE" +/* Not safe. Idempotent. RFC4437, Section 7. */ +#define MHD_HTTP_METHOD_UPDATEREDIRECTREF "UPDATEREDIRECTREF" +/* Not safe. Idempotent. RFC3253, Section 3.5. */ +#define MHD_HTTP_METHOD_VERSION_CONTROL "VERSION-CONTROL" + /** @} */ /* end of group methods */ /** @@ -491,13 +870,14 @@ /** * @brief Flags for the `struct MHD_Daemon`. * - * Note that if neither #MHD_USE_THREAD_PER_CONNECTION nor - * #MHD_USE_SELECT_INTERNALLY is used, the client wants control over - * the process and will call the appropriate microhttpd callbacks. + * Note that MHD will run automatically in background thread(s) only + * if #MHD_USE_INTERNAL_POLLING_THREAD is used. Otherwise caller (application) + * must use #MHD_run() or #MHD_run_from_select() to have MHD processed + * network connections and data. * * Starting the daemon may also fail if a particular option is not * implemented or not supported on the target platform (i.e. no - * support for SSL, threads or IPv6). + * support for TLS, epoll or IPv6). */ enum MHD_FLAG { @@ -507,25 +887,56 @@ MHD_NO_FLAG = 0, /** + * Print errors messages to custom error logger or to `stderr` if + * custom error logger is not set. + * @sa ::MHD_OPTION_EXTERNAL_LOGGER + */ + MHD_USE_ERROR_LOG = 1, + + /** * Run in debug mode. If this flag is used, the library should * print error messages and warnings to `stderr`. */ MHD_USE_DEBUG = 1, /** - * Run in HTTPS mode. + * Run in HTTPS mode. The modern protocol is called TLS. */ + MHD_USE_TLS = 2, + + /** @deprecated */ MHD_USE_SSL = 2, +#if 0 + /* let's do this later once versions that define MHD_USE_TLS a more widely deployed. */ +#define MHD_USE_SSL \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SSL is deprecated, use MHD_USE_TLS") \ + MHD_USE_TLS +#endif /** * Run using one thread per connection. + * Must be used only with #MHD_USE_INTERNAL_POLLING_THREAD. */ MHD_USE_THREAD_PER_CONNECTION = 4, /** - * Run using an internal thread (or thread pool) doing `select()`. + * Run using an internal thread (or thread pool) for sockets sending + * and receiving and data processing. Without this flag MHD will not + * run automatically in background thread(s). + * If this flag is set, #MHD_run() and #MHD_run_from_select() couldn't + * be used. + * This flag is set explicitly by #MHD_USE_POLL_INTERNAL_THREAD and + * by #MHD_USE_EPOLL_INTERNAL_THREAD. */ + MHD_USE_INTERNAL_POLLING_THREAD = 8, + + /** @deprecated */ MHD_USE_SELECT_INTERNALLY = 8, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_SELECT_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SELECT_INTERNALLY is deprecated, use MHD_USE_INTERNAL_POLLING_THREAD instead") \ + MHD_USE_INTERNAL_POLLING_THREAD +#endif /* 0 */ /** * Run using the IPv6 protocol (otherwise, MHD will just support @@ -546,20 +957,35 @@ * MHD, and OFF in production. */ MHD_USE_PEDANTIC_CHECKS = 32, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_PEDANTIC_CHECKS \ + _MHD_DEPR_IN_MACRO("Flag MHD_USE_PEDANTIC_CHECKS is deprecated, use option MHD_OPTION_STRICT_FOR_CLIENT instead") \ + 32 +#endif /* 0 */ /** * Use `poll()` instead of `select()`. This allows sockets with `fd >= * FD_SETSIZE`. This option is not compatible with using an - * 'external' `select()` mode (as there is no API to get the file - * descriptors for the external select from MHD) and must also not - * be used in combination with #MHD_USE_EPOLL_LINUX_ONLY. + * 'external' polling mode (as there is no API to get the file + * descriptors for the external poll() from MHD) and must also not + * be used in combination with #MHD_USE_EPOLL. + * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL_INTERNAL_THREAD */ MHD_USE_POLL = 64, /** * Run using an internal thread (or thread pool) doing `poll()`. + * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL, #MHD_USE_INTERNAL_POLLING_THREAD */ - MHD_USE_POLL_INTERNALLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL, + MHD_USE_POLL_INTERNAL_THREAD = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, + + /** @deprecated */ + MHD_USE_POLL_INTERNALLY = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_POLL_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_POLL_INTERNALLY is deprecated, use MHD_USE_POLL_INTERNAL_THREAD instead") \ + MHD_USE_POLL_INTERNAL_THREAD +#endif /* 0 */ /** * Suppress (automatically) adding the 'Date:' header to HTTP responses. @@ -567,7 +993,15 @@ * and that DO provide other mechanisms for cache control. See also * RFC 2616, section 14.18 (exception 3). */ + MHD_USE_SUPPRESS_DATE_NO_CLOCK = 128, + + /** @deprecated */ MHD_SUPPRESS_DATE_NO_CLOCK = 128, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_SUPPRESS_DATE_NO_CLOCK \ + _MHD_DEPR_IN_MACRO("Value MHD_SUPPRESS_DATE_NO_CLOCK is deprecated, use MHD_USE_SUPPRESS_DATE_NO_CLOCK instead") \ + MHD_USE_SUPPRESS_DATE_NO_CLOCK +#endif /* 0 */ /** * Run without a listen socket. This option only makes sense if @@ -580,36 +1014,64 @@ /** * Use `epoll()` instead of `select()` or `poll()` for the event loop. - * This option is only available on Linux; using the option on - * non-Linux systems will cause #MHD_start_daemon to fail. Using - * this option is not supported with MHD_USE_THREAD_PER_CONNECTION. + * This option is only available on some systems; using the option on + * systems without epoll will cause #MHD_start_daemon to fail. Using + * this option is not supported with #MHD_USE_THREAD_PER_CONNECTION. + * @sa ::MHD_FEATURE_EPOLL */ + MHD_USE_EPOLL = 512, + + /** @deprecated */ MHD_USE_EPOLL_LINUX_ONLY = 512, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_LINUX_ONLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_LINUX_ONLY is deprecated, use MHD_USE_EPOLL") \ + MHD_USE_EPOLL +#endif /* 0 */ /** * Run using an internal thread (or thread pool) doing `epoll()`. - * This option is only available on Linux; using the option on - * non-Linux systems will cause #MHD_start_daemon to fail. + * This option is only available on certain platforms; using the option on + * platform without `epoll` support will cause #MHD_start_daemon to fail. + * @sa ::MHD_FEATURE_EPOLL, #MHD_USE_EPOLL, #MHD_USE_INTERNAL_POLLING_THREAD + */ + MHD_USE_EPOLL_INTERNAL_THREAD = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, + + /** @deprecated */ + MHD_USE_EPOLL_INTERNALLY = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, + /** @deprecated */ + MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \ + MHD_USE_EPOLL_INTERNAL_THREAD + /** @deprecated */ +#define MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \ + MHD_USE_EPOLL_INTERNAL_THREAD +#endif /* 0 */ + + /** + * Use inter-thread communication channel. + * #MHD_USE_ITC can be used with #MHD_USE_INTERNAL_POLLING_THREAD + * and is ignored with any "external" mode. + * It's required for use of #MHD_quiesce_daemon + * or #MHD_add_connection. + * This option is enforced by #MHD_ALLOW_SUSPEND_RESUME or + * #MHD_USE_NO_LISTEN_SOCKET. + * #MHD_USE_ITC is always used automatically on platforms + * where select()/poll()/other ignore shutdown of listen + * socket. */ - MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL_LINUX_ONLY, + MHD_USE_ITC = 1024, - /** - * Force MHD to use a signal pipe to notify the event loop (of - * threads) of our shutdown. This is required if an appliction uses - * #MHD_USE_SELECT_INTERNALLY or #MHD_USE_THREAD_PER_CONNECTION and - * then performs #MHD_quiesce_daemon (which eliminates our ability - * to signal termination via the listen socket). In these modes, - * #MHD_quiesce_daemon will fail if this option was not set. Also, - * use of this option is automatic (as in, you do not even have to - * specify it), if #MHD_USE_NO_LISTEN_SOCKET is specified. In - * "external" `select()` mode, this option is always simply ignored. - * MHD can be build for use a pair of sockets instead of a pipe. - * Pair of sockets is forced on W32. - * - * You must also use this option if you use internal select mode - * or a thread pool in conjunction with #MHD_add_connection. - */ + /** @deprecated */ MHD_USE_PIPE_FOR_SHUTDOWN = 1024, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_PIPE_FOR_SHUTDOWN \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_PIPE_FOR_SHUTDOWN is deprecated, use MHD_USE_ITC") \ + MHD_USE_ITC +#endif /* 0 */ /** * Use a single socket for IPv4 and IPv6. @@ -617,26 +1079,69 @@ MHD_USE_DUAL_STACK = MHD_USE_IPv6 | 2048, /** - * Enable `epoll()` turbo. Disables certain calls to `shutdown()` - * and enables aggressive non-blocking optimisitc reads. - * Most effects only happen with #MHD_USE_EPOLL_LINUX_ONLY. - * Enalbed always on W32 as winsock does not properly behave - * with `shutdown()` and this then fixes potential problems. + * Enable `turbo`. Disables certain calls to `shutdown()`, + * enables aggressive non-blocking optimistic reads and + * other potentially unsafe optimizations. + * Most effects only happen with #MHD_USE_EPOLL. */ + MHD_USE_TURBO = 4096, + + /** @deprecated */ MHD_USE_EPOLL_TURBO = 4096, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_TURBO \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_TURBO is deprecated, use MHD_USE_TURBO") \ + MHD_USE_TURBO +#endif /* 0 */ /** * Enable suspend/resume functions, which also implies setting up - * pipes to signal resume. + * ITC to signal resume. */ - MHD_USE_SUSPEND_RESUME = 8192 | MHD_USE_PIPE_FOR_SHUTDOWN, + MHD_ALLOW_SUSPEND_RESUME = 8192 | MHD_USE_ITC, + + /** @deprecated */ + MHD_USE_SUSPEND_RESUME = 8192 | MHD_USE_ITC, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_SUSPEND_RESUME \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SUSPEND_RESUME is deprecated, use MHD_ALLOW_SUSPEND_RESUME instead") \ + MHD_ALLOW_SUSPEND_RESUME +#endif /* 0 */ /** * Enable TCP_FASTOPEN option. This option is only available on Linux with a * kernel >= 3.6. On other systems, using this option cases #MHD_start_daemon * to fail. */ - MHD_USE_TCP_FASTOPEN = 16384 + MHD_USE_TCP_FASTOPEN = 16384, + + /** + * You need to set this option if you want to use HTTP "Upgrade". + * "Upgrade" may require usage of additional internal resources, + * which we do not want to use unless necessary. + */ + MHD_ALLOW_UPGRADE = 32768, + + /** + * Automatically use best available polling function. + * Choice of polling function is also depend on other daemon options. + * If #MHD_USE_INTERNAL_POLLING_THREAD is specified then epoll, poll() or + * select() will be used (listed in decreasing preference order, first + * function available on system will be used). + * If #MHD_USE_THREAD_PER_CONNECTION is specified then poll() or select() + * will be used. + * If those flags are not specified then epoll or select() will be + * used (as the only suitable for MHD_get_fdset()) + */ + MHD_USE_AUTO = 65536, + + /** + * Run using an internal thread (or thread pool) with best available on + * system polling function. + * This is combination of #MHD_USE_AUTO and #MHD_USE_INTERNAL_POLLING_THREAD + * flags. + */ + MHD_USE_AUTO_INTERNAL_THREAD = MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD }; @@ -649,7 +1154,10 @@ * @param ap arguments to @a fm * @ingroup logging */ -typedef void (*MHD_LogCallback)(void *cls, const char *fm, va_list ap); +typedef void +(*MHD_LogCallback)(void *cls, + const char *fm, + va_list ap); /** @@ -744,9 +1252,13 @@ * be the 0-terminated URI of the request. * * Note that during the time of this call, most of the connection's - * state is not initialized (as we have not yet parsed he headers). + * state is not initialized (as we have not yet parsed the headers). * However, information about the connecting client (IP, socket) * is available. + * + * The specified function is called only once per request, therefore some + * programmers may use it to instantiate their own request objects, freeing + * them in the notifier #MHD_OPTION_NOTIFY_COMPLETED. */ MHD_OPTION_URI_LOG_CALLBACK = 7, @@ -782,7 +1294,7 @@ /** * Pass a listen socket for MHD to use (systemd-style). If this * option is used, MHD will not open its own listen socket(s). The - * argument passed must be of type `int` and refer to an + * argument passed must be of type `MHD_socket` and refer to an * existing socket that has been bound to a port and is listening. */ MHD_OPTION_LISTEN_SOCKET = 12, @@ -804,7 +1316,7 @@ * Number (`unsigned int`) of threads in thread pool. Enable * thread pooling by setting this value to to something * greater than 1. Currently, thread model must be - * #MHD_USE_SELECT_INTERNALLY if thread pooling is enabled + * #MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled * (#MHD_start_daemon returns NULL for an unsupported thread * model). */ @@ -947,8 +1459,34 @@ * pointer to a closure to pass to the request completed callback. * The second pointer maybe NULL. */ - MHD_OPTION_NOTIFY_CONNECTION = 27 + MHD_OPTION_NOTIFY_CONNECTION = 27, + /** + * Allow to change maximum length of the queue of pending connections on + * listen socket. If not present than default platform-specific SOMAXCONN + * value is used. This option should be followed by an `unsigned int` + * argument. + */ + MHD_OPTION_LISTEN_BACKLOG_SIZE = 28, + + /** + * If set to 1 - be strict about the protocol (as opposed to as + * tolerant as possible). Specifically, at the moment, this flag + * causes MHD to reject HTTP 1.1 connections without a "Host" header. + * This is required by the standard, but of course in violation of + * the "be as liberal as possible in what you accept" norm. It is + * recommended to set this to 1 if you are testing clients against + * MHD, and 0 in production. + * if set to -1 - be opposite to strict and be permissive about the + * protocol, allowing slight deviations that are technically not + * allowed by the RFC. Specifically, at the moment, this flag + * causes MHD to allow spaces in header field names. This is + * disallowed by the standard. + * It is not recommended to set it to -1 on publicly available + * servers as it may potentially lower level of protection. + * This option should be followed by an `int` argument. + */ + MHD_OPTION_STRICT_FOR_CLIENT = 29 }; @@ -988,11 +1526,15 @@ /** * Response header + * @deprecated */ MHD_RESPONSE_HEADER_KIND = 0, +#define MHD_RESPONSE_HEADER_KIND \ + _MHD_DEPR_IN_MACRO("Value MHD_RESPONSE_HEADER_KIND is deprecated and not used") \ + MHD_RESPONSE_HEADER_KIND /** - * HTTP header. + * HTTP header (request/response). */ MHD_HEADER_KIND = 1, @@ -1122,11 +1664,28 @@ int /* enum gnutls_protocol */ protocol; /** + * The suspended status of a connection. + */ + int /* MHD_YES or MHD_NO */ suspended; + + /** + * Amount of second that connection could spend in idle state + * before automatically disconnected. + * Zero for no timeout (unlimited idle time). + */ + unsigned int connection_timeout; + + /** * Connect socket */ MHD_socket connect_fd; /** + * Size of the client's HTTP header. + */ + size_t header_size; + + /** * GNUtls session handle, of type "gnutls_session_t". */ void * /* gnutls_session_t */ tls_session; @@ -1151,7 +1710,7 @@ * Socket-specific client context. Points to the same address as * the "socket_context" of the #MHD_NotifyConnectionCallback. */ - void **socket_context; + void *socket_context; }; @@ -1206,7 +1765,7 @@ MHD_CONNECTION_INFO_DAEMON, /** - * Request the file descriptor for the listening socket. + * Request the file descriptor for the connection socket. * No extra arguments should be passed. * @ingroup request */ @@ -1220,8 +1779,25 @@ * fresh for each HTTP request, while the "socket_context" is fresh * for each socket. */ - MHD_CONNECTION_INFO_SOCKET_CONTEXT + MHD_CONNECTION_INFO_SOCKET_CONTEXT, + /** + * Check whether the connection is suspended. + * @ingroup request + */ + MHD_CONNECTION_INFO_CONNECTION_SUSPENDED, + + /** + * Get connection timeout + * @ingroup request + */ + MHD_CONNECTION_INFO_CONNECTION_TIMEOUT, + + /** + * Return length of the client's HTTP request header. + * @ingroup request + */ + MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE }; @@ -1252,12 +1828,24 @@ * No extra arguments should be passed. */ MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY, + MHD_DAEMON_INFO_EPOLL_FD = MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY, /** * Request the number of current connections handled by the daemon. * No extra arguments should be passed. + * Note: when using MHD in external polling mode, this type of request + * could be used only when #MHD_run()/#MHD_run_from_select is not + * working in other thread at the same time. */ - MHD_DAEMON_INFO_CURRENT_CONNECTIONS + MHD_DAEMON_INFO_CURRENT_CONNECTIONS, + + /** + * Request the daemon flags. + * No extra arguments should be passed. + * Note: flags may differ from original 'flags' specified for + * daemon, especially if #MHD_USE_AUTO was set. + */ + MHD_DAEMON_INFO_FLAGS }; @@ -1562,7 +2150,7 @@ * that an existing thread is still using it). * * Note that some thread modes require the caller to have passed - * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is + * #MHD_USE_ITC when using this API. If this daemon is * in one of those modes and this option was not given to * #MHD_start_daemon, this function will return #MHD_INVALID_SOCKET. * @@ -1594,7 +2182,7 @@ * * If you use this API in conjunction with a internal select or a * thread pool, you must set the option - * #MHD_USE_PIPE_FOR_SHUTDOWN to ensure that the freshly added + * #MHD_USE_ITC to ensure that the freshly added * connection is immediately processed by MHD. * * The given client socket will be managed (and closed!) by MHD after @@ -1628,6 +2216,14 @@ * before calling this function. FD_SETSIZE is assumed * to be platform's default. * + * This function should only be called in when MHD is configured to + * use external select with @code{select()} or with @code{epoll()}. + * In the latter case, it will only add the single @code{epoll()} file + * descriptor used by MHD to the sets. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * * @param daemon daemon to get sets from * @param read_fd_set read set * @param write_fd_set write set @@ -1652,9 +2248,18 @@ * Obtain the `select()` sets for this daemon. * Daemon's FDs will be added to fd_sets. To get only * daemon FDs in fd_sets, call FD_ZERO for each fd_set - * before calling this function. Passing custom FD_SETSIZE - * as @a fd_setsize allow usage of larger/smaller than - * platform's default fd_sets. + * before calling this function. + * + * Passing custom FD_SETSIZE as @a fd_setsize allow usage of + * larger/smaller than platform's default fd_sets. + * + * This function should only be called in when MHD is configured to + * use external select with @code{select()} or with @code{epoll()}. + * In the latter case, it will only add the single @code{epoll()} file + * descriptor used by MHD to the sets. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. * * @param daemon daemon to get sets from * @param read_fd_set read set @@ -1671,11 +2276,11 @@ */ _MHD_EXTERN int MHD_get_fdset2 (struct MHD_Daemon *daemon, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *except_fd_set, - MHD_socket *max_fd, - unsigned int fd_setsize); + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd, + unsigned int fd_setsize); /** @@ -1685,6 +2290,9 @@ * before calling this function. Size of fd_set is * determined by current value of FD_SETSIZE. * + * This function could be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * * @param daemon daemon to get sets from * @param read_fd_set read set * @param write_fd_set write set @@ -1728,10 +2336,10 @@ * This function is a convenience method, which is useful if the * fd_sets from #MHD_get_fdset were not directly passed to `select()`; * with this function, MHD will internally do the appropriate `select()` - * call itself again. While it is always safe to call #MHD_run (in - * external select mode), you should call #MHD_run_from_select if - * performance is important (as it saves an expensive call to - * `select()`). + * call itself again. While it is always safe to call #MHD_run (if + * #MHD_USE_INTERNAL_POLLING_THREAD is not set), you should call + * #MHD_run_from_select if performance is important (as it saves an + * expensive call to `select()`). * * @param daemon daemon to run * @return #MHD_YES on success, #MHD_NO if this @@ -1755,10 +2363,13 @@ * not have to call `select()` again to determine which operations are * ready. * + * This function cannot be used with daemon started with + * #MHD_USE_INTERNAL_POLLING_THREAD flag. + * * @param daemon daemon to run select loop for * @param read_fd_set read set * @param write_fd_set write set - * @param except_fd_set except set (not used, can be NULL) + * @param except_fd_set except set * @return #MHD_NO on serious errors, #MHD_YES on success * @ingroup event */ @@ -1777,7 +2388,7 @@ * Get all of the headers from the request. * * @param connection connection to get values from - * @param kind types of values to iterate over + * @param kind types of values to iterate over, can be a bitmask * @param iterator callback to call on each header; * maybe NULL (then just count headers) * @param iterator_cls extra argument to @a iterator @@ -1787,7 +2398,8 @@ _MHD_EXTERN int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, - MHD_KeyValueIterator iterator, void *iterator_cls); + MHD_KeyValueIterator iterator, + void *iterator_cls); /** @@ -1796,6 +2408,7 @@ * return them -- and the `struct MHD_PostProcessor` will also see * them). This maybe required in certain situations (see Mantis * #1399) where (broken) HTTP implementations fail to supply values + * needed by the post processor (or other parts of the application). * * This function MUST only be called from within the @@ -1890,12 +2503,10 @@ /** * Suspend handling of network data for a given connection. This can - * be used to dequeue a connection from MHD's event loop (external - * select, internal select or thread pool; not applicable to - * thread-per-connection!) for a while. + * be used to dequeue a connection from MHD's event loop for a while. * * If you use this API in conjunction with a internal select or a - * thread pool, you must set the option #MHD_USE_PIPE_FOR_SHUTDOWN to + * thread pool, you must set the option #MHD_USE_ITC to * ensure that a resumed connection is immediately processed by MHD. * * Suspended connections continue to count against the total number of @@ -1925,6 +2536,12 @@ * function on a connection that was not previously suspended will * result in undefined behavior. * + * If you are using this function in ``external'' select mode, you must + * make sure to run #MHD_run() afterwards (before again calling + * #MHD_get_fdset(), as otherwise the change may not be reflected in + * the set returned by #MHD_get_fdset() and you may end up with a + * connection that is stuck until the next network activity. + * * @param connection the connection to resume */ _MHD_EXTERN void @@ -2133,11 +2750,13 @@ int fd, off_t offset); +#if !defined(_MHD_NO_DEPR_IN_MACRO) || defined(_MHD_NO_DEPR_FUNC) /* Substitute MHD_create_response_from_fd_at_offset64() instead of MHD_create_response_from_fd_at_offset() - to minimize possible problems with different off_t options */ + to minimize potential problems with different off_t sizes */ #define MHD_create_response_from_fd_at_offset(size,fd,offset) \ - _MHD_DEPR_MACRO("Usage of MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \ + _MHD_DEPR_IN_MACRO("Usage of MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \ MHD_create_response_from_fd_at_offset64((size),(fd),(offset)) +#endif /* !_MHD_NO_DEPR_IN_MACRO || _MHD_NO_DEPR_FUNC */ /** @@ -2162,7 +2781,6 @@ uint64_t offset); -#if 0 /** * Enumeration for actions MHD should perform on the underlying socket * of the upgrade. This API is not finalized, and in particular @@ -2176,93 +2794,93 @@ * Close the socket, the application is done with it. * * Takes no extra arguments. - * - * NOTE: it is unclear if we want to have this in the - * "final" API, this is all just ideas. */ - MHD_UPGRADE_ACTION_CLOSE = 0, - - /** - * Uncork the TCP write buffer (that is, tell the OS to transmit all - * bytes in the buffer now, and to not use TCP-CORKing). - * - * Takes no extra arguments. - * - * NOTE: it is unclear if we want to have this in the - * "final" API, this is all just ideas. - */ - MHD_UPGRADE_ACTION_CORK + MHD_UPGRADE_ACTION_CLOSE = 0 }; /** + * Handle given to the application to manage special + * actions relating to MHD responses that "upgrade" + * the HTTP protocol (i.e. to WebSockets). + */ +struct MHD_UpgradeResponseHandle; + + +/** * This connection-specific callback is provided by MHD to * applications (unusual) during the #MHD_UpgradeHandler. * It allows applications to perform 'special' actions on * the underlying socket from the upgrade. * - * @param cls the closure (from `upgrade_action_cls`) + * @param urh the handle identifying the connection to perform + * the upgrade @a action on. * @param action which action should be performed * @param ... arguments to the action (depends on the action) * @return #MHD_NO on error, #MHD_YES on success */ -typedef int -(*MHD_UpgradeActionCallback)(void *cls, - enum MHD_UpgradeAction action, - ...); +_MHD_EXTERN int +MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, + enum MHD_UpgradeAction action, + ...); + /** * Function called after a protocol "upgrade" response was sent * successfully and the socket should now be controlled by some * protocol other than HTTP. * - * Any data received on the socket will be made available in - * 'data_in'. The function should update 'data_in_size' to - * reflect the number of bytes consumed from 'data_in' (the remaining - * bytes will be made available in the next call to the handler). - * - * Any data that should be transmitted on the socket should be - * stored in 'data_out'. '*data_out_size' is initially set to - * the available buffer space in 'data_out'. It should be set to - * the number of bytes stored in 'data_out' (which can be zero). - * - * The return value is a BITMASK that indicates how the function - * intends to interact with the event loop. It can request to be - * notified for reading, writing, request to UNCORK the send buffer - * (which MHD is allowed to ignore, if it is not possible to uncork on - * the local platform), to wait for the 'external' select loop to - * trigger another round. It is also possible to specify "no events" - * to terminate the connection; in this case, the - * #MHD_RequestCompletedCallback will be called and all resources of - * the connection will be released. + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Data forwarding to "upgraded" @a sock will be started as soon + * as this function return. * * Except when in 'thread-per-connection' mode, implementations * of this function should never block (as it will still be called * from within the main event loop). * - * @param cls closure + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in * @param sock socket to use for bi-directional communication * with the client. For HTTPS, this may not be a socket * that is directly connected to the client and thus certain * operations (TCP-specific setsockopt(), getsockopt(), etc.) * may not work as expected (as the socket could be from a - * socketpair() or a TCP-loopback) - * @param upgrade_action function that can be used to perform actions - * on the @a sock (like those that cannot be done explicitly). - * Applications must use this callback to perform the - * close() action on the @a sock. - * @param upgrade_action_cls closure that must be passed to @a upgrade_action + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. */ typedef void (*MHD_UpgradeHandler)(void *cls, struct MHD_Connection *connection, - MHD_SOCKET sock, - MHD_UpgradeActionCallback upgrade_action, - void *upgrade_action_cls); + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh); /** @@ -2290,14 +2908,14 @@ * information and then be used any number of times (as long as the * header information is not connection-specific). * - * @param upgrade_handler function to call with the 'upgraded' socket + * @param upgrade_handler function to call with the "upgraded" socket * @param upgrade_handler_cls closure for @a upgrade_handler * @return NULL on error (i.e. invalid arguments, out of memory) */ -struct MHD_Response * +_MHD_EXTERN struct MHD_Response * MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls); -#endif + /** * Destroy a response object and associated resources. Note that @@ -2578,6 +3196,8 @@ * Set a custom timeout for the given connection. Specified * as the number of seconds, given as an `unsigned int`. Use * zero for no timeout. + * If timeout was set to zero (or unset) before, setup of new value by + * MHD_set_connection_option() will reset timeout timer. */ MHD_CONNECTION_OPTION_TIMEOUT @@ -2617,15 +3237,27 @@ size_t mac_key_size; /** - * Listen socket file descriptor, for #MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY - * and #MHD_DAEMON_INFO_LISTEN_FD. + * Socket, returned for #MHD_DAEMON_INFO_LISTEN_FD. */ MHD_socket listen_fd; /** + * epoll FD, returned for #MHD_DAEMON_INFO_EPOLL_FD. + */ + int epoll_fd; + + /** * Number of active connections, for #MHD_DAEMON_INFO_CURRENT_CONNECTIONS. */ unsigned int num_connections; + + /** + * Combination of #MHD_FLAG values, for #MHD_DAEMON_INFO_FLAGS. + * This value is actually a bitfield. + * Note: flags may differ from original 'flags' specified for + * daemon, especially if #MHD_USE_AUTO was set. + */ + enum MHD_FLAG flags; }; @@ -2666,15 +3298,16 @@ * Get whether messages are supported. If supported then in debug * mode messages can be printed to stderr or to external logger. */ - MHD_FEATURE_MESSGES = 1, + MHD_FEATURE_MESSAGES = 1, /** * Get whether HTTPS is supported. If supported then flag - * #MHD_USE_SSL and options #MHD_OPTION_HTTPS_MEM_KEY, + * #MHD_USE_TLS and options #MHD_OPTION_HTTPS_MEM_KEY, * #MHD_OPTION_HTTPS_MEM_CERT, #MHD_OPTION_HTTPS_MEM_TRUST, * #MHD_OPTION_HTTPS_MEM_DHPARAMS, #MHD_OPTION_HTTPS_CRED_TYPE, * #MHD_OPTION_HTTPS_PRIORITIES can be used. */ + MHD_FEATURE_TLS = 2, MHD_FEATURE_SSL = 2, /** @@ -2705,15 +3338,15 @@ /** * Get whether `epoll()` is supported. If supported then Flags - * #MHD_USE_EPOLL_LINUX_ONLY and - * #MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used. + * #MHD_USE_EPOLL and + * #MHD_USE_EPOLL_INTERNAL_THREAD can be used. */ MHD_FEATURE_EPOLL = 7, /** * Get whether shutdown on listen socket to signal other * threads is supported. If not supported flag - * #MHD_USE_PIPE_FOR_SHUTDOWN is automatically forced. + * #MHD_USE_ITC is automatically forced. */ MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET = 8, @@ -2768,7 +3401,33 @@ * offsets larger than 2 GiB. If not supported value of size+offset is * limited to 2 GiB. */ - MHD_FEATURE_LARGE_FILE = 15 + MHD_FEATURE_LARGE_FILE = 15, + + /** + * Get whether MHD set names on generated threads. + */ + MHD_FEATURE_THREAD_NAMES = 16, + MHD_THREAD_NAMES = 16, + + /** + * Get whether HTTP "Upgrade" is supported. + * If supported then #MHD_ALLOW_UPGRADE, #MHD_upgrade_action() and + * #MHD_create_response_for_upgrade() can be used. + */ + MHD_FEATURE_UPGRADE = 17, + + /** + * Get whether it's safe to use same FD for multiple calls of + * #MHD_create_response_from_fd() and whether it's safe to use single + * response generated by #MHD_create_response_from_fd() with multiple + * connections at same time. + * If #MHD_is_feature_supported() return #MHD_NO for this feature then + * usage of responses with same file FD in multiple parallel threads may + * results in incorrect data sent to remote client. + * It's always safe to use same file FD in multiple responses if MHD + * is run in any single thread mode. + */ + MHD_FEATURE_RESPONSES_SHARED_FD = 18 }; @@ -2784,7 +3443,7 @@ * @ingroup specialized */ _MHD_EXTERN int -MHD_is_feature_supported(enum MHD_FEATURE feature); +MHD_is_feature_supported (enum MHD_FEATURE feature); #if 0 /* keep Emacsens' auto-indent happy */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/microspdy.h libmicrohttpd-0.9.55/src/include/microspdy.h --- libmicrohttpd-0.9.44+dfsg/src/include/microspdy.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/include/microspdy.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,1380 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012, 2013 Christian Grothoff - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file microspdy.h - * @brief public interface to libmicrospdy - * @author Andrey Uzunov - * @author Christian Grothoff - * - * All symbols defined in this header start with SPDY_. libmisrospdy is a small - * SPDY daemon library. The application can start multiple daemons - * and they are independent.

- * - * The header file defines various constants used by the SPDY and the HTTP protocol. - * This does not mean that the lib actually interprets all of these - * values. Not everything is implemented. The provided constants are exported as a convenience - * for users of the library. The lib does not verify that provided - * HTTP headers and if their values conform to the SPDY protocol, - * it only checks if the required headers for the SPDY requests and - * responses are provided.

- * - * The library uses just a single thread.

- * - * Before including "microspdy.h" you should add the necessary - * includes to define the types used in this file (which headers are needed may - * depend on your platform; for possible suggestions consult - * "platform.h" in the libmicrospdy distribution).

- * - * All of the functions returning SPDY_YES/SPDY_NO return - * SPDY_INPUT_ERROR when any of the parameters are invalid, e.g. - * required parameter is NULL.

- * - * The library does not check if anything at the application layer -- - * requests and responses -- is correct. For example, it - * is up to the user to check if a client is sending HTTP body but the - * method is GET.

- * - * The SPDY flow control is just partially implemented: the receiving - * window is updated, and the client is notified, to prevent a client - * from stop sending POST body data, for example. - */ -#ifndef SPDY_MICROSPDY_H -#define SPDY_MICROSPDY_H - -#include -#include - -/* While we generally would like users to use a configure-driven - build process which detects which headers are present and - hence works on any platform, we use "standard" includes here - to build out-of-the-box for beginning users on common systems. - - Once you have a proper build system and go for more exotic - platforms, you should define MHD_PLATFORM_H in some header that - you always include *before* "microhttpd.h". Then the following - "standard" includes won't be used (which might be a good - idea, especially on platforms where they do not exist). */ -#ifndef MHD_PLATFORM_H -#include -#include -#include -#ifdef __MINGW32__ -#include -#else -#include -#include -#include -#endif -#endif - -#ifndef _MHD_EXTERN -#define _MHD_EXTERN extern -#endif - -/** - * return code for "YES". - */ -#define SPDY_YES 1 - -/** - * return code for "NO". - */ -#define SPDY_NO 0 - -/** - * return code for error when input parameters are wrong. To be returned - * only by functions which return int. The others will return NULL on - * input error. - */ -#define SPDY_INPUT_ERROR -1 - -/** - * SPDY version supported by the lib. - */ -#define SPDY_VERSION 3 - -/** - * The maximum allowed size (without 8 byte headers) of - * SPDY frames (value length) is 8192. The lib will accept and - * send frames with length at most this value here. - */ -#define SPDY_MAX_SUPPORTED_FRAME_SIZE 8192 - -/** - * HTTP response codes. - */ -#define SPDY_HTTP_CONTINUE 100 -#define SPDY_HTTP_SWITCHING_PROTOCOLS 101 -#define SPDY_HTTP_PROCESSING 102 - -#define SPDY_HTTP_OK 200 -#define SPDY_HTTP_CREATED 201 -#define SPDY_HTTP_ACCEPTED 202 -#define SPDY_HTTP_NON_AUTHORITATIVE_INFORMATION 203 -#define SPDY_HTTP_NO_CONTENT 204 -#define SPDY_HTTP_RESET_CONTENT 205 -#define SPDY_HTTP_PARTIAL_CONTENT 206 -#define SPDY_HTTP_MULTI_STATUS 207 - -#define SPDY_HTTP_MULTIPLE_CHOICES 300 -#define SPDY_HTTP_MOVED_PERMANENTLY 301 -#define SPDY_HTTP_FOUND 302 -#define SPDY_HTTP_SEE_OTHER 303 -#define SPDY_HTTP_NOT_MODIFIED 304 -#define SPDY_HTTP_USE_PROXY 305 -#define SPDY_HTTP_SWITCH_PROXY 306 -#define SPDY_HTTP_TEMPORARY_REDIRECT 307 - -#define SPDY_HTTP_BAD_REQUEST 400 -#define SPDY_HTTP_UNAUTHORIZED 401 -#define SPDY_HTTP_PAYMENT_REQUIRED 402 -#define SPDY_HTTP_FORBIDDEN 403 -#define SPDY_HTTP_NOT_FOUND 404 -#define SPDY_HTTP_METHOD_NOT_ALLOWED 405 -#define SPDY_HTTP_METHOD_NOT_ACCEPTABLE 406 -#define SPDY_HTTP_PROXY_AUTHENTICATION_REQUIRED 407 -#define SPDY_HTTP_REQUEST_TIMEOUT 408 -#define SPDY_HTTP_CONFLICT 409 -#define SPDY_HTTP_GONE 410 -#define SPDY_HTTP_LENGTH_REQUIRED 411 -#define SPDY_HTTP_PRECONDITION_FAILED 412 -#define SPDY_HTTP_REQUEST_ENTITY_TOO_LARGE 413 -#define SPDY_HTTP_REQUEST_URI_TOO_LONG 414 -#define SPDY_HTTP_UNSUPPORTED_MEDIA_TYPE 415 -#define SPDY_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416 -#define SPDY_HTTP_EXPECTATION_FAILED 417 -#define SPDY_HTTP_UNPROCESSABLE_ENTITY 422 -#define SPDY_HTTP_LOCKED 423 -#define SPDY_HTTP_FAILED_DEPENDENCY 424 -#define SPDY_HTTP_UNORDERED_COLLECTION 425 -#define SPDY_HTTP_UPGRADE_REQUIRED 426 -#define SPDY_HTTP_NO_RESPONSE 444 -#define SPDY_HTTP_RETRY_WITH 449 -#define SPDY_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450 -#define SPDY_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451 - -#define SPDY_HTTP_INTERNAL_SERVER_ERROR 500 -#define SPDY_HTTP_NOT_IMPLEMENTED 501 -#define SPDY_HTTP_BAD_GATEWAY 502 -#define SPDY_HTTP_SERVICE_UNAVAILABLE 503 -#define SPDY_HTTP_GATEWAY_TIMEOUT 504 -#define SPDY_HTTP_HTTP_VERSION_NOT_SUPPORTED 505 -#define SPDY_HTTP_VARIANT_ALSO_NEGOTIATES 506 -#define SPDY_HTTP_INSUFFICIENT_STORAGE 507 -#define SPDY_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 -#define SPDY_HTTP_NOT_EXTENDED 510 - -/** - * HTTP headers are used in SPDY, but all of them MUST be lowercase. - * Some are not valid in SPDY and MUST not be used - */ -#define SPDY_HTTP_HEADER_ACCEPT "accept" -#define SPDY_HTTP_HEADER_ACCEPT_CHARSET "accept-charset" -#define SPDY_HTTP_HEADER_ACCEPT_ENCODING "accept-encoding" -#define SPDY_HTTP_HEADER_ACCEPT_LANGUAGE "accept-language" -#define SPDY_HTTP_HEADER_ACCEPT_RANGES "accept-ranges" -#define SPDY_HTTP_HEADER_AGE "age" -#define SPDY_HTTP_HEADER_ALLOW "allow" -#define SPDY_HTTP_HEADER_AUTHORIZATION "authorization" -#define SPDY_HTTP_HEADER_CACHE_CONTROL "cache-control" -/* Connection header is forbidden in SPDY */ -#define SPDY_HTTP_HEADER_CONNECTION "connection" -#define SPDY_HTTP_HEADER_CONTENT_ENCODING "content-encoding" -#define SPDY_HTTP_HEADER_CONTENT_LANGUAGE "content-language" -#define SPDY_HTTP_HEADER_CONTENT_LENGTH "content-length" -#define SPDY_HTTP_HEADER_CONTENT_LOCATION "content-location" -#define SPDY_HTTP_HEADER_CONTENT_MD5 "content-md5" -#define SPDY_HTTP_HEADER_CONTENT_RANGE "content-range" -#define SPDY_HTTP_HEADER_CONTENT_TYPE "content-type" -#define SPDY_HTTP_HEADER_COOKIE "cookie" -#define SPDY_HTTP_HEADER_DATE "date" -#define SPDY_HTTP_HEADER_ETAG "etag" -#define SPDY_HTTP_HEADER_EXPECT "expect" -#define SPDY_HTTP_HEADER_EXPIRES "expires" -#define SPDY_HTTP_HEADER_FROM "from" -/* Host header is forbidden in SPDY */ -#define SPDY_HTTP_HEADER_HOST "host" -#define SPDY_HTTP_HEADER_IF_MATCH "if-match" -#define SPDY_HTTP_HEADER_IF_MODIFIED_SINCE "if-modified-since" -#define SPDY_HTTP_HEADER_IF_NONE_MATCH "if-none-match" -#define SPDY_HTTP_HEADER_IF_RANGE "if-range" -#define SPDY_HTTP_HEADER_IF_UNMODIFIED_SINCE "if-unmodified-since" -/* Keep-Alive header is forbidden in SPDY */ -#define SPDY_HTTP_HEADER_KEEP_ALIVE "keep-alive" -#define SPDY_HTTP_HEADER_LAST_MODIFIED "last-modified" -#define SPDY_HTTP_HEADER_LOCATION "location" -#define SPDY_HTTP_HEADER_MAX_FORWARDS "max-forwards" -#define SPDY_HTTP_HEADER_PRAGMA "pragma" -#define SPDY_HTTP_HEADER_PROXY_AUTHENTICATE "proxy-authenticate" -#define SPDY_HTTP_HEADER_PROXY_AUTHORIZATION "proxy-authorization" -/* Proxy-Connection header is forbidden in SPDY */ -#define SPDY_HTTP_HEADER_PROXY_CONNECTION "proxy-connection" -#define SPDY_HTTP_HEADER_RANGE "range" -#define SPDY_HTTP_HEADER_REFERER "referer" -#define SPDY_HTTP_HEADER_RETRY_AFTER "retry-after" -#define SPDY_HTTP_HEADER_SERVER "server" -#define SPDY_HTTP_HEADER_SET_COOKIE "set-cookie" -#define SPDY_HTTP_HEADER_SET_COOKIE2 "set-cookie2" -#define SPDY_HTTP_HEADER_TE "te" -#define SPDY_HTTP_HEADER_TRAILER "trailer" -/* Transfer-Encoding header is forbidden in SPDY */ -#define SPDY_HTTP_HEADER_TRANSFER_ENCODING "transfer-encoding" -#define SPDY_HTTP_HEADER_UPGRADE "upgrade" -#define SPDY_HTTP_HEADER_USER_AGENT "user-agent" -#define SPDY_HTTP_HEADER_VARY "vary" -#define SPDY_HTTP_HEADER_VIA "via" -#define SPDY_HTTP_HEADER_WARNING "warning" -#define SPDY_HTTP_HEADER_WWW_AUTHENTICATE "www-authenticate" - -/** - * HTTP versions (a value must be provided in SPDY requests/responses). - */ -#define SPDY_HTTP_VERSION_1_0 "HTTP/1.0" -#define SPDY_HTTP_VERSION_1_1 "HTTP/1.1" - -/** - * HTTP methods - */ -#define SPDY_HTTP_METHOD_CONNECT "CONNECT" -#define SPDY_HTTP_METHOD_DELETE "DELETE" -#define SPDY_HTTP_METHOD_GET "GET" -#define SPDY_HTTP_METHOD_HEAD "HEAD" -#define SPDY_HTTP_METHOD_OPTIONS "OPTIONS" -#define SPDY_HTTP_METHOD_POST "POST" -#define SPDY_HTTP_METHOD_PUT "PUT" -#define SPDY_HTTP_METHOD_TRACE "TRACE" - -/** - * HTTP POST encodings, see also - * http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 - */ -#define SPDY_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" -#define SPDY_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" - - -/** - * Handle for the daemon (listening on a socket). - */ -struct SPDY_Daemon; - - -/** - * Handle for a SPDY session/connection. - */ -struct SPDY_Session; - - -/** - * Handle for a SPDY request sent by a client. The structure has pointer - * to the session's handler - */ -struct SPDY_Request; - - -/** - * Handle for a response containing HTTP headers and data to be sent. - * The structure has pointer to the session's handler - * for this response. - */ -struct SPDY_Response; - - -/** - * Collection of tuples of an HTTP header and values used in requests - * and responses. - */ -struct SPDY_NameValue; - - -/** - * Collection of tuples of a SPDY setting ID, value - * and flags used to control the sessions. - */ -struct SPDY_Settings; - - -/** - * SPDY IO sybsystem flags used by SPDY_init() and SPDY_deinit().

- * - * The values are used internally as flags, that is why they must be - * powers of 2. - */ -enum SPDY_IO_SUBSYSTEM -{ - - /** - * No subsystem. For internal use. - */ - SPDY_IO_SUBSYSTEM_NONE = 0, - - /** - * Default TLS implementation provided by openSSL/libssl. - */ - SPDY_IO_SUBSYSTEM_OPENSSL = 1, - - /** - * No TLS is used. - */ - SPDY_IO_SUBSYSTEM_RAW = 2 -}; - - -/** - * SPDY daemon options. Passed in the varargs portion of - * SPDY_start_daemon to customize the daemon. Each option must - * be followed by a value of a specific type.

- * - * The values are used internally as flags, that is why they must be - * powers of 2. - */ -enum SPDY_DAEMON_OPTION -{ - - /** - * No more options / last option. This is used - * to terminate the VARARGs list. - */ - SPDY_DAEMON_OPTION_END = 0, - - /** - * Set a custom timeout for all connections. Must be followed by - * a number of seconds, given as an 'unsigned int'. Use - * zero for no timeout. - */ - SPDY_DAEMON_OPTION_SESSION_TIMEOUT = 1, - - /** - * Bind daemon to the supplied sockaddr. This option must be - * followed by a 'struct sockaddr *'. The 'struct sockaddr*' - * should point to a 'struct sockaddr_in6' or to a - * 'struct sockaddr_in'. - */ - SPDY_DAEMON_OPTION_SOCK_ADDR = 2, - - /** - * Flags for the daemon. Must be followed by a SPDY_DAEMON_FLAG value - * which is the result of bitwise OR of desired flags. - */ - SPDY_DAEMON_OPTION_FLAGS = 4, - - /** - * IO subsystem type used by daemon and all its sessions. If not set, - * TLS provided by openssl is used. Must be followed by a - * SPDY_IO_SUBSYSTEM value. - */ - SPDY_DAEMON_OPTION_IO_SUBSYSTEM = 8, - - /** - * Maximum number of frames to be written to the socket at once. The - * library tries to send max_num_frames in a single call to SPDY_run - * for a single session. This means no requests can be received nor - * other sessions can send data as long the current one has enough - * frames to send and there is no error on writing. Thus, a big value - * will affect the performance. Small value gives fairnes for sessions. - * Must be followed by a positive integer (uin32_t). If not set, the - * default value 10 will be used. - */ - SPDY_DAEMON_OPTION_MAX_NUM_FRAMES = 16 -}; - - -/** - * Flags for starting SPDY daemon. They are used to set some settings - * for the daemon, which do not require values. - */ -enum SPDY_DAEMON_FLAG -{ - /** - * No flags selected. - */ - SPDY_DAEMON_FLAG_NO = 0, - - /** - * The server will bind only on IPv6 addresses. If the flag is set and - * the daemon is provided with IPv4 address or IPv6 is not supported, - * starting daemon will fail. - */ - SPDY_DAEMON_FLAG_ONLY_IPV6 = 1, - - /** - * All sessions' sockets will be set with TCP_NODELAY if the flag is - * used. Option considered only by SPDY_IO_SUBSYSTEM_RAW. - */ - SPDY_DAEMON_FLAG_NO_DELAY = 2 -}; - - -/** - * SPDY settings IDs sent by both client and server in SPDY SETTINGS frame. - * They affect the whole SPDY session. Defined in SPDY Protocol - Draft 3. - */ -enum SPDY_SETTINGS -{ - - /** - * Allows the sender to send its expected upload bandwidth on this - * channel. This number is an estimate. The value should be the - * integral number of kilobytes per second that the sender predicts - * as an expected maximum upload channel capacity. - */ - SPDY_SETTINGS_UPLOAD_BANDWIDTH = 1, - - /** - * Allows the sender to send its expected download bandwidth on this - * channel. This number is an estimate. The value should be the - * integral number of kilobytes per second that the sender predicts as - * an expected maximum download channel capacity. - */ - SPDY_SETTINGS_DOWNLOAD_BANDWIDTH = 2, - - /** - * Allows the sender to send its expected round-trip-time on this - * channel. The round trip time is defined as the minimum amount of - * time to send a control frame from this client to the remote and - * receive a response. The value is represented in milliseconds. - */ - SPDY_SETTINGS_ROUND_TRIP_TIME = 3, - - /** - * Allows the sender to inform the remote endpoint the maximum number - * of concurrent streams which it will allow. By default there is no - * limit. For implementors it is recommended that this value be no - * smaller than 100. - */ - SPDY_SETTINGS_MAX_CONCURRENT_STREAMS = 4, - - /** - * Allows the sender to inform the remote endpoint of the current TCP - * CWND value. - */ - SPDY_SETTINGS_CURRENT_CWND = 5, - - /** - * Allows the sender to inform the remote endpoint the retransmission - * rate (bytes retransmitted / total bytes transmitted). - */ - SPDY_SETTINGS_DOWNLOAD_RETRANS_RATE = 6, - - /** - * Allows the sender to inform the remote endpoint the initial window - * size (in bytes) for new streams. - */ - SPDY_SETTINGS_INITIAL_WINDOW_SIZE = 7, - - /** - * Allows the server to inform the client if the new size of the - * client certificate vector. - */ - SPDY_SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE = 8 -}; - - -/** - * Flags for each individual SPDY setting in the SPDY SETTINGS frame. - * They affect only one setting to which they are set. - * Defined in SPDY Protocol - Draft 3. - */ -enum SPDY_FLAG_SETTINGS -{ - - /** - * When set, the sender of this SETTINGS frame is requesting that the - * recipient persist the ID/Value and return it in future SETTINGS - * frames sent from the sender to this recipient. Because persistence - * is only implemented on the client, this flag is only sent by the - * server. - */ - SPDY_FLAG_SETTINGS_PERSIST_VALUE = 1, - - /** - * When set, the sender is notifying the recipient that this ID/Value - * pair was previously sent to the sender by the recipient with the - * #SPDY_FLAG_SETTINGS_PERSIST_VALUE, and the sender is returning it. - * Because persistence is only implemented on the client, this flag is - * only sent by the client. - */ - SPDY_FLAG_SETTINGS_PERSISTED = 2 -}; - - -/** - * Flag associated with a whole SPDY SETTINGS frame. Affect all the - * settings in the frame. Defined in SPDY Protocol - Draft 3. - */ -enum SPDY_FLAG_SETTINGS_FRAME -{ - - /** - * When set, the client should clear any previously persisted SETTINGS - * ID/Value pairs. If this frame contains ID/Value pairs with the - * #SPDY_FLAG_SETTINGS_PERSIST_VALUE set, then the client will first - * clear its existing, persisted settings, and then persist the values - * with the flag set which are contained within this frame. Because - * persistence is only implemented on the client, this flag can only - * be used when the sender is the server. - */ - SPDY_FLAG_SETTINGS_CLEAR_SETTINGS = 1 -}; - - -/** - * SPDY settings function options. Passed in the varargs portion of - * SPDY_SettingsReceivedCallback and SPDY_send_settings to customize - * more the settings handling. Each option must - * be followed by a value of a specific type.

- * - * The values are used internally as flags, that is why they must be - * powers of 2. - */ -enum SPDY_SETTINGS_OPTION -{ - - /** - * No more options / last option. This is used - * to terminate the VARARGs list. - */ - SPDY_SETTINGS_OPTION_END = 0 -}; - - -/** - * Used as a parameter for SPDY_ResponseResultCallback and shows if the - * response was actually written to the TLS socket or discarded by the - * lib for any reason (and respectively the reason). - */ -enum SPDY_RESPONSE_RESULT -{ - - /** - * The lib has written the full response to the TLS socket. - */ - SPDY_RESPONSE_RESULT_SUCCESS = 0, - - /** - * The session is being closed, so the data is being discarded - */ - SPDY_RESPONSE_RESULT_SESSION_CLOSED = 1, - - /** - * The stream for this response has been closed. May happen when the - * sender had sent first SYN_STREAM and after that RST_STREAM. - */ - SPDY_RESPONSE_RESULT_STREAM_CLOSED = 2 -}; - - -/** - * Callback for serious error condition. The default action is to print - * an error message and abort(). - * - * @param cls user specified value - * @param file where the error occured - * @param line where the error occured - * @param reason error details message, may be NULL - */ -typedef void -(*SPDY_PanicCallback) (void * cls, - const char *file, - unsigned int line, - const char *reason); - - -/** - * Callback for new SPDY session established by a client. Called - * immediately after the TCP connection was established. - * - * @param cls client-defined closure - * @param session handler for the new SPDY session - */ -typedef void -(*SPDY_NewSessionCallback) (void * cls, - struct SPDY_Session * session); - - -/** - * Callback for closed session. Called after the TCP connection was - * closed. In this callback function the user has the last - * chance to access the SPDY_Session structure. After that the latter - * will be cleaned! - * - * @param cls client-defined closure - * @param session handler for the closed SPDY session - * @param by_client #SPDY_YES if the session close was initiated by the - * client; - * #SPDY_NO if closed by the server - */ -typedef void -(*SPDY_SessionClosedCallback) (void *cls, - struct SPDY_Session *session, - int by_client); - - -/** - * Iterator over name-value pairs. - * - * @param cls client-defined closure - * @param name of the pair - * @param value of the pair - * @return #SPDY_YES to continue iterating, - * #SPDY_NO to abort the iteration - */ -typedef int -(*SPDY_NameValueIterator) (void *cls, - const char *name, - const char * const * value, - int num_values); - - -/** - * Callback for received SPDY request. The functions is called whenever - * a reqest comes, but will also be called if more headers/trailers are - * received. - * - * @param cls client-defined closure - * @param request handler. The request object is required for - * sending responses. - * @param priority of the SPDY stream which the request was - * sent over - * @param method HTTP method - * @param path HTTP path - * @param version HTTP version just like in HTTP request/response: - * "HTTP/1.0" or "HTTP/1.1" currently - * @param host called host as in HTTP - * @param scheme used ("http" or "https"). In SPDY 3 it is only "https". - * @param headers other HTTP headers from the request - * @param more a flag saying if more data related to the request is - * expected to be received. HTTP body may arrive (e.g. POST data); - * then SPDY_NewDataCallback will be called for the connection. - * It is also possible that more headers/trailers arrive; - * then the same callback will be invoked. The user should detect - * that it is not the first invocation of the function for that - * request. - */ -typedef void -(*SPDY_NewRequestCallback) (void *cls, - struct SPDY_Request *request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue *headers, - bool more); - - -/** - * Callback for received new data chunk (HTTP body) from a given - * request (e.g. POST data). - * - * @param cls client-defined closure - * @param request handler - * @param buf data chunk from the POST data - * @param size the size of the data chunk 'buf' in bytes. Note that it - * may be 0. - * @param more false if this is the last chunk from the data. Note: - * true does not mean that more data will come, exceptional - * situation is possible - * @return #SPDY_YES to continue calling the function, - * #SPDY_NO to stop calling the function for this request - */ -typedef int -(*SPDY_NewDataCallback) (void *cls, - struct SPDY_Request *request, - const void *buf, - size_t size, - bool more); -// How about passing POST encoding information -// here as well? -//TODO - - -/** - * Callback to be used with SPDY_build_response_with_callback. The - * callback will be called when the lib wants to write to the TLS socket. - * The application should provide the data to be sent. - * - * @param cls client-defined closure - * @param max maximum number of bytes that are allowed to be written - * to the buffer. - * @param more true if more data will be sent (i.e. the function must - * be calleed again), - * false if this is the last chunk, the lib will close - * the stream - * @return number of bytes written to buffer. On error the call MUST - * return value less than 0 to indicate the library. - */ -typedef ssize_t -(*SPDY_ResponseCallback) (void *cls, - void *buffer, - size_t max, - bool *more); - - -/** - * Callback to be called when the last bytes from the response was sent - * to the client or when the response was discarded from the lib. This - * callback is a very good place to discard the request and the response - * objects, if they will not be reused (e.g., sending the same response - * again). If the stream is closed it is safe to discard the request - * object. - * - * @param cls client-defined closure - * @param response handler to the response that was just sent - * @param request handler to the request for which the response was sent - * @param status shows if actually the response was sent or it was - * discarded by the lib for any reason (e.g., closing session, - * closing stream, stopping daemon, etc.). It is possible that - * status indicates an error but parts of the response headers - * and/or body (in one - * or several frames) were already sent to the client. - * @param streamopened indicates if the the stream for this request/ - * response pair is still opened. If yes, the server may want - * to use SPDY push to send something additional to the client - * and/or close the stream. - */ -typedef void -(*SPDY_ResponseResultCallback) (void * cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened); - - -/** - * Callback to notify when SPDY ping response is received. - * - * @param session handler for which the ping request was sent - * @param rtt the timespan between sending ping request and receiving it - * from the library - */ -typedef void -(*SPDY_PingCallback) (void * cls, - struct SPDY_Session *session, - struct timeval *rtt); - - -/** - * Iterator over settings ID/Value/Flags tuples. - * - * @param cls client-defined closure - * @param id SPDY settings ID - * @param value value for this setting - * @param flags flags for this tuple; use - * `enum SPDY_FLAG_SETTINGS` - * @return #SPDY_YES to continue iterating, - * #SPDY_NO to abort the iteration - */ -typedef int -(*SPDY_SettingsIterator) (void *cls, - enum SPDY_SETTINGS id, - int32_t value, - uint8_t flags); - - -/** - * Callback to notify when SPDY SETTINGS are received from the client. - * - * @param session handler for which settings are received - * @param settings ID/value/flags tuples of the settings - * @param flags for the whole settings frame; use - * enum SPDY_FLAG_SETTINGS_FRAME - * @param ... list of options (type-value pairs, - * terminated with #SPDY_SETTINGS_OPTION_END). - */ -typedef void -(*SPDY_SettingsReceivedCallback) (struct SPDY_Session *session, - struct SPDY_Settings *settings, - uint8_t flags, - ...); - - -/* Global functions for the library */ - - -/** - * Init function for the whole library. It MUST be called before any - * other function of the library to initialize things like TLS context - * and possibly other stuff needed by the lib. Currently the call - * always returns #SPDY_YES. - * - * @param io_subsystem the IO subsystem that will - * be initialized. Several can be used with bitwise OR. If no - * parameter is set, the default openssl subsystem will be used. - * @return #SPDY_YES if the library was correctly initialized and its - * functions can be used now; - * #SPDY_NO on error - */ -_MHD_EXTERN int -(SPDY_init) (enum SPDY_IO_SUBSYSTEM io_subsystem, ...); -#define SPDY_init() SPDY_init (SPDY_IO_SUBSYSTEM_OPENSSL) - - -/** - * Deinit function for the whole lib. It can be called after finishing - * using the library. It frees and cleans up resources allocated in - * SPDY_init. Currently the function does not do anything. - */ -_MHD_EXTERN void -SPDY_deinit (void); - - -/** - * Sets the global error handler to a different implementation. "cb" - * will only be called in the case of typically fatal, serious - * internal consistency issues. These issues should only arise in the - * case of serious memory corruption or similar problems with the - * architecture as well as failed assertions. While "cb" is allowed to - * return and the lib will then try to continue, this is never safe. - * - * The default implementation that is used if no panic function is set - * simply prints an error message and calls "abort". Alternative - * implementations might call "exit" or other similar functions. - * - * @param cb new error handler - * @param cls passed to error handler - */ -_MHD_EXTERN void -SPDY_set_panic_func (SPDY_PanicCallback cb, - void *cls); - - -/* Daemon functions */ - - -/** - * Start a SPDY webserver on the given port. - * - * @param port to bind to. The value is ignored if address structure - * is passed as daemon option - * @param certfile path to the certificate that will be used by server - * @param keyfile path to the keyfile for the certificate - * @param nscb callback called when a new SPDY session is - * established by a client - * @param sccb callback called when a session is closed - * @param nrcb callback called when a client sends request - * @param npdcb callback called when HTTP body (POST data) is received - * after request - * @param cls common extra argument to all of the callbacks - * @param ... list of options (type-value pairs, - * terminated with #SPDY_DAEMON_OPTION_END). - * @return NULL on error, handle to daemon on success - */ -_MHD_EXTERN struct SPDY_Daemon * -SPDY_start_daemon (uint16_t port, - const char *certfile, - const char *keyfile, - SPDY_NewSessionCallback nscb, - SPDY_SessionClosedCallback sccb, - SPDY_NewRequestCallback nrcb, - SPDY_NewDataCallback npdcb, - void *cls, - ...); - - -/** - * Shutdown the daemon. First all sessions are closed. It is NOT safe - * to call this function in user callbacks. - * - * @param daemon to stop - */ -_MHD_EXTERN void -SPDY_stop_daemon (struct SPDY_Daemon *daemon); - - -/** - * Obtain the select sets for this daemon. Only those are retrieved, - * which some processing should be done for, i.e. not all sockets are - * added to write_fd_set.

- * - * It is possible that there is - * nothing to be read from a socket but there is data either in the - * TLS subsystem's read buffers or in libmicrospdy's read buffers, which - * waits for being processed. In such case the file descriptor will be - * added to write_fd_set. Since it is very likely for the socket to be - * ready for writing, the select used in the application's event loop - * will return with success, SPDY_run will be called, the data will be - * processed and maybe something will be written to the socket. Without - * this behaviour, considering a proper event loop, data may stay in the - * buffers, but run is never called. - * - * @param daemon to get sets from - * @param read_fd_set read set - * @param write_fd_set write set - * @param except_fd_set except set - * @return largest FD added to any of the sets - */ -_MHD_EXTERN int -SPDY_get_fdset (struct SPDY_Daemon *daemon, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *except_fd_set); - - -/** - * Obtain timeout value for select for this daemon. The returned value - * is how long select - * should at most block, not the timeout value set for connections. - * - * @param daemon to query for timeout - * @param timeout will be set to the timeout value (in milliseconds) - * @return #SPDY_YES on success - * #SPDY_NO if no connections exist that - * would necessiate the use of a timeout right now - */ -_MHD_EXTERN int -SPDY_get_timeout (struct SPDY_Daemon *daemon, - unsigned long long *timeout); - - -/** - * Run webserver operations. This method must be called in - * the client event loop. - * - * @param daemon to run - */ -_MHD_EXTERN void -SPDY_run (struct SPDY_Daemon *daemon); - - -/* SPDY Session handling functions */ - - -/** - * Closes a SPDY session. SPDY clients and servers are expected to keep - * sessions opened as long as possible. However, the server may want to - * close some connections, e.g. if there are too many, to free some - * resources. The function can also be used to close a specific session - * if the client is not desired. - * - * @param session handler to be closed - */ -_MHD_EXTERN void -SPDY_close_session (struct SPDY_Session * session); - - -/** - * Associate a void pointer with a session. The data accessible by the - * pointer can later be used wherever the session handler is available. - * - * @param session handler - * @param cls any data pointed by a pointer to be accessible later - */ -_MHD_EXTERN void -SPDY_set_cls_to_session (struct SPDY_Session *session, - void *cls); - - -/** - * Retrieves the pointer associated with SPDY_set_cls_to_session(). - * - * @param session handler to get its cls - * @return same pointer added by SPDY_set_cls_to_session() or - * NULL when nothing was associated - */ -_MHD_EXTERN void * -SPDY_get_cls_from_session (struct SPDY_Session *session); - - -/** - * Retrieves the remote address of a given session. - * - * @param session handler to get its remote address - * @param addr out parameter; pointing to remote address - * @return length of the address structure - */ -_MHD_EXTERN socklen_t -SPDY_get_remote_addr (struct SPDY_Session *session, - struct sockaddr **addr); - - -/* SPDY name/value data structure handling functions */ - - -/** - * Create a new NameValue structure. It is needed for putting inside the - * HTTP headers and their values for a response. The user should later - * destroy alone the structure. - * - * @return handler to the new empty structure or NULL on error - */ -_MHD_EXTERN struct SPDY_NameValue * -SPDY_name_value_create (void); - - -/** - * Add name/value pair to a NameValue structure. SPDY_NO will be returned - * if the name/value pair is already in the structure. It is legal to - * add different values for the same name. - * - * @param container structure to which the new pair is added - * @param name for the value. Null-terminated string. - * @param value the value itself. Null-terminated string. - * @return #SPDY_NO on error or #SPDY_YES on success - */ -_MHD_EXTERN int -SPDY_name_value_add (struct SPDY_NameValue *container, - const char *name, - const char *value); - - -/** - * Lookup value for a name in a name/value structure. - * - * @param container structure in which to lookup - * @param name the name to look for - * @param num_values length of the returned array with values - * @return NULL if no such item was found, or an array containing the - * values - */ -_MHD_EXTERN const char * const * -SPDY_name_value_lookup (struct SPDY_NameValue *container, - const char *name, - int *num_values); - - -/** - * Iterate over name/value structure. - * - * @param container structure which to iterate over - * @param iterator callback to call on each name/value pair; - * maybe NULL (then just count headers) - * @param iterator_cls extra argument to @a iterator - * @return number of entries iterated over - */ -_MHD_EXTERN int -SPDY_name_value_iterate (struct SPDY_NameValue *container, - SPDY_NameValueIterator iterator, - void *iterator_cls); - - -/** - * Destroy a NameValue structure. Use this function to destroy only - * objects which, after passed to, will not be destroied by other - * functions. - * - */ -_MHD_EXTERN void -SPDY_name_value_destroy (struct SPDY_NameValue *container); - - -/* SPDY request handling functions */ - - -/** - * Gets the session responsible for the given - * request. - * - * @param request for which the session is wanted - * @return session handler for the request - */ -_MHD_EXTERN struct SPDY_Session * -SPDY_get_session_for_request (const struct SPDY_Request *request); - - -/** - * Associate a void pointer with a request. The data accessible by the - * pointer can later be used wherever the request handler is available. - * - * @param request with which to associate a pointer - * @param cls any data pointed by a pointer to be accessible later - */ -_MHD_EXTERN void -SPDY_set_cls_to_request (struct SPDY_Request *request, - void *cls); - - -/** - * Retrieves the pointer associated with the request by - * SPDY_set_cls_to_request(). - * - * @param request to get its cls - * @return same pointer added by SPDY_set_cls_to_request() or - * NULL when nothing was associated - */ -_MHD_EXTERN void * -SPDY_get_cls_from_request (struct SPDY_Request *request); - - -/* SPDY response handling functions */ - - -/** - * Create response object containing all needed headers and data. The - * response object is not bound to a request, so it can be used multiple - * times with SPDY_queue_response() and schould be - * destroied by calling the SPDY_destroy_response().

- * - * Currently the library does not provide compression of the body data. - * It is up to the user to pass already compressed data and the - * appropriate headers to this function when desired. - * - * @param status HTTP status code for the response (e.g. 404) - * @param statustext HTTP status message for the response, which will - * be appended to the status code (e.g. "OK"). Can be NULL - * @param version HTTP version for the response (e.g. "http/1.1") - * @param headers name/value structure containing additional HTTP headers. - * Can be NULL. Can be used multiple times, it is up to - * the user to destoy the object when not needed anymore. - * @param data the body of the response. The lib will make a copy of it, - * so it is up to the user to take care of the memory - * pointed by data - * @param size length of @a data. It can be 0, then the lib will send only - * headers - * @return NULL on error, handle to response object on success - */ -_MHD_EXTERN struct SPDY_Response * -SPDY_build_response (int status, - const char *statustext, - const char *version, - struct SPDY_NameValue *headers, - const void *data, - size_t size); - - -/** - * Create response object containing all needed headers. The data will - * be provided later when the lib calls the callback function (just - * before writing it to the TLS socket). The - * response object is not bound to a request, so it can be used multiple - * times with SPDY_queue_response() and schould be - * destroied by calling the SPDY_destroy_response().

- * - * Currently the library does not provide compression of the body data. - * It is up to the user to pass already compressed data and the - * appropriate headers to this function and the callback when desired. - * - * @param status HTTP status code for the response (e.g. 404) - * @param statustext HTTP status message for the response, which will - * be appended to the status code (e.g. "OK"). Can be NULL - * @param version HTTP version for the response (e.g. "http/1.1") - * @param headers name/value structure containing additional HTTP headers. - * Can be NULL. Can be used multiple times, it is up to - * the user to destoy the object when not needed anymore. - * @param rcb callback to use to obtain response data - * @param rcb_cls extra argument to @a rcb - * @param block_size preferred block size for querying rcb (advisory only, - * the lib will call rcb specifying the block size); clients - * should pick a value that is appropriate for IO and - * memory performance requirements. The function will - * fail if the value is bigger than the maximum - * supported value (SPDY_MAX_SUPPORTED_FRAME_SIZE). - * Can be 0, then the lib will use - * #SPDY_MAX_SUPPORTED_FRAME_SIZE instead. - * @return NULL on error, handle to response object on success - */ -_MHD_EXTERN struct SPDY_Response * -SPDY_build_response_with_callback(int status, - const char *statustext, - const char *version, - struct SPDY_NameValue *headers, - SPDY_ResponseCallback rcb, - void *rcb_cls, - uint32_t block_size); - - -/** - * Queue response object to be sent to the client. A successfully queued - * response may never be sent, e.g. when the stream gets closed. The - * data will be added to the output queue. The call will fail, if the - * output for this session - * is closed (i.e. the session is closed, half or full) or the output - * channel for the stream, on which the request was received, is closed - * (i.e. the stream is closed, half or full). - * - * @param request object identifying the request to which the - * response is returned - * @param response object containg headers and data to be sent - * @param closestream TRUE if the server does NOT intend to PUSH - * something more associated to this request/response later, - * FALSE otherwise - * @param consider_priority if FALSE, the response will be added to the - * end of the queue. If TRUE, the response will be added after - * the last previously added response with priority of the - * request grater or equal to that of the current one. This - * means that the function should be called with TRUE each time - * if one wants to be sure that the output queue behaves like - * a priority queue - * @param rrcb callback called when all the data was sent (last frame - * from response) or when that frame was discarded (e.g. the - * stream has been closed meanwhile) - * @param rrcb_cls extra argument to @a rrcb - * @return #SPDY_NO on error or #SPDY_YES on success - */ -_MHD_EXTERN int -SPDY_queue_response (struct SPDY_Request *request, - struct SPDY_Response *response, - bool closestream, - bool consider_priority, - SPDY_ResponseResultCallback rrcb, - void *rrcb_cls); - - -/** - * Destroy a response structure. It should be called for all objects - * returned by SPDY_build_response*() functions to free the memory - * associated with the prepared response. It is safe to call this - * function not before being sure that the response will not be used by - * the lib anymore, this means after SPDY_ResponseResultCallback - * callbacks were called for all calls to SPDY_queue_response() passing - * this response. - * - * @param response to destroy - */ -_MHD_EXTERN void -SPDY_destroy_response (struct SPDY_Response *response); - - -/* SPDY settings ID/value data structure handling functions */ - - -/** - * Create a new SettingsIDValue structure. It is needed for putting - * inside tuples of SPDY option, flags and value for sending to the - * client. - * - * @return hendler to the new empty structure or NULL on error - */ -_MHD_EXTERN const struct SPDY_Settings * -SPDY_settings_create (void); - - -/** - * Add or update a tuple to a SettingsIDValue structure. - * - * @param container structure to which the new tuple is added - * @param id SPDY settings ID that will be sent. If this ID already in - * container, the tupple for it will be updated (value and/or - * flags). If it is not in the container, a new tupple will be - * added. - * @param flags SPDY settings flags applied only to this setting - * @param value of the setting - * @return #SPDY_NO on error - * or #SPDY_YES if a new setting was added - */ -_MHD_EXTERN int -SPDY_settings_add (struct SPDY_Settings *container, - enum SPDY_SETTINGS id, - enum SPDY_FLAG_SETTINGS flags, - int32_t value); - - -/** - * Lookup value and flags for an ID in a settings ID/value structure. - * - * @param container structure in which to lookup - * @param id SPDY settings ID to search for - * @param flags out param for SPDY settings flags for this setting; - * check it against the flags in enum SPDY_FLAG_SETTINGS - * @param value out param for the value of this setting - * @return #SPDY_NO if the setting is not into the structure - * or #SPDY_YES if it is into it - */ -_MHD_EXTERN int -SPDY_settings_lookup (const struct SPDY_Settings *container, - enum SPDY_SETTINGS id, - enum SPDY_FLAG_SETTINGS *flags, - int32_t *value); - - -/** - * Iterate over settings ID/value structure. - * - * @param container structure which to iterate over - * @param iterator callback to call on each ID/value pair; - * maybe NULL (then just count number of settings) - * @param iterator_cls extra argument to iterator - * @return number of entries iterated over - */ -_MHD_EXTERN int -SPDY_settings_iterate (const struct SPDY_Settings *container, - SPDY_SettingsIterator iterator, - void *iterator_cls); - - -/** - * Destroy a settings ID/value structure. Use this function to destroy - * only objects which, after passed to, will not be destroied by other - * functions. - * - * @param container structure which to detroy - */ -_MHD_EXTERN void -SPDY_settings_destroy (struct SPDY_Settings * container); - - -/* SPDY SETTINGS handling functions */ - - -/** - * Send SPDY SETTINGS to the client. The call will return fail if there - * in invald setting into the settings container (e.g. invalid setting - * ID). - * - * @param session SPDY_Session handler for which settings are being sent - * @param settings ID/value pairs of the settings to be sent. - * Can be used multiple times, it is up to the user to destoy - * the object when not needed anymore. - * @param flags for the whole settings frame. They are valid for all tuples - * @param ... list of options (type-value pairs, - * terminated with #SPDY_SETTINGS_OPTION_END). - * @return SPDY_NO on error or SPDY_YES on - * success - */ -_MHD_EXTERN int -SPDY_send_settings (struct SPDY_Session *session, - struct SPDY_Settings *settings, - enum SPDY_FLAG_SETTINGS_FRAME flags, - ...); - - -/* SPDY misc functions */ - - -/** - * Destroy a request structure. It should be called for all objects - * received as a parameter in SPDY_NewRequestCallback to free the memory - * associated with the request. It is safe to call this - * function not before being sure that the request will not be used by - * the lib anymore, this means after the stream, on which this request - * had been sent, was closed and all SPDY_ResponseResultCallback - * callbacks were called for all calls to SPDY_queue_response() passing - * this request object. - * - * @param request to destroy - */ -_MHD_EXTERN void -SPDY_destroy_request (struct SPDY_Request * request); - - -/** - * Send SPDY ping to the client - * - * @param session handler for which the ping request is sent - * @param rttcb callback called when ping response to the request is - * received - * @param rttcb_cls extra argument to @a rttcb - * @return #SPDY_NO on error or #SPDY_YES on success - */ -_MHD_EXTERN int -SPDY_send_ping (struct SPDY_Session *session, - SPDY_PingCallback rttcb, - void *rttcb_cls); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/platform.h libmicrohttpd-0.9.55/src/include/platform.h --- libmicrohttpd-0.9.44+dfsg/src/include/platform.h 2015-08-08 23:38:38.000000000 +0200 +++ libmicrohttpd-0.9.55/src/include/platform.h 2017-05-28 22:34:00.000000000 +0200 @@ -34,53 +34,7 @@ #ifndef MHD_PLATFORM_H #define MHD_PLATFORM_H -#include "MHD_config.h" - -#ifndef BUILDING_MHD_LIB -#ifdef _MHD_EXTERN -#undef _MHD_EXTERN -#endif /* _MHD_EXTERN */ -#if defined(_WIN32) && defined(MHD_W32LIB) -#define _MHD_EXTERN extern -#elif defined (_WIN32) && defined(MHD_W32DLL) -#define _MHD_EXTERN __declspec(dllimport) -#else -#define _MHD_EXTERN extern -#endif -#elif !defined(_MHD_EXTERN) /* && BUILDING_MHD_LIB */ -#if defined(_WIN32) && defined(MHD_W32LIB) -#define _MHD_EXTERN extern -#elif defined (_WIN32) && defined(MHD_W32DLL) -#define _MHD_EXTERN extern __declspec(dllexport) -#else -#define _MHD_EXTERN extern -#endif -#endif /* BUILDING_MHD_LIB */ - -#define _XOPEN_SOURCE_EXTENDED 1 -#if OS390 -#define _OPEN_THREADS -#define _OPEN_SYS_SOCK_IPV6 -#define _OPEN_MSGQ_EXT -#define _LP64 -#endif - -#if defined(_WIN32) -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 -#else /* _WIN32_WINNT */ -#if _WIN32_WINNT < 0x0501 -#error "Headers for Windows XP or later are required" -#endif /* _WIN32_WINNT < 0x0501 */ -#endif /* _WIN32_WINNT */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif /* !WIN32_LEAN_AND_MEAN */ -#endif /* _WIN32 */ - -#if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE) -#define _LARGEFILE64_SOURCE 1 -#endif +#include "mhd_options.h" #include #include @@ -94,11 +48,6 @@ #include #include #include -#ifdef MHD_USE_POSIX_THREADS -#undef HAVE_CONFIG_H -#include -#define HAVE_CONFIG_H 1 -#endif /* MHD_USE_POSIX_THREADS */ /* different OSes have fd_set in a broad range of header files; @@ -106,13 +55,17 @@ are available) */ -#ifdef OS_VXWORKS -#include -#include +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) #include #include -#define RESTRICT __restrict__ -#endif +#ifdef HAVE_SOCKLIB_H +#include +#endif /* HAVE_SOCKLIB_H */ +#ifdef HAVE_INETLIB_H +#include +#endif /* HAVE_INETLIB_H */ +#endif /* __VXWORKS__ */ + #if HAVE_MEMORY_H #include #endif @@ -135,59 +88,35 @@ #if HAVE_SYS_MMAN_H #include #endif -#if HAVE_NETDB_H -#include -#endif -#if HAVE_NETINET_IN_H -#include -#endif #if HAVE_TIME_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif -#if HAVE_ARPA_INET_H -#include -#endif +#if defined(_WIN32) && !defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#include +#endif /* _WIN32 && !__CYGWIN__ */ +#if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET) +/* Do not define __USE_W32_SOCKETS under Cygwin! */ +#error Cygwin with winsock fd_set is not supported +#endif #if defined(_WIN32) && !defined(__CYGWIN__) -#include #define sleep(seconds) ((SleepEx((seconds)*1000, 1)==0)?0:(seconds)) #define usleep(useconds) ((SleepEx((useconds)/1000, 1)==0)?0:-1) #endif -#if !defined(SHUT_WR) && defined(SD_SEND) -#define SHUT_WR SD_SEND -#endif -#if !defined(SHUT_RD) && defined(SD_RECEIVE) -#define SHUT_RD SD_RECEIVE -#endif -#if !defined(SHUT_RDWR) && defined(SD_BOTH) -#define SHUT_RDWR SD_BOTH -#endif - #if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) #define _SSIZE_T_DEFINED typedef intptr_t ssize_t; #endif /* !_SSIZE_T_DEFINED */ -#ifndef MHD_SOCKET_DEFINED -/** - * MHD_socket is type for socket FDs - */ -#if !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) -#define MHD_POSIX_SOCKETS 1 -typedef int MHD_socket; -#define MHD_INVALID_SOCKET (-1) -#else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */ -#define MHD_WINSOCK_SOCKETS 1 -#include -typedef SOCKET MHD_socket; -#define MHD_INVALID_SOCKET (INVALID_SOCKET) -#endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */ -#define MHD_SOCKET_DEFINED 1 -#endif /* MHD_SOCKET_DEFINED */ #ifndef _WIN32 typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; @@ -195,18 +124,6 @@ typedef long _MHD_TIMEVAL_TV_SEC_TYPE; #endif /* _WIN32 */ -/* Force don't use pipes on W32 */ -#if defined(_WIN32) && !defined(MHD_DONT_USE_PIPES) -#define MHD_DONT_USE_PIPES 1 -#endif /* defined(_WIN32) && !defined(MHD_DONT_USE_PIPES) */ - -/* MHD_pipe is type for pipe FDs*/ -#ifndef MHD_DONT_USE_PIPES -typedef int MHD_pipe; -#else /* ! MHD_DONT_USE_PIPES */ -typedef MHD_socket MHD_pipe; -#endif /* ! MHD_DONT_USE_PIPES */ - #if !defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501 /* VC use IPPROTO_IPV6 as part of enum */ #define IPPROTO_IPV6 IPPROTO_IPV6 diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/platform_interface.h libmicrohttpd-0.9.55/src/include/platform_interface.h --- libmicrohttpd-0.9.44+dfsg/src/include/platform_interface.h 2015-08-08 23:38:38.000000000 +0200 +++ libmicrohttpd-0.9.55/src/include/platform_interface.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,364 +0,0 @@ -/* - This file is part of libmicrohttpd - Copyright (C) 2014 Karlson2k (Evgeny Grin) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. - If not, see . -*/ - -/** - * @file include/platform_interface.h - * @brief internal platform abstraction functions - * @author Karlson2k (Evgeny Grin) - */ - -#ifndef MHD_PLATFORM_INTERFACE_H -#define MHD_PLATFORM_INTERFACE_H - -#include "platform.h" -#if defined(_WIN32) && !defined(__CYGWIN__) -#include "w32functions.h" -#endif - -/* ***************************** - General function mapping - *****************************/ -#if !defined(_WIN32) || defined(__CYGWIN__) -/** - * Check two strings case-insensitive equality - * @param a first string to check - * @param b second string to check - * @return boolean true if strings are equal, boolean false if strings are unequal - */ -#define MHD_str_equal_caseless_(a,b) (0==strcasecmp((a),(b))) -#else -/** - * Check two strings case-insensitive equality - * @param a first string to check - * @param b second string to check - * @return boolean true if strings are equal, boolean false if strings are unequal - */ -#define MHD_str_equal_caseless_(a,b) (0==_stricmp((a),(b))) -#endif - -#if !defined(_WIN32) || defined(__CYGWIN__) -/** - * Check not more than n chars in two strings case-insensitive equality - * @param a first string to check - * @param b second string to check - * @param n maximum number of chars to check - * @return boolean true if strings are equal, boolean false if strings are unequal - */ -#define MHD_str_equal_caseless_n_(a,b,n) (0==strncasecmp((a),(b),(n))) -#else -/** - * Check not more than n chars in two strings case-insensitive equality - * @param a first string to check - * @param b second string to check - * @param n maximum number of chars to check - * @return boolean true if strings are equal, boolean false if strings are unequal - */ -#define MHD_str_equal_caseless_n_(a,b,n) (0==_strnicmp((a),(b),(n))) -#endif - -/* Platform-independent snprintf name */ -#if !defined(_WIN32) || defined(__CYGWIN__) -#define MHD_snprintf_ snprintf -#else -#define MHD_snprintf_ W32_snprintf -#endif - - -/** - * _MHD_socket_funcs_size is type used to specify size for send and recv - * functions - */ -#if !defined(MHD_WINSOCK_SOCKETS) -typedef size_t _MHD_socket_funcs_size; -#else -typedef int _MHD_socket_funcs_size; -#endif - -/** - * MHD_socket_close_(fd) close any FDs (non-W32) / close only socket - * FDs (W32). Note that on HP-UNIX, this function may leak the FD if - * errno is set to EINTR. Do not use HP-UNIX. - * - * @param fd descriptor to close - * @return 0 on success (error codes like EINTR and EIO are counted as success, - * only EBADF counts as an error!) - */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_socket_close_(fd) (((0 != close(fd)) && (EBADF == errno)) ? -1 : 0) -#else -#define MHD_socket_close_(fd) closesocket((fd)) -#endif - -/** - * MHD_socket_errno_ is errno of last function (non-W32) / errno of - * last socket function (W32) - */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_socket_errno_ errno -#else -#define MHD_socket_errno_ MHD_W32_errno_from_winsock_() -#endif - -/* MHD_socket_last_strerr_ is description string of last errno (non-W32) / - * description string of last socket error (W32) */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_socket_last_strerr_() strerror(errno) -#else -#define MHD_socket_last_strerr_() MHD_W32_strerror_last_winsock_() -#endif - -/* MHD_strerror_ is strerror (both non-W32/W32) */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_strerror_(errnum) strerror((errnum)) -#else -#define MHD_strerror_(errnum) MHD_W32_strerror_((errnum)) -#endif - -/* MHD_set_socket_errno_ set errno to errnum (non-W32) / set socket last error to errnum (W32) */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_set_socket_errno_(errnum) errno=(errnum) -#else -#define MHD_set_socket_errno_(errnum) MHD_W32_set_last_winsock_error_((errnum)) -#endif - -/* MHD_SYS_select_ is wrapper macro for system select() function */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_SYS_select_(n,r,w,e,t) select((n),(r),(w),(e),(t)) -#else -#define MHD_SYS_select_(n,r,w,e,t) select((int)0,(r),(w),(e),(t)) -#endif - -#if defined(HAVE_POLL) -/* MHD_sys_poll_ is wrapper macro for system poll() function */ -#if !defined(MHD_WINSOCK_SOCKETS) -#define MHD_sys_poll_ poll -#else /* MHD_WINSOCK_SOCKETS */ -#define MHD_sys_poll_ WSAPoll -#endif /* MHD_WINSOCK_SOCKETS */ -#endif /* HAVE_POLL */ - -/* MHD_pipe_ create pipe (!MHD_DONT_USE_PIPES) / - * create two connected sockets (MHD_DONT_USE_PIPES) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_(fdarr) pipe((fdarr)) -#else /* MHD_DONT_USE_PIPES */ -#if !defined(_WIN32) || defined(__CYGWIN__) -#define MHD_pipe_(fdarr) socketpair(AF_LOCAL, SOCK_STREAM, 0, (fdarr)) -#else /* !defined(_WIN32) || defined(__CYGWIN__) */ -#define MHD_pipe_(fdarr) MHD_W32_pair_of_sockets_((fdarr)) -#endif /* !defined(_WIN32) || defined(__CYGWIN__) */ -#endif /* MHD_DONT_USE_PIPES */ - -/* MHD_pipe_errno_ is errno of last function (!MHD_DONT_USE_PIPES) / - * errno of last emulated pipe function (MHD_DONT_USE_PIPES) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_errno_ errno -#else -#define MHD_pipe_errno_ MHD_socket_errno_ -#endif - -/* MHD_pipe_last_strerror_ is description string of last errno (!MHD_DONT_USE_PIPES) / - * description string of last pipe error (MHD_DONT_USE_PIPES) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_last_strerror_() strerror(errno) -#else -#define MHD_pipe_last_strerror_() MHD_socket_last_strerr_() -#endif - -/* MHD_pipe_write_ write data to real pipe (!MHD_DONT_USE_PIPES) / - * write data to emulated pipe (MHD_DONT_USE_PIPES) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_write_(fd, ptr, sz) write((fd), (const void*)(ptr), (sz)) -#else -#define MHD_pipe_write_(fd, ptr, sz) send((fd), (const char*)(ptr), (sz), 0) -#endif - -/* MHD_pipe_read_ read data from real pipe (!MHD_DONT_USE_PIPES) / - * read data from emulated pipe (MHD_DONT_USE_PIPES) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_read_(fd, ptr, sz) read((fd), (void*)(ptr), (sz)) -#else -#define MHD_pipe_read_(fd, ptr, sz) recv((fd), (char*)(ptr), (sz), 0) -#endif - -/* MHD_pipe_close_(fd) close any FDs (non-W32) / - * close emulated pipe FDs (W32) */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_pipe_close_(fd) close((fd)) -#else -#define MHD_pipe_close_(fd) MHD_socket_close_((fd)) -#endif - -/* MHD_INVALID_PIPE_ is a value of bad pipe FD */ -#ifndef MHD_DONT_USE_PIPES -#define MHD_INVALID_PIPE_ (-1) -#else -#define MHD_INVALID_PIPE_ MHD_INVALID_SOCKET -#endif - -#if !defined(_WIN32) || defined(__CYGWIN__) -#define MHD_random_() random() -#else -#define MHD_random_() MHD_W32_random_() -#endif - -#if defined(MHD_USE_POSIX_THREADS) -typedef pthread_t MHD_thread_handle_; -#elif defined(MHD_USE_W32_THREADS) -#include -typedef HANDLE MHD_thread_handle_; -#else -#error "No threading API is available." -#endif - -#if defined(MHD_USE_POSIX_THREADS) -#define MHD_THRD_RTRN_TYPE_ void* -#define MHD_THRD_CALL_SPEC_ -#elif defined(MHD_USE_W32_THREADS) -#define MHD_THRD_RTRN_TYPE_ unsigned -#define MHD_THRD_CALL_SPEC_ __stdcall -#endif - -#if defined(MHD_USE_POSIX_THREADS) -/** - * Wait until specified thread is ended - * @param thread ID to watch - * @return zero on success, nonzero on failure - */ -#define MHD_join_thread_(thread) pthread_join((thread), NULL) -#elif defined(MHD_USE_W32_THREADS) -/** - * Wait until specified thread is ended - * Close thread handle on success - * @param thread handle to watch - * @return zero on success, nonzero on failure - */ -#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject((thread), INFINITE) ? (CloseHandle((thread)), 0) : 1 ) -#endif - -#if defined(MHD_USE_W32_THREADS) -#define MHD_W32_MUTEX_ 1 -#include -typedef CRITICAL_SECTION MHD_mutex_; -#elif defined(HAVE_PTHREAD_H) && defined(MHD_USE_POSIX_THREADS) -#define MHD_PTHREAD_MUTEX_ 1 -typedef pthread_mutex_t MHD_mutex_; -#else -#error "No base mutex API is available." -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Create new mutex. - * @param mutex pointer to the mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_create_(mutex) \ - ((0 == pthread_mutex_init ((mutex), NULL)) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Create new mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_create_(mutex) \ - ((NULL != (mutex) && 0 != InitializeCriticalSectionAndSpinCount((mutex),2000)) ? MHD_YES : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Destroy previously created mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_destroy_(mutex) \ - ((0 == pthread_mutex_destroy ((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Destroy previously created mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_destroy_(mutex) \ - ((NULL != (mutex)) ? (DeleteCriticalSection(mutex), MHD_YES) : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Acquire lock on previously created mutex. - * If mutex was already locked by other thread, function - * blocks until mutex becomes available. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_lock_(mutex) \ - ((0 == pthread_mutex_lock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Acquire lock on previously created mutex. - * If mutex was already locked by other thread, function - * blocks until mutex becomes available. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_lock_(mutex) \ - ((NULL != (mutex)) ? (EnterCriticalSection((mutex)), MHD_YES) : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Try to acquire lock on previously created mutex. - * Function returns immediately. - * @param mutex pointer to mutex - * @return #MHD_YES if mutex is locked, #MHD_NO if - * mutex was not locked. - */ -#define MHD_mutex_trylock_(mutex) \ - ((0 == pthread_mutex_trylock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Try to acquire lock on previously created mutex. - * Function returns immediately. - * @param mutex pointer to mutex - * @return #MHD_YES if mutex is locked, #MHD_NO if - * mutex was not locked. - */ -#define MHD_mutex_trylock_(mutex) \ - ((NULL != (mutex) && 0 != TryEnterCriticalSection ((mutex))) ? MHD_YES : MHD_NO) -#endif - -#if defined(MHD_PTHREAD_MUTEX_) -/** - * Unlock previously created and locked mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_unlock_(mutex) \ - ((0 == pthread_mutex_unlock((mutex))) ? MHD_YES : MHD_NO) -#elif defined(MHD_W32_MUTEX_) -/** - * Unlock previously created and locked mutex. - * @param mutex pointer to mutex - * @return #MHD_YES on success, #MHD_NO on failure - */ -#define MHD_mutex_unlock_(mutex) \ - ((NULL != (mutex)) ? (LeaveCriticalSection((mutex)), MHD_YES) : MHD_NO) -#endif - -#endif /* MHD_PLATFORM_INTERFACE_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/include/w32functions.h libmicrohttpd-0.9.55/src/include/w32functions.h --- libmicrohttpd-0.9.44+dfsg/src/include/w32functions.h 2015-07-07 23:23:21.000000000 +0200 +++ libmicrohttpd-0.9.55/src/include/w32functions.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,213 +0,0 @@ -/* - This file is part of libmicrohttpd - Copyright (C) 2014 Karlson2k (Evgeny Grin) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. - If not, see . -*/ - -/** - * @file include/w32functions.h - * @brief internal functions for W32 systems - * @author Karlson2k (Evgeny Grin) - */ - -#ifndef MHD_W32FUNCTIONS_H -#define MHD_W32FUNCTIONS_H -#ifndef _WIN32 -#error w32functions.h is designed only for W32 systems -#endif - -#include "platform.h" -#include -#include -#include "platform_interface.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define MHDW32ERRBASE 3300 - -#ifndef EWOULDBLOCK -#define EWOULDBLOCK (MHDW32ERRBASE+1) -#endif -#ifndef EINPROGRESS -#define EINPROGRESS (MHDW32ERRBASE+2) -#endif -#ifndef EALREADY -#define EALREADY (MHDW32ERRBASE+3) -#endif -#ifndef ENOTSOCK -#define ENOTSOCK (MHDW32ERRBASE+4) -#endif -#ifndef EDESTADDRREQ -#define EDESTADDRREQ (MHDW32ERRBASE+5) -#endif -#ifndef EMSGSIZE -#define EMSGSIZE (MHDW32ERRBASE+6) -#endif -#ifndef EPROTOTYPE -#define EPROTOTYPE (MHDW32ERRBASE+7) -#endif -#ifndef ENOPROTOOPT -#define ENOPROTOOPT (MHDW32ERRBASE+8) -#endif -#ifndef EPROTONOSUPPORT -#define EPROTONOSUPPORT (MHDW32ERRBASE+9) -#endif -#ifndef EOPNOTSUPP -#define EOPNOTSUPP (MHDW32ERRBASE+10) -#endif -#ifndef EAFNOSUPPORT -#define EAFNOSUPPORT (MHDW32ERRBASE+11) -#endif -#ifndef EADDRINUSE -#define EADDRINUSE (MHDW32ERRBASE+12) -#endif -#ifndef EADDRNOTAVAIL -#define EADDRNOTAVAIL (MHDW32ERRBASE+13) -#endif -#ifndef ENETDOWN -#define ENETDOWN (MHDW32ERRBASE+14) -#endif -#ifndef ENETUNREACH -#define ENETUNREACH (MHDW32ERRBASE+15) -#endif -#ifndef ENETRESET -#define ENETRESET (MHDW32ERRBASE+16) -#endif -#ifndef ECONNABORTED -#define ECONNABORTED (MHDW32ERRBASE+17) -#endif -#ifndef ECONNRESET -#define ECONNRESET (MHDW32ERRBASE+18) -#endif -#ifndef ENOBUFS -#define ENOBUFS (MHDW32ERRBASE+19) -#endif -#ifndef EISCONN -#define EISCONN (MHDW32ERRBASE+20) -#endif -#ifndef ENOTCONN -#define ENOTCONN (MHDW32ERRBASE+21) -#endif -#ifndef ETOOMANYREFS -#define ETOOMANYREFS (MHDW32ERRBASE+22) -#endif -#ifndef ECONNREFUSED -#define ECONNREFUSED (MHDW32ERRBASE+23) -#endif -#ifndef ELOOP -#define ELOOP (MHDW32ERRBASE+24) -#endif -#ifndef EHOSTDOWN -#define EHOSTDOWN (MHDW32ERRBASE+25) -#endif -#ifndef EHOSTUNREACH -#define EHOSTUNREACH (MHDW32ERRBASE+26) -#endif -#ifndef EPROCLIM -#define EPROCLIM (MHDW32ERRBASE+27) -#endif -#ifndef EUSERS -#define EUSERS (MHDW32ERRBASE+28) -#endif -#ifndef EDQUOT -#define EDQUOT (MHDW32ERRBASE+29) -#endif -#ifndef ESTALE -#define ESTALE (MHDW32ERRBASE+30) -#endif -#ifndef EREMOTE -#define EREMOTE (MHDW32ERRBASE+31) -#endif -#ifndef ESOCKTNOSUPPORT -#define ESOCKTNOSUPPORT (MHDW32ERRBASE+32) -#endif -#ifndef EPFNOSUPPORT -#define EPFNOSUPPORT (MHDW32ERRBASE+33) -#endif -#ifndef ESHUTDOWN -#define ESHUTDOWN (MHDW32ERRBASE+34) -#endif -#ifndef ENODATA -#define ENODATA (MHDW32ERRBASE+35) -#endif -#ifndef ETIMEDOUT -#define ETIMEDOUT (MHDW32ERRBASE+36) -#endif - -/** - * Return errno equivalent of last winsock error - * @return errno equivalent of last winsock error - */ -int MHD_W32_errno_from_winsock_(void); - -/** - * Return pointer to string description of errnum error - * Works fine with both standard errno errnums - * and errnums from MHD_W32_errno_from_winsock_ - * @param errnum the errno or value from MHD_W32_errno_from_winsock_() - * @return pointer to string description of error - */ -const char* MHD_W32_strerror_(int errnum); - -/** - * Return pointer to string description of last winsock error - * @return pointer to string description of last winsock error - */ -const char* MHD_W32_strerror_last_winsock_(void); - -/** - * Set last winsock error to equivalent of given errno value - * @param errnum the errno value to set - */ -void MHD_W32_set_last_winsock_error_(int errnum); - -/** - * Create pair of mutually connected TCP/IP sockets on loopback address - * @param sockets_pair array to receive resulted sockets - * @return zero on success, -1 otherwise - */ -int MHD_W32_pair_of_sockets_(SOCKET sockets_pair[2]); - -/** - * Generate 31-bit pseudo random number. - * Function initialize itself at first call to current time. - * @return 31-bit pseudo random number. - */ -int MHD_W32_random_(void); - -/* Emulate snprintf function on W32 */ -int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...); - -#ifndef _MSC_FULL_VER -/* Thread name available only for VC-compiler */ -static void W32_SetThreadName(const DWORD thread_id, const char *thread_name) -{ } -#else /* _MSC_FULL_VER */ -/** - * Set thread name - * @param thread_id ID of thread, -1 for current thread - * @param thread_name name to set - */ -void W32_SetThreadName(const DWORD thread_id, const char *thread_name); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* MHD_W32FUNCTIONS_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/Makefile.am libmicrohttpd-0.9.55/src/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -7,19 +7,8 @@ endif endif endif -if ENABLE_SPDY -if HAVE_OPENSSL -microspdy = microspdy -if HAVE_CURL -microspdy += spdy2http -endif -#if HAVE_SPDYLAY -microspdy += testspdy -#endif -endif -endif -SUBDIRS = include platform microhttpd $(microspdy) $(curltests) $(zzuftests) . +SUBDIRS = include microhttpd $(curltests) $(zzuftests) . if BUILD_EXAMPLES SUBDIRS += examples @@ -27,5 +16,4 @@ EXTRA_DIST = \ datadir/cert-and-key.pem \ - datadir/cert-and-key-for-wireshark.pem \ - datadir/spdy-draft.txt + datadir/cert-and-key-for-wireshark.pem diff -Nru libmicrohttpd-0.9.44+dfsg/src/Makefile.in libmicrohttpd-0.9.55/src/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -87,15 +87,13 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@ENABLE_SPDY_TRUE@@HAVE_CURL_TRUE@@HAVE_OPENSSL_TRUE@am__append_1 = spdy2http -@BUILD_EXAMPLES_TRUE@am__append_2 = examples +@BUILD_EXAMPLES_TRUE@am__append_1 = examples subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -103,8 +101,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -166,8 +167,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = include platform microhttpd microspdy spdy2http \ - testspdy testcurl testzzuf . examples +DIST_SUBDIRS = include microhttpd testcurl testzzuf . examples am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ @@ -220,8 +220,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -229,6 +231,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -244,9 +247,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -254,6 +254,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -268,9 +269,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -292,13 +290,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -306,6 +301,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -350,6 +346,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -362,16 +359,11 @@ # This Makefile.am is in the public domain @HAVE_CURL_TRUE@curltests = testcurl @HAVE_CURL_TRUE@@HAVE_SOCAT_TRUE@@HAVE_ZZUF_TRUE@zzuftests = testzzuf -#if HAVE_SPDYLAY -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@microspdy = microspdy \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@ $(am__append_1) testspdy -#endif -SUBDIRS = include platform microhttpd $(microspdy) $(curltests) \ - $(zzuftests) . $(am__append_2) +SUBDIRS = include microhttpd $(curltests) $(zzuftests) . \ + $(am__append_1) EXTRA_DIST = \ datadir/cert-and-key.pem \ - datadir/cert-and-key-for-wireshark.pem \ - datadir/spdy-draft.txt + datadir/cert-and-key-for-wireshark.pem all: all-recursive diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/base64.c libmicrohttpd-0.9.55/src/microhttpd/base64.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/base64.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/base64.c 2017-05-28 22:34:00.000000000 +0200 @@ -8,9 +8,6 @@ */ #include "base64.h" -static const char base64_chars[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - static const char base64_digits[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/basicauth.c libmicrohttpd-0.9.55/src/microhttpd/basicauth.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/basicauth.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/basicauth.c 2017-05-28 22:34:00.000000000 +0200 @@ -23,9 +23,10 @@ * @author Matthieu Speder */ #include "platform.h" -#include +#include "mhd_limits.h" #include "internal.h" #include "base64.h" +#include "mhd_compat.h" /** * Beginning string for any valid Basic authentication header. @@ -44,33 +45,36 @@ */ char * MHD_basic_auth_get_username_password (struct MHD_Connection *connection, - char** password) + char** password) { const char *header; char *decode; const char *separator; char *user; - - if ( (NULL == (header = MHD_lookup_connection_value (connection, + + if ( (NULL == (header = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION))) || - (0 != strncmp (header, _BASIC_BASE, strlen(_BASIC_BASE))) ) + (0 != strncmp (header, + _BASIC_BASE, + MHD_STATICSTR_LEN_ (_BASIC_BASE))) ) return NULL; - header += strlen (_BASIC_BASE); + header += MHD_STATICSTR_LEN_ (_BASIC_BASE); if (NULL == (decode = BASE64Decode (header))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Error decoding basic authentication\n"); + _("Error decoding basic authentication\n")); #endif return NULL; } /* Find user:password pattern */ - if (NULL == (separator = strchr (decode, ':'))) + if (NULL == (separator = strchr (decode, + ':'))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG(connection->daemon, - "Basic authentication doesn't contain ':' separator\n"); + _("Basic authentication doesn't contain ':' separator\n")); #endif free (decode); return NULL; @@ -81,14 +85,14 @@ return NULL; } user[separator - decode] = '\0'; /* cut off at ':' */ - if (NULL != password) + if (NULL != password) { - *password = strdup (separator + 1); + *password = strdup (separator + 1); if (NULL == *password) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG(connection->daemon, - "Failed to allocate memory for password\n"); + _("Failed to allocate memory for password\n")); #endif free (decode); free (user); @@ -112,36 +116,48 @@ * @return #MHD_YES on success, #MHD_NO otherwise * @ingroup authentication */ -int +int MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, - const char *realm, - struct MHD_Response *response) + const char *realm, + struct MHD_Response *response) { int ret; + int res; size_t hlen = strlen(realm) + strlen("Basic realm=\"\"") + 1; char *header; - - header = (char*)malloc(hlen); + + header = (char *) malloc(hlen); if (NULL == header) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG(connection->daemon, "Failed to allocate memory for auth header\n"); #endif /* HAVE_MESSAGES */ return MHD_NO; } - MHD_snprintf_ (header, - hlen, - "Basic realm=\"%s\"", - realm); - ret = MHD_add_response_header (response, - MHD_HTTP_HEADER_WWW_AUTHENTICATE, - header); + res = MHD_snprintf_ (header, + hlen, + "Basic realm=\"%s\"", + realm); + if (res > 0 && (size_t)res < hlen) + ret = MHD_add_response_header (response, + MHD_HTTP_HEADER_WWW_AUTHENTICATE, + header); + else + ret = MHD_NO; + free(header); if (MHD_YES == ret) - ret = MHD_queue_response (connection, - MHD_HTTP_UNAUTHORIZED, + ret = MHD_queue_response (connection, + MHD_HTTP_UNAUTHORIZED, response); + else + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to add Basic auth header\n")); +#endif /* HAVE_MESSAGES */ + } return ret; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection.c libmicrohttpd-0.9.55/src/microhttpd/connection.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection.c 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/connection.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007-2015 Daniel Pittman and Christian Grothoff + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -22,26 +22,23 @@ * @brief Methods for managing connections * @author Daniel Pittman * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) */ #include "internal.h" -#include +#include "mhd_limits.h" #include "connection.h" #include "memorypool.h" #include "response.h" #include "mhd_mono_clock.h" - -#if HAVE_NETINET_TCP_H -/* for TCP_CORK */ -#include -#endif - -#if defined(_WIN32) && defined(MHD_W32_MUTEX_) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif /* !WIN32_LEAN_AND_MEAN */ -#include -#endif /* _WIN32 && MHD_W32_MUTEX_ */ +#include "mhd_str.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_compat.h" +#include "mhd_itc.h" +#ifdef HTTPS_SUPPORT +#include "connection_https.h" +#endif /* HTTPS_SUPPORT */ /** @@ -56,7 +53,7 @@ * Intentionally empty here to keep our memory footprint * minimal. */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #define REQUEST_TOO_BIG "Request too bigYour HTTP header was too big for the memory constraints of this webserver." #else #define REQUEST_TOO_BIG "" @@ -69,7 +66,7 @@ * Intentionally empty here to keep our memory footprint * minimal. */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #define REQUEST_LACKS_HOST ""Host:" header requiredIn HTTP 1.1, requests must include a "Host:" header, and your HTTP 1.1 request lacked such a header." #else #define REQUEST_LACKS_HOST "" @@ -82,7 +79,7 @@ * Intentionally empty here to keep our memory footprint * minimal. */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #define REQUEST_MALFORMED "Request malformedYour HTTP request was syntactically incorrect." #else #define REQUEST_MALFORMED "" @@ -94,8 +91,8 @@ * Intentionally empty here to keep our memory footprint * minimal. */ -#if HAVE_MESSAGES -#define INTERNAL_ERROR "Internal server errorSome programmer needs to study the manual more carefully." +#ifdef HAVE_MESSAGES +#define INTERNAL_ERROR "Internal server errorPlease ask the developer of this Web server to carefully read the GNU libmicrohttpd documentation about connection management and blocking." #else #define INTERNAL_ERROR "" #endif @@ -113,10 +110,242 @@ /** + * Check whether is possible to force push socket buffer content as + * partial packet. + * MHD use different buffering logic depending on whether flushing of + * socket buffer is possible or not. + * If flushing IS possible than MHD activates extra buffering before + * sending data to prevent sending partial packets and flush pending + * data in socket buffer to push last partial packet to client after + * sending logical completed part of data (for example: after sending + * full response header or full response message). + * If flushing IS NOT possible than MHD activates no buffering (no + * delay sending) when it going to send formed fully completed logical + * part of data and activate normal buffering after sending. + * For idled keep-alive connection MHD always activate normal + * buffering. + * + * @param connection connection to check + * @return #MHD_YES if force push is possible, #MHD_NO otherwise + */ +static int +socket_flush_possible(struct MHD_Connection *connection) +{ +#if defined(TCP_CORK) || defined(TCP_PUSH) + return MHD_YES; +#else /* !TCP_CORK && !TCP_PUSH */ + return MHD_NO; +#endif /* !TCP_CORK && !TCP_PUSH */ +} + + +/** + * Activate extra buffering mode on connection socket to prevent + * sending of partial packets. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_extra_buffering (struct MHD_Connection *connection) +{ + int res = MHD_NO; +#if defined(TCP_CORK) || defined(TCP_NOPUSH) + const MHD_SCKT_OPT_BOOL_ on_val = 1; +#if defined(TCP_NODELAY) + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#endif /* TCP_NODELAY */ + if (!connection) + return MHD_NO; +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Buffer data before sending */ + res = (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#if defined(TCP_NODELAY) + /* Enable Nagle's algorithm */ + /* TCP_NODELAY may interfere with TCP_NOPUSH */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NODELAY */ +#else /* TCP_CORK */ +#if defined(TCP_NODELAY) + /* Enable Nagle's algorithm */ + /* TCP_NODELAY may prevent enabling TCP_CORK. Resulting buffering mode depends + solely on TCP_CORK result, so ignoring return code here. */ + (void) setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val)); +#endif /* TCP_NODELAY */ + /* Send only full packets */ + res = (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_CORK */ +#endif /* TCP_CORK || TCP_NOPUSH */ + return res; +} + + +/** + * Activate no buffering mode (no delay sending) on connection socket. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_no_buffering (struct MHD_Connection *connection) +{ +#if defined(TCP_NODELAY) + int res = MHD_YES; + const MHD_SCKT_OPT_BOOL_ on_val = 1; +#if defined(TCP_CORK) || defined(TCP_NOPUSH) + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#endif /* TCP_CORK || TCP_NOPUSH */ + + if (NULL == connection) + return MHD_NO; +#if defined(TCP_CORK) + /* Allow partial packets */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_CORK */ +#if defined(TCP_NODELAY) + /* Disable Nagle's algorithm for sending packets without delay */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NODELAY */ +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Disable extra buffering */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK */ + return res; +#else /* !TCP_NODELAY */ + return MHD_NO; +#endif /* !TCP_NODELAY */ +} + + +/** + * Activate no buffering mode (no delay sending) on connection socket + * and push to client data pending in socket buffer. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_no_buffering_flush (struct MHD_Connection *connection) +{ + int res = MHD_YES; +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + const int dummy = 0; +#endif /* !TCP_CORK */ + + if (NULL == connection) + return MHD_NO; + res = socket_start_no_buffering (connection); +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Force flush data with zero send otherwise Darwin and some BSD systems + will add 5 seconds delay. Not required with TCP_CORK as switching off + TCP_CORK always flushes socket buffer. */ + res &= (0 <= MHD_send_ (connection->socket_fd, + &dummy, + 0)) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK*/ + return res; +} + + +/** + * Activate normal buffering mode on connection socket. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_normal_buffering (struct MHD_Connection *connection) +{ +#if defined(TCP_NODELAY) + int res = MHD_YES; + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#if defined(TCP_CORK) + MHD_SCKT_OPT_BOOL_ cork_val = 0; + socklen_t param_size = sizeof (cork_val); +#endif /* TCP_CORK */ + if (!connection) + return MHD_NO; +#if defined(TCP_CORK) + /* Allow partial packets */ + /* Disabling TCP_CORK will flush partial packet even if TCP_CORK wasn't enabled before + so try to check current value of TCP_CORK to prevent unrequested flushing */ + if ( (0 != getsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (void*)&cork_val, + ¶m_size)) || + (0 != cork_val)) + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#elif defined(TCP_NOPUSH) + /* Disable extra buffering */ + /* No need to check current value as disabling TCP_NOPUSH will not flush partial + packet if TCP_NOPUSH wasn't enabled before */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK */ + /* Enable Nagle's algorithm for normal buffering */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; + return res; +#else /* !TCP_NODELAY */ + return MHD_NO; +#endif /* !TCP_NODELAY */ +} + + +/** * Get all of the headers from the request. * * @param connection connection to get values from - * @param kind types of values to iterate over + * @param kind types of values to iterate over, can be a bitmask * @param iterator callback to call on each header; * maybe NULL (then just count headers) * @param iterator_cls extra argument to @a iterator @@ -126,7 +355,8 @@ int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, - MHD_KeyValueIterator iterator, void *iterator_cls) + MHD_KeyValueIterator iterator, + void *iterator_cls) { int ret; struct MHD_HTTP_Header *pos; @@ -138,9 +368,11 @@ if (0 != (pos->kind & kind)) { ret++; - if ((NULL != iterator) && - (MHD_YES != iterator (iterator_cls, - kind, pos->header, pos->value))) + if ( (NULL != iterator) && + (MHD_YES != iterator (iterator_cls, + pos->kind, + pos->header, + pos->value)) ) return ret; } return ret; @@ -175,12 +407,14 @@ int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, - const char *key, const char *value) + const char *key, + const char *value) { struct MHD_HTTP_Header *pos; pos = MHD_pool_allocate (connection->pool, - sizeof (struct MHD_HTTP_Header), MHD_YES); + sizeof (struct MHD_HTTP_Header), + MHD_YES); if (NULL == pos) return MHD_NO; pos->header = (char *) key; @@ -214,7 +448,8 @@ */ const char * MHD_lookup_connection_value (struct MHD_Connection *connection, - enum MHD_ValueKind kind, const char *key) + enum MHD_ValueKind kind, + const char *key) { struct MHD_HTTP_Header *pos; @@ -225,13 +460,65 @@ ( (key == pos->header) || ( (NULL != pos->header) && (NULL != key) && - (MHD_str_equal_caseless_(key, pos->header))))) + (MHD_str_equal_caseless_(key, + pos->header))))) return pos->value; return NULL; } /** + * Check whether request header contains particular token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param connection the connection to get values from + * @param header the header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +static bool +MHD_lookup_header_token_ci (const struct MHD_Connection *connection, + const char *header, + const char *token, + size_t token_len) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == connection || NULL == header || 0 == header[0] || NULL == token || 0 == token[0]) + return false; + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + { + if ((0 != (pos->kind & MHD_HEADER_KIND)) && + ( (header == pos->header) || + (MHD_str_equal_caseless_(header, + pos->header)) ) && + (MHD_str_has_token_caseless_ (pos->value, token, token_len))) + return true; + } + return false; +} + + +/** + * Check whether request header contains particular static @a tkn. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param c the connection to get values from + * @param h the header name + * @param tkn the static string of token to find + * @return true if token is found in specified header, + * false otherwise + */ +#define MHD_lookup_header_s_token_ci(c,h,tkn) \ + MHD_lookup_header_token_ci((c),(h),(tkn),MHD_STATICSTR_LEN_(tkn)) + + +/** * Do we (still) need to send a 100 continue * message for this connection? * @@ -250,39 +537,144 @@ (NULL != (expect = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_EXPECT))) && - (MHD_str_equal_caseless_(expect, "100-continue")) && + (MHD_str_equal_caseless_(expect, + "100-continue")) && (connection->continue_message_write_offset < - strlen (HTTP_100_CONTINUE)) ); + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) ); +} + + +/** + * Mark connection as "closed". + * @remark To be called from any thread. + * + * @param connection connection to close + */ +void +MHD_connection_mark_closed_ (struct MHD_Connection *connection) +{ + const struct MHD_Daemon *daemon = connection->daemon; + + connection->state = MHD_CONNECTION_CLOSED; + connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; + if (0 == (daemon->options & MHD_USE_TURBO)) + { +#ifdef HTTPS_SUPPORT + /* For TLS connection use shutdown of TLS layer + * and do not shutdown TCP socket. This give more + * chances to send TLS closure data to remote side. + * Closure of TLS layer will be interpreted by + * remote side as end of transmission. */ + if (0 != (daemon->options & MHD_USE_TLS)) + { + if (MHD_NO == MHD_tls_connection_shutdown(connection)) + shutdown (connection->socket_fd, + SHUT_WR); + } + else /* Combined with next 'shutdown()'. */ +#endif /* HTTPS_SUPPORT */ + shutdown (connection->socket_fd, + SHUT_WR); + } } /** * Close the given connection and give the * specified termination code to the user. + * @remark To be called only from thread that + * process connection's recv(), send() and response. * * @param connection connection to close * @param termination_code termination reason to give */ void -MHD_connection_close (struct MHD_Connection *connection, - enum MHD_RequestTerminationCode termination_code) +MHD_connection_close_ (struct MHD_Connection *connection, + enum MHD_RequestTerminationCode termination_code) { - struct MHD_Daemon *daemon; + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_Response *resp = connection->response; - daemon = connection->daemon; - if (0 == (connection->daemon->options & MHD_USE_EPOLL_TURBO)) - shutdown (connection->socket_fd, - (MHD_YES == connection->read_closed) ? SHUT_WR : SHUT_RDWR); - connection->state = MHD_CONNECTION_CLOSED; - connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; + MHD_connection_mark_closed_ (connection); + if (NULL != resp) + { + connection->response = NULL; + MHD_destroy_response (resp); + } if ( (NULL != daemon->notify_completed) && - (MHD_YES == connection->client_aware) ) + (connection->client_aware) ) daemon->notify_completed (daemon->notify_completed_cls, connection, &connection->client_context, termination_code); - connection->client_aware = MHD_NO; + connection->client_aware = false; +} + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Stop TLS forwarding on upgraded connection and + * reflect remote disconnect state to socketpair. + * @remark In thread-per-connection mode this function + * can be called from any thread, in other modes this + * function must be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the upgraded connection + */ +void +MHD_connection_finish_forward_ (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_UpgradeResponseHandle *urh = connection->urh; + + if (0 == (daemon->options & MHD_USE_TLS)) + return; /* Nothing to do with non-TLS connection. */ + + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + DLL_remove (daemon->urh_head, + daemon->urh_tail, + urh); +#if EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + connection->socket_fd, + NULL)) ) + { + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + } + if (urh->in_eready_list) + { + EDLL_remove (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = false; + } +#endif /* EPOLL_SUPPORT */ + if (MHD_INVALID_SOCKET != urh->mhd.socket) + { +#if EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + urh->mhd.socket, + NULL)) ) + { + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + } +#endif /* EPOLL_SUPPORT */ + /* Reflect remote disconnect to application by breaking + * socketpair connection. */ + shutdown (urh->mhd.socket, SHUT_RDWR); + } + /* Socketpair sockets will remain open as they will be + * used with MHD_UPGRADE_ACTION_CLOSE. They will be + * closed by MHD_cleanup_upgraded_connection_() during + * connection's final cleanup. + */ } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ /** @@ -296,20 +688,21 @@ connection_close_error (struct MHD_Connection *connection, const char *emsg) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES if (NULL != emsg) - MHD_DLOG (connection->daemon, emsg); + MHD_DLOG (connection->daemon, + emsg); #endif - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_WITH_ERROR); + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_WITH_ERROR); } /** * Macro to only include error message in call to - * "connection_close_error" if we have HAVE_MESSAGES. + * #connection_close_error() if we have HAVE_MESSAGES. */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg) #else #define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL) @@ -346,8 +739,7 @@ connection->response_write_position) ) return MHD_YES; /* response already ready */ #if LINUX - if ( (MHD_INVALID_SOCKET != response->fd) && - (0 == (connection->daemon->options & MHD_USE_SSL)) ) + if (MHD_resp_sender_sendfile == connection->resp_sender) { /* will use sendfile, no need to bother response crc */ return MHD_YES; @@ -357,22 +749,21 @@ ret = response->crc (response->crc_cls, connection->response_write_position, response->data, - (size_t)MHD_MIN ((uint64_t)response->data_buffer_size, - response->total_size - - connection->response_write_position)); + (size_t) MHD_MIN ((uint64_t)response->data_buffer_size, + response->total_size - + connection->response_write_position)); if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || (((ssize_t) MHD_CONTENT_READER_END_WITH_ERROR) == ret) ) { /* either error or http 1.0 transfer, close socket! */ response->total_size = connection->response_write_position; - if (NULL != response->crc) - (void) MHD_mutex_unlock_ (&response->mutex); + MHD_mutex_unlock_chk_ (&response->mutex); if ( ((ssize_t)MHD_CONTENT_READER_END_OF_STREAM) == ret) - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_COMPLETED_OK); + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_COMPLETED_OK); else CONNECTION_CLOSE_ERROR (connection, - "Closing connection (stream error)\n"); + _("Closing connection (application reported error generating data)\n")); return MHD_NO; } response->data_start = connection->response_write_position; @@ -380,8 +771,7 @@ if (0 == ret) { connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; - if (NULL != response->crc) - (void) MHD_mutex_unlock_ (&response->mutex); + MHD_mutex_unlock_chk_ (&response->mutex); return MHD_NO; } return MHD_YES; @@ -410,7 +800,8 @@ response = connection->response; if (0 == connection->write_buffer_size) { - size = MHD_MIN(connection->daemon->pool_size, 2 * (0xFFFFFF + sizeof(cbuf) + 2)); + size = MHD_MIN (connection->daemon->pool_size, + 2 * (0xFFFFFF + sizeof(cbuf) + 2)); do { size /= 2; @@ -418,10 +809,12 @@ { /* not enough memory */ CONNECTION_CLOSE_ERROR (connection, - "Closing connection (out of memory)\n"); + _("Closing connection (out of memory)\n")); return MHD_NO; } - buf = MHD_pool_allocate (connection->pool, size, MHD_NO); + buf = MHD_pool_allocate (connection->pool, + size, + MHD_NO); } while (NULL == buf); connection->write_buffer_size = size; @@ -437,13 +830,15 @@ { /* difference between response_write_position and data_start is less than data_size which is size_t type, no need to check for overflow */ - const size_t data_write_offset = (size_t)(connection->response_write_position - response->data_start); + const size_t data_write_offset + = (size_t)(connection->response_write_position - response->data_start); /* buffer already ready, use what is there for the chunk */ ret = response->data_size - data_write_offset; if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2 ) ret = connection->write_buffer_size - sizeof (cbuf) - 2; memcpy (&connection->write_buffer[sizeof (cbuf)], - &response->data[data_write_offset], ret); + &response->data[data_write_offset], + ret); } else { @@ -458,14 +853,15 @@ /* error, close socket! */ response->total_size = connection->response_write_position; CONNECTION_CLOSE_ERROR (connection, - "Closing connection (error generating response)\n"); + _("Closing connection (application error generating response)\n")); return MHD_NO; } if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || (0 == response->total_size) ) { /* end of message, signal other side! */ - strcpy (connection->write_buffer, "0\r\n"); + strcpy (connection->write_buffer, + "0\r\n"); connection->write_buffer_append_offset = 3; connection->write_buffer_send_offset = 0; response->total_size = connection->response_write_position; @@ -479,12 +875,17 @@ if (ret > 0xFFFFFF) ret = 0xFFFFFF; cblen = MHD_snprintf_(cbuf, - sizeof (cbuf), - "%X\r\n", (unsigned int) ret); + sizeof (cbuf), + "%X\r\n", + (unsigned int) ret); EXTRA_CHECK(cblen > 0); EXTRA_CHECK(cblen < sizeof(cbuf)); - memcpy (&connection->write_buffer[sizeof (cbuf) - cblen], cbuf, cblen); - memcpy (&connection->write_buffer[sizeof (cbuf) + ret], "\r\n", 2); + memcpy (&connection->write_buffer[sizeof (cbuf) - cblen], + cbuf, + cblen); + memcpy (&connection->write_buffer[sizeof (cbuf) + ret], + "\r\n", + 2); connection->response_write_position += ret; connection->write_buffer_send_offset = sizeof (cbuf) - cblen; connection->write_buffer_append_offset = sizeof (cbuf) + ret + 2; @@ -511,97 +912,111 @@ static int keepalive_possible (struct MHD_Connection *connection) { - const char *end; - + if (MHD_CONN_MUST_CLOSE == connection->keepalive) + return MHD_NO; if (NULL == connection->version) return MHD_NO; if ( (NULL != connection->response) && (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) return MHD_NO; - end = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - MHD_HTTP_HEADER_CONNECTION); + if (MHD_str_equal_caseless_(connection->version, - MHD_HTTP_VERSION_1_1)) - { - if (NULL == end) + MHD_HTTP_VERSION_1_1)) + { + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "upgrade")) + { +#ifdef UPGRADE_SUPPORT + if ( (NULL == connection->response) || + (NULL == connection->response->upgrade_handler) ) +#endif /* UPGRADE_SUPPORT */ + return MHD_NO; + } + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "close")) + return MHD_NO; + return MHD_YES; - if ( (MHD_str_equal_caseless_ (end, "close")) || - (MHD_str_equal_caseless_ (end, "upgrade")) ) - return MHD_NO; - return MHD_YES; - } + } if (MHD_str_equal_caseless_(connection->version, - MHD_HTTP_VERSION_1_0)) - { - if (NULL == end) + MHD_HTTP_VERSION_1_0)) + { + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "Keep-Alive")) + return MHD_YES; + return MHD_NO; - if (MHD_str_equal_caseless_(end, "Keep-Alive")) - return MHD_YES; - return MHD_NO; - } + } return MHD_NO; } /** - * Produce HTTP "Date:" header. + * Produce HTTP time stamp. * * @param date where to write the header, with * at least 128 bytes available space. + * @param date_len number of bytes in @a date */ static void -get_date_string (char *date) +get_date_string (char *date, + size_t date_len) { - static const char *const days[] = - { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static const char *const mons[] = - { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", - "Nov", "Dec" + static const char *const days[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char *const mons[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct tm now; time_t t; -#if defined(_WIN32) && !defined(HAVE_GMTIME_S) && !defined(__CYGWIN__) +#if !defined(HAVE_C11_GMTIME_S) && !defined(HAVE_W32_GMTIME_S) && !defined(HAVE_GMTIME_R) struct tm* pNow; #endif date[0] = 0; time (&t); -#if !defined(_WIN32) - if (NULL != gmtime_r (&t, &now)) - { -#elif defined(HAVE_GMTIME_S) - if (0 == gmtime_s (&now, &t)) - { -#elif defined(__CYGWIN__) - if (NULL != gmtime_r (&t, &now)) - { +#if defined(HAVE_C11_GMTIME_S) + if (NULL == gmtime_s (&t, + &now)) + return; +#elif defined(HAVE_W32_GMTIME_S) + if (0 != gmtime_s (&now, + &t)) + return; +#elif defined(HAVE_GMTIME_R) + if (NULL == gmtime_r(&t, + &now)) + return; #else pNow = gmtime(&t); - if (NULL != pNow) - { - now = *pNow; -#endif - sprintf (date, - "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", - days[now.tm_wday % 7], - (unsigned int) now.tm_mday, - mons[now.tm_mon % 12], - (unsigned int) (1900 + now.tm_year), - (unsigned int) now.tm_hour, - (unsigned int) now.tm_min, - (unsigned int) now.tm_sec); - } + if (NULL == pNow) + return; + now = *pNow; +#endif + MHD_snprintf_ (date, + date_len, + "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", + days[now.tm_wday % 7], + (unsigned int) now.tm_mday, + mons[now.tm_mon % 12], + (unsigned int) (1900 + now.tm_year), + (unsigned int) now.tm_hour, + (unsigned int) now.tm_min, + (unsigned int) now.tm_sec); } /** - * Try growing the read buffer. We initially claim half the - * available buffer space for the read buffer (the other half - * being left for management data structures; the write - * buffer can in the end take virtually everything as the - * read buffer can be reduced to the minimum necessary at that - * point. + * Try growing the read buffer. We initially claim half the available + * buffer space for the read buffer (the other half being left for + * management data structures; the write buffer can in the end take + * virtually everything as the read buffer can be reduced to the + * minimum necessary at that point. * * @param connection the connection * @return #MHD_YES on success, #MHD_NO on failure @@ -652,9 +1067,9 @@ enum MHD_ValueKind kind; const char *reason_phrase; uint32_t rc; - const char *client_requested_close; - const char *response_has_close; - const char *response_has_keepalive; + bool client_requested_close; + bool response_has_close; + bool response_has_keepalive; const char *have_encoding; const char *have_content_length; int must_add_close; @@ -663,37 +1078,41 @@ int must_add_content_length; EXTRA_CHECK (NULL != connection->version); - if (0 == strlen (connection->version)) + if (0 == connection->version[0]) { - data = MHD_pool_allocate (connection->pool, 0, MHD_YES); + data = MHD_pool_allocate (connection->pool, + 0, + MHD_YES); connection->write_buffer = data; connection->write_buffer_append_offset = 0; connection->write_buffer_send_offset = 0; connection->write_buffer_size = 0; return MHD_YES; } + rc = connection->responseCode & (~MHD_ICY_FLAG); if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) { - rc = connection->responseCode & (~MHD_ICY_FLAG); reason_phrase = MHD_get_reason_phrase_for (rc); - sprintf (code, - "%s %u %s\r\n", - (0 != (connection->responseCode & MHD_ICY_FLAG)) - ? "ICY" - : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0, - connection->version)) - ? MHD_HTTP_VERSION_1_0 - : MHD_HTTP_VERSION_1_1), - rc, - reason_phrase); + MHD_snprintf_ (code, + sizeof (code), + "%s %u %s\r\n", + (0 != (connection->responseCode & MHD_ICY_FLAG)) + ? "ICY" + : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0, + connection->version)) + ? MHD_HTTP_VERSION_1_0 + : MHD_HTTP_VERSION_1_1), + rc, + reason_phrase); off = strlen (code); /* estimate size */ size = off + 2; /* +2 for extra "\r\n" at the end */ kind = MHD_HEADER_KIND; - if ( (0 == (connection->daemon->options & MHD_SUPPRESS_DATE_NO_CLOCK)) && + if ( (0 == (connection->daemon->options & MHD_USE_SUPPRESS_DATE_NO_CLOCK)) && (NULL == MHD_get_response_header (connection->response, MHD_HTTP_HEADER_DATE)) ) - get_date_string (date); + get_date_string (date, + sizeof (date)); else date[0] = '\0'; size += strlen (date); @@ -712,31 +1131,38 @@ must_add_chunked_encoding = MHD_NO; must_add_keep_alive = MHD_NO; must_add_content_length = MHD_NO; + response_has_close = false; + response_has_keepalive = false; switch (connection->state) { case MHD_CONNECTION_FOOTERS_RECEIVED: - response_has_close = MHD_get_response_header (connection->response, - MHD_HTTP_HEADER_CONNECTION); - response_has_keepalive = response_has_close; - if ( (NULL != response_has_close) && - (!MHD_str_equal_caseless_ (response_has_close, "close")) ) - response_has_close = NULL; - if ( (NULL != response_has_keepalive) && - (!MHD_str_equal_caseless_ (response_has_keepalive, "Keep-Alive")) ) - response_has_keepalive = NULL; - client_requested_close = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - MHD_HTTP_HEADER_CONNECTION); - if ( (NULL != client_requested_close) && - (!MHD_str_equal_caseless_ (client_requested_close, "close")) ) - client_requested_close = NULL; + response_has_close = MHD_check_response_header_s_token_ci (connection->response, + MHD_HTTP_HEADER_CONNECTION, + "close"); + response_has_keepalive = MHD_check_response_header_s_token_ci (connection->response, + MHD_HTTP_HEADER_CONNECTION, + "Keep-Alive"); + client_requested_close = MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "close"); + + if (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY)) + connection->keepalive = MHD_CONN_MUST_CLOSE; +#ifdef UPGRADE_SUPPORT + else if (NULL != connection->response->upgrade_handler) + /* If this connection will not be "upgraded", it must be closed. */ + connection->keepalive = MHD_CONN_MUST_CLOSE; +#endif /* UPGRADE_SUPPORT */ /* now analyze chunked encoding situation */ - connection->have_chunked_upload = MHD_NO; + connection->have_chunked_upload = false; if ( (MHD_SIZE_UNKNOWN == connection->response->total_size) && - (NULL == response_has_close) && - (NULL == client_requested_close) ) +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ + (! response_has_close) && + (! client_requested_close) ) { /* size is unknown, and close was not explicitly requested; need to either to HTTP 1.1 chunked encoding or @@ -752,31 +1178,36 @@ if (NULL == have_encoding) { must_add_chunked_encoding = MHD_YES; - connection->have_chunked_upload = MHD_YES; + connection->have_chunked_upload = true; } - else if (MHD_str_equal_caseless_(have_encoding, "identity")) + else if (MHD_str_equal_caseless_ (have_encoding, + "identity")) { /* application forced identity encoding, can't do 'chunked' */ must_add_close = MHD_YES; } else { - connection->have_chunked_upload = MHD_YES; + connection->have_chunked_upload = true; } } else { /* Keep alive or chunking not possible => set close header if not present */ - if (NULL == response_has_close) + if (! response_has_close) must_add_close = MHD_YES; } } /* check for other reasons to add 'close' header */ - if ( ( (NULL != client_requested_close) || - (MHD_YES == connection->read_closed) ) && - (NULL == response_has_close) && + if ( ( (client_requested_close) || + (connection->read_closed) || + (MHD_CONN_MUST_CLOSE == connection->keepalive)) && + (! response_has_close) && +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) must_add_close = MHD_YES; @@ -784,7 +1215,13 @@ have_content_length = MHD_get_response_header (connection->response, MHD_HTTP_HEADER_CONTENT_LENGTH); + /* MHD_HTTP_NO_CONTENT, MHD_HTTP_NOT_MODIFIED and 1xx-status + codes SHOULD NOT have a Content-Length according to spec; + also chunked encoding / unknown length or CONNECT... */ if ( (MHD_SIZE_UNKNOWN != connection->response->total_size) && + (MHD_HTTP_NO_CONTENT != rc) && + (MHD_HTTP_NOT_MODIFIED != rc) && + (MHD_HTTP_OK <= rc) && (NULL == have_content_length) && ( (NULL == connection->method) || (! MHD_str_equal_caseless_ (connection->method, @@ -806,49 +1243,69 @@ a recent development of the HTTP 1.1 specification. */ content_length_len - = sprintf (content_length_buf, - MHD_HTTP_HEADER_CONTENT_LENGTH ": " MHD_UNSIGNED_LONG_LONG_PRINTF "\r\n", - (MHD_UNSIGNED_LONG_LONG) connection->response->total_size); + = MHD_snprintf_ (content_length_buf, + sizeof (content_length_buf), + MHD_HTTP_HEADER_CONTENT_LENGTH ": " MHD_UNSIGNED_LONG_LONG_PRINTF "\r\n", + (MHD_UNSIGNED_LONG_LONG) connection->response->total_size); must_add_content_length = MHD_YES; } /* check for adding keep alive */ - if ( (NULL == response_has_keepalive) && - (NULL == response_has_close) && + if ( (! response_has_keepalive) && + (! response_has_close) && (MHD_NO == must_add_close) && - (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) && + (MHD_CONN_MUST_CLOSE != connection->keepalive) && +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ (MHD_YES == keepalive_possible (connection)) ) must_add_keep_alive = MHD_YES; break; case MHD_CONNECTION_BODY_SENT: + response_has_keepalive = false; break; default: EXTRA_CHECK (0); } + if (MHD_CONN_MUST_CLOSE != connection->keepalive) + { + if ( (must_add_close) || (response_has_close) ) + connection->keepalive = MHD_CONN_MUST_CLOSE; + else if ( (must_add_keep_alive) || (response_has_keepalive) ) + connection->keepalive = MHD_CONN_USE_KEEPALIVE; + } + if (must_add_close) - size += strlen ("Connection: close\r\n"); + size += MHD_STATICSTR_LEN_ ("Connection: close\r\n"); if (must_add_keep_alive) - size += strlen ("Connection: Keep-Alive\r\n"); + size += MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n"); if (must_add_chunked_encoding) - size += strlen ("Transfer-Encoding: chunked\r\n"); + size += MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n"); if (must_add_content_length) size += content_length_len; EXTRA_CHECK (! (must_add_close && must_add_keep_alive) ); EXTRA_CHECK (! (must_add_chunked_encoding && must_add_content_length) ); for (pos = connection->response->first_header; NULL != pos; pos = pos->next) - if ( (pos->kind == kind) && - (! ( (MHD_YES == must_add_close) && - (pos->value == response_has_keepalive) && - (MHD_str_equal_caseless_(pos->header, - MHD_HTTP_HEADER_CONNECTION) ) ) ) ) - size += strlen (pos->header) + strlen (pos->value) + 4; /* colon, space, linefeeds */ + { + /* TODO: add proper support for excluding "Keep-Alive" token. */ + if ( (pos->kind == kind) && + (! ( (MHD_YES == must_add_close) && + (response_has_keepalive) && + (MHD_str_equal_caseless_(pos->header, + MHD_HTTP_HEADER_CONNECTION)) && + (MHD_str_equal_caseless_(pos->value, + "Keep-Alive")) ) ) ) + size += strlen (pos->header) + strlen (pos->value) + 4; /* colon, space, linefeeds */ + } /* produce data */ - data = MHD_pool_allocate (connection->pool, size + 1, MHD_NO); + data = MHD_pool_allocate (connection->pool, + size + 1, + MHD_NO); if (NULL == data) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, "Not enough memory for write!\n"); #endif @@ -856,31 +1313,33 @@ } if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) { - memcpy (data, code, off); + memcpy (data, + code, + off); } if (must_add_close) { /* we must add the 'Connection: close' header */ memcpy (&data[off], "Connection: close\r\n", - strlen ("Connection: close\r\n")); - off += strlen ("Connection: close\r\n"); + MHD_STATICSTR_LEN_ ("Connection: close\r\n")); + off += MHD_STATICSTR_LEN_ ("Connection: close\r\n"); } if (must_add_keep_alive) { /* we must add the 'Connection: Keep-Alive' header */ memcpy (&data[off], "Connection: Keep-Alive\r\n", - strlen ("Connection: Keep-Alive\r\n")); - off += strlen ("Connection: Keep-Alive\r\n"); + MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n")); + off += MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n"); } if (must_add_chunked_encoding) { /* we must add the 'Transfer-Encoding: chunked' header */ memcpy (&data[off], "Transfer-Encoding: chunked\r\n", - strlen ("Transfer-Encoding: chunked\r\n")); - off += strlen ("Transfer-Encoding: chunked\r\n"); + MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n")); + off += MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n"); } if (must_add_content_length) { @@ -891,25 +1350,37 @@ off += content_length_len; } for (pos = connection->response->first_header; NULL != pos; pos = pos->next) - if ( (pos->kind == kind) && - (! ( (pos->value == response_has_keepalive) && - (MHD_YES == must_add_close) && - (MHD_str_equal_caseless_(pos->header, - MHD_HTTP_HEADER_CONNECTION) ) ) ) ) - off += sprintf (&data[off], - "%s: %s\r\n", - pos->header, - pos->value); + { + /* TODO: add proper support for excluding "Keep-Alive" token. */ + if ( (pos->kind == kind) && + (! ( (MHD_YES == must_add_close) && + (response_has_keepalive) && + (MHD_str_equal_caseless_(pos->header, + MHD_HTTP_HEADER_CONNECTION)) && + (MHD_str_equal_caseless_(pos->value, + "Keep-Alive")) ) ) ) + off += MHD_snprintf_ (&data[off], + size - off, + "%s: %s\r\n", + pos->header, + pos->value); + } if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) { - strcpy (&data[off], date); + strcpy (&data[off], + date); off += strlen (date); } - memcpy (&data[off], "\r\n", 2); + memcpy (&data[off], + "\r\n", + 2); off += 2; if (off != size) - mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); connection->write_buffer = data; connection->write_buffer_append_offset = size; connection->write_buffer_send_offset = 0; @@ -941,24 +1412,33 @@ connection->version = MHD_HTTP_VERSION_1_0; } connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; - connection->read_closed = MHD_YES; -#if HAVE_MESSAGES + connection->read_closed = true; +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Error %u (`%s') processing request, closing connection.\n", - status_code, message); + _("Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"), + status_code, + message); #endif - EXTRA_CHECK (NULL == connection->response); + if (NULL != connection->response) + { + MHD_destroy_response (connection->response); + connection->response = NULL; + } response = MHD_create_response_from_buffer (strlen (message), (void *) message, MHD_RESPMEM_PERSISTENT); - MHD_queue_response (connection, status_code, response); + MHD_queue_response (connection, + status_code, + response); EXTRA_CHECK (NULL != connection->response); MHD_destroy_response (response); + /* Do not reuse this connection. */ + connection->keepalive = MHD_CONN_MUST_CLOSE; if (MHD_NO == build_header_response (connection)) { /* oops - close! */ CONNECTION_CLOSE_ERROR (connection, - "Closing connection (failed to create response header)\n"); + _("Closing connection (failed to create response header)\n")); } else { @@ -973,29 +1453,32 @@ * perform other updates to the connection if needed to prepare for * the next round of the event loop. * - * @param connection connetion to get poll set for + * @param connection connection to get poll set for */ static void MHD_connection_update_event_loop_info (struct MHD_Connection *connection) { + /* Do not update states of suspended connection */ + if (connection->suspended) + return; /* States will be updated after resume. */ while (1) { #if DEBUG_STATES MHD_DLOG (connection->daemon, - "%s: state: %s\n", + _("In function %s handling connection at state: %s\n"), __FUNCTION__, MHD_state_to_string (connection->state)); #endif switch (connection->state) { -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT case MHD_TLS_CONNECTION_INIT: if (0 == gnutls_record_get_direction (connection->tls_session)) connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; else connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; break; -#endif +#endif /* HTTPS_SUPPORT */ case MHD_CONNECTION_INIT: case MHD_CONNECTION_URL_RECEIVED: case MHD_CONNECTION_HEADER_PART_RECEIVED: @@ -1006,12 +1489,12 @@ { transmit_error_response (connection, (connection->url != NULL) - ? MHD_HTTP_REQUEST_ENTITY_TOO_LARGE - : MHD_HTTP_REQUEST_URI_TOO_LONG, + ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE + : MHD_HTTP_URI_TOO_LONG, REQUEST_TOO_BIG); continue; } - if (MHD_NO == connection->read_closed) + if (! connection->read_closed) connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; else connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; @@ -1030,8 +1513,7 @@ { if ((MHD_YES != try_grow_read_buffer (connection)) && (0 != (connection->daemon->options & - (MHD_USE_SELECT_INTERNALLY | - MHD_USE_THREAD_PER_CONNECTION)))) + MHD_USE_INTERNAL_POLLING_THREAD))) { /* failed to grow the read buffer, and the client which is supposed to handle the @@ -1051,7 +1533,7 @@ } } if ( (connection->read_buffer_offset < connection->read_buffer_size) && - (MHD_NO == connection->read_closed) ) + (! connection->read_closed) ) connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; else connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; @@ -1060,7 +1542,7 @@ case MHD_CONNECTION_FOOTER_PART_RECEIVED: /* while reading footers, we always grow the read buffer if needed, no size-check required */ - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -1104,6 +1586,14 @@ case MHD_CONNECTION_CLOSED: connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; return; /* do nothing, not even reading */ + case MHD_CONNECTION_IN_CLEANUP: + EXTRA_CHECK (0); + break; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + EXTRA_CHECK (0); + break; +#endif /* UPGRADE_SUPPORT */ default: EXTRA_CHECK (0); } @@ -1113,18 +1603,21 @@ /** - * Parse a single line of the HTTP header. Advance - * read_buffer (!) appropriately. If the current line does not - * fit, consider growing the buffer. If the line is - * far too long, close the connection. If no line is - * found (incomplete, buffer too small, line too long), + * Parse a single line of the HTTP header. Advance read_buffer (!) + * appropriately. If the current line does not fit, consider growing + * the buffer. If the line is far too long, close the connection. If + * no line is found (incomplete, buffer too small, line too long), * return NULL. Otherwise return a pointer to the line. * * @param connection connection we're processing - * @return NULL if no full line is available + * @param[out] line_len pointer to variable that receive + * length of line or NULL + * @return NULL if no full line is available; note that the returned + * string will not be 0-termianted */ static char * -get_next_header_line (struct MHD_Connection *connection) +get_next_header_line (struct MHD_Connection *connection, + size_t *line_len) { char *rbuf; size_t pos; @@ -1133,8 +1626,9 @@ return NULL; pos = 0; rbuf = connection->read_buffer; - while ((pos < connection->read_buffer_offset - 1) && - ('\r' != rbuf[pos]) && ('\n' != rbuf[pos])) + while ( (pos < connection->read_buffer_offset - 1) && + ('\r' != rbuf[pos]) && + ('\n' != rbuf[pos]) ) pos++; if ( (pos == connection->read_buffer_offset - 1) && ('\n' != rbuf[pos]) ) @@ -1146,14 +1640,20 @@ { transmit_error_response (connection, (NULL != connection->url) - ? MHD_HTTP_REQUEST_ENTITY_TOO_LARGE - : MHD_HTTP_REQUEST_URI_TOO_LONG, + ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE + : MHD_HTTP_URI_TOO_LONG, REQUEST_TOO_BIG); } + if (line_len) + *line_len = 0; return NULL; } + + if (line_len) + *line_len = pos; /* found, check if we have proper LFCR */ - if (('\r' == rbuf[pos]) && ('\n' == rbuf[pos + 1])) + if ( ('\r' == rbuf[pos]) && + ('\n' == rbuf[pos + 1]) ) rbuf[pos++] = '\0'; /* skip both r and n */ rbuf[pos++] = '\0'; connection->read_buffer += pos; @@ -1176,17 +1676,22 @@ */ static int connection_add_header (struct MHD_Connection *connection, - char *key, char *value, enum MHD_ValueKind kind) + const char *key, + const char *value, + enum MHD_ValueKind kind) { - if (MHD_NO == MHD_set_connection_value (connection, - kind, - key, value)) + if (MHD_NO == + MHD_set_connection_value (connection, + kind, + key, + value)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Not enough memory to allocate header record!\n"); + _("Not enough memory in pool to allocate header record!\n")); #endif - transmit_error_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_TOO_BIG); return MHD_NO; } @@ -1195,98 +1700,9 @@ /** - * Parse and unescape the arguments given by the client as part - * of the HTTP request URI. - * - * @param kind header kind to use for adding to the connection - * @param connection connection to add headers to - * @param args argument URI string (after "?" in URI) - * @return #MHD_NO on failure (out of memory), #MHD_YES for success - */ -static int -parse_arguments (enum MHD_ValueKind kind, - struct MHD_Connection *connection, - char *args) -{ - char *equals; - char *amper; - - while (NULL != args) - { - equals = strchr (args, '='); - amper = strchr (args, '&'); - if (NULL == amper) - { - /* last argument */ - if (NULL == equals) - { - /* got 'foo', add key 'foo' with NULL for value */ - MHD_unescape_plus (args); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - args); - return connection_add_header (connection, - args, - NULL, - kind); - } - /* got 'foo=bar' */ - equals[0] = '\0'; - equals++; - MHD_unescape_plus (args); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - args); - MHD_unescape_plus (equals); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - equals); - return connection_add_header (connection, args, equals, kind); - } - /* amper is non-NULL here */ - amper[0] = '\0'; - amper++; - if ( (NULL == equals) || - (equals >= amper) ) - { - /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ - MHD_unescape_plus (args); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - args); - if (MHD_NO == - connection_add_header (connection, - args, - NULL, - kind)) - return MHD_NO; - /* continue with 'bar' */ - args = amper; - continue; - } - /* equals and amper are non-NULL here, and equals < amper, - so we got regular 'foo=value&bar...'-kind of argument */ - equals[0] = '\0'; - equals++; - MHD_unescape_plus (args); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - args); - MHD_unescape_plus (equals); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - equals); - if (MHD_NO == connection_add_header (connection, args, equals, kind)) - return MHD_NO; - args = amper; - } - return MHD_YES; -} - - -/** * Parse the cookie header (see RFC 2109). * + * @param connection connection to parse header of * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory) */ static int @@ -1307,18 +1723,23 @@ MHD_HTTP_HEADER_COOKIE); if (NULL == hdr) return MHD_YES; - cpy = MHD_pool_allocate (connection->pool, strlen (hdr) + 1, MHD_YES); + cpy = MHD_pool_allocate (connection->pool, + strlen (hdr) + 1, + MHD_YES); if (NULL == cpy) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Not enough memory to parse cookies!\n"); + _("Not enough memory in pool to parse cookies!\n")); #endif - transmit_error_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_TOO_BIG); return MHD_NO; } - memcpy (cpy, hdr, strlen (hdr) + 1); + memcpy (cpy, + hdr, + strlen (hdr) + 1); pos = cpy; while (NULL != pos) { @@ -1326,12 +1747,15 @@ pos++; /* skip spaces */ sce = pos; - while (((*sce) != '\0') && - ((*sce) != ',') && ((*sce) != ';') && ((*sce) != '=')) + while ( ((*sce) != '\0') && + ((*sce) != ',') && + ((*sce) != ';') && + ((*sce) != '=') ) sce++; /* remove tailing whitespace (if any) from key */ ekill = sce - 1; - while ((*ekill == ' ') && (ekill >= pos)) + while ( (*ekill == ' ') && + (ekill >= pos) ) *(ekill--) = '\0'; old = *sce; *sce = '\0'; @@ -1339,7 +1763,10 @@ { /* value part omitted, use empty string... */ if (MHD_NO == - connection_add_header (connection, pos, "", MHD_COOKIE_KIND)) + connection_add_header (connection, + pos, + "", + MHD_COOKIE_KIND)) return MHD_NO; if (old == '\0') break; @@ -1372,8 +1799,11 @@ equals[strlen (equals) - 1] = '\0'; equals++; } - if (MHD_NO == connection_add_header (connection, - pos, equals, MHD_COOKIE_KIND)) + if (MHD_NO == + connection_add_header (connection, + pos, + equals, + MHD_COOKIE_KIND)) return MHD_NO; pos = semicolon; } @@ -1385,50 +1815,94 @@ * Parse the first line of the HTTP HEADER. * * @param connection the connection (updated) - * @param line the first line + * @param line the first line, not 0-terminated + * @param line_len length of the first @a line * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed */ static int parse_initial_message_line (struct MHD_Connection *connection, - char *line) + char *line, + size_t line_len) { + struct MHD_Daemon *daemon = connection->daemon; + const char *curi; char *uri; char *http_version; char *args; + unsigned int unused_num_headers; - if (NULL == (uri = strchr (line, ' '))) + if (NULL == (uri = memchr (line, + ' ', + line_len))) return MHD_NO; /* serious error */ uri[0] = '\0'; connection->method = line; uri++; - while (' ' == uri[0]) + /* Skip any spaces. Not required by standard but allow + to be more tolerant. */ + while ( (' ' == uri[0]) && + ( (size_t)(uri - line) < line_len) ) uri++; - http_version = strchr (uri, ' '); - if (NULL != http_version) + if ((size_t)(uri - line) == line_len) { - http_version[0] = '\0'; - http_version++; + curi = ""; + uri = NULL; + connection->version = ""; + args = NULL; + } + else + { + curi = uri; + /* Search from back to accept misformed URI with space */ + http_version = line + line_len - 1; + /* Skip any trailing spaces */ + while ( (' ' == http_version[0]) && + (http_version > uri) ) + http_version--; + /* Find first space in reverse direction */ + while ( (' ' != http_version[0]) && + (http_version > uri) ) + http_version--; + if (http_version > uri) + { + http_version[0] = '\0'; + connection->version = http_version + 1; + args = memchr (uri, + '?', + http_version - uri); + } + else + { + connection->version = ""; + args = memchr (uri, + '?', + line_len - (uri - line)); + } + } + if (NULL != daemon->uri_log_callback) + { + connection->client_aware = true; + connection->client_context + = daemon->uri_log_callback (daemon->uri_log_callback_cls, + curi, + connection); } - if (NULL != connection->daemon->uri_log_callback) - connection->client_context - = connection->daemon->uri_log_callback (connection->daemon->uri_log_callback_cls, - uri, - connection); - args = strchr (uri, '?'); if (NULL != args) { args[0] = '\0'; args++; - parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args); - } - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - uri); - connection->url = uri; - if (NULL == http_version) - connection->version = ""; - else - connection->version = http_version; + /* note that this call clobbers 'args' */ + MHD_parse_arguments_ (connection, + MHD_GET_ARGUMENT_KIND, + args, + &connection_add_header, + &unused_num_headers); + } + if (NULL != uri) + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + uri); + connection->url = curi; return MHD_YES; } @@ -1448,19 +1922,20 @@ if (NULL != connection->response) return; /* already queued a response */ processed = 0; - connection->client_aware = MHD_YES; + connection->client_aware = true; if (MHD_NO == - connection->daemon->default_handler (connection->daemon-> default_handler_cls, + connection->daemon->default_handler (connection->daemon->default_handler_cls, connection, connection->url, connection->method, connection->version, - NULL, &processed, + NULL, + &processed, &connection->client_context)) { /* serious internal error, close connection */ CONNECTION_CLOSE_ERROR (connection, - "Internal application error, closing connection.\n"); + _("Application reported internal error, closing connection.\n")); return; } } @@ -1477,14 +1952,9 @@ static void process_request_body (struct MHD_Connection *connection) { - size_t processed; size_t available; - size_t used; - size_t i; int instant_retry; - int malformed; char *buffer_head; - char *end; if (NULL != connection->response) return; /* already queued a response */ @@ -1493,25 +1963,32 @@ available = connection->read_buffer_offset; do { + size_t to_be_processed; + size_t left_unprocessed; + size_t processed_size; + instant_retry = MHD_NO; - if ( (MHD_YES == connection->have_chunked_upload) && + if ( (connection->have_chunked_upload) && (MHD_SIZE_UNKNOWN == connection->remaining_upload_size) ) { if ( (connection->current_chunk_offset == connection->current_chunk_size) && - (0 != connection->current_chunk_offset) && + (0LLU != connection->current_chunk_offset) && (available >= 2) ) { + size_t i; /* skip new line at the *end* of a chunk */ i = 0; - if ((buffer_head[i] == '\r') || (buffer_head[i] == '\n')) + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) i++; /* skip 1st part of line feed */ - if ((buffer_head[i] == '\r') || (buffer_head[i] == '\n')) + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) i++; /* skip 2nd part of line feed */ - if (i == 0) + if (0 == i) { /* malformed encoding */ CONNECTION_CLOSE_ERROR (connection, - "Received malformed HTTP request (bad chunked encoding), closing connection.\n"); + _("Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); return; } available -= i; @@ -1522,54 +1999,80 @@ if (connection->current_chunk_offset < connection->current_chunk_size) { + uint64_t cur_chunk_left; /* we are in the middle of a chunk, give as much as possible to the client (without crossing chunk boundaries) */ - processed = - connection->current_chunk_size - - connection->current_chunk_offset; - if (processed > available) - processed = available; - if (available > processed) - instant_retry = MHD_YES; + cur_chunk_left + = connection->current_chunk_size - connection->current_chunk_offset; + if (cur_chunk_left > available) + to_be_processed = available; + else + { /* cur_chunk_left <= (size_t)available */ + to_be_processed = (size_t)cur_chunk_left; + if (available > to_be_processed) + instant_retry = MHD_YES; + } } else { + size_t i; + size_t end_size; + bool malformed; + /* we need to read chunk boundaries */ i = 0; while (i < available) { - if ((buffer_head[i] == '\r') || (buffer_head[i] == '\n')) + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) || + (';' == buffer_head[i]) ) break; i++; - if (i >= 6) + if (i >= 16) break; } - /* take '\n' into account; if '\n' - is the unavailable character, we - will need to wait until we have it + end_size = i; + /* find beginning of CRLF (skip over chunk extensions) */ + if (';' == buffer_head[i]) + { + while (i < available) + { + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) + break; + i++; + } + } + /* take '\n' into account; if '\n' is the unavailable + character, we will need to wait until we have it before going further */ - if ((i + 1 >= available) && - !((i == 1) && (available == 2) && (buffer_head[0] == '0'))) + if ( (i + 1 >= available) && + ! ( (1 == i) && + (2 == available) && + ('0' == buffer_head[0]) ) ) break; /* need more data... */ - malformed = (i >= 6); - if (!malformed) + i++; + malformed = (end_size >= 16); + if (! malformed) { - buffer_head[i] = '\0'; - connection->current_chunk_size = strtoul (buffer_head, &end, 16); - malformed = ('\0' != *end); + size_t num_dig = MHD_strx_to_uint64_n_ (buffer_head, + end_size, + &connection->current_chunk_size); + malformed = (end_size != num_dig); } if (malformed) { /* malformed encoding */ CONNECTION_CLOSE_ERROR (connection, - "Received malformed HTTP request (bad chunked encoding), closing connection.\n"); + _("Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); return; } - i++; - if ((i < available) && - ((buffer_head[i] == '\r') || (buffer_head[i] == '\n'))) - i++; /* skip 2nd part of line feed */ + /* skip 2nd part of line feed */ + if ( (i < available) && + ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) ) + i++; buffer_head += i; available -= i; @@ -1577,7 +2080,7 @@ if (available > 0) instant_retry = MHD_YES; - if (0 == connection->current_chunk_size) + if (0LLU == connection->current_chunk_size) { connection->remaining_upload_size = 0; break; @@ -1592,7 +2095,7 @@ (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) && (connection->remaining_upload_size < available) ) { - processed = (size_t)connection->remaining_upload_size; + to_be_processed = (size_t)connection->remaining_upload_size; } else { @@ -1600,11 +2103,11 @@ * 1. no chunked encoding, give all to the client * 2. client may send large chunked data, but only a smaller part is available at one time. */ - processed = available; + to_be_processed = available; } } - used = processed; - connection->client_aware = MHD_YES; + left_unprocessed = to_be_processed; + connection->client_aware = true; if (MHD_NO == connection->daemon->default_handler (connection->daemon->default_handler_cls, connection, @@ -1612,43 +2115,58 @@ connection->method, connection->version, buffer_head, - &processed, + &left_unprocessed, &connection->client_context)) { /* serious internal error, close connection */ - CONNECTION_CLOSE_ERROR (connection, - "Internal application error, closing connection.\n"); + CONNECTION_CLOSE_ERROR (connection, + _("Application reported internal error, closing connection.\n")); return; } - if (processed > used) - mhd_panic (mhd_panic_cls, __FILE__, __LINE__ -#if HAVE_MESSAGES - , "API violation" + if (left_unprocessed > to_be_processed) + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__ +#ifdef HAVE_MESSAGES + , _("libmicrohttpd API violation") #else , NULL #endif ); - if (0 != processed) - instant_retry = MHD_NO; /* client did not process everything */ - used -= processed; - if (connection->have_chunked_upload == MHD_YES) - connection->current_chunk_offset += used; + if (0 != left_unprocessed) + { + instant_retry = MHD_NO; /* client did not process everything */ +#ifdef HAVE_MESSAGES + /* client did not process all upload data, complain if + the setup was incorrect, which may prevent us from + handling the rest of the request */ + if ( (0 != (connection->daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && + (! connection->suspended) ) + MHD_DLOG (connection->daemon, + _("WARNING: incomplete upload processing and connection not suspended may result in hung connection.\n")); +#endif + } + processed_size = to_be_processed - left_unprocessed; + if (connection->have_chunked_upload) + connection->current_chunk_offset += processed_size; /* dh left "processed" bytes in buffer for next time... */ - buffer_head += used; - available -= used; - if (connection->remaining_upload_size != MHD_SIZE_UNKNOWN) - connection->remaining_upload_size -= used; + buffer_head += processed_size; + available -= processed_size; + if (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) + connection->remaining_upload_size -= processed_size; } while (MHD_YES == instant_retry); if (available > 0) - memmove (connection->read_buffer, buffer_head, available); + memmove (connection->read_buffer, + buffer_head, + available); connection->read_buffer_offset = available; } /** - * Try reading data from the socket into the - * read buffer of the connection. + * Try reading data from the socket into the read buffer of the + * connection. * * @param connection connection we're processing * @return #MHD_YES if something changed, @@ -1669,24 +2187,27 @@ connection->read_buffer_offset); if (bytes_read < 0) { - const int err = MHD_socket_errno_; - if ((EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err)) + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err) || + MHD_SCKT_ERR_IS_EAGAIN_ (err)) return MHD_NO; - if (ECONNRESET == err) + if (MHD_SCKT_ERR_IS_REMOTE_DISCNN_ (err)) { - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return MHD_NO; } - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return MHD_YES; } if (0 == bytes_read) { /* other side closed connection; RFC 2616, section 8.1.4 suggests we should then shutdown ourselves as well. */ - connection->read_closed = MHD_YES; - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_CLIENT_ABORT); + connection->read_closed = true; + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_CLIENT_ABORT); return MHD_YES; } connection->read_buffer_offset += bytes_read; @@ -1716,15 +2237,17 @@ if (ret < 0) { - const int err = MHD_socket_errno_; - if ((EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err)) + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err) || + MHD_SCKT_ERR_IS_EAGAIN_ (err)) return MHD_NO; - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return MHD_YES; } #if DEBUG_SEND_DATA fprintf (stderr, - "Sent response: `%.*s'\n", + _("Sent response: `%.*s'\n"), ret, &connection->write_buffer[connection->write_buffer_send_offset]); #endif @@ -1756,7 +2279,8 @@ connection->state = next_state; MHD_pool_reallocate (connection->pool, connection->write_buffer, - connection->write_buffer_size, 0); + connection->write_buffer_size, + 0); connection->write_buffer = NULL; connection->write_buffer_size = 0; return MHD_YES; @@ -1773,7 +2297,8 @@ * @return #MHD_YES on success, #MHD_NO on error (malformed @a line) */ static int -process_header_line (struct MHD_Connection *connection, char *line) +process_header_line (struct MHD_Connection *connection, + char *line) { char *colon; @@ -1783,13 +2308,31 @@ { /* error in header line, die hard */ CONNECTION_CLOSE_ERROR (connection, - "Received malformed line (no colon), closing connection.\n"); + _("Received malformed line (no colon). Closing connection.\n")); return MHD_NO; } + if (-1 >= connection->daemon->strict_for_client) + { + /* check for whitespace before colon, which is not allowed + by RFC 7230 section 3.2.4; we count space ' ' and + tab '\t', but not '\r\n' as those would have ended the line. */ + const char *white; + + white = strchr (line, ' '); + if ( (NULL != white) && + (white < colon) ) + return MHD_NO; + white = strchr (line, '\t'); + if ( (NULL != white) && + (white < colon) ) + return MHD_NO; + } /* zero-terminate header */ colon[0] = '\0'; colon++; /* advance to value */ - while ((colon[0] != '\0') && ((colon[0] == ' ') || (colon[0] == '\t'))) + while ( ('\0' != colon[0]) && + ( (' ' == colon[0]) || + ('\t' == colon[0]) ) ) colon++; /* we do the actual adding of the connection header at the beginning of the while @@ -1814,7 +2357,8 @@ */ static int process_broken_line (struct MHD_Connection *connection, - char *line, enum MHD_ValueKind kind) + char *line, + enum MHD_ValueKind kind) { char *last; char *tmp; @@ -1822,14 +2366,16 @@ size_t tmp_len; last = connection->last; - if ((line[0] == ' ') || (line[0] == '\t')) + if ( (' ' == line[0]) || + ('\t' == line[0]) ) { /* value was continued on the next line, see http://www.jmarshall.com/easy/http/ */ last_len = strlen (last); /* skip whitespace at start of 2nd line */ tmp = line; - while ((tmp[0] == ' ') || (tmp[0] == '\t')) + while ( (' ' == tmp[0]) || + ('\t' == tmp[0]) ) tmp++; tmp_len = strlen (tmp); /* FIXME: we might be able to do this better (faster!), as most @@ -1837,7 +2383,7 @@ memory; however, doing this right gets tricky if we have a value continued over multiple lines (in which case we need to record how often we have done this so we can check for - adjaency); also, in the case where these are not adjacent + adjacency); also, in the case where these are not adjacent (not sure how it can happen!), we would want to allocate from the end of the pool, so as to not destroy the read-buffer's ability to grow nicely. */ @@ -1848,7 +2394,7 @@ if (NULL == last) { transmit_error_response (connection, - MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_TOO_BIG); return MHD_NO; } @@ -1856,21 +2402,27 @@ connection->last = last; return MHD_YES; /* possibly more than 2 lines... */ } - EXTRA_CHECK ((NULL != last) && (NULL != connection->colon)); + EXTRA_CHECK ( (NULL != last) && + (NULL != connection->colon) ); if ((MHD_NO == connection_add_header (connection, - last, connection->colon, kind))) + last, + connection->colon, + kind))) { - transmit_error_response (connection, MHD_HTTP_REQUEST_ENTITY_TOO_LARGE, + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_TOO_BIG); return MHD_NO; } /* we still have the current line to deal with... */ - if (0 != strlen (line)) + if (0 != line[0]) { - if (MHD_NO == process_header_line (connection, line)) + if (MHD_NO == process_header_line (connection, + line)) { transmit_error_response (connection, - MHD_HTTP_BAD_REQUEST, REQUEST_MALFORMED); + MHD_HTTP_BAD_REQUEST, + REQUEST_MALFORMED); return MHD_NO; } } @@ -1889,15 +2441,15 @@ parse_connection_headers (struct MHD_Connection *connection) { const char *clen; - MHD_UNSIGNED_LONG_LONG cval; struct MHD_Response *response; const char *enc; - char *end; + const char *end; parse_cookie_header (connection); - if ( (0 != (MHD_USE_PEDANTIC_CHECKS & connection->daemon->options)) && + if ( (1 <= connection->daemon->strict_for_client) && (NULL != connection->version) && - (MHD_str_equal_caseless_(MHD_HTTP_VERSION_1_1, connection->version)) && + (MHD_str_equal_caseless_(MHD_HTTP_VERSION_1_1, + connection->version)) && (NULL == MHD_lookup_connection_value (connection, MHD_HEADER_KIND, @@ -1905,18 +2457,19 @@ { /* die, http 1.1 request without host and we are pedantic */ connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; - connection->read_closed = MHD_YES; -#if HAVE_MESSAGES + connection->read_closed = true; +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Received `%s' request without `%s' header.\n", - MHD_HTTP_VERSION_1_1, MHD_HTTP_HEADER_HOST); + _("Received HTTP 1.1 request without `Host' header.\n")); #endif EXTRA_CHECK (NULL == connection->response); response = - MHD_create_response_from_buffer (strlen (REQUEST_LACKS_HOST), + MHD_create_response_from_buffer (MHD_STATICSTR_LEN_ (REQUEST_LACKS_HOST), REQUEST_LACKS_HOST, MHD_RESPMEM_PERSISTENT); - MHD_queue_response (connection, MHD_HTTP_BAD_REQUEST, response); + MHD_queue_response (connection, + MHD_HTTP_BAD_REQUEST, + response); MHD_destroy_response (response); return; } @@ -1928,8 +2481,9 @@ if (NULL != enc) { connection->remaining_upload_size = MHD_SIZE_UNKNOWN; - if (MHD_str_equal_caseless_(enc, "chunked")) - connection->have_chunked_upload = MHD_YES; + if (MHD_str_equal_caseless_(enc, + "chunked")) + connection->have_chunked_upload = true; } else { @@ -1938,20 +2492,20 @@ MHD_HTTP_HEADER_CONTENT_LENGTH); if (NULL != clen) { - cval = strtoul (clen, &end, 10); - if ( ('\0' != *end) || - ( (LONG_MAX == cval) && (errno == ERANGE) ) ) + end = clen + MHD_str_to_uint64_ (clen, + &connection->remaining_upload_size); + if ( (clen == end) || + ('\0' != *end) ) { -#if HAVE_MESSAGES + connection->remaining_upload_size = 0; +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Failed to parse `%s' header `%s', closing connection.\n", - MHD_HTTP_HEADER_CONTENT_LENGTH, - clen); + "Failed to parse `Content-Length' header. Closing connection.\n"); #endif - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return; } - connection->remaining_upload_size = cval; } } } @@ -1964,28 +2518,33 @@ * * @param connection the connection that saw some activity */ -static void -update_last_activity (struct MHD_Connection *connection) +void +MHD_update_last_activity_ (struct MHD_Connection *connection) { struct MHD_Daemon *daemon = connection->daemon; + if (0 == connection->connection_timeout) + return; /* Skip update of activity for connections + without timeout timer. */ + if (connection->suspended) + return; /* no activity on suspended connections */ + connection->last_activity = MHD_monotonic_sec_counter(); + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + return; /* each connection has personal timeout */ + if (connection->connection_timeout != daemon->connection_timeout) return; /* custom timeout, no need to move it in "normal" DLL */ + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); /* move connection to head of timeout list (by remove + add operation) */ - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); XDLL_remove (daemon->normal_timeout_head, daemon->normal_timeout_tail, connection); XDLL_insert (daemon->normal_timeout_head, daemon->normal_timeout_tail, connection); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); } @@ -2000,8 +2559,8 @@ int MHD_connection_handle_read (struct MHD_Connection *connection) { - update_last_activity (connection); - if (MHD_CONNECTION_CLOSED == connection->state) + if ( (MHD_CONNECTION_CLOSED == connection->state) || + (connection->suspended) ) return MHD_YES; /* make sure "read" has a reasonable number of bytes in buffer to use per system call (if possible) */ @@ -2010,10 +2569,12 @@ try_grow_read_buffer (connection); if (MHD_NO == do_read (connection)) return MHD_YES; + MHD_update_last_activity_ (connection); while (1) { #if DEBUG_STATES - MHD_DLOG (connection->daemon, "%s: state: %s\n", + MHD_DLOG (connection->daemon, + _("In function %s handling connection at state: %s\n"), __FUNCTION__, MHD_state_to_string (connection->state)); #endif @@ -2029,15 +2590,20 @@ case MHD_CONNECTION_BODY_RECEIVED: case MHD_CONNECTION_FOOTER_PART_RECEIVED: /* nothing to do but default action */ - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_READ_ERROR); + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_READ_ERROR); continue; } break; case MHD_CONNECTION_CLOSED: return MHD_YES; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + EXTRA_CHECK (0); + break; +#endif /* UPGRADE_SUPPORT */ default: /* shrink read buffer to how much is actually used */ MHD_pool_reallocate (connection->pool, @@ -2065,12 +2631,14 @@ { struct MHD_Response *response; ssize_t ret; + if (connection->suspended) + return MHD_YES; - update_last_activity (connection); while (1) { #if DEBUG_STATES - MHD_DLOG (connection->daemon, "%s: state: %s\n", + MHD_DLOG (connection->daemon, + _("In function %s handling connection at state: %s\n"), __FUNCTION__, MHD_state_to_string (connection->state)); #endif @@ -2088,28 +2656,33 @@ ret = connection->send_cls (connection, &HTTP_100_CONTINUE [connection->continue_message_write_offset], - strlen (HTTP_100_CONTINUE) - + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) - connection->continue_message_write_offset); if (ret < 0) { - const int err = MHD_socket_errno_; - if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) + const int err = MHD_socket_get_error_ (); + + if (MHD_SCKT_ERR_IS_EINTR_ (err) || + MHD_SCKT_ERR_IS_EAGAIN_ (err)) break; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Failed to send data: %s\n", - MHD_socket_last_strerr_ ()); + _("Failed to send data in request for %s: %s\n"), + connection->url, + MHD_socket_strerr_ (err)); #endif - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return MHD_YES; } #if DEBUG_SEND_DATA fprintf (stderr, - "Sent 100 continue response: `%.*s'\n", + _("Sent 100 continue response: `%.*s'\n"), (int) ret, &HTTP_100_CONTINUE[connection->continue_message_write_offset]); #endif connection->continue_message_write_offset += ret; + MHD_update_last_activity_ (connection); break; case MHD_CONNECTION_CONTINUE_SENT: case MHD_CONNECTION_BODY_RECEIVED: @@ -2118,13 +2691,14 @@ EXTRA_CHECK (0); break; case MHD_CONNECTION_HEADERS_SENDING: - do_write (connection); - if (connection->state != MHD_CONNECTION_HEADERS_SENDING) + if (MHD_NO != do_write (connection)) + MHD_update_last_activity_ (connection); + if (MHD_CONNECTION_HEADERS_SENDING != connection->state) break; - check_write_done (connection, MHD_CONNECTION_HEADERS_SENT); + check_write_done (connection, + MHD_CONNECTION_HEADERS_SENT); break; case MHD_CONNECTION_HEADERS_SENT: - EXTRA_CHECK (0); break; case MHD_CONNECTION_NORMAL_BODY_READY: response = connection->response; @@ -2133,44 +2707,52 @@ { int err; uint64_t data_write_offset; + if (NULL != response->crc) - (void) MHD_mutex_lock_ (&response->mutex); + MHD_mutex_lock_chk_ (&response->mutex); if (MHD_YES != try_ready_normal_body (connection)) - break; + { + /* mutex was already unlocked by try_ready_normal_body */ + break; + } data_write_offset = connection->response_write_position - response->data_start; if (data_write_offset > (uint64_t)SIZE_MAX) - MHD_PANIC("Data offset exceeds limit"); + MHD_PANIC (_("Data offset exceeds limit")); ret = connection->send_cls (connection, &response->data [(size_t)data_write_offset], response->data_size - (size_t)data_write_offset); - err = MHD_socket_errno_; #if DEBUG_SEND_DATA if (ret > 0) fprintf (stderr, - "Sent %d-byte DATA response: `%.*s'\n", + _("Sent %d-byte DATA response: `%.*s'\n"), (int) ret, (int) ret, &response->data[connection->response_write_position - response->data_start]); #endif if (NULL != response->crc) - (void) MHD_mutex_unlock_ (&response->mutex); + MHD_mutex_unlock_chk_ (&response->mutex); if (ret < 0) { - if ((err == EINTR) || (err == EAGAIN) || (EWOULDBLOCK == err)) + err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err) || + MHD_SCKT_ERR_IS_EAGAIN_ (err)) return MHD_YES; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Failed to send data: %s\n", - MHD_socket_last_strerr_ ()); + _("Failed to send data in request for `%s': %s\n"), + connection->url, + MHD_socket_strerr_ (err)); #endif - CONNECTION_CLOSE_ERROR (connection, NULL); + CONNECTION_CLOSE_ERROR (connection, + NULL); return MHD_YES; } connection->response_write_position += ret; + MHD_update_last_activity_ (connection); } if (connection->response_write_position == connection->response->total_size) @@ -2180,7 +2762,8 @@ EXTRA_CHECK (0); break; case MHD_CONNECTION_CHUNKED_BODY_READY: - do_write (connection); + if (MHD_NO != do_write (connection)) + MHD_update_last_activity_ (connection); if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state) break; check_write_done (connection, @@ -2194,10 +2777,12 @@ EXTRA_CHECK (0); break; case MHD_CONNECTION_FOOTERS_SENDING: - do_write (connection); - if (connection->state != MHD_CONNECTION_FOOTERS_SENDING) + if (MHD_NO != do_write (connection)) + MHD_update_last_activity_ (connection); + if (MHD_CONNECTION_FOOTERS_SENDING != connection->state) break; - check_write_done (connection, MHD_CONNECTION_FOOTERS_SENT); + check_write_done (connection, + MHD_CONNECTION_FOOTERS_SENT); break; case MHD_CONNECTION_FOOTERS_SENT: EXTRA_CHECK (0); @@ -2207,10 +2792,18 @@ case MHD_TLS_CONNECTION_INIT: EXTRA_CHECK (0); break; + case MHD_CONNECTION_IN_CLEANUP: + EXTRA_CHECK (0); + break; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + EXTRA_CHECK (0); + break; +#endif /* UPGRADE_SUPPORT */ default: EXTRA_CHECK (0); CONNECTION_CLOSE_ERROR (connection, - "Internal error\n"); + _("Internal error\n")); return MHD_YES; } break; @@ -2222,6 +2815,8 @@ /** * Clean up the state of the given connection and move it into the * clean up queue for final disposal. + * @remark To be called only from thread that process connection's + * recv(), send() and response. * * @param connection handle for the connection to clean up */ @@ -2230,45 +2825,67 @@ { struct MHD_Daemon *daemon = connection->daemon; + if (connection->in_cleanup) + return; /* Prevent double cleanup. */ + connection->in_cleanup = true; if (NULL != connection->response) { MHD_destroy_response (connection->response); connection->response = NULL; } - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - if (connection->connection_timeout == daemon->connection_timeout) - XDLL_remove (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); - else - XDLL_remove (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - connection); - if (MHD_YES == connection->suspended) - DLL_remove (daemon->suspended_connections_head, - daemon->suspended_connections_tail, - connection); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (connection->suspended) + { + DLL_remove (daemon->suspended_connections_head, + daemon->suspended_connections_tail, + connection); + connection->suspended = false; + } else - DLL_remove (daemon->connections_head, - daemon->connections_tail, - connection); + { + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } + DLL_remove (daemon->connections_head, + daemon->connections_tail, + connection); + } DLL_insert (daemon->cleanup_head, daemon->cleanup_tail, connection); - connection->suspended = MHD_NO; - connection->resuming = MHD_NO; - connection->in_idle = MHD_NO; - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_(&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + connection->resuming = false; + connection->in_idle = false; + MHD_mutex_unlock_chk_(&daemon->cleanup_connection_mutex); + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + /* if we were at the connection limit before and are in + thread-per-connection mode, signal the main thread + to resume accepting connections */ + if ( (MHD_ITC_IS_VALID_ (daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "c")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal end of connection via inter-thread communication channel")); +#endif + } + } } /** * This function was created to handle per-connection processing that * has to happen even if the socket cannot be read or written to. + * @remark To be called only from thread that process connection's + * recv(), send() and response. * * @param connection connection to handle * @return #MHD_YES if we should continue to process the @@ -2278,29 +2895,34 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) { struct MHD_Daemon *daemon = connection->daemon; - unsigned int timeout; - const char *end; char *line; - int client_close; + size_t line_len; + int ret; - connection->in_idle = MHD_YES; - while (1) + connection->in_idle = true; + while (! connection->suspended) { #if DEBUG_STATES MHD_DLOG (daemon, - "%s: state: %s\n", + _("In function %s handling connection at state: %s\n"), __FUNCTION__, MHD_state_to_string (connection->state)); #endif switch (connection->state) { case MHD_CONNECTION_INIT: - line = get_next_header_line (connection); - if (NULL == line) + line = get_next_header_line (connection, + &line_len); + /* Check for empty string, as we might want + to tolerate 'spurious' empty lines; also + NULL means we didn't get a full line yet; + line is not 0-terminated here. */ + if ( (NULL == line) || + (0 == line[0]) ) { if (MHD_CONNECTION_INIT != connection->state) continue; - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -2308,18 +2930,22 @@ } break; } - if (MHD_NO == parse_initial_message_line (connection, line)) - CONNECTION_CLOSE_ERROR (connection, NULL); + if (MHD_NO == parse_initial_message_line (connection, + line, + line_len)) + CONNECTION_CLOSE_ERROR (connection, + NULL); else connection->state = MHD_CONNECTION_URL_RECEIVED; continue; case MHD_CONNECTION_URL_RECEIVED: - line = get_next_header_line (connection); + line = get_next_header_line (connection, + NULL); if (NULL == line) { if (MHD_CONNECTION_URL_RECEIVED != connection->state) continue; - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -2327,12 +2953,14 @@ } break; } - if (strlen (line) == 0) + if (0 == line[0]) { connection->state = MHD_CONNECTION_HEADERS_RECEIVED; + connection->header_size = (size_t) (line - connection->read_buffer); continue; } - if (MHD_NO == process_header_line (connection, line)) + if (MHD_NO == process_header_line (connection, + line)) { transmit_error_response (connection, MHD_HTTP_BAD_REQUEST, @@ -2342,12 +2970,13 @@ connection->state = MHD_CONNECTION_HEADER_PART_RECEIVED; continue; case MHD_CONNECTION_HEADER_PART_RECEIVED: - line = get_next_header_line (connection); + line = get_next_header_line (connection, + NULL); if (NULL == line) { if (connection->state != MHD_CONNECTION_HEADER_PART_RECEIVED) continue; - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -2356,11 +2985,14 @@ break; } if (MHD_NO == - process_broken_line (connection, line, MHD_HEADER_KIND)) + process_broken_line (connection, + line, + MHD_HEADER_KIND)) continue; - if (0 == strlen (line)) + if (0 == line[0]) { connection->state = MHD_CONNECTION_HEADERS_RECEIVED; + connection->header_size = (size_t) (line - connection->read_buffer); continue; } continue; @@ -2369,6 +3001,8 @@ if (MHD_CONNECTION_CLOSED == connection->state) continue; connection->state = MHD_CONNECTION_HEADERS_PROCESSED; + if (connection->suspended) + break; continue; case MHD_CONNECTION_HEADERS_PROCESSED: call_connection_handler (connection); /* first call */ @@ -2377,27 +3011,39 @@ if (need_100_continue (connection)) { connection->state = MHD_CONNECTION_CONTINUE_SENDING; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_no_buffering (connection); + break; } if ( (NULL != connection->response) && ( (MHD_str_equal_caseless_ (connection->method, - MHD_HTTP_METHOD_POST)) || + MHD_HTTP_METHOD_POST)) || (MHD_str_equal_caseless_ (connection->method, - MHD_HTTP_METHOD_PUT))) ) + MHD_HTTP_METHOD_PUT))) ) { /* we refused (no upload allowed!) */ connection->remaining_upload_size = 0; /* force close, in case client still tries to upload... */ - connection->read_closed = MHD_YES; + connection->read_closed = true; } connection->state = (0 == connection->remaining_upload_size) ? MHD_CONNECTION_FOOTERS_RECEIVED : MHD_CONNECTION_CONTINUE_SENT; + if (connection->suspended) + break; continue; case MHD_CONNECTION_CONTINUE_SENDING: if (connection->continue_message_write_offset == - strlen (HTTP_100_CONTINUE)) + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) { connection->state = MHD_CONNECTION_CONTINUE_SENT; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + else + socket_start_normal_buffering (connection); + continue; } break; @@ -2408,26 +3054,29 @@ if (MHD_CONNECTION_CLOSED == connection->state) continue; } - if ((0 == connection->remaining_upload_size) || - ((connection->remaining_upload_size == MHD_SIZE_UNKNOWN) && - (0 == connection->read_buffer_offset) && - (MHD_YES == connection->read_closed))) + if ( (0 == connection->remaining_upload_size) || + ( (MHD_SIZE_UNKNOWN == connection->remaining_upload_size) && + (0 == connection->read_buffer_offset) && + (connection->read_closed) ) ) { - if ((MHD_YES == connection->have_chunked_upload) && - (MHD_NO == connection->read_closed)) + if ( (connection->have_chunked_upload) && + (! connection->read_closed) ) connection->state = MHD_CONNECTION_BODY_RECEIVED; else connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; continue; } break; case MHD_CONNECTION_BODY_RECEIVED: - line = get_next_header_line (connection); + line = get_next_header_line (connection, + NULL); if (NULL == line) { if (connection->state != MHD_CONNECTION_BODY_RECEIVED) continue; - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -2435,12 +3084,15 @@ } break; } - if (0 == strlen (line)) + if (0 == line[0]) { connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; continue; } - if (MHD_NO == process_header_line (connection, line)) + if (MHD_NO == process_header_line (connection, + line)) { transmit_error_response (connection, MHD_HTTP_BAD_REQUEST, @@ -2450,12 +3102,13 @@ connection->state = MHD_CONNECTION_FOOTER_PART_RECEIVED; continue; case MHD_CONNECTION_FOOTER_PART_RECEIVED: - line = get_next_header_line (connection); + line = get_next_header_line (connection, + NULL); if (NULL == line) { if (connection->state != MHD_CONNECTION_FOOTER_PART_RECEIVED) continue; - if (MHD_YES == connection->read_closed) + if (connection->read_closed) { CONNECTION_CLOSE_ERROR (connection, NULL); @@ -2464,11 +3117,15 @@ break; } if (MHD_NO == - process_broken_line (connection, line, MHD_FOOTER_KIND)) + process_broken_line (connection, + line, + MHD_FOOTER_KIND)) continue; - if (0 == strlen (line)) + if (0 == line[0]) { connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; continue; } continue; @@ -2482,24 +3139,54 @@ { /* oops - close! */ CONNECTION_CLOSE_ERROR (connection, - "Closing connection (failed to create response header)\n"); + _("Closing connection (failed to create response header)\n")); continue; } connection->state = MHD_CONNECTION_HEADERS_SENDING; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_no_buffering (connection); -#if HAVE_DECL_TCP_CORK - /* starting header send, set TCP cork */ - { - const int val = 1; - setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val, - sizeof (val)); - } -#endif break; case MHD_CONNECTION_HEADERS_SENDING: /* no default action */ break; case MHD_CONNECTION_HEADERS_SENT: + /* Some clients may take some actions right after header receive */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + +#ifdef UPGRADE_SUPPORT + if (NULL != connection->response->upgrade_handler) + { + socket_start_normal_buffering (connection); + connection->state = MHD_CONNECTION_UPGRADE; + /* This connection is "upgraded". Pass socket to application. */ + if (MHD_YES != + MHD_response_execute_upgrade_ (connection->response, + connection)) + { + /* upgrade failed, fail hard */ + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + /* Response is not required anymore for this connection. */ + if (NULL != connection->response) + { + struct MHD_Response * const resp = connection->response; + connection->response = NULL; + MHD_destroy_response (resp); + } + continue; + } +#endif /* UPGRADE_SUPPORT */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_normal_buffering (connection); + if (connection->have_chunked_upload) connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; else @@ -2510,21 +3197,25 @@ break; case MHD_CONNECTION_NORMAL_BODY_UNREADY: if (NULL != connection->response->crc) - (void) MHD_mutex_lock_ (&connection->response->mutex); + MHD_mutex_lock_chk_ (&connection->response->mutex); if (0 == connection->response->total_size) { if (NULL != connection->response->crc) - (void) MHD_mutex_unlock_ (&connection->response->mutex); + MHD_mutex_unlock_chk_ (&connection->response->mutex); connection->state = MHD_CONNECTION_BODY_SENT; continue; } if (MHD_YES == try_ready_normal_body (connection)) { if (NULL != connection->response->crc) - (void) MHD_mutex_unlock_ (&connection->response->mutex); + MHD_mutex_unlock_chk_ (&connection->response->mutex); connection->state = MHD_CONNECTION_NORMAL_BODY_READY; + /* Buffering for flushable socket was already enabled*/ + if (MHD_NO == socket_flush_possible (connection)) + socket_start_no_buffering (connection); break; } + /* mutex was already unlocked by "try_ready_normal_body */ /* not ready, no socket action */ break; case MHD_CONNECTION_CHUNKED_BODY_READY: @@ -2532,35 +3223,38 @@ break; case MHD_CONNECTION_CHUNKED_BODY_UNREADY: if (NULL != connection->response->crc) - (void) MHD_mutex_lock_ (&connection->response->mutex); + MHD_mutex_lock_chk_ (&connection->response->mutex); if ( (0 == connection->response->total_size) || (connection->response_write_position == connection->response->total_size) ) { if (NULL != connection->response->crc) - (void) MHD_mutex_unlock_ (&connection->response->mutex); + MHD_mutex_unlock_chk_ (&connection->response->mutex); connection->state = MHD_CONNECTION_BODY_SENT; continue; } if (MHD_YES == try_ready_chunked_body (connection)) { if (NULL != connection->response->crc) - (void) MHD_mutex_unlock_ (&connection->response->mutex); + MHD_mutex_unlock_chk_ (&connection->response->mutex); connection->state = MHD_CONNECTION_CHUNKED_BODY_READY; + /* Buffering for flushable socket was already enabled */ + if (MHD_NO == socket_flush_possible (connection)) + socket_start_no_buffering (connection); continue; } if (NULL != connection->response->crc) - (void) MHD_mutex_unlock_ (&connection->response->mutex); + MHD_mutex_unlock_chk_ (&connection->response->mutex); break; case MHD_CONNECTION_BODY_SENT: if (MHD_NO == build_header_response (connection)) { /* oops - close! */ CONNECTION_CLOSE_ERROR (connection, - "Closing connection (failed to create response header)\n"); + _("Closing connection (failed to create response header)\n")); continue; } - if ( (MHD_NO == connection->have_chunked_upload) || + if ( (! connection->have_chunked_upload) || (connection->write_buffer_send_offset == connection->write_buffer_append_offset) ) connection->state = MHD_CONNECTION_FOOTERS_SENT; @@ -2571,48 +3265,37 @@ /* no default action */ break; case MHD_CONNECTION_FOOTERS_SENT: -#if HAVE_DECL_TCP_CORK - /* done sending, uncork */ - { - const int val = 0; - setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val, - sizeof (val)); - } -#endif - end = - MHD_get_response_header (connection->response, - MHD_HTTP_HEADER_CONNECTION); - client_close = ((NULL != end) && (MHD_str_equal_caseless_(end, "close"))); + if (MHD_HTTP_PROCESSING == connection->responseCode) + { + /* After this type of response, we allow sending another! */ + connection->state = MHD_CONNECTION_HEADERS_PROCESSED; + MHD_destroy_response (connection->response); + connection->response = NULL; + /* FIXME: maybe partially reset memory pool? */ + continue; + } + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + else + socket_start_normal_buffering (connection); + MHD_destroy_response (connection->response); connection->response = NULL; if ( (NULL != daemon->notify_completed) && - (MHD_YES == connection->client_aware) ) + (connection->client_aware) ) { + connection->client_aware = false; daemon->notify_completed (daemon->notify_completed_cls, connection, &connection->client_context, MHD_REQUEST_TERMINATED_COMPLETED_OK); - connection->client_aware = MHD_NO; } - end = - MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - MHD_HTTP_HEADER_CONNECTION); - if ( (MHD_YES == connection->read_closed) || - (client_close) || - ( (NULL != end) && - (MHD_str_equal_caseless_ (end, "close")) ) ) - { - connection->read_closed = MHD_YES; - connection->read_buffer_offset = 0; - } - if (((MHD_YES == connection->read_closed) && - (0 == connection->read_buffer_offset)) || - (MHD_NO == keepalive_possible (connection))) + if ( (MHD_CONN_USE_KEEPALIVE != connection->keepalive) || + (connection->read_closed) ) { /* have to close for some reason */ - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_COMPLETED_OK); + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_COMPLETED_OK); MHD_pool_destroy (connection->pool); connection->pool = NULL; connection->read_buffer = NULL; @@ -2622,21 +3305,34 @@ else { /* can try to keep-alive */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_normal_buffering (connection); connection->version = NULL; connection->state = MHD_CONNECTION_INIT; + connection->last = NULL; + connection->colon = NULL; + connection->header_size = 0; + connection->keepalive = MHD_CONN_KEEPALIVE_UNKOWN; + /* Reset the read buffer to the starting size, + preserving the bytes we have already read. */ connection->read_buffer = MHD_pool_reset (connection->pool, connection->read_buffer, - connection->read_buffer_size); + connection->read_buffer_offset, + connection->daemon->pool_size / 2); + connection->read_buffer_size + = connection->daemon->pool_size / 2; } - connection->client_aware = MHD_NO; + connection->client_aware = false; connection->client_context = NULL; connection->continue_message_write_offset = 0; connection->responseCode = 0; connection->headers_received = NULL; connection->headers_received_tail = NULL; connection->response_write_position = 0; - connection->have_chunked_upload = MHD_NO; + connection->have_chunked_upload = false; + connection->current_chunk_size = 0; + connection->current_chunk_offset = 0; connection->method = NULL; connection->url = NULL; connection->write_buffer = NULL; @@ -2647,71 +3343,45 @@ case MHD_CONNECTION_CLOSED: cleanup_connection (connection); return MHD_NO; - default: +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + connection->in_idle = false; + return MHD_YES; /* keep open */ +#endif /* UPGRADE_SUPPORT */ + default: EXTRA_CHECK (0); break; } break; } - timeout = connection->connection_timeout; - if ( (0 != timeout) && - (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) ) - { - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); - connection->in_idle = MHD_NO; - return MHD_YES; + if (! connection->suspended) + { + time_t timeout; + timeout = connection->connection_timeout; + if ( (0 != timeout) && + (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)) ) + { + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); + connection->in_idle = false; + return MHD_YES; + } } MHD_connection_update_event_loop_info (connection); -#if EPOLL_SUPPORT - switch (connection->event_loop_info) + ret = MHD_YES; +#ifdef EPOLL_SUPPORT + if ( (! connection->suspended) && + (0 != (daemon->options & MHD_USE_EPOLL)) ) { - case MHD_EVENT_LOOP_INFO_READ: - if ( (0 != (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) && - (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) && - (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) ) - { - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - connection); - connection->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - break; - case MHD_EVENT_LOOP_INFO_WRITE: - if ( (0 != (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY)) && - (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) && - (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) ) - { - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - connection); - connection->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - break; - case MHD_EVENT_LOOP_INFO_BLOCK: - /* we should look at this connection again in the next iteration - of the event loop, as we're waiting on the application */ - if ( (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) && - (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED))) ) - { - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - connection); - connection->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - break; - case MHD_EVENT_LOOP_INFO_CLEANUP: - /* This connection is finished, nothing left to do */ - break; + ret = MHD_connection_epoll_update_ (connection); } - return MHD_connection_epoll_update_ (connection); -#else - return MHD_YES; -#endif +#endif /* EPOLL_SUPPORT */ + connection->in_idle = false; + return ret; } -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * Perform epoll() processing, possibly moving the connection back into * the epoll() set if needed. @@ -2725,29 +3395,28 @@ { struct MHD_Daemon *daemon = connection->daemon; - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) && (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) && - ( (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY)) || - ( (0 == (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) && - ( (MHD_EVENT_LOOP_INFO_READ == connection->event_loop_info) || - (connection->read_buffer_size > connection->read_buffer_offset) ) && - (MHD_NO == connection->read_closed) ) ) ) + ( ( (MHD_EVENT_LOOP_INFO_WRITE == connection->event_loop_info) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY))) || + ( (MHD_EVENT_LOOP_INFO_READ == connection->event_loop_info) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) ) ) ) { /* add to epoll set */ struct epoll_event event; - event.events = EPOLLIN | EPOLLOUT | EPOLLET; + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; event.data.ptr = connection; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, connection->socket_fd, &event)) { -#if HAVE_MESSAGES - if (0 != (daemon->options & MHD_USE_DEBUG)) +#ifdef HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_ERROR_LOG)) MHD_DLOG (daemon, - "Call to epoll_ctl failed: %s\n", + _("Call to epoll_ctl failed: %s\n"), MHD_socket_last_strerr_ ()); #endif connection->state = MHD_CONNECTION_CLOSED; @@ -2756,7 +3425,6 @@ } connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET; } - connection->in_idle = MHD_NO; return MHD_YES; } #endif @@ -2788,26 +3456,27 @@ */ const union MHD_ConnectionInfo * MHD_get_connection_info (struct MHD_Connection *connection, - enum MHD_ConnectionInfoType info_type, ...) + enum MHD_ConnectionInfoType info_type, + ...) { switch (info_type) { -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT case MHD_CONNECTION_INFO_CIPHER_ALGO: - if (connection->tls_session == NULL) + if (NULL == connection->tls_session) return NULL; connection->cipher = gnutls_cipher_get (connection->tls_session); return (const union MHD_ConnectionInfo *) &connection->cipher; case MHD_CONNECTION_INFO_PROTOCOL: - if (connection->tls_session == NULL) + if (NULL == connection->tls_session) return NULL; connection->protocol = gnutls_protocol_get_version (connection->tls_session); return (const union MHD_ConnectionInfo *) &connection->protocol; case MHD_CONNECTION_INFO_GNUTLS_SESSION: - if (connection->tls_session == NULL) + if (NULL == connection->tls_session) return NULL; return (const union MHD_ConnectionInfo *) &connection->tls_session; -#endif +#endif /* HTTPS_SUPPORT */ case MHD_CONNECTION_INFO_CLIENT_ADDRESS: return (const union MHD_ConnectionInfo *) &connection->addr; case MHD_CONNECTION_INFO_DAEMON: @@ -2816,9 +3485,21 @@ return (const union MHD_ConnectionInfo *) &connection->socket_fd; case MHD_CONNECTION_INFO_SOCKET_CONTEXT: return (const union MHD_ConnectionInfo *) &connection->socket_context; + case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED: + connection->suspended_dummy = connection->suspended ? MHD_YES : MHD_NO; + return (const union MHD_ConnectionInfo *) &connection->suspended_dummy; + case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT: + connection->connection_timeout_dummy = (unsigned int)connection->connection_timeout; + return (const union MHD_ConnectionInfo *) &connection->connection_timeout_dummy; + case MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE: + if ( (MHD_CONNECTION_HEADERS_RECEIVED > connection->state) || + (MHD_CONNECTION_CLOSED == connection->state) || + (MHD_CONNECTION_IN_CLEANUP == connection->state) ) + return NULL; /* invalid, too early! */ + return (const union MHD_ConnectionInfo *) &connection->header_size; default: return NULL; - }; + } } @@ -2843,37 +3524,39 @@ switch (option) { case MHD_CONNECTION_OPTION_TIMEOUT: - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - if (MHD_YES != connection->suspended) + if (0 == connection->connection_timeout) + connection->last_activity = MHD_monotonic_sec_counter(); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! connection->suspended) ) { if (connection->connection_timeout == daemon->connection_timeout) XDLL_remove (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); + daemon->normal_timeout_tail, + connection); else XDLL_remove (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - connection); + daemon->manual_timeout_tail, + connection); } va_start (ap, option); - connection->connection_timeout = va_arg (ap, unsigned int); + connection->connection_timeout = va_arg (ap, + unsigned int); va_end (ap); - if (MHD_YES != connection->suspended) + if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! connection->suspended) ) { if (connection->connection_timeout == daemon->connection_timeout) XDLL_insert (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); + daemon->normal_timeout_tail, + connection); else XDLL_insert (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - connection); + daemon->manual_timeout_tail, + connection); } - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); return MHD_YES; default: return MHD_NO; @@ -2897,35 +3580,73 @@ unsigned int status_code, struct MHD_Response *response) { +#ifdef UPGRADE_SUPPORT + struct MHD_Daemon *daemon; +#endif /* UPGRADE_SUPPORT */ + if ( (NULL == connection) || (NULL == response) || (NULL != connection->response) || ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) && (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) ) return MHD_NO; +#ifdef UPGRADE_SUPPORT + daemon = connection->daemon; + if ( (NULL != response->upgrade_handler) && + (0 == (daemon->options & MHD_ALLOW_UPGRADE)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n")); +#endif + return MHD_NO; + } + if ( (MHD_HTTP_SWITCHING_PROTOCOLS != status_code) && + (NULL != response->upgrade_handler) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Application used invalid status code for 'upgrade' response!\n")); +#endif + return MHD_NO; + } +#endif /* UPGRADE_SUPPORT */ MHD_increment_response_rc (response); connection->response = response; connection->responseCode = status_code; - if ( (NULL != connection->method) && - (MHD_str_equal_caseless_ (connection->method, MHD_HTTP_METHOD_HEAD)) ) - { - /* if this is a "HEAD" request, pretend that we - have already sent the full message body */ +#if LINUX + if ( (response->fd == -1) || + (0 != (connection->daemon->options & MHD_USE_TLS)) ) + connection->resp_sender = MHD_resp_sender_std; + else + connection->resp_sender = MHD_resp_sender_sendfile; +#endif /* LINUX */ + + if ( ( (NULL != connection->method) && + (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_HEAD)) ) || + (MHD_HTTP_OK > status_code) || + (MHD_HTTP_NO_CONTENT == status_code) || + (MHD_HTTP_NOT_MODIFIED == status_code) ) + { + /* if this is a "HEAD" request, or a status code for + which a body is not allowed, pretend that we + have already sent the full message body. */ connection->response_write_position = response->total_size; } if ( (MHD_CONNECTION_HEADERS_PROCESSED == connection->state) && (NULL != connection->method) && ( (MHD_str_equal_caseless_ (connection->method, - MHD_HTTP_METHOD_POST)) || + MHD_HTTP_METHOD_POST)) || (MHD_str_equal_caseless_ (connection->method, - MHD_HTTP_METHOD_PUT))) ) + MHD_HTTP_METHOD_PUT))) ) { /* response was queued "early", refuse to read body / footers or further requests! */ - connection->read_closed = MHD_YES; + connection->read_closed = true; connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; } - if (MHD_NO == connection->in_idle) + if (! connection->in_idle) (void) MHD_connection_handle_idle (connection); return MHD_YES; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection.h libmicrohttpd-0.9.55/src/microhttpd/connection.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/connection.h 2017-05-28 22:34:00.000000000 +0200 @@ -22,6 +22,7 @@ * @brief Methods for managing connections * @author Daniel Pittman * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) */ #ifndef CONNECTION_H @@ -72,6 +73,8 @@ * has to happen even if the socket cannot be read or written to. All * implementations (multithreaded, external select, internal select) * call this function. + * @remark To be called only from thread that process connection's + * recv(), send() and response. * * @param connection connection to handle * @return MHD_YES if we should continue to process the @@ -82,18 +85,43 @@ /** + * Mark connection as "closed". + * @remark To be called from any thread. + * + * @param connection connection to close + */ +void +MHD_connection_mark_closed_ (struct MHD_Connection *connection); + + +/** * Close the given connection and give the * specified termination code to the user. + * @remark To be called only from thread that + * process connection's recv(), send() and response. * * @param connection connection to close * @param termination_code termination reason to give */ void -MHD_connection_close (struct MHD_Connection *connection, - enum MHD_RequestTerminationCode termination_code); +MHD_connection_close_ (struct MHD_Connection *connection, + enum MHD_RequestTerminationCode termination_code); + + +#ifdef HTTPS_SUPPORT +/** + * Stop TLS forwarding on upgraded connection and + * reflect remote disconnect state to socketpair. + * @param connection the upgraded connection + */ +void +MHD_connection_finish_forward_ (struct MHD_Connection *connection); +#else /* ! HTTPS_SUPPORT */ +#define MHD_connection_finish_forward_(conn) (void)conn +#endif /* ! HTTPS_SUPPORT */ -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * Perform epoll processing, possibly moving the connection back into * the epoll set if needed. @@ -106,5 +134,14 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection); #endif +/** + * Update the 'last_activity' field of the connection to the current time + * and move the connection to the head of the 'normal_timeout' list if + * the timeout for the connection uses the default value. + * + * @param connection the connection that saw some activity + */ +void +MHD_update_last_activity_ (struct MHD_Connection *connection); #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection_https.c libmicrohttpd-0.9.55/src/microhttpd/connection_https.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection_https.c 2015-09-13 15:50:21.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/connection_https.c 2017-05-28 22:34:00.000000000 +0200 @@ -48,29 +48,29 @@ { int ret; - connection->last_activity = MHD_monotonic_sec_counter(); - if (connection->state == MHD_TLS_CONNECTION_INIT) + if (MHD_TLS_CONNECTION_INIT == connection->state) { ret = gnutls_handshake (connection->tls_session); if (ret == GNUTLS_E_SUCCESS) { /* set connection state to enable HTTP processing */ connection->state = MHD_CONNECTION_INIT; - return MHD_YES; + MHD_update_last_activity_ (connection); + return MHD_NO; } - if ( (ret == GNUTLS_E_AGAIN) || - (ret == GNUTLS_E_INTERRUPTED) ) + if ( (GNUTLS_E_AGAIN == ret) || + (GNUTLS_E_INTERRUPTED == ret) ) { /* handshake not done */ return MHD_YES; } /* handshake failed */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Error: received handshake message out of context\n"); + _("Error: received handshake message out of context\n")); #endif - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_WITH_ERROR); + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_WITH_ERROR); return MHD_YES; } return MHD_NO; @@ -132,18 +132,16 @@ static int MHD_tls_connection_handle_idle (struct MHD_Connection *connection) { - unsigned int timeout; + time_t timeout; #if DEBUG_STATES MHD_DLOG (connection->daemon, - "%s: state: %s\n", + _("In function %s handling connection at state: %s\n"), __FUNCTION__, MHD_state_to_string (connection->state)); #endif - timeout = connection->connection_timeout; - if ( (timeout != 0) && (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity))) - MHD_connection_close (connection, - MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); + if (connection->suspended) + return MHD_connection_handle_idle (connection); switch (connection->state) { /* on newly created connections we might reach here before any reply has been received */ @@ -151,15 +149,16 @@ break; /* close connection if necessary */ case MHD_CONNECTION_CLOSED: - gnutls_bye (connection->tls_session, GNUTLS_SHUT_RDWR); return MHD_connection_handle_idle (connection); default: - if ( (0 != gnutls_record_check_pending (connection->tls_session)) && - (MHD_YES != MHD_tls_connection_handle_read (connection)) ) - return MHD_YES; return MHD_connection_handle_idle (connection); } -#if EPOLL_SUPPORT + timeout = connection->connection_timeout; + if ( (timeout != 0) && + (timeout < (MHD_monotonic_sec_counter() - connection->last_activity))) + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); +#ifdef EPOLL_SUPPORT return MHD_connection_epoll_update_ (connection); #else return MHD_YES; @@ -181,4 +180,22 @@ connection->idle_handler = &MHD_tls_connection_handle_idle; } + +/** + * Initiate shutdown of TLS layer of connection. + * + * @param connection to use + * @return #MHD_YES if succeed, #MHD_NO otherwise. + */ +int +MHD_tls_connection_shutdown (struct MHD_Connection *connection) +{ + if (connection->tls_closed) + return MHD_NO; + + connection->tls_closed = true; + return (GNUTLS_E_SUCCESS == gnutls_bye(connection->tls_session, GNUTLS_SHUT_WR)) ? + MHD_YES : MHD_NO; +} + /* end of connection_https.c */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection_https.h libmicrohttpd-0.9.55/src/microhttpd/connection_https.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/connection_https.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/connection_https.h 2017-05-28 22:34:00.000000000 +0200 @@ -28,7 +28,7 @@ #include "internal.h" -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT /** * Set connection callback function to be used through out * the processing of this secure connection. @@ -37,6 +37,16 @@ */ void MHD_set_https_callbacks (struct MHD_Connection *connection); -#endif + + +/** + * Initiate shutdown of TLS layer of connection. + * + * @param connection to use + * @return #MHD_YES if succeed, #MHD_NO otherwise. + */ +int +MHD_tls_connection_shutdown (struct MHD_Connection *connection); +#endif /* HTTPS_SUPPORT */ #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/daemon.c libmicrohttpd-0.9.55/src/microhttpd/daemon.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/daemon.c 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/daemon.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007-2014 Daniel Pittman and Christian Grothoff + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -23,15 +23,10 @@ * @brief A minimal-HTTP server library * @author Daniel Pittman * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) */ -#if defined(MHD_WINSOCK_SOCKETS) -/* override small default value */ -#define FD_SETSIZE 1024 -#define MHD_DEFAULT_FD_SETSIZE 64 -#else -#define MHD_DEFAULT_FD_SETSIZE FD_SETSIZE -#endif #include "platform.h" +#include "mhd_threads.h" #include "internal.h" #include "response.h" #include "connection.h" @@ -39,6 +34,10 @@ #include "mhd_limits.h" #include "autoinit_funcs.h" #include "mhd_mono_clock.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_itc.h" +#include "mhd_compat.h" #if HAVE_SEARCH_H #include @@ -46,14 +45,10 @@ #include "tsearch.h" #endif -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT #include "connection_https.h" #include -#endif - -#if defined(HAVE_POLL_H) && defined(HAVE_POLL) -#include -#endif +#endif /* HTTPS_SUPPORT */ #ifdef LINUX #include @@ -64,20 +59,15 @@ #define WIN32_LEAN_AND_MEAN 1 #endif /* !WIN32_LEAN_AND_MEAN */ #include -#include -#endif - -#ifndef HAVE_ACCEPT4 -#define HAVE_ACCEPT4 0 #endif /** * Default connection limit. */ -#ifndef MHD_WINSOCK_SOCKETS -#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE - 4 +#ifdef MHD_POSIX_SOCKETS +#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 4) #else -#define MHD_MAX_CONNECTIONS_DEFAULT FD_SETSIZE +#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 2) #endif /** @@ -85,13 +75,6 @@ */ #define MHD_POOL_SIZE_DEFAULT (32 * 1024) -#ifdef TCP_FASTOPEN -/** - * Default TCP fastopen queue size. - */ -#define MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT 10 -#endif - /** * Print extra messages with reasons for closing * sockets? (only adds non-error messages). @@ -104,20 +87,35 @@ */ #define DEBUG_CONNECT MHD_NO -#ifndef LINUX -#ifndef MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 -#endif -#endif -#ifndef SOCK_CLOEXEC -#define SOCK_CLOEXEC 0 -#endif +/* Forward declarations. */ -#ifndef EPOLL_CLOEXEC -#define EPOLL_CLOEXEC 0 -#endif +/** + * Close all connections for the daemon. + * Must only be called when MHD_Daemon::shutdown was set to #MHD_YES. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon to close down + */ +static void +close_all_connections (struct MHD_Daemon *daemon); + +#ifdef EPOLL_SUPPORT + +/** + * Do epoll()-based processing (this function is allowed to + * block if @a may_block is set to #MHD_YES). + * + * @param daemon daemon to run poll loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_epoll (struct MHD_Daemon *daemon, + int may_block); +#endif /* EPOLL_SUPPORT */ /** * Default implementation of the panic function, @@ -134,9 +132,12 @@ unsigned int line, const char *reason) { -#if HAVE_MESSAGES - fprintf (stderr, "Fatal error in GNU libmicrohttpd %s:%u: %s\n", - file, line, reason); +#ifdef HAVE_MESSAGES + fprintf (stderr, + _("Fatal error in GNU libmicrohttpd %s:%u: %s\n"), + file, + line, + reason); #endif abort (); } @@ -148,7 +149,7 @@ MHD_PanicCallback mhd_panic; /** - * Closure argument for "mhd_panic". + * Closure argument for #mhd_panic. */ void *mhd_panic_cls; @@ -159,6 +160,7 @@ static int mhd_winsock_inited_ = 0; #endif + /** * Trace up to and return master daemon. If the supplied daemon * is a master, then return the daemon itself. @@ -217,10 +219,7 @@ static void MHD_ip_count_lock (struct MHD_Daemon *daemon) { - if (MHD_YES != MHD_mutex_lock_(&daemon->per_ip_connection_mutex)) - { - MHD_PANIC ("Failed to acquire IP connection limit mutex\n"); - } + MHD_mutex_lock_chk_(&daemon->per_ip_connection_mutex); } @@ -232,10 +231,7 @@ static void MHD_ip_count_unlock (struct MHD_Daemon *daemon) { - if (MHD_YES != MHD_mutex_unlock_(&daemon->per_ip_connection_mutex)) - { - MHD_PANIC ("Failed to release IP connection limit mutex\n"); - } + MHD_mutex_unlock_chk_(&daemon->per_ip_connection_mutex); } @@ -249,17 +245,21 @@ * @return -1, 0 or 1 depending on result of compare */ static int -MHD_ip_addr_compare (const void *a1, const void *a2) +MHD_ip_addr_compare (const void *a1, + const void *a2) { - return memcmp (a1, a2, offsetof (struct MHD_IPCount, count)); + return memcmp (a1, + a2, + offsetof (struct MHD_IPCount, + count)); } /** - * Parse address and initialize 'key' using the address. + * Parse address and initialize @a key using the address. * * @param addr address to parse - * @param addrlen number of bytes in addr + * @param addrlen number of bytes in @a addr * @param key where to store the parsed address * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type) */ @@ -268,14 +268,19 @@ socklen_t addrlen, struct MHD_IPCount *key) { - memset(key, 0, sizeof(*key)); + memset(key, + 0, + sizeof(*key)); /* IPv4 addresses */ if (sizeof (struct sockaddr_in) == addrlen) { const struct sockaddr_in *addr4 = (const struct sockaddr_in*) addr; + key->family = AF_INET; - memcpy (&key->addr.ipv4, &addr4->sin_addr, sizeof(addr4->sin_addr)); + memcpy (&key->addr.ipv4, + &addr4->sin_addr, + sizeof(addr4->sin_addr)); return MHD_YES; } @@ -284,8 +289,11 @@ if (sizeof (struct sockaddr_in6) == addrlen) { const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*) addr; + key->family = AF_INET6; - memcpy (&key->addr.ipv6, &addr6->sin6_addr, sizeof(addr6->sin6_addr)); + memcpy (&key->addr.ipv6, + &addr6->sin6_addr, + sizeof(addr6->sin6_addr)); return MHD_YES; } #endif @@ -296,11 +304,13 @@ /** - * Check if IP address is over its limit. + * Check if IP address is over its limit in terms of the number + * of allowed concurrent connections. If the IP is still allowed, + * increments the connection counter. * * @param daemon handle to daemon where connection counts are tracked * @param addr address to add (or increment counter) - * @param addrlen number of bytes in addr + * @param addrlen number of bytes in @a addr * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit. * Also returns #MHD_NO if fails to allocate memory. */ @@ -323,7 +333,9 @@ return MHD_NO; /* Initialize key */ - if (MHD_NO == MHD_ip_addr_to_key (addr, addrlen, key)) + if (MHD_NO == MHD_ip_addr_to_key (addr, + addrlen, + key)) { /* Allow unhandled address types through */ free (key); @@ -336,9 +348,9 @@ &daemon->per_ip_connection_count, &MHD_ip_addr_compare))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to add IP connection count node\n"); + _("Failed to add IP connection count node\n")); #endif MHD_ip_count_unlock (daemon); free (key); @@ -382,7 +394,9 @@ if (0 == daemon->per_ip_connection_limit) return; /* Initialize search key */ - if (MHD_NO == MHD_ip_addr_to_key (addr, addrlen, &search_key)) + if (MHD_NO == MHD_ip_addr_to_key (addr, + addrlen, + &search_key)) return; MHD_ip_count_lock (daemon); @@ -394,13 +408,13 @@ { /* Something's wrong if we couldn't find an IP address * that was previously added */ - MHD_PANIC ("Failed to find previously-added IP address\n"); + MHD_PANIC (_("Failed to find previously-added IP address\n")); } found_key = (struct MHD_IPCount *) *nodep; /* Validate existing count for IP address */ if (0 == found_key->count) { - MHD_PANIC ("Previously-added IP address had 0 count\n"); + MHD_PANIC (_("Previously-added IP address had counter of zero\n")); } /* Remove the node entirely if count reduces to 0 */ if (0 == --found_key->count) @@ -415,7 +429,7 @@ } -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT /** * Callback for receiving data from the socket. * @@ -425,22 +439,25 @@ * @return number of bytes actually received */ static ssize_t -recv_tls_adapter (struct MHD_Connection *connection, void *other, size_t i) +recv_tls_adapter (struct MHD_Connection *connection, + void *other, + size_t i) { ssize_t res; - if (MHD_YES == connection->tls_read_ready) - { - connection->daemon->num_tls_read_ready--; - connection->tls_read_ready = MHD_NO; - } - res = gnutls_record_recv (connection->tls_session, other, i); + if (i > SSIZE_MAX) + i = SSIZE_MAX; + + res = gnutls_record_recv (connection->tls_session, + other, + i); if ( (GNUTLS_E_AGAIN == res) || (GNUTLS_E_INTERRUPTED == res) ) { - MHD_set_socket_errno_ (EINTR); -#if EPOLL_SUPPORT - connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; + MHD_socket_set_error_ (MHD_SCKT_EINTR_); +#ifdef EPOLL_SUPPORT + if (GNUTLS_E_AGAIN == res) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; #endif return -1; } @@ -449,14 +466,20 @@ /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication disrupted); set errno to something caller will interpret correctly as a hard error */ - MHD_set_socket_errno_ (ECONNRESET); + MHD_socket_set_error_ (MHD_SCKT_ECONNRESET_); + connection->tls_read_ready = false; return res; } - if ((size_t)res == i) - { - connection->tls_read_ready = MHD_YES; - connection->daemon->num_tls_read_ready++; - } + +#ifdef EPOLL_SUPPORT + /* If data not available to fill whole buffer - socket is not read ready anymore. */ + if (i > (size_t)res) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; +#endif /* EPOLL_SUPPORT */ + + /* Check whether TLS buffers still have some unread data. */ + connection->tls_read_ready = ( ((size_t)res == i) && + (0 != gnutls_record_check_pending (connection->tls_session)) ); return res; } @@ -471,17 +494,24 @@ */ static ssize_t send_tls_adapter (struct MHD_Connection *connection, - const void *other, size_t i) + const void *other, + size_t i) { - int res; + ssize_t res; + + if (i > SSIZE_MAX) + i = SSIZE_MAX; - res = gnutls_record_send (connection->tls_session, other, i); + res = gnutls_record_send (connection->tls_session, + other, + i); if ( (GNUTLS_E_AGAIN == res) || (GNUTLS_E_INTERRUPTED == res) ) { - MHD_set_socket_errno_ (EINTR); -#if EPOLL_SUPPORT - connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; + MHD_socket_set_error_ (MHD_SCKT_EINTR_); +#ifdef EPOLL_SUPPORT + if (GNUTLS_E_AGAIN == res) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; #endif return -1; } @@ -491,9 +521,14 @@ really understand the error (not listed in GnuTLS documentation explicitly), we set 'errno' to something that will cause the connection to fail. */ - MHD_set_socket_errno_ (ECONNRESET); + MHD_socket_set_error_ (MHD_SCKT_ECONNRESET_); return -1; } +#ifdef EPOLL_SUPPORT + /* If NOT all available data was sent - socket is not write ready anymore. */ + if (i > (size_t)res) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ return res; } @@ -522,10 +557,11 @@ { cert.data = (unsigned char *) daemon->https_mem_trust; cert.size = strlen (daemon->https_mem_trust); - if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, &cert, + if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, + &cert, GNUTLS_X509_FMT_PEM) < 0) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG(daemon, "Bad trust certificate format\n"); #endif @@ -533,7 +569,7 @@ } } - if (MHD_YES == daemon->have_dhparams) + if (daemon->have_dhparams) { gnutls_certificate_set_dh_params (daemon->x509_cred, daemon->https_mem_dhparams); @@ -550,24 +586,26 @@ if (NULL != daemon->https_key_password) { #if GNUTLS_VERSION_NUMBER >= 0x030111 ret = gnutls_certificate_set_x509_key_mem2 (daemon->x509_cred, - &cert, &key, + &cert, + &key, GNUTLS_X509_FMT_PEM, daemon->https_key_password, 0); #else -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to setup x509 certificate/key: pre 3.X.X version " \ - "of GnuTLS does not support setting key password"); + _("Failed to setup x509 certificate/key: pre 3.X.X version " \ + "of GnuTLS does not support setting key password")); #endif return -1; #endif } else ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred, - &cert, &key, + &cert, + &key, GNUTLS_X509_FMT_PEM); -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES if (0 != ret) MHD_DLOG (daemon, "GnuTLS failed to setup x509 certificate/key: %s\n", @@ -579,7 +617,7 @@ if (NULL != daemon->cert_callback) return 0; #endif -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, "You need to specify a certificate and key location\n"); #endif @@ -604,54 +642,16 @@ return GNUTLS_E_MEMORY_ERROR; return MHD_init_daemon_certificate (daemon); default: -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Error: invalid credentials type %d specified.\n", + _("Error: invalid credentials type %d specified.\n"), daemon->cred_type); #endif return -1; } } -#endif - - -/** - * Add @a fd to the @a set. If @a fd is - * greater than @a max_fd, set @a max_fd to @a fd. - * - * @param fd file descriptor to add to the @a set - * @param set set to modify - * @param max_fd maximum value to potentially update - * @param fd_setsize value of FD_SETSIZE - * @return #MHD_YES on success, #MHD_NO otherwise - */ -static int -add_to_fd_set (MHD_socket fd, - fd_set *set, - MHD_socket *max_fd, - unsigned int fd_setsize) -{ - if (NULL == set) - return MHD_NO; -#ifdef MHD_WINSOCK_SOCKETS - if (set->fd_count >= fd_setsize) - { - if (FD_ISSET(fd, set)) - return MHD_YES; - else - return MHD_NO; - } -#else /* ! MHD_WINSOCK_SOCKETS */ - if (fd >= (MHD_socket)fd_setsize) - return MHD_NO; -#endif /* ! MHD_WINSOCK_SOCKETS */ - FD_SET (fd, set); - if ( (NULL != max_fd) && (MHD_INVALID_SOCKET != fd) && - ((fd > *max_fd) || (MHD_INVALID_SOCKET == *max_fd)) ) - *max_fd = fd; +#endif /* HTTPS_SUPPORT */ - return MHD_YES; -} #undef MHD_get_fdset @@ -681,11 +681,365 @@ fd_set *except_fd_set, MHD_socket *max_fd) { - return MHD_get_fdset2(daemon, read_fd_set, - write_fd_set, except_fd_set, - max_fd, MHD_DEFAULT_FD_SETSIZE); + return MHD_get_fdset2 (daemon, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + _MHD_SYS_DEFAULT_FD_SETSIZE); +} + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Obtain the select() file descriptor sets for the + * given @a urh. + * + * @param urh upgrade handle to wait for + * @param[out] rs read set to initialize + * @param[out] ws write set to initialize + * @param[out] es except set to initialize + * @param[out] max_fd maximum FD to update + * @param fd_setsize value of FD_SETSIZE + * @return true on success, false on error + */ +static bool +urh_to_fdset (struct MHD_UpgradeResponseHandle *urh, + fd_set *rs, + fd_set *ws, + fd_set *es, + MHD_socket *max_fd, + unsigned int fd_setsize) +{ + const MHD_socket conn_sckt = urh->connection->socket_fd; + const MHD_socket mhd_sckt = urh->mhd.socket; + bool res = true; + + /* Do not add to 'es' only if socket is closed + * or not used anymore. */ + if (MHD_INVALID_SOCKET != conn_sckt) + { + if ( (urh->in_buffer_used < urh->in_buffer_size) && + (! MHD_add_to_fd_set_ (conn_sckt, + rs, + max_fd, + fd_setsize)) ) + res = false; + if ( (0 != urh->out_buffer_used) && + (! MHD_add_to_fd_set_ (conn_sckt, + ws, + max_fd, + fd_setsize)) ) + res = false; + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->app.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used))) + MHD_add_to_fd_set_ (conn_sckt, + es, + max_fd, + fd_setsize); + } + if (MHD_INVALID_SOCKET != mhd_sckt) + { + if ( (urh->out_buffer_used < urh->out_buffer_size) && + (! MHD_add_to_fd_set_ (mhd_sckt, + rs, + max_fd, + fd_setsize)) ) + res = false; + if ( (0 != urh->in_buffer_used) && + (! MHD_add_to_fd_set_ (mhd_sckt, + ws, + max_fd, + fd_setsize)) ) + res = false; + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->mhd.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->out_buffer_size) || + (0 != urh->in_buffer_size) || + (0 != urh->in_buffer_used))) + MHD_add_to_fd_set_ (mhd_sckt, + es, + max_fd, + fd_setsize); + } + + return res; } + +/** + * Update the @a urh based on the ready FDs in + * the @a rs, @a ws, and @a es. + * + * @param urh upgrade handle to update + * @param rs read result from select() + * @param ws write result from select() + * @param es except result from select() + */ +static void +urh_from_fdset (struct MHD_UpgradeResponseHandle *urh, + const fd_set *rs, + const fd_set *ws, + const fd_set *es) +{ + const MHD_socket conn_sckt = urh->connection->socket_fd; + const MHD_socket mhd_sckt = urh->mhd.socket; + + /* Reset read/write ready, preserve error state. */ + urh->app.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + urh->mhd.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + + if (MHD_INVALID_SOCKET != conn_sckt) + { + if (FD_ISSET (conn_sckt, rs)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (FD_ISSET (conn_sckt, ws)) + urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (FD_ISSET (conn_sckt, es)) + urh->app.celi |= MHD_EPOLL_STATE_ERROR; + } + if ((MHD_INVALID_SOCKET != mhd_sckt)) + { + if (FD_ISSET (mhd_sckt, rs)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + if (FD_ISSET (mhd_sckt, ws)) + urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (FD_ISSET (mhd_sckt, es)) + urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; + } +} + +#ifdef HAVE_POLL + +/** + * Set required 'event' members in 'pollfd' elements, + * assuming that @a p[0].fd is MHD side of socketpair + * and @a p[1].fd is TLS connected socket. + * + * @param urh upgrade handle to watch for + * @param p pollfd array to update + */ +static void +urh_update_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + p[0].events = 0; + p[1].events = 0; + + if (urh->in_buffer_used < urh->in_buffer_size) + p[0].events |= POLLIN; + if (0 != urh->out_buffer_used) + p[0].events |= POLLOUT; + + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->app.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used))) + p[0].events |= MHD_POLL_EVENTS_ERR_DISC; + + if (urh->out_buffer_used < urh->out_buffer_size) + p[1].events |= POLLIN; + if (0 != urh->in_buffer_used) + p[1].events |= POLLOUT; + + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->mhd.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->out_buffer_size) || + (0 != urh->in_buffer_size) || + (0 != urh->in_buffer_used))) + p[1].events |= MHD_POLL_EVENTS_ERR_DISC; +} + + +/** + * Set @a p to watch for @a urh. + * + * @param urh upgrade handle to watch for + * @param p pollfd array to set + */ +static void +urh_to_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + p[0].fd = urh->connection->socket_fd; + p[1].fd = urh->mhd.socket; + urh_update_pollfd(urh, p); +} + + +/** + * Update ready state in @a urh based on pollfd. + * @param urh upgrade handle to update + * @param p 'poll()' processed pollfd. + */ +static void +urh_from_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + /* Reset read/write ready, preserve error state. */ + urh->app.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + urh->mhd.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + + if (0 != (p[0].revents & POLLIN)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (p[0].revents & POLLOUT)) + urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[0].revents & POLLHUP)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[0].revents & MHD_POLL_REVENTS_ERRROR)) + urh->app.celi |= MHD_EPOLL_STATE_ERROR; + if (0 != (p[1].revents & POLLIN)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (p[1].revents & POLLOUT)) + urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[1].revents & POLLHUP)) + urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; + if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; +} +#endif /* HAVE_POLL */ +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + +/** + * Internal version of #MHD_get_fdset2(). + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @param fd_setsize value of FD_SETSIZE + * @return #MHD_YES on success, #MHD_NO if any FD didn't + * fit fd_set. + * @ingroup event + */ +static int +internal_get_fdset2 (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd, + unsigned int fd_setsize) + +{ + struct MHD_Connection *pos; + struct MHD_Connection *posn; + int result = MHD_YES; + MHD_socket ls; + + if (daemon->shutdown) + return MHD_NO; + + ls = daemon->listen_fd; + if ( (MHD_INVALID_SOCKET != ls) && + (! daemon->was_quiesced) && + (! MHD_add_to_fd_set_ (ls, + read_fd_set, + max_fd, + fd_setsize)) ) + result = MHD_NO; + + /* Add all sockets to 'except_fd_set' as well to watch for + * out-of-band data. However, ignore errors if INFO_READ + * or INFO_WRITE sockets will not fit 'except_fd_set'. */ + /* Start from oldest connections. Make sense for W32 FDSETs. */ + for (pos = daemon->connections_tail; NULL != pos; pos = posn) + { + posn = pos->prev; + + switch (pos->event_loop_info) + { + case MHD_EVENT_LOOP_INFO_READ: + if (! MHD_add_to_fd_set_ (pos->socket_fd, + read_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; +#ifdef MHD_POSIX_SOCKETS + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); +#endif /* MHD_POSIX_SOCKETS */ + break; + case MHD_EVENT_LOOP_INFO_WRITE: + if (! MHD_add_to_fd_set_ (pos->socket_fd, + write_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; +#ifdef MHD_POSIX_SOCKETS + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); +#endif /* MHD_POSIX_SOCKETS */ + break; + case MHD_EVENT_LOOP_INFO_BLOCK: + if ( (NULL == except_fd_set) || + ! MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; + break; + case MHD_EVENT_LOOP_INFO_CLEANUP: + /* this should never happen */ + break; + } + } +#ifdef MHD_WINSOCK_SOCKETS + /* W32 use limited array for fd_set so add INFO_READ/INFO_WRITE sockets + * only after INFO_BLOCK sockets to ensure that INFO_BLOCK sockets will + * not be pushed out. */ + for (pos = daemon->connections_tail; NULL != pos; pos = posn) + { + posn = pos->prev; + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); + } +#endif /* MHD_WINSOCK_SOCKETS */ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + { + struct MHD_UpgradeResponseHandle *urh; + + for (urh = daemon->urh_tail; NULL != urh; urh = urh->prev) + { + if (MHD_NO == + urh_to_fdset (urh, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; + } + } +#endif +#if DEBUG_CONNECT +#ifdef HAVE_MESSAGES + if (NULL != max_fd) + MHD_DLOG (daemon, + _("Maximum socket in select set: %d\n"), + *max_fd); +#endif +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + return result; +} + + /** * Obtain the `select()` sets for this daemon. * Daemon's FDs will be added to fd_sets. To get only @@ -694,6 +1048,9 @@ * as @a fd_setsize allow usage of larger/smaller than * platform's default fd_sets. * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * * @param daemon daemon to get sets from * @param read_fd_set read set * @param write_fd_set write set @@ -715,63 +1072,695 @@ MHD_socket *max_fd, unsigned int fd_setsize) { - struct MHD_Connection *pos; + fd_set es; - if ( (NULL == daemon) - || (NULL == read_fd_set) - || (NULL == write_fd_set) - || (MHD_YES == daemon->shutdown) - || (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) - || (0 != (daemon->options & MHD_USE_POLL))) + if ( (NULL == daemon) || + (NULL == read_fd_set) || + (NULL == write_fd_set) || + (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || + (0 != (daemon->options & MHD_USE_POLL))) return MHD_NO; -#if EPOLL_SUPPORT - if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) + + if (NULL == except_fd_set) + { /* Workaround to maintain backward compatibility. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_get_fdset2() called with except_fd_set " + "set to NULL. Such behavior is unsupported.\n")); +#endif + FD_ZERO (&es); + except_fd_set = &es; + } + +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) { + if (daemon->shutdown) + return MHD_NO; + /* we're in epoll mode, use the epoll FD as a stand-in for - the entire event set */ + the entire event set */ - return add_to_fd_set (daemon->epoll_fd, read_fd_set, max_fd, fd_setsize); + return MHD_add_to_fd_set_ (daemon->epoll_fd, + read_fd_set, + max_fd, + fd_setsize) ? MHD_YES : MHD_NO; } #endif - if (MHD_INVALID_SOCKET != daemon->socket_fd && - MHD_YES != add_to_fd_set (daemon->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; - for (pos = daemon->connections_head; NULL != pos; pos = pos->next) + return internal_get_fdset2 (daemon, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + fd_setsize); +} + + +/** + * Call the handlers for a connection in the appropriate order based + * on the readiness as detected by the event loop. + * + * @param con connection to handle + * @param read_ready set if the socket is ready for reading + * @param write_ready set if the socket is ready for writing + * @param force_close set if a hard error was detected on the socket; + * if this information is not available, simply pass #MHD_NO + * @return #MHD_YES to continue normally, + * #MHD_NO if a serious error was encountered and the + * connection is to be closed. + */ +static int +call_handlers (struct MHD_Connection *con, + bool read_ready, + bool write_ready, + bool force_close) +{ + int ret; + bool states_info_processed = false; + /* Fast track flag */ + bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); + +#ifdef HTTPS_SUPPORT + if (con->tls_read_ready) + read_ready = true; +#endif /* HTTPS_SUPPORT */ + if (!force_close) { - switch (pos->event_loop_info) - { - case MHD_EVENT_LOOP_INFO_READ: - if (MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; - break; - case MHD_EVENT_LOOP_INFO_WRITE: - if (MHD_YES != add_to_fd_set (pos->socket_fd, write_fd_set, max_fd, fd_setsize)) - return MHD_NO; - if (pos->read_buffer_size > pos->read_buffer_offset && - MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; - break; - case MHD_EVENT_LOOP_INFO_BLOCK: - if (pos->read_buffer_size > pos->read_buffer_offset && - MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; - break; - case MHD_EVENT_LOOP_INFO_CLEANUP: - /* this should never happen */ - break; - } + if ( (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) && + read_ready) + { + con->read_handler (con); + ret = con->idle_handler (con); + states_info_processed = true; + } + /* No need to check value of 'ret' here as closed connection + * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ + if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) && + write_ready) + { + con->write_handler (con); + ret = con->idle_handler (con); + states_info_processed = true; + } } -#if DEBUG_CONNECT -#if HAVE_MESSAGES - if (NULL != max_fd) - MHD_DLOG (daemon, - "Maximum socket in select set: %d\n", - *max_fd); + else + { + MHD_connection_close_ (con, + MHD_REQUEST_TERMINATED_WITH_ERROR); + return con->idle_handler (con); + } + + if (!states_info_processed) + { /* Connection is not read or write ready, but external conditions + * may be changed and need to be processed. */ + ret = con->idle_handler (con); + } + /* Fast track for fast connections. */ + /* If full request was read by single read_handler() invocation + and headers were completely prepared by single idle_handler() + then try not to wait for next sockets polling and send response + immediately. + As writeability of socket was not checked and it may have + some data pending in system buffers, use this optimization + only for non-blocking sockets. */ + /* No need to check 'ret' as connection is always in + * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */ + else if (on_fasttrack && con->sk_nonblck) + { + if (MHD_CONNECTION_HEADERS_SENDING == con->state) + { + con->write_handler (con); + /* Always call 'idle_handler()' after each read/write. */ + ret = con->idle_handler (con); + } + /* If all headers were sent by single write_handler() and + * response body is prepared by single idle_handler() + * call - continue. */ + if ((MHD_CONNECTION_NORMAL_BODY_READY == con->state) || + (MHD_CONNECTION_CHUNKED_BODY_READY == con->state)) + { + con->write_handler (con); + ret = con->idle_handler (con); + } + } + + /* All connection's data and states are processed for this turn. + * If connection already has more data to be processed - use + * zero timeout for next select()/poll(). */ + /* Thread-per-connection do not need global zero timeout as + * connections are processed individually. */ + /* Note: no need to check for read buffer availability for + * TLS read-ready connection in 'read info' state as connection + * without space in read buffer will be market as 'info block'. */ + if ( (!con->daemon->data_already_pending) && + (0 == (con->daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + { + if (MHD_EVENT_LOOP_INFO_BLOCK == con->event_loop_info) + con->daemon->data_already_pending = true; +#ifdef HTTPS_SUPPORT + else if ( (con->tls_read_ready) && + (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) ) + con->daemon->data_already_pending = true; +#endif /* HTTPS_SUPPORT */ + } + return ret; +} + + +#ifdef UPGRADE_SUPPORT +/** + * Finally cleanup upgrade-related resources. It should + * be called when TLS buffers have been drained and + * application signaled MHD by #MHD_UPGRADE_ACTION_CLOSE. + * + * @param connection handle to the upgraded connection to clean + */ +static void +cleanup_upgraded_connection (struct MHD_Connection *connection) +{ + struct MHD_UpgradeResponseHandle *urh = connection->urh; + + if (NULL == urh) + return; +#ifdef HTTPS_SUPPORT + /* Signal remote client the end of TLS connection by + * gracefully closing TLS session. */ + if (0 != (connection->daemon->options & MHD_USE_TLS)) + gnutls_bye (connection->tls_session, + GNUTLS_SHUT_WR); + + if (MHD_INVALID_SOCKET != urh->mhd.socket) + MHD_socket_close_chk_ (urh->mhd.socket); + + if (MHD_INVALID_SOCKET != urh->app.socket) + MHD_socket_close_chk_ (urh->app.socket); +#endif /* HTTPS_SUPPORT */ + connection->urh = NULL; + free (urh); +} +#endif /* UPGRADE_SUPPORT */ + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Performs bi-directional forwarding on upgraded HTTPS connections + * based on the readyness state stored in the @a urh handle. + * @remark To be called only from thread that process + * connection's recv(), send() and response. + * + * @param urh handle to process + */ +static void +process_urh (struct MHD_UpgradeResponseHandle *urh) +{ + /* Help compiler to optimize: + * pointers to 'connection' and 'daemon' are not changed + * during this processing, so no need to chain dereference + * each time. */ + struct MHD_Connection * const connection = urh->connection; + struct MHD_Daemon * const daemon = connection->daemon; + /* Prevent data races: use same value of 'was_closed' throughout + * this function. If 'was_closed' changed externally in the middle + * of processing - it will be processed on next iteration. */ + bool was_closed; + if (daemon->shutdown) + { + /* Daemon shutting down, application will not receive any more data. */ +#ifdef HAVE_MESSAGES + if (! urh->was_closed) + { + MHD_DLOG (daemon, + _("Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); + } #endif + urh->was_closed = true; + } + was_closed = urh->was_closed; + if (was_closed) + { + /* Application was closed connections: no more data + * can be forwarded to application socket. */ + if (0 < urh->in_buffer_used) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to application " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from remote side: application shut down socket\n"), + (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used); #endif - return MHD_YES; + + } + /* If application signaled MHD about socket closure then + * check for any pending data even if socket is not marked + * as 'ready' (signal may arrive after poll()/select()). + * Socketpair for forwarding is always in non-blocking mode + * so no risk that recv() will block the thread. */ + if (0 != urh->out_buffer_size) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + /* Discard any data received form remote. */ + urh->in_buffer_used = 0; + /* Do not try to push data to application. */ + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + + /* On some platforms (W32, possibly Darwin) failed send() (send() will always + * fail after remote disconnect was detected) may discard data in system + * buffers received by system but not yet read by recv(). + * So, before trying send() on any socket, recv() must be performed at first + * otherwise last part of incoming data may be lost. */ + + /* If disconnect or error was detected - try to read from socket + * to dry data possibly pending is system buffers. */ + if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + + /* + * handle reading from remote TLS client + */ + if ( ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->app.celi)) || + (connection->tls_read_ready) ) && + (urh->in_buffer_used < urh->in_buffer_size) ) + { + ssize_t res; + size_t buf_size; + + buf_size = urh->in_buffer_size - urh->in_buffer_used; + if (buf_size > SSIZE_MAX) + buf_size = SSIZE_MAX; + + connection->tls_read_ready = false; + res = gnutls_record_recv (connection->tls_session, + &urh->in_buffer[urh->in_buffer_used], + buf_size); + if (0 >= res) + { + if (GNUTLS_E_INTERRUPTED != res) + { + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + if (GNUTLS_E_AGAIN != res) + { + /* Unrecoverable error on socket was detected or + * socket was disconnected/shut down. */ + /* Stop trying to read from this TLS socket. */ + urh->in_buffer_size = 0; + } + } + } + else /* 0 < res */ + { + urh->in_buffer_used += res; + if (buf_size > (size_t)res) + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + else if (0 < gnutls_record_check_pending (connection->tls_session)) + connection->tls_read_ready = true; + } + if (MHD_EPOLL_STATE_ERROR == + ((MHD_EPOLL_STATE_ERROR | MHD_EPOLL_STATE_READ_READY) & urh->app.celi)) + { + /* Unrecoverable error on socket was detected and all + * pending data was read from system buffers. */ + /* Stop trying to read from this TLS socket. */ + urh->in_buffer_size = 0; + } + } + + /* + * handle reading from application + */ + if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + (urh->out_buffer_used < urh->out_buffer_size) ) + { + ssize_t res; + size_t buf_size; + + buf_size = urh->out_buffer_size - urh->out_buffer_used; + if (buf_size > MHD_SCKT_SEND_MAX_SIZE_) + buf_size = MHD_SCKT_SEND_MAX_SIZE_; + + res = MHD_recv_ (urh->mhd.socket, + &urh->out_buffer[urh->out_buffer_used], + buf_size); + if (0 >= res) + { + const int err = MHD_socket_get_error_ (); + if ((0 == res) || + ((! MHD_SCKT_ERR_IS_EINTR_ (err)) && + (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)))) + { + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + if ((0 == res) || + (was_closed) || + (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) || + (! MHD_SCKT_ERR_IS_EAGAIN_ (err))) + { + /* Socket disconnect/shutdown was detected; + * Application signaled about closure of 'upgraded' socket; + * or persistent / unrecoverable error. */ + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + } + } + } + else /* 0 < res */ + { + urh->out_buffer_used += res; + if (buf_size > (size_t)res) + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + if ( (0 == (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + ( (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) || + (was_closed) ) ) + { + /* Unrecoverable error on socket was detected and all + * pending data was read from system buffers. */ + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + } + } + + /* + * handle writing to remote HTTPS client + */ + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->app.celi)) && + (urh->out_buffer_used > 0) ) + { + ssize_t res; + size_t data_size; + + data_size = urh->out_buffer_used; + if (data_size > SSIZE_MAX) + data_size = SSIZE_MAX; + + res = gnutls_record_send (connection->tls_session, + urh->out_buffer, + data_size); + if (0 >= res) + { + if (GNUTLS_E_INTERRUPTED != res) + { + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + if (GNUTLS_E_INTERRUPTED != res) + { + /* TLS connection shut down or + * persistent / unrecoverable error. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to remote client " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from application: %s\n"), + (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used, + gnutls_strerror(res)); +#endif + /* Discard any data unsent to remote. */ + urh->out_buffer_used = 0; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + } + } + else /* 0 < res */ + { + const size_t next_out_buffer_used = urh->out_buffer_used - res; + if (0 != next_out_buffer_used) + { + memmove (urh->out_buffer, + &urh->out_buffer[res], + next_out_buffer_used); + if (data_size > (size_t)res) + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + } + urh->out_buffer_used = next_out_buffer_used; + } + if ( (0 == urh->out_buffer_used) && + (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) ) + { + /* Unrecoverable error on socket was detected and all + * pending data was sent to remote. */ + /* Do not try to send to remote anymore. */ + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + } + + /* + * handle writing to application + */ + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->mhd.celi)) && + (urh->in_buffer_used > 0) ) + { + ssize_t res; + size_t data_size; + + data_size = urh->in_buffer_used; + if (data_size > MHD_SCKT_SEND_MAX_SIZE_) + data_size = MHD_SCKT_SEND_MAX_SIZE_; + + res = MHD_send_ (urh->mhd.socket, + urh->in_buffer, + data_size); + if (0 >= res) + { + const int err = MHD_socket_get_error_ (); + if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) && + (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) ) + { + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + if (! MHD_SCKT_ERR_IS_EAGAIN_ (err)) + { + /* Socketpair connection shut down or + * persistent / unrecoverable error. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to application " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from remote side: %s\n"), + (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used, + MHD_socket_strerr_ (err)); +#endif + /* Discard any data received form remote. */ + urh->in_buffer_used = 0; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + } + } + else /* 0 < res */ + { + const size_t next_in_buffer_used = urh->in_buffer_used - res; + if (0 != next_in_buffer_used) + { + memmove (urh->in_buffer, + &urh->in_buffer[res], + next_in_buffer_used); + if (data_size > (size_t)res) + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + } + urh->in_buffer_used = next_in_buffer_used; + } + if ( (0 == urh->in_buffer_used) && + (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) ) + { + /* Do not try to push data to application. */ + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + } + + /* Check whether data is present in TLS buffers + * and incoming forward buffer have some space. */ + if ( (connection->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size) && + (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + daemon->data_already_pending = true; + + if ( (daemon->shutdown) && + ( (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used) ) ) + { + /* Daemon shutting down, discard any remaining forward data. */ +#ifdef HAVE_MESSAGES + if (0 < urh->out_buffer_used) + MHD_DLOG (daemon, + _("Failed to forward to remote client " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from application: daemon shut down\n"), + (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used); +#endif + /* Discard any data unsent to remote. */ + urh->out_buffer_used = 0; + /* Do not try to sent to remote anymore. */ + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } +} +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + +#ifdef UPGRADE_SUPPORT +/** + * Main function of the thread that handles an individual connection + * after it was "upgraded" when #MHD_USE_THREAD_PER_CONNECTION is set. + * @remark To be called only from thread that process + * connection's recv(), send() and response. + * + * @param con the connection this thread will handle + */ +static void +thread_main_connection_upgrade (struct MHD_Connection *con) +{ +#ifdef HTTPS_SUPPORT + struct MHD_UpgradeResponseHandle *urh = con->urh; + struct MHD_Daemon *daemon = con->daemon; + + /* Here, we need to bi-directionally forward + until the application tells us that it is done + with the socket; */ + if ( (0 != (daemon->options & MHD_USE_TLS)) && + (0 == (daemon->options & MHD_USE_POLL))) + { + while ( (0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->in_buffer_used) || + (0 != urh->out_buffer_used) ) + { + /* use select */ + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max_fd; + int num_ready; + bool result; + + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + max_fd = MHD_INVALID_SOCKET; + result = urh_to_fdset (urh, + &rs, + &ws, + &es, + &max_fd, + FD_SETSIZE); + if (! result) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error preparing select\n")); +#endif + break; + } + /* FIXME: does this check really needed? */ + if (MHD_INVALID_SOCKET != max_fd) + { + struct timeval* tvp; + struct timeval tv; + if ( (con->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size)) + { /* No need to wait if incoming data is already pending in TLS buffers. */ + tv.tv_sec = 0; + tv.tv_usec = 0; + tvp = &tv; + } + else + tvp = NULL; + num_ready = MHD_SYS_select_ (max_fd + 1, + &rs, + &ws, + &es, + tvp); + } + else + num_ready = 0; + if (num_ready < 0) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); +#endif + break; + } + urh_from_fdset (urh, + &rs, + &ws, + &es); + process_urh (urh); + } + } +#ifdef HAVE_POLL + else if (0 != (daemon->options & MHD_USE_TLS)) + { + /* use poll() */ + struct pollfd p[2]; + memset (p, + 0, + sizeof (p)); + p[0].fd = urh->connection->socket_fd; + p[1].fd = urh->mhd.socket; + + while ( (0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->in_buffer_used) || + (0 != urh->out_buffer_used) ) + { + int timeout; + + urh_update_pollfd(urh, p); + + if ( (con->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size)) + timeout = 0; /* No need to wait if incoming data is already pending in TLS buffers. */ + else + timeout = -1; + + if (MHD_sys_poll_ (p, + 2, + timeout) < 0) + { + const int err = MHD_socket_get_error_ (); + + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during poll: `%s'\n"), + MHD_socket_strerr_ (err)); +#endif + break; + } + urh_from_pollfd(urh, p); + process_urh (urh); + } + } + /* end POLL */ +#endif + /* end HTTPS */ +#endif /* HTTPS_SUPPORT */ + /* TLS forwarding was finished. Cleanup socketpair. */ + MHD_connection_finish_forward_ (con); + /* Do not set 'urh->clean_ready' yet as 'urh' will be used + * in connection thread for a little while. */ } +#endif /* UPGRADE_SUPPORT */ /** @@ -782,20 +1771,19 @@ * @return always 0 */ static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ -MHD_handle_connection (void *data) +thread_main_handle_connection (void *data) { struct MHD_Connection *con = data; + struct MHD_Daemon *daemon = con->daemon; int num_ready; fd_set rs; fd_set ws; - MHD_socket max; + fd_set es; + MHD_socket maxsock; struct timeval tv; struct timeval *tvp; - unsigned int timeout; time_t now; #if WINDOWS - MHD_pipe spipe = con->daemon->wpipe[0]; - char tmp; #ifdef HAVE_POLL int extra_slot; #endif /* HAVE_POLL */ @@ -806,22 +1794,112 @@ #ifdef HAVE_POLL struct pollfd p[1 + EXTRA_SLOTS]; #endif +#undef EXTRA_SLOTS +#ifdef HAVE_POLL + const bool use_poll = (0 != (daemon->options & MHD_USE_POLL)); +#else /* ! HAVE_POLL */ + const bool use_poll = 0; +#endif /* ! HAVE_POLL */ + bool was_suspended = false; - timeout = con->daemon->connection_timeout; - while ( (MHD_YES != con->daemon->shutdown) && + while ( (! daemon->shutdown) && (MHD_CONNECTION_CLOSED != con->state) ) { + const time_t timeout = daemon->connection_timeout; +#ifdef UPGRADE_SUPPORT + struct MHD_UpgradeResponseHandle * const urh = con->urh; +#else /* ! UPGRADE_SUPPORT */ + static const void * const urh = NULL; +#endif /* ! UPGRADE_SUPPORT */ + + if ( (con->suspended) && + (NULL == urh) ) + { + /* Connection was suspended, wait for resume. */ + was_suspended = true; + if (! use_poll) + { + FD_ZERO (&rs); + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + NULL, + FD_SETSIZE)) + { + #ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Failed to add FD to fd_set\n")); + #endif + goto exit; + } + if (0 > MHD_SYS_select_ (MHD_itc_r_fd_ (daemon->itc) + 1, + &rs, + NULL, + NULL, + NULL)) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); +#endif + break; + } + } +#ifdef HAVE_POLL + else /* use_poll */ + { + p[0].events = POLLIN; + p[0].fd = MHD_itc_r_fd_ (daemon->itc); + p[0].revents = 0; + if (0 > MHD_sys_poll_ (p, + 1, + -1)) + { + if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during poll: `%s'\n"), + MHD_socket_last_strerr_ ()); +#endif + break; + } + } +#endif /* HAVE_POLL */ + MHD_itc_clear_ (daemon->itc); + continue; /* Check again for resume. */ + } /* End of "suspended" branch. */ + + if (was_suspended) + { + MHD_update_last_activity_ (con); /* Reset timeout timer. */ + /* Process response queued during suspend and update states. */ + MHD_connection_handle_idle (con); + was_suspended = false; + } + tvp = NULL; -#if HTTPS_SUPPORT - if (MHD_YES == con->tls_read_ready) + + if ( (MHD_EVENT_LOOP_INFO_BLOCK == con->event_loop_info) +#ifdef HTTPS_SUPPORT + || ( (con->tls_read_ready) && + (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) ) +#endif /* HTTPS_SUPPORT */ + ) { - /* do not block (more data may be inside of TLS buffers waiting for us) */ + /* do not block: more data may be inside of TLS buffers waiting or + * application must provide response data */ tv.tv_sec = 0; tv.tv_usec = 0; tvp = &tv; } -#endif - if (NULL == tvp && timeout > 0) + if ( (NULL == tvp) && + (timeout > 0) ) { now = MHD_monotonic_sec_counter(); if (now - con->last_activity > timeout) @@ -835,118 +1913,122 @@ if (seconds_left > TIMEVAL_TV_SEC_MAX) tv.tv_sec = TIMEVAL_TV_SEC_MAX; else - tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE)seconds_left; + tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) seconds_left; #endif /* _WIN32 */ } tv.tv_usec = 0; tvp = &tv; } - if (0 == (con->daemon->options & MHD_USE_POLL)) + if (! use_poll) { /* use select */ - int err_state = 0; + bool err_state = false; + FD_ZERO (&rs); FD_ZERO (&ws); - max = 0; + FD_ZERO (&es); + maxsock = MHD_INVALID_SOCKET; switch (con->event_loop_info) { case MHD_EVENT_LOOP_INFO_READ: - if (MHD_YES != - add_to_fd_set (con->socket_fd, &rs, &max, FD_SETSIZE)) - err_state = 1; + if (! MHD_add_to_fd_set_ (con->socket_fd, + &rs, + &maxsock, + FD_SETSIZE)) + err_state = true; break; case MHD_EVENT_LOOP_INFO_WRITE: - if (MHD_YES != - add_to_fd_set (con->socket_fd, &ws, &max, FD_SETSIZE)) - err_state = 1; - if ( (con->read_buffer_size > con->read_buffer_offset) && - (MHD_YES != - add_to_fd_set (con->socket_fd, &rs, &max, FD_SETSIZE)) ) - err_state = 1; + if (! MHD_add_to_fd_set_ (con->socket_fd, + &ws, + &maxsock, + FD_SETSIZE)) + err_state = true; break; case MHD_EVENT_LOOP_INFO_BLOCK: - if ( (con->read_buffer_size > con->read_buffer_offset) && - (MHD_YES != - add_to_fd_set (con->socket_fd, &rs, &max, FD_SETSIZE)) ) - err_state = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - tvp = &tv; + if (! MHD_add_to_fd_set_ (con->socket_fd, + &es, + &maxsock, + FD_SETSIZE)) + err_state = true; break; case MHD_EVENT_LOOP_INFO_CLEANUP: /* how did we get here!? */ goto exit; } #if WINDOWS - if (MHD_INVALID_PIPE_ != spipe) + if (MHD_ITC_IS_VALID_(daemon->itc) ) { - if (MHD_YES != - add_to_fd_set (spipe, &rs, &max, FD_SETSIZE)) + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) err_state = 1; } #endif - if (0 != err_state) + if (err_state) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (con->daemon, - "Can't add FD to fd_set\n"); + _("Failed to add FD to fd_set\n")); #endif goto exit; } - num_ready = MHD_SYS_select_ (max + 1, &rs, &ws, NULL, tvp); + num_ready = MHD_SYS_select_ (maxsock + 1, + &rs, + &ws, + NULL, + tvp); if (num_ready < 0) { - if (EINTR == MHD_socket_errno_) + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) continue; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (con->daemon, - "Error during select (%d): `%s'\n", - MHD_socket_errno_, - MHD_socket_last_strerr_ ()); + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); #endif break; } #if WINDOWS - /* drain signaling pipe */ - if ( (MHD_INVALID_PIPE_ != spipe) && - (FD_ISSET (spipe, &rs)) ) - (void) MHD_pipe_read_ (spipe, &tmp, sizeof (tmp)); -#endif - /* call appropriate connection handler if necessary */ - if ( (FD_ISSET (con->socket_fd, &rs)) -#if HTTPS_SUPPORT - || (MHD_YES == con->tls_read_ready) -#endif - ) - con->read_handler (con); - if (FD_ISSET (con->socket_fd, &ws)) - con->write_handler (con); - if (MHD_NO == con->idle_handler (con)) - goto exit; + /* Clear ITC before other processing so additional + * signals will trigger select() again */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (FD_ISSET (MHD_itc_r_fd_ (daemon->itc), + &rs)) ) + MHD_itc_clear_ (daemon->itc); +#endif + if (MHD_NO == + call_handlers (con, + FD_ISSET (con->socket_fd, + &rs), + FD_ISSET (con->socket_fd, + &ws), + FD_ISSET (con->socket_fd, + &es)) ) + goto exit; } #ifdef HAVE_POLL else { /* use poll */ - memset (&p, 0, sizeof (p)); + memset (&p, + 0, + sizeof (p)); p[0].fd = con->socket_fd; switch (con->event_loop_info) { case MHD_EVENT_LOOP_INFO_READ: - p[0].events |= POLLIN; + p[0].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_WRITE: - p[0].events |= POLLOUT; - if (con->read_buffer_size > con->read_buffer_offset) - p[0].events |= POLLIN; + p[0].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_BLOCK: - if (con->read_buffer_size > con->read_buffer_offset) - p[0].events |= POLLIN; - tv.tv_sec = 0; - tv.tv_usec = 0; - tvp = &tv; + p[0].events |= MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_CLEANUP: /* how did we get here!? */ @@ -954,63 +2036,88 @@ } #if WINDOWS extra_slot = 0; - if (MHD_INVALID_PIPE_ != spipe) + if (MHD_ITC_IS_VALID_(daemon->itc)) { p[1].events |= POLLIN; - p[1].fd = spipe; + p[1].fd = MHD_itc_r_fd_ (daemon->itc); p[1].revents = 0; extra_slot = 1; } #endif if (MHD_sys_poll_ (p, #if WINDOWS - 1 + extra_slot, + 1 + extra_slot, #else - 1, + 1, #endif - (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0) + (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0) { - if (EINTR == MHD_socket_errno_) + if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_)) continue; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (con->daemon, - "Error during poll: `%s'\n", + _("Error during poll: `%s'\n"), MHD_socket_last_strerr_ ()); #endif break; } #if WINDOWS - /* drain signaling pipe */ - if ( (MHD_INVALID_PIPE_ != spipe) && - (0 != (p[1].revents & (POLLERR | POLLHUP))) ) - (void) MHD_pipe_read_ (spipe, &tmp, sizeof (tmp)); -#endif - if ( (0 != (p[0].revents & POLLIN)) -#if HTTPS_SUPPORT - || (MHD_YES == con->tls_read_ready) -#endif - ) - con->read_handler (con); - if (0 != (p[0].revents & POLLOUT)) - con->write_handler (con); - if (0 != (p[0].revents & (POLLERR | POLLHUP))) - MHD_connection_close (con, MHD_REQUEST_TERMINATED_WITH_ERROR); - if (MHD_NO == con->idle_handler (con)) - goto exit; + /* Clear ITC before other processing so additional + * signals will trigger poll() again */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (0 != (p[1].revents & (POLLERR | POLLHUP | POLLIN))) ) + MHD_itc_clear_ (daemon->itc); +#endif + if (MHD_NO == + call_handlers (con, + 0 != (p[0].revents & POLLIN), + 0 != (p[0].revents & POLLOUT), + 0 != (p[0].revents & (POLLERR | MHD_POLL_REVENTS_ERR_DISC)))) + goto exit; } #endif +#ifdef UPGRADE_SUPPORT + if (MHD_CONNECTION_UPGRADE == con->state) + { + /* Normal HTTP processing is finished, + * notify application. */ + if ( (NULL != daemon->notify_completed) && + (con->client_aware) ) + daemon->notify_completed (daemon->notify_completed_cls, + con, + &con->client_context, + MHD_REQUEST_TERMINATED_COMPLETED_OK); + con->client_aware = false; + + thread_main_connection_upgrade (con); + /* MHD_connection_finish_forward_() was called by thread_main_connection_upgrade(). */ + + /* "Upgraded" data will not be used in this thread from this point. */ + con->urh->clean_ready = true; + /* If 'urh->was_closed' set to true, connection will be + * moved immediately to cleanup list. Otherwise connection + * will stay in suspended list until 'urh' will be marked + * with 'was_closed' by application. */ + MHD_resume_connection(con); + + /* skip usual clean up */ + return (MHD_THRD_RTRN_TYPE_) 0; + } +#endif /* UPGRADE_SUPPORT */ } if (MHD_CONNECTION_IN_CLEANUP != con->state) { #if DEBUG_CLOSE -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (con->daemon, - "Processing thread terminating, closing connection\n"); + _("Processing thread terminating. Closing connection\n")); #endif #endif if (MHD_CONNECTION_CLOSED != con->state) - MHD_connection_close (con, - MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); + MHD_connection_close_ (con, + (daemon->shutdown) ? + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN: + MHD_REQUEST_TERMINATED_WITH_ERROR); con->idle_handler (con); } exit: @@ -1020,12 +2127,14 @@ con->response = NULL; } - if (NULL != con->daemon->notify_connection) - con->daemon->notify_connection (con->daemon->notify_connection_cls, - con, - &con->socket_context, - MHD_CONNECTION_NOTIFY_CLOSED); - + if (MHD_INVALID_SOCKET != con->socket_fd) + { + shutdown (con->socket_fd, + SHUT_WR); + /* 'socket_fd' can be used in other thread to signal shutdown. + * To avoid data races, do not close socket here. Daemon will + * use more connections only after cleanup anyway. */ + } return (MHD_THRD_RTRN_TYPE_) 0; } @@ -1044,31 +2153,28 @@ size_t i) { ssize_t ret; -#if EPOLL_SUPPORT - const size_t requested_size = i; -#endif if ( (MHD_INVALID_SOCKET == connection->socket_fd) || (MHD_CONNECTION_CLOSED == connection->state) ) { - MHD_set_socket_errno_ (ENOTCONN); + MHD_socket_set_error_ (MHD_SCKT_ENOTCONN_); return -1; } -#ifdef MHD_POSIX_SOCKETS - if (i > SSIZE_MAX) - i = SSIZE_MAX; /* return value limit */ -#else /* MHD_WINSOCK_SOCKETS */ - if (i > INT_MAX) - i = INT_MAX; /* return value limit */ -#endif /* MHD_WINSOCK_SOCKETS */ + if (i > MHD_SCKT_SEND_MAX_SIZE_) + i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */ - ret = (ssize_t)recv (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); -#if EPOLL_SUPPORT - if ( (0 > ret) || (requested_size > (size_t) ret)) - { - /* partial read --- no longer read-ready */ - connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; + ret = MHD_recv_ (connection->socket_fd, + other, + i); +#ifdef EPOLL_SUPPORT + if (0 > ret) + { + /* Got EAGAIN --- no longer read-ready */ + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; } + else if (i > (size_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; #endif return ret; } @@ -1088,39 +2194,31 @@ size_t i) { ssize_t ret; -#if EPOLL_SUPPORT - const size_t requested_size = i; -#endif -#if LINUX - MHD_socket fd; -#endif + int err; if ( (MHD_INVALID_SOCKET == connection->socket_fd) || (MHD_CONNECTION_CLOSED == connection->state) ) { - MHD_set_socket_errno_ (ENOTCONN); + MHD_socket_set_error_ (MHD_SCKT_ENOTCONN_); return -1; } -#ifdef MHD_POSIX_SOCKETS - if (i > SSIZE_MAX) - i = SSIZE_MAX; /* return value limit */ -#else /* MHD_WINSOCK_SOCKETS */ - if (i > INT_MAX) - i = INT_MAX; /* return value limit */ -#endif /* MHD_WINSOCK_SOCKETS */ + if (i > MHD_SCKT_SEND_MAX_SIZE_) + i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */ - if (0 != (connection->daemon->options & MHD_USE_SSL)) - return (ssize_t)send (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); + if (0 != (connection->daemon->options & MHD_USE_TLS)) + return MHD_send_ (connection->socket_fd, + other, + i); #if LINUX if ( (connection->write_buffer_append_offset == connection->write_buffer_send_offset) && (NULL != connection->response) && - (-1 != (fd = connection->response->fd)) ) + (MHD_resp_sender_sendfile == connection->resp_sender) ) { /* can use sendfile */ + int file_fd = connection->response->fd; uint64_t left; uint64_t offsetu64; - int err; #ifndef HAVE_SENDFILE64 off_t offset; #else /* HAVE_SENDFILE64 */ @@ -1128,124 +2226,94 @@ #endif /* HAVE_SENDFILE64 */ offsetu64 = connection->response_write_position + connection->response->fd_off; left = connection->response->total_size - connection->response_write_position; + ret = 0; #ifndef HAVE_SENDFILE64 - offset = (off_t) offsetu64; - if ( (offsetu64 <= (uint64_t)OFF_T_MAX) && - 0 < (ret = sendfile (connection->socket_fd, fd, &offset, left))) + if ((uint64_t)OFF_T_MAX < offsetu64) + MHD_socket_set_error_to_ENOMEM (); + else + { + offset = (off_t) offsetu64; + ret = sendfile (connection->socket_fd, + file_fd, + &offset, + left); + } #else /* HAVE_SENDFILE64 */ - offset = (off64_t) offsetu64; - if ( (offsetu64 <= (uint64_t)OFF64_T_MAX) && - 0 < (ret = sendfile64 (connection->socket_fd, fd, &offset, left))) + if ((uint64_t)OFF64_T_MAX < offsetu64) + MHD_socket_set_error_to_ENOMEM (); + else + { + offset = (off64_t) offsetu64; + ret = sendfile64 (connection->socket_fd, + file_fd, + &offset, + left); + } #endif /* HAVE_SENDFILE64 */ - { -#if EPOLL_SUPPORT - if (requested_size > (size_t) ret) - { - /* partial write --- no longer write-ready */ - connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; - } + if (0 < ret) + { + /* write successful */ +#ifdef EPOLL_SUPPORT + if (left > (uint64_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ + return ret; + } + err = MHD_socket_get_error_(); +#ifdef EPOLL_SUPPORT + if ( (0 > ret) && (MHD_SCKT_ERR_IS_EAGAIN_(err)) ) + { + /* EAGAIN --- no longer write-ready */ + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; + } #endif - return ret; - } - err = MHD_socket_errno_; - if ( (EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err) ) + if (MHD_SCKT_ERR_IS_EINTR_ (err) || + MHD_SCKT_ERR_IS_EAGAIN_ (err)) return 0; - if ( (EINVAL == err) || (EBADF == err) ) + if (MHD_SCKT_ERR_IS_(err, + MHD_SCKT_EBADF_)) return -1; - /* None of the 'usual' sendfile errors occurred, so we should try + /* sendfile() failed with EINVAL if mmap()-like operations are not + supported for FD or other 'unusual' errors occurred, so we should try to fall back to 'SEND'; see also this thread for info on odd libc/Linux behavior with sendfile: http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ + connection->resp_sender = MHD_resp_sender_std; } #endif - ret = (ssize_t)send (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); -#if EPOLL_SUPPORT - if ( (0 > ret) || (requested_size > (size_t) ret) ) - { - /* partial write --- no longer write-ready */ - connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; + ret = MHD_send_ (connection->socket_fd, + other, + i); + err = MHD_socket_get_error_(); +#ifdef EPOLL_SUPPORT + if (0 > ret) + { + /* EAGAIN --- no longer write-ready */ + if (MHD_SCKT_ERR_IS_EAGAIN_(err)) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; } + else if (i > (size_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; #endif /* Handle broken kernel / libc, returning -1 but not setting errno; kill connection as that should be safe; reported on mailinglist here: http://lists.gnu.org/archive/html/libmicrohttpd/2014-10/msg00023.html */ - if ( (0 > ret) && (0 == MHD_socket_errno_) ) - MHD_set_socket_errno_(ECONNRESET); + if ( (0 > ret) && + (0 == err) ) + MHD_socket_set_error_ (MHD_SCKT_ECONNRESET_); return ret; } /** - * Signature of main function for a thread. - * - * @param cls closure argument for the function - * @return termination code from the thread - */ -typedef MHD_THRD_RTRN_TYPE_ (MHD_THRD_CALL_SPEC_ *ThreadStartRoutine)(void *cls); - - -/** - * Create a thread and set the attributes according to our options. + * Free resources associated with all closed connections. + * (destroy responses, free buffers, etc.). All closed + * connections are kept in the "cleanup" doubly-linked list. * - * @param thread handle to initialize - * @param daemon daemon with options - * @param start_routine main function of thread - * @param arg argument for start_routine - * @return 0 on success + * @param daemon daemon to clean up */ -static int -create_thread (MHD_thread_handle_ *thread, - const struct MHD_Daemon *daemon, - ThreadStartRoutine start_routine, - void *arg) -{ -#if defined(MHD_USE_POSIX_THREADS) - pthread_attr_t attr; - pthread_attr_t *pattr; - int ret; - - if (0 != daemon->thread_stack_size) - { - if (0 != (ret = pthread_attr_init (&attr))) - goto ERR; - if (0 != (ret = pthread_attr_setstacksize (&attr, daemon->thread_stack_size))) - { - pthread_attr_destroy (&attr); - goto ERR; - } - pattr = &attr; - } - else - { - pattr = NULL; - } - ret = pthread_create (thread, pattr, - start_routine, arg); -#ifdef HAVE_PTHREAD_SETNAME_NP - (void) pthread_setname_np (*thread, "libmicrohttpd"); -#endif /* HAVE_PTHREAD_SETNAME_NP */ - if (0 != daemon->thread_stack_size) - pthread_attr_destroy (&attr); - return ret; - ERR: -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to set thread stack size\n"); -#endif - errno = EINVAL; - return ret; -#elif defined(MHD_USE_W32_THREADS) - unsigned threadID; - *thread = (HANDLE)_beginthreadex(NULL, (unsigned)daemon->thread_stack_size, start_routine, - arg, 0, &threadID); - if (NULL == (*thread)) - return errno; - - W32_SetThreadName(threadID, "libmicrohttpd"); - - return 0; -#endif -} +static void +MHD_cleanup_connections (struct MHD_Daemon *daemon); /** @@ -1262,6 +2330,9 @@ * * Per-IP connection limits are ignored when using this API. * + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * * @param daemon daemon that manages the connection * @param client_socket socket to manage (MHD will expect * to receive an HTTP request from this socket next). @@ -1269,6 +2340,7 @@ * @param addrlen number of bytes in @a addr * @param external_add perform additional operations needed due * to the application calling us directly + * @param non_blck indicate that socket in non-blocking mode * @return #MHD_YES on success, #MHD_NO if this daemon could * not handle the connection (i.e. malloc failed, etc). * The socket will be closed in any case; 'errno' is @@ -1279,16 +2351,13 @@ MHD_socket client_socket, const struct sockaddr *addr, socklen_t addrlen, - int external_add) + int external_add, + bool non_blck) { struct MHD_Connection *connection; - int res_thread_create; unsigned int i; int eno; struct MHD_Daemon *worker; -#if OSX - static int on = 1; -#endif if (NULL != daemon->worker_pool) { @@ -1301,55 +2370,73 @@ if (worker->connections < worker->connection_limit) return internal_add_connection (worker, client_socket, - addr, addrlen, - external_add); + addr, + addrlen, + external_add, + non_blck); } /* all pools are at their connection limit, must refuse */ - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (client_socket); #if ENFILE errno = ENFILE; #endif return MHD_NO; } -#ifndef MHD_WINSOCK_SOCKETS - if ( (client_socket >= FD_SETSIZE) && - (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) ) + if ( (! MHD_SCKT_FD_FITS_FDSET_(client_socket, + NULL)) && + (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Socket descriptor larger than FD_SETSIZE: %d > %d\n", - client_socket, - FD_SETSIZE); + _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"), + (int) client_socket, + (int) FD_SETSIZE); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (client_socket); #if EINVAL errno = EINVAL; #endif return MHD_NO; } + +#ifdef MHD_socket_nosignal_ + if (! MHD_socket_nosignal_ (client_socket)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set SO_NOSIGPIPE on accepted socket: %s\n"), + MHD_socket_last_strerr_()); #endif +#ifndef MSG_NOSIGNAL + /* Cannot use socket as it can produce SIGPIPE. */ +#ifdef ENOTSOCK + errno = ENOTSOCK; +#endif /* ENOTSOCK */ + return MHD_NO; +#endif /* ! MSG_NOSIGNAL */ + } +#endif /* MHD_socket_nosignal_ */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #if DEBUG_CONNECT MHD_DLOG (daemon, - "Accepted connection on socket %d\n", + _("Accepted connection on socket %d\n"), client_socket); #endif #endif if ( (daemon->connections == daemon->connection_limit) || - (MHD_NO == MHD_ip_limit_add (daemon, addr, addrlen)) ) + (MHD_NO == MHD_ip_limit_add (daemon, + addr, + addrlen)) ) { /* above connection limit - reject */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Server reached connection limit (closing inbound connection)\n"); + _("Server reached connection limit. Closing inbound connection.\n")); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (client_socket); #if ENFILE errno = ENFILE; #endif @@ -1359,61 +2446,52 @@ /* apply connection acceptance policy if present */ if ( (NULL != daemon->apc) && (MHD_NO == daemon->apc (daemon->apc_cls, - addr, addrlen)) ) + addr, + addrlen)) ) { #if DEBUG_CLOSE -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Connection rejected, closing connection\n"); + _("Connection rejected by application. Closing connection.\n")); #endif #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); #if EACCESS errno = EACCESS; #endif return MHD_NO; } -#if OSX -#ifdef SOL_SOCKET -#ifdef SO_NOSIGPIPE - setsockopt (client_socket, - SOL_SOCKET, SO_NOSIGPIPE, - &on, sizeof (on)); -#endif -#endif -#endif - - if (NULL == (connection = malloc (sizeof (struct MHD_Connection)))) + if (NULL == (connection = MHD_calloc_ (1, sizeof (struct MHD_Connection)))) { eno = errno; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, "Error allocating memory: %s\n", MHD_strerror_ (errno)); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); errno = eno; return MHD_NO; } - memset (connection, - 0, - sizeof (struct MHD_Connection)); connection->pool = MHD_pool_create (daemon->pool_size); if (NULL == connection->pool) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Error allocating memory: %s\n", + _("Error allocating memory: %s\n"), MHD_strerror_ (errno)); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); free (connection); #if ENOMEM errno = ENOMEM; @@ -1425,74 +2503,45 @@ if (NULL == (connection->addr = malloc (addrlen))) { eno = errno; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Error allocating memory: %s\n", + _("Error allocating memory: %s\n"), MHD_strerror_ (errno)); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); MHD_pool_destroy (connection->pool); free (connection); errno = eno; return MHD_NO; } - memcpy (connection->addr, addr, addrlen); + memcpy (connection->addr, + addr, + addrlen); connection->addr_len = addrlen; connection->socket_fd = client_socket; + connection->sk_nonblck = non_blck; connection->daemon = daemon; connection->last_activity = MHD_monotonic_sec_counter(); - /* set default connection handlers */ - MHD_set_http_callbacks_ (connection); - connection->recv_cls = &recv_param_adapter; - connection->send_cls = &send_param_adapter; - - if (0 == (connection->daemon->options & MHD_USE_EPOLL_TURBO)) - { - /* non-blocking sockets are required on most systems and for GNUtls; - however, they somehow cause serious problems on CYGWIN (#1824); - in turbo mode, we assume that non-blocking was already set - by 'accept4' or whoever calls 'MHD_add_connection' */ -#ifdef CYGWIN - if (0 != (daemon->options & MHD_USE_SSL)) -#endif - { - /* make socket non-blocking */ -#if !defined(MHD_WINSOCK_SOCKETS) - int flags = fcntl (connection->socket_fd, F_GETFL); - if ( (-1 == flags) || - (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) ) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make socket non-blocking: %s\n", - MHD_socket_last_strerr_ ()); -#endif - } -#else - unsigned long flags = 1; - if (0 != ioctlsocket (connection->socket_fd, FIONBIO, &flags)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make socket non-blocking: %s\n", - MHD_socket_last_strerr_ ()); -#endif - } -#endif - } + if (0 == (daemon->options & MHD_USE_TLS)) + { + /* set default connection handlers */ + MHD_set_http_callbacks_ (connection); + connection->recv_cls = &recv_param_adapter; + connection->send_cls = &send_param_adapter; } - -#if HTTPS_SUPPORT - if (0 != (daemon->options & MHD_USE_SSL)) + else { +#ifdef HTTPS_SUPPORT connection->recv_cls = &recv_tls_adapter; connection->send_cls = &send_tls_adapter; connection->state = MHD_TLS_CONNECTION_INIT; MHD_set_https_callbacks (connection); - gnutls_init (&connection->tls_session, GNUTLS_SERVER); + gnutls_init (&connection->tls_session, + GNUTLS_SERVER); gnutls_priority_set (connection->tls_session, daemon->priority_cache); switch (daemon->cred_type) @@ -1504,17 +2553,18 @@ daemon->x509_cred); break; default: -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Failed to setup TLS credentials: unknown credential type %d\n", + _("Failed to setup TLS credentials: unknown credential type %d\n"), daemon->cred_type); #endif - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); free (connection->addr); free (connection); - MHD_PANIC ("Unknown credential type"); + MHD_PANIC (_("Unknown credential type")); #if EINVAL errno = EINVAL; #endif @@ -1530,21 +2580,24 @@ if (daemon->https_mem_trust) gnutls_certificate_server_set_request (connection->tls_session, GNUTLS_CERT_REQUEST); +#else /* ! HTTPS_SUPPORT */ + eno = EINVAL; + goto cleanup; +#endif /* ! HTTPS_SUPPORT */ } -#endif - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - XDLL_insert (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + } DLL_insert (daemon->connections_head, daemon->connections_tail, connection); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); if (NULL != daemon->notify_connection) daemon->notify_connection (daemon->notify_connection_cls, @@ -1555,39 +2608,39 @@ /* attempt to create handler thread */ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { - res_thread_create = create_thread (&connection->pid, - daemon, - &MHD_handle_connection, - connection); - if (0 != res_thread_create) + if (! MHD_create_named_thread_ (&connection->pid, + "MHD-connection", + daemon->thread_stack_size, + &thread_main_handle_connection, + connection)) { eno = errno; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, "Failed to create a thread: %s\n", - MHD_strerror_ (res_thread_create)); + MHD_strerror_ (eno)); #endif goto cleanup; } } else if ( (MHD_YES == external_add) && - (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && - (1 != MHD_pipe_write_ (daemon->wpipe[1], "n", 1)) ) + (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "n")) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "failed to signal new connection via pipe"); + _("Failed to signal new connection via inter-thread communication channel.")); #endif } -#if EPOLL_SUPPORT - if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) { - if (0 == (daemon->options & MHD_USE_EPOLL_TURBO)) + if (0 == (daemon->options & MHD_USE_TURBO)) { struct epoll_event event; - event.events = EPOLLIN | EPOLLOUT | EPOLLET; + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; event.data.ptr = connection; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, @@ -1595,9 +2648,9 @@ &event)) { eno = errno; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to epoll_ctl failed: %s\n", + _("Call to epoll_ctl failed: %s\n"), MHD_socket_last_strerr_ ()); #endif goto cleanup; @@ -1622,85 +2675,72 @@ connection, &connection->socket_context, MHD_CONNECTION_NOTIFY_CLOSED); - if (0 != MHD_socket_close_ (client_socket)) - MHD_PANIC ("close failed\n"); - MHD_ip_limit_del (daemon, addr, addrlen); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + } DLL_remove (daemon->connections_head, daemon->connections_tail, connection); - XDLL_remove (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); MHD_pool_destroy (connection->pool); free (connection->addr); free (connection); -#if EINVAL errno = eno; -#endif return MHD_NO; } /** - * Suspend handling of network data for a given connection. This can - * be used to dequeue a connection from MHD's event loop (external - * select, internal select or thread pool; not applicable to - * thread-per-connection!) for a while. - * - * If you use this API in conjunction with a internal select or a - * thread pool, you must set the option #MHD_USE_PIPE_FOR_SHUTDOWN to - * ensure that a resumed connection is immediately processed by MHD. - * - * Suspended connections continue to count against the total number of - * connections allowed (per daemon, as well as per IP, if such limits - * are set). Suspended connections will NOT time out; timeouts will - * restart when the connection handling is resumed. While a - * connection is suspended, MHD will not detect disconnects by the - * client. + * Internal version of ::MHD_suspend_connection(). * - * The only safe time to suspend a connection is from the - * #MHD_AccessHandlerCallback. - * - * Finally, it is an API violation to call #MHD_stop_daemon while - * having suspended connections (this will at least create memory and - * socket leaks or lead to undefined behavior). You must explicitly - * resume all connections before stopping the daemon. + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. * * @param connection the connection to suspend */ void -MHD_suspend_connection (struct MHD_Connection *connection) +internal_suspend_connection_ (struct MHD_Connection *connection) { - struct MHD_Daemon *daemon; + struct MHD_Daemon *daemon = connection->daemon; - daemon = connection->daemon; - if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME)) - MHD_PANIC ("Cannot suspend connections without enabling MHD_USE_SUSPEND_RESUME!\n"); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (connection->resuming) + { + /* suspending again while we didn't even complete resuming yet */ + connection->resuming = false; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + return; + } + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } DLL_remove (daemon->connections_head, daemon->connections_tail, connection); + EXTRA_CHECK (! connection->suspended); DLL_insert (daemon->suspended_connections_head, daemon->suspended_connections_tail, connection); - if (connection->connection_timeout == daemon->connection_timeout) - XDLL_remove (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - connection); - else - XDLL_remove (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - connection); -#if EPOLL_SUPPORT - if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) + connection->suspended = true; +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) { if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) { @@ -1715,16 +2755,65 @@ EPOLL_CTL_DEL, connection->socket_fd, NULL)) - MHD_PANIC ("Failed to remove FD from epoll set\n"); + MHD_PANIC (_("Failed to remove FD from epoll set\n")); connection->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET; } connection->epoll_state |= MHD_EPOLL_STATE_SUSPENDED; } #endif - connection->suspended = MHD_YES; - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** + * Suspend handling of network data for a given connection. This can + * be used to dequeue a connection from MHD's event loop (external + * select, internal select or thread pool; not applicable to + * thread-per-connection!) for a while. + * + * If you use this API in conjunction with a internal select or a + * thread pool, you must set the option #MHD_USE_ITC to + * ensure that a resumed connection is immediately processed by MHD. + * + * Suspended connections continue to count against the total number of + * connections allowed (per daemon, as well as per IP, if such limits + * are set). Suspended connections will NOT time out; timeouts will + * restart when the connection handling is resumed. While a + * connection is suspended, MHD will not detect disconnects by the + * client. + * + * The only safe time to suspend a connection is from the + * #MHD_AccessHandlerCallback. + * + * Finally, it is an API violation to call #MHD_stop_daemon while + * having suspended connections (this will at least create memory and + * socket leaks or lead to undefined behavior). You must explicitly + * resume all connections before stopping the daemon. + * + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the connection to suspend + */ +void +MHD_suspend_connection (struct MHD_Connection *connection) +{ + struct MHD_Daemon * const daemon = connection->daemon; + + if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + MHD_PANIC (_("Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); +#ifdef UPGRADE_SUPPORT + if (NULL != connection->urh) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error: connection scheduled for \"upgrade\" cannot be suspended")); +#endif /* HAVE_MESSAGES */ + return; + } +#endif /* UPGRADE_SUPPORT */ + internal_suspend_connection_ (connection); } @@ -1742,30 +2831,28 @@ struct MHD_Daemon *daemon; daemon = connection->daemon; - if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME)) - MHD_PANIC ("Cannot resume connections without enabling MHD_USE_SUSPEND_RESUME!\n"); - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - connection->resuming = MHD_YES; - daemon->resuming = MHD_YES; - if ( (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && - (1 != MHD_pipe_write_ (daemon->wpipe[1], "r", 1)) ) + if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + connection->resuming = true; + daemon->resuming = true; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "r")) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "failed to signal resume via pipe"); + _("Failed to signal resume via inter-thread communication channel.")); #endif } - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); } /** * Run through the suspended connections and move any that are no * longer suspended back to the active state. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. * * @param daemon daemon context * @return #MHD_YES if a connection was actually resumed @@ -1774,114 +2861,105 @@ resume_suspended_connections (struct MHD_Daemon *daemon) { struct MHD_Connection *pos; - struct MHD_Connection *next = NULL; + struct MHD_Connection *prev = NULL; int ret; + const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)); ret = MHD_NO; - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - if (MHD_YES == daemon->resuming) - next = daemon->suspended_connections_head; + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); - while (NULL != (pos = next)) - { - next = pos->next; - if (MHD_NO == pos->resuming) + if (daemon->resuming) + prev = daemon->suspended_connections_tail; + + EXTRA_CHECK(NULL != next); + daemon->resuming = false; + + while (NULL != (pos = prev)) + { +#ifdef UPGRADE_SUPPORT + struct MHD_UpgradeResponseHandle * const urh = pos->urh; +#else /* ! UPGRADE_SUPPORT */ + static const void * const urh = NULL; +#endif /* ! UPGRADE_SUPPORT */ + prev = pos->prev; + if ( (! pos->resuming) +#ifdef UPGRADE_SUPPORT + || ( (NULL != urh) && + ( (! urh->was_closed) || + (! urh->clean_ready) ) ) +#endif /* UPGRADE_SUPPORT */ + ) continue; ret = MHD_YES; + EXTRA_CHECK (pos->suspended); DLL_remove (daemon->suspended_connections_head, daemon->suspended_connections_tail, pos); - DLL_insert (daemon->connections_head, - daemon->connections_tail, - pos); - if (pos->connection_timeout == daemon->connection_timeout) - XDLL_insert (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - pos); - else - XDLL_insert (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - pos); -#if EPOLL_SUPPORT - if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) + pos->suspended = false; + if (NULL == urh) { - if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) - MHD_PANIC ("Resumed connection was already in EREADY set\n"); - /* we always mark resumed connections as ready, as we - might have missed the edge poll event during suspension */ - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - pos); - pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - pos->epoll_state &= ~MHD_EPOLL_STATE_SUSPENDED; - } + DLL_insert (daemon->connections_head, + daemon->connections_tail, + pos); + if (!used_thr_p_c) + { + /* Reset timeout timer on resume. */ + if (0 != pos->connection_timeout) + pos->last_activity = MHD_monotonic_sec_counter(); + + if (pos->connection_timeout == daemon->connection_timeout) + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + pos); + else + XDLL_insert (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + pos); + } +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + MHD_PANIC ("Resumed connection was already in EREADY set\n"); + /* we always mark resumed connections as ready, as we + might have missed the edge poll event during suspension */ + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL | \ + MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + pos->epoll_state &= ~MHD_EPOLL_STATE_SUSPENDED; + } #endif - pos->suspended = MHD_NO; - pos->resuming = MHD_NO; - } - daemon->resuming = MHD_NO; - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); - return ret; -} - - -/** - * Change socket options to be non-blocking, non-inheritable. - * - * @param daemon daemon context - * @param sock socket to manipulate - */ -static void -make_nonblocking_noninheritable (struct MHD_Daemon *daemon, - MHD_socket sock) -{ -#ifdef MHD_WINSOCK_SOCKETS - DWORD dwFlags; - unsigned long flags = 1; + } +#ifdef UPGRADE_SUPPORT + else + { + /* Data forwarding was finished (for TLS connections) AND + * application was closed upgraded connection. + * Insert connection into cleanup list. */ + DLL_insert (daemon->cleanup_head, + daemon->cleanup_tail, + pos); - if (0 != ioctlsocket (sock, FIONBIO, &flags)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make socket non-blocking: %s\n", - MHD_socket_last_strerr_ ()); -#endif - } - if (!GetHandleInformation ((HANDLE) sock, &dwFlags) || - ((dwFlags != (dwFlags & ~HANDLE_FLAG_INHERIT)) && - !SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0))) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make socket non-inheritable: %u\n", - (unsigned int) GetLastError ()); -#endif + } +#endif /* UPGRADE_SUPPORT */ + pos->resuming = false; } -#else - int flags; - int nonblock; - - nonblock = O_NONBLOCK; -#ifdef CYGWIN - if (0 == (daemon->options & MHD_USE_SSL)) - nonblock = 0; -#endif - flags = fcntl (sock, F_GETFD); - if ( ( (-1 == flags) || - ( (flags != (flags | FD_CLOEXEC)) && - (0 != fcntl (sock, F_SETFD, flags | nonblock | FD_CLOEXEC)) ) ) ) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make socket non-inheritable: %s\n", - MHD_socket_last_strerr_ ()); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (used_thr_p_c) && + (MHD_NO != ret) ) + { /* Wake up suspended connections. */ + if (! MHD_itc_activate_(daemon->itc, + "w")) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal resume of connection via inter-thread communication channel.")); #endif + } } -#endif + return ret; } @@ -1894,7 +2972,7 @@ * * If you use this API in conjunction with a internal select or a * thread pool, you must set the option - * #MHD_USE_PIPE_FOR_SHUTDOWN to ensure that the freshly added + * #MHD_USE_ITC to ensure that the freshly added * connection is immediately processed by MHD. * * The given client socket will be managed (and closed!) by MHD after @@ -1920,12 +2998,33 @@ const struct sockaddr *addr, socklen_t addrlen) { - make_nonblocking_noninheritable (daemon, - client_socket); + bool sk_nonbl; + if (! MHD_socket_nonblocking_ (client_socket)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on new client socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + sk_nonbl = 0; + } + else + sk_nonbl = !0; + + if ( (0 != (daemon->options & MHD_USE_TURBO)) && + (! MHD_socket_noninheritable_ (client_socket)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on new client socket.\n")); +#endif + } return internal_add_connection (daemon, client_socket, - addr, addrlen, - MHD_YES); + addr, + addrlen, + MHD_YES, + sk_nonbl); } @@ -1933,6 +3032,8 @@ * Accept an incoming connection and create the MHD_Connection object for * it. This function also enforces policy by way of checking with the * accept policy callback. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. * * @param daemon handle with the listen socket * @return #MHD_YES on success (connections denied by policy or due @@ -1953,60 +3054,107 @@ socklen_t addrlen; MHD_socket s; MHD_socket fd; - int nonblock; + bool sk_nonbl; addrlen = sizeof (addrstorage); - memset (addr, 0, sizeof (addrstorage)); - if (MHD_INVALID_SOCKET == (fd = daemon->socket_fd)) + memset (addr, + 0, + sizeof (addrstorage)); + if ( (MHD_INVALID_SOCKET == (fd = daemon->listen_fd)) || + (daemon->was_quiesced) ) return MHD_NO; -#ifdef HAVE_SOCK_NONBLOCK - nonblock = SOCK_NONBLOCK; -#else - nonblock = 0; -#endif -#ifdef CYGWIN - if (0 == (daemon->options & MHD_USE_SSL)) - nonblock = 0; -#endif -#if HAVE_ACCEPT4 - s = accept4 (fd, addr, &addrlen, SOCK_CLOEXEC | nonblock); -#else - s = accept (fd, addr, &addrlen); -#endif - if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0)) +#ifdef USE_ACCEPT4 + s = accept4 (fd, + addr, + &addrlen, + MAYBE_SOCK_CLOEXEC | MAYBE_SOCK_NONBLOCK); + sk_nonbl = (MAYBE_SOCK_NONBLOCK != 0); +#else /* ! USE_ACCEPT4 */ + s = accept (fd, + addr, + &addrlen); + sk_nonbl = 0; +#endif /* ! USE_ACCEPT4 */ + if ( (MHD_INVALID_SOCKET == s) || + (addrlen <= 0) ) { -#if HAVE_MESSAGES - const int err = MHD_socket_errno_; + const int err = MHD_socket_get_error_ (); + /* This could be a common occurance with multiple worker threads */ - if ( (EINVAL == err) && - (MHD_INVALID_SOCKET == daemon->socket_fd) ) + if (MHD_SCKT_ERR_IS_ (err, + MHD_SCKT_EINVAL_)) return MHD_NO; /* can happen during shutdown */ - if ((EAGAIN != err) && (EWOULDBLOCK != err)) + if (MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err)) + return MHD_NO; /* do not print error if client just disconnected early */ +#ifdef HAVE_MESSAGES + if (! MHD_SCKT_ERR_IS_EAGAIN_ (err) ) MHD_DLOG (daemon, - "Error accepting connection: %s\n", - MHD_socket_last_strerr_ ()); + _("Error accepting connection: %s\n"), + MHD_socket_strerr_(err)); #endif if (MHD_INVALID_SOCKET != s) { - if (0 != MHD_socket_close_ (s)) - MHD_PANIC ("close failed\n"); - /* just in case */ + MHD_socket_close_chk_ (s); + } + if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) + { + /* system/process out of resources */ + if (0 == daemon->connections) + { +#ifdef HAVE_MESSAGES + /* Not setting 'at_limit' flag, as there is no way it + would ever be cleared. Instead trying to produce + bit fat ugly warning. */ + MHD_DLOG (daemon, + _("Hit process or system resource limit at FIRST connection. This is really bad as there is no sane way to proceed. Will try busy waiting for system resources to become magically available.\n")); +#endif + } + else + { + daemon->at_limit = true; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Hit process or system resource limit at %u connections, temporarily suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n"), + (unsigned int) daemon->connections); +#endif + } } return MHD_NO; } -#if !defined(HAVE_ACCEPT4) || HAVE_ACCEPT4+0 == 0 || !defined(HAVE_SOCK_NONBLOCK) || SOCK_CLOEXEC+0 == 0 - make_nonblocking_noninheritable (daemon, s); +#if !defined(USE_ACCEPT4) || !defined(HAVE_SOCK_NONBLOCK) + if (! MHD_socket_nonblocking_ (s)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on incoming connection socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + } + else + sk_nonbl = !0; +#endif /* !USE_ACCEPT4 || !HAVE_SOCK_NONBLOCK */ +#if !defined(USE_ACCEPT4) || !defined(SOCK_CLOEXEC) + if (! MHD_socket_noninheritable_ (s)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on incoming connection socket.\n")); #endif -#if HAVE_MESSAGES + } +#endif /* !USE_ACCEPT4 || !SOCK_CLOEXEC */ +#ifdef HAVE_MESSAGES #if DEBUG_CONNECT MHD_DLOG (daemon, - "Accepted connection on socket %d\n", + _("Accepted connection on socket %d\n"), s); #endif #endif - (void) internal_add_connection (daemon, s, - addr, addrlen, - MHD_NO); + (void) internal_add_connection (daemon, + s, + addr, + addrlen, + MHD_NO, + sk_nonbl); return MHD_YES; } @@ -2015,6 +3163,8 @@ * Free resources associated with all closed connections. * (destroy responses, free buffers, etc.). All closed * connections are kept in the "cleanup" doubly-linked list. + * @remark To be called only from thread that + * process daemon's select()/poll()/etc. * * @param daemon daemon to clean up */ @@ -2023,59 +3173,65 @@ { struct MHD_Connection *pos; - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - while (NULL != (pos = daemon->cleanup_head)) + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + while (NULL != (pos = daemon->cleanup_tail)) { DLL_remove (daemon->cleanup_head, daemon->cleanup_tail, pos); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_NO == pos->thread_joined) ) - { - if (0 != MHD_join_thread_ (pos->pid)) - { - MHD_PANIC ("Failed to join a thread\n"); - } - } + (! pos->thread_joined) && + (! MHD_join_thread_ (pos->pid)) ) + MHD_PANIC (_("Failed to join a thread\n")); +#ifdef UPGRADE_SUPPORT + cleanup_upgraded_connection (pos); +#endif /* UPGRADE_SUPPORT */ MHD_pool_destroy (pos->pool); -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT if (NULL != pos->tls_session) gnutls_deinit (pos->tls_session); -#endif +#endif /* HTTPS_SUPPORT */ daemon->connections--; + daemon->at_limit = false; + + /* clean up the connection */ if (NULL != daemon->notify_connection) daemon->notify_connection (daemon->notify_connection_cls, pos, &pos->socket_context, MHD_CONNECTION_NOTIFY_CLOSED); - MHD_ip_limit_del (daemon, pos->addr, pos->addr_len); -#if EPOLL_SUPPORT - if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) - { - EDLL_remove (daemon->eready_head, - daemon->eready_tail, - pos); - pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && - (MHD_INVALID_SOCKET != daemon->epoll_fd) && - (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) ) - { - /* epoll documentation suggests that closing a FD - automatically removes it from the epoll set; however, - this is not true as if we fail to do manually remove it, - we are still seeing an event for this fd in epoll, - causing grief (use-after-free...) --- at least on my - system. */ - if (0 != epoll_ctl (daemon->epoll_fd, - EPOLL_CTL_DEL, - pos->socket_fd, - NULL)) - MHD_PANIC ("Failed to remove FD from epoll set\n"); - pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET; - } + MHD_ip_limit_del (daemon, + pos->addr, + pos->addr_len); +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + { + EDLL_remove (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + if ( (-1 != daemon->epoll_fd) && + (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) ) + { + /* epoll documentation suggests that closing a FD + automatically removes it from the epoll set; however, + this is not true as if we fail to do manually remove it, + we are still seeing an event for this fd in epoll, + causing grief (use-after-free...) --- at least on my + system. */ + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + pos->socket_fd, + NULL)) + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET; + } + } #endif if (NULL != pos->response) { @@ -2083,20 +3239,14 @@ pos->response = NULL; } if (MHD_INVALID_SOCKET != pos->socket_fd) - { -#ifdef WINDOWS - shutdown (pos->socket_fd, SHUT_WR); -#endif - if (0 != MHD_socket_close_ (pos->socket_fd)) - MHD_PANIC ("close failed\n"); - } + MHD_socket_close_chk_ (pos->socket_fd); if (NULL != pos->addr) free (pos->addr); free (pos); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); } - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); } @@ -2106,12 +3256,14 @@ * `select()` or `poll()` should at most block, not the timeout value set * for connections. This function MUST NOT be called if MHD is * running with #MHD_USE_THREAD_PER_CONNECTION. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. * * @param daemon daemon to query for timeout * @param timeout set to the timeout (in milliseconds) * @return #MHD_YES on success, #MHD_NO if timeouts are * not used (or no connections exist that would - * necessiate the use of a timeout right now). + * necessitate the use of a timeout right now). * @ingroup event */ int @@ -2121,61 +3273,62 @@ time_t earliest_deadline; time_t now; struct MHD_Connection *pos; - int have_timeout; + bool have_timeout; if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Illegal call to MHD_get_timeout\n"); + _("Illegal call to MHD_get_timeout\n")); #endif return MHD_NO; } -#if HTTPS_SUPPORT - if (0 != daemon->num_tls_read_ready) + if (daemon->data_already_pending) { - /* if there is any TLS connection with data ready for - reading, we must not block in the event loop */ + /* Some data already waiting to be processed. */ *timeout = 0; return MHD_YES; } -#endif - have_timeout = MHD_NO; +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + ((NULL != daemon->eready_head) +#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT) + || (NULL != daemon->eready_urh_head) +#endif /* UPGRADE_SUPPORT && HTTPS_SUPPORT */ + ) ) + { + /* Some connection(s) already have some data pending. */ + *timeout = 0; + return MHD_YES; + } +#endif /* EPOLL_SUPPORT */ + + have_timeout = false; earliest_deadline = 0; /* avoid compiler warnings */ - for (pos = daemon->manual_timeout_head; NULL != pos; pos = pos->nextX) + for (pos = daemon->manual_timeout_tail; NULL != pos; pos = pos->prevX) { if (0 != pos->connection_timeout) { if ( (! have_timeout) || - (earliest_deadline > pos->last_activity + pos->connection_timeout) ) + (earliest_deadline - pos->last_activity > pos->connection_timeout) ) earliest_deadline = pos->last_activity + pos->connection_timeout; -#if HTTPS_SUPPORT - if ( (0 != (daemon->options & MHD_USE_SSL)) && - (0 != gnutls_record_check_pending (pos->tls_session)) ) - earliest_deadline = 0; -#endif - have_timeout = MHD_YES; + have_timeout = true; } } - /* normal timeouts are sorted, so we only need to look at the 'head' */ - pos = daemon->normal_timeout_head; + /* normal timeouts are sorted, so we only need to look at the 'tail' (oldest) */ + pos = daemon->normal_timeout_tail; if ( (NULL != pos) && (0 != pos->connection_timeout) ) { if ( (! have_timeout) || - (earliest_deadline > pos->last_activity + pos->connection_timeout) ) + (earliest_deadline - pos->connection_timeout > pos->last_activity) ) earliest_deadline = pos->last_activity + pos->connection_timeout; -#if HTTPS_SUPPORT - if ( (0 != (daemon->options & MHD_USE_SSL)) && - (0 != gnutls_record_check_pending (pos->tls_session)) ) - earliest_deadline = 0; -#endif - have_timeout = MHD_YES; + have_timeout = true; } - if (MHD_NO == have_timeout) + if (! have_timeout) return MHD_NO; now = MHD_monotonic_sec_counter(); if (earliest_deadline < now) @@ -2183,26 +3336,17 @@ else { const time_t second_left = earliest_deadline - now; - if (second_left > ULLONG_MAX / 1000) + if (second_left > ULLONG_MAX / 1000) /* Ignore compiler warning: 'second_left' is always positive. */ *timeout = ULLONG_MAX; else - *timeout = 1000 * second_left; + *timeout = 1000LL * second_left; } return MHD_YES; } /** - * Run webserver operations. This method should be called by clients - * in combination with #MHD_get_fdset if the client-controlled select - * method is used. - * - * You can use this function instead of #MHD_run if you called - * `select()` on the result from #MHD_get_fdset. File descriptors in - * the sets that are not controlled by MHD will be ignored. Calling - * this function instead of #MHD_run is more efficient as MHD will - * not have to call `select()` again to determine which operations are - * ready. + * Internal version of #MHD_run_from_select(). * * @param daemon daemon to run select loop for * @param read_fd_set read set @@ -2211,92 +3355,156 @@ * @return #MHD_NO on serious errors, #MHD_YES on success * @ingroup event */ -int -MHD_run_from_select (struct MHD_Daemon *daemon, - const fd_set *read_fd_set, - const fd_set *write_fd_set, - const fd_set *except_fd_set) +static int +internal_run_from_select (struct MHD_Daemon *daemon, + const fd_set *read_fd_set, + const fd_set *write_fd_set, + const fd_set *except_fd_set) { MHD_socket ds; - char tmp; struct MHD_Connection *pos; - struct MHD_Connection *next; - unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY | - MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION; - - /* Resuming external connections when using an extern mainloop */ - if (MHD_USE_SUSPEND_RESUME == (daemon->options & mask)) - resume_suspended_connections (daemon); - -#if EPOLL_SUPPORT - if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) - { - /* we're in epoll mode, the epoll FD stands for - the entire event set! */ - if (daemon->epoll_fd >= FD_SETSIZE) - return MHD_NO; /* poll fd too big, fail hard */ - if (FD_ISSET (daemon->epoll_fd, read_fd_set)) - return MHD_run (daemon); - return MHD_YES; - } -#endif + struct MHD_Connection *prev; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + /* Reset. New value will be set when connections are processed. */ + /* Note: no-op for thread-per-connection as it is always false in that mode. */ + daemon->data_already_pending = false; + + /* Clear ITC to avoid spinning select */ + /* Do it before any other processing so new signals + will trigger select again and will be processed */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (FD_ISSET (MHD_itc_r_fd_ (daemon->itc), + read_fd_set)) ) + MHD_itc_clear_ (daemon->itc); /* select connection thread handling type */ - if ( (MHD_INVALID_SOCKET != (ds = daemon->socket_fd)) && - (FD_ISSET (ds, read_fd_set)) ) + if ( (MHD_INVALID_SOCKET != (ds = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (FD_ISSET (ds, + read_fd_set)) ) (void) MHD_accept_connection (daemon); - /* drain signaling pipe to avoid spinning select */ - if ( (MHD_INVALID_PIPE_ != daemon->wpipe[0]) && - (FD_ISSET (daemon->wpipe[0], read_fd_set)) ) - (void) MHD_pipe_read_ (daemon->wpipe[0], &tmp, sizeof (tmp)); if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { /* do not have a thread per connection, process all connections now */ - next = daemon->connections_head; - while (NULL != (pos = next)) + prev = daemon->connections_tail; + while (NULL != (pos = prev)) { - next = pos->next; + prev = pos->prev; ds = pos->socket_fd; if (MHD_INVALID_SOCKET == ds) continue; - switch (pos->event_loop_info) - { - case MHD_EVENT_LOOP_INFO_READ: - if ( (FD_ISSET (ds, read_fd_set)) -#if HTTPS_SUPPORT - || (MHD_YES == pos->tls_read_ready) -#endif - ) - pos->read_handler (pos); - break; - case MHD_EVENT_LOOP_INFO_WRITE: - if ( (FD_ISSET (ds, read_fd_set)) && - (pos->read_buffer_size > pos->read_buffer_offset) ) - pos->read_handler (pos); - if (FD_ISSET (ds, write_fd_set)) - pos->write_handler (pos); - break; - case MHD_EVENT_LOOP_INFO_BLOCK: - if ( (FD_ISSET (ds, read_fd_set)) && - (pos->read_buffer_size > pos->read_buffer_offset) ) - pos->read_handler (pos); - break; - case MHD_EVENT_LOOP_INFO_CLEANUP: - /* should never happen */ - break; - } - pos->idle_handler (pos); + call_handlers (pos, + FD_ISSET (ds, + read_fd_set), + FD_ISSET (ds, + write_fd_set), + FD_ISSET (ds, + except_fd_set)); } } + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + /* handle upgraded HTTPS connections */ + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + urhn = urh->prev; + /* update urh state based on select() output */ + urh_from_fdset (urh, + read_fd_set, + write_fd_set, + except_fd_set); + /* call generic forwarding function for passing data */ + process_urh (urh); + /* Finished forwarding? */ + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + { + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* Resuming will move connection to cleanup list. */ + MHD_resume_connection(urh->connection); + } + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ MHD_cleanup_connections (daemon); return MHD_YES; } /** + * Run webserver operations. This method should be called by clients + * in combination with #MHD_get_fdset if the client-controlled select + * method is used. + * + * You can use this function instead of #MHD_run if you called + * `select()` on the result from #MHD_get_fdset. File descriptors in + * the sets that are not controlled by MHD will be ignored. Calling + * this function instead of #MHD_run is more efficient as MHD will + * not have to call `select()` again to determine which operations are + * ready. + * + * This function cannot be used with daemon started with + * MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to run select loop for + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @return #MHD_NO on serious errors, #MHD_YES on success + * @ingroup event + */ +int +MHD_run_from_select (struct MHD_Daemon *daemon, + const fd_set *read_fd_set, + const fd_set *write_fd_set, + const fd_set *except_fd_set) +{ + fd_set es; + if (0 != (daemon->options & + (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) ) + return MHD_NO; + if (NULL == read_fd_set || NULL == write_fd_set) + return MHD_NO; + if (NULL == except_fd_set) + { /* Workaround to maintain backward compatibility. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_run_from_select() called with except_fd_set " + "set to NULL. Such behavior is deprecated.\n")); +#endif + FD_ZERO (&es); + except_fd_set = &es; + } + if (0 != (daemon->options & MHD_USE_EPOLL)) + { +#ifdef EPOLL_SUPPORT + int ret; + ret = MHD_epoll (daemon, MHD_NO); + MHD_cleanup_connections (daemon); + return ret; +#else /* ! EPOLL_SUPPORT */ + return MHD_NO; +#endif /* ! EPOLL_SUPPORT */ + } + + /* Resuming external connections when using an extern mainloop */ + if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + resume_suspended_connections (daemon); + + return internal_run_from_select (daemon, read_fd_set, + write_fd_set, except_fd_set); +} + + +/** * Main internal select() call. Will compute select sets, call select() - * and then #MHD_run_from_select with the result. + * and then #internal_run_from_select with the result. * * @param daemon daemon to run select() loop for * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking @@ -2310,57 +3518,110 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; struct timeval timeout; struct timeval *tv; MHD_UNSIGNED_LONG_LONG ltimeout; + int err_state; + MHD_socket ls; timeout.tv_sec = 0; timeout.tv_usec = 0; - if (MHD_YES == daemon->shutdown) + if (daemon->shutdown) return MHD_NO; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); - max = MHD_INVALID_SOCKET; + maxsock = MHD_INVALID_SOCKET; + err_state = MHD_NO; + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) && + (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + may_block = MHD_NO; + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { - if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) && - (MHD_YES == resume_suspended_connections (daemon)) ) - may_block = MHD_NO; - /* single-threaded, go over everything */ - if (MHD_NO == MHD_get_fdset2 (daemon, &rs, &ws, &es, &max, FD_SETSIZE)) - return MHD_NO; - - /* If we're at the connection limit, no need to - accept new connections; however, make sure - we do not miss the shutdown, so only do this - optimization if we have a shutdown signaling - pipe. */ - if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && - (daemon->connections == daemon->connection_limit) && - (0 != (daemon->options & MHD_USE_PIPE_FOR_SHUTDOWN)) ) - FD_CLR (daemon->socket_fd, &rs); + if (MHD_NO == + internal_get_fdset2 (daemon, + &rs, + &ws, + &es, + &maxsock, + FD_SETSIZE)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not obtain daemon fdsets")); +#endif + err_state = MHD_YES; + } } else { /* accept only, have one thread per connection */ - if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && - (MHD_YES != add_to_fd_set (daemon->socket_fd, - &rs, - &max, - FD_SETSIZE)) ) - return MHD_NO; - } - if ( (MHD_INVALID_PIPE_ != daemon->wpipe[0]) && - (MHD_YES != add_to_fd_set (daemon->wpipe[0], + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (! MHD_add_to_fd_set_ (ls, &rs, - &max, + &maxsock, FD_SETSIZE)) ) - return MHD_NO; - + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not add listen socket to fdset")); +#endif + return MHD_NO; + } + } + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) ) + { +#if defined(MHD_WINSOCK_SOCKETS) + /* fdset limit reached, new connections + cannot be handled. Remove listen socket FD + from fdset and retry to add ITC FD. */ + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) ) + { + FD_CLR (ls, + &rs); + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_(daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) + { +#endif /* MHD_WINSOCK_SOCKETS */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not add control inter-thread communication channel FD to fdset")); +#endif + err_state = MHD_YES; +#if defined(MHD_WINSOCK_SOCKETS) + } + } +#endif /* MHD_WINSOCK_SOCKETS */ + } + /* Stop listening if we are at the configured connection limit */ + /* If we're at the connection limit, no point in really + accepting new connections; however, make sure we do not miss + the shutdown OR the termination of an existing connection; so + only do this optimization if we have a signaling ITC in + place. */ + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (MHD_ITC_IS_VALID_(daemon->itc)) && + ( (daemon->connections == daemon->connection_limit) || + (daemon->at_limit) ) ) + { + FD_CLR (ls, + &rs); + } tv = NULL; + if (MHD_YES == err_state) + may_block = MHD_NO; if (MHD_NO == may_block) { timeout.tv_usec = 0; @@ -2378,21 +3639,31 @@ timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE)(ltimeout / 1000); tv = &timeout; } - num_ready = MHD_SYS_select_ (max + 1, &rs, &ws, &es, tv); - if (MHD_YES == daemon->shutdown) + num_ready = MHD_SYS_select_ (maxsock + 1, + &rs, + &ws, + &es, + tv); + if (daemon->shutdown) return MHD_NO; if (num_ready < 0) { - if (EINTR == MHD_socket_errno_) - return MHD_YES; -#if HAVE_MESSAGES + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_(err)) + return (MHD_NO == err_state) ? MHD_YES : MHD_NO; +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "select failed: %s\n", - MHD_socket_last_strerr_ ()); + _("select failed: %s\n"), + MHD_socket_strerr_ (err)); #endif return MHD_NO; } - return MHD_run_from_select (daemon, &rs, &ws, &es); + if (MHD_YES == internal_run_from_select (daemon, + &rs, + &ws, + &es)) + return (MHD_NO == err_state) ? MHD_YES : MHD_NO; + return MHD_NO; } @@ -2411,9 +3682,13 @@ { unsigned int num_connections; struct MHD_Connection *pos; - struct MHD_Connection *next; + struct MHD_Connection *prev; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ - if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) && + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && (MHD_YES == resume_suspended_connections (daemon)) ) may_block = MHD_NO; @@ -2421,73 +3696,76 @@ num_connections = 0; for (pos = daemon->connections_head; NULL != pos; pos = pos->next) num_connections++; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_head; NULL != urh; urh = urh->next) + num_connections += 2; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ { MHD_UNSIGNED_LONG_LONG ltimeout; unsigned int i; int timeout; unsigned int poll_server; int poll_listen; - int poll_pipe; - char tmp; + int poll_itc_idx; struct pollfd *p; + MHD_socket ls; - p = malloc(sizeof (struct pollfd) * (2 + num_connections)); + p = MHD_calloc_ ((2 + num_connections), sizeof (struct pollfd)); if (NULL == p) { -#if HAVE_MESSAGES - MHD_DLOG(daemon, - "Error allocating memory: %s\n", - MHD_strerror_(errno)); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error allocating memory: %s\n"), + MHD_strerror_(errno)); #endif return MHD_NO; } - memset (p, 0, sizeof (struct pollfd) * (2 + num_connections)); poll_server = 0; poll_listen = -1; - if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && - (daemon->connections < daemon->connection_limit) ) + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (daemon->connections < daemon->connection_limit) && + (! daemon->at_limit) ) { /* only listen if we are not at the connection limit */ - p[poll_server].fd = daemon->socket_fd; + p[poll_server].fd = ls; p[poll_server].events = POLLIN; p[poll_server].revents = 0; poll_listen = (int) poll_server; poll_server++; } - poll_pipe = -1; - if (MHD_INVALID_PIPE_ != daemon->wpipe[0]) + poll_itc_idx = -1; + if (MHD_ITC_IS_VALID_(daemon->itc)) { - p[poll_server].fd = daemon->wpipe[0]; + p[poll_server].fd = MHD_itc_r_fd_ (daemon->itc); p[poll_server].events = POLLIN; p[poll_server].revents = 0; - poll_pipe = (int) poll_server; + poll_itc_idx = (int) poll_server; poll_server++; } if (may_block == MHD_NO) timeout = 0; else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || - (MHD_YES != MHD_get_timeout (daemon, <imeout)) ) + (MHD_YES != MHD_get_timeout (daemon, + <imeout)) ) timeout = -1; else timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout; i = 0; - for (pos = daemon->connections_head; NULL != pos; pos = pos->next) + for (pos = daemon->connections_tail; NULL != pos; pos = pos->prev) { p[poll_server+i].fd = pos->socket_fd; switch (pos->event_loop_info) { case MHD_EVENT_LOOP_INFO_READ: - p[poll_server+i].events |= POLLIN; + p[poll_server+i].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_WRITE: - p[poll_server+i].events |= POLLOUT; - if (pos->read_buffer_size > pos->read_buffer_offset) - p[poll_server+i].events |= POLLIN; + p[poll_server+i].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_BLOCK: - if (pos->read_buffer_size > pos->read_buffer_offset) - p[poll_server+i].events |= POLLIN; + p[poll_server+i].events |= MHD_POLL_EVENTS_ERR_DISC; break; case MHD_EVENT_LOOP_INFO_CLEANUP: timeout = 0; /* clean up "pos" immediately */ @@ -2495,85 +3773,108 @@ } i++; } +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_tail; NULL != urh; urh = urh->prev) + { + urh_to_pollfd(urh, &(p[poll_server+i])); + i += 2; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ if (0 == poll_server + num_connections) { free(p); return MHD_YES; } - if (MHD_sys_poll_(p, poll_server + num_connections, timeout) < 0) + if (MHD_sys_poll_(p, + poll_server + num_connections, + timeout) < 0) { - if (EINTR == MHD_socket_errno_) + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) { free(p); return MHD_YES; } -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "poll failed: %s\n", - MHD_socket_last_strerr_ ()); + _("poll failed: %s\n"), + MHD_socket_strerr_ (err)); #endif free(p); return MHD_NO; } + + /* Reset. New value will be set when connections are processed. */ + daemon->data_already_pending = false; + + /* handle ITC FD */ + /* do it before any other processing so + new signals will be processed in next loop */ + if ( (-1 != poll_itc_idx) && + (0 != (p[poll_itc_idx].revents & POLLIN)) ) + MHD_itc_clear_ (daemon->itc); + /* handle shutdown */ - if (MHD_YES == daemon->shutdown) + if (daemon->shutdown) { free(p); return MHD_NO; } i = 0; - next = daemon->connections_head; - while (NULL != (pos = next)) + prev = daemon->connections_tail; + while (NULL != (pos = prev)) { - next = pos->next; - switch (pos->event_loop_info) - { - case MHD_EVENT_LOOP_INFO_READ: - /* first, sanity checks */ - if (i >= num_connections) - break; /* connection list changed somehow, retry later ... */ - if (p[poll_server+i].fd != pos->socket_fd) - break; /* fd mismatch, something else happened, retry later ... */ - /* normal handling */ - if (0 != (p[poll_server+i].revents & POLLIN)) - pos->read_handler (pos); - pos->idle_handler (pos); - i++; - break; - case MHD_EVENT_LOOP_INFO_WRITE: - /* first, sanity checks */ - if (i >= num_connections) - break; /* connection list changed somehow, retry later ... */ - if (p[poll_server+i].fd != pos->socket_fd) - break; /* fd mismatch, something else happened, retry later ... */ - /* normal handling */ - if (0 != (p[poll_server+i].revents & POLLIN)) - pos->read_handler (pos); - if (0 != (p[poll_server+i].revents & POLLOUT)) - pos->write_handler (pos); - pos->idle_handler (pos); - i++; - break; - case MHD_EVENT_LOOP_INFO_BLOCK: - if (0 != (p[poll_server+i].revents & POLLIN)) - pos->read_handler (pos); - pos->idle_handler (pos); - break; - case MHD_EVENT_LOOP_INFO_CLEANUP: - pos->idle_handler (pos); - break; - } + prev = pos->prev; + /* first, sanity checks */ + if (i >= num_connections) + break; /* connection list changed somehow, retry later ... */ + if (p[poll_server+i].fd != pos->socket_fd) + continue; /* fd mismatch, something else happened, retry later ... */ + call_handlers (pos, + 0 != (p[poll_server+i].revents & POLLIN), + 0 != (p[poll_server+i].revents & POLLOUT), + 0 != (p[poll_server+i].revents & MHD_POLL_REVENTS_ERR_DISC)); + i++; } +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + if (i >= num_connections) + break; /* connection list changed somehow, retry later ... */ + + /* Get next connection here as connection can be removed + * from 'daemon->urh_head' list. */ + urhn = urh->prev; + /* Check for fd mismatch. FIXME: required for safety? */ + if ((p[poll_server+i].fd != urh->connection->socket_fd) || + (p[poll_server+i+1].fd != urh->mhd.socket)) + break; + urh_from_pollfd(urh, &(p[poll_server+i])); + i += 2; + process_urh (urh); + /* Finished forwarding? */ + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + { + /* MHD_connection_finish_forward_() will remove connection from + * 'daemon->urh_head' list. */ + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* If 'urh->was_closed' already was set to true, connection will be + * moved immediately to cleanup list. Otherwise connection + * will stay in suspended list until 'urh' will be marked + * with 'was_closed' by application. */ + MHD_resume_connection(urh->connection); + } + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ /* handle 'listen' FD */ if ( (-1 != poll_listen) && (0 != (p[poll_listen].revents & POLLIN)) ) (void) MHD_accept_connection (daemon); - /* handle pipe FD */ - if ( (-1 != poll_pipe) && - (0 != (p[poll_pipe].revents & POLLIN)) ) - (void) MHD_pipe_read_ (daemon->wpipe[0], &tmp, sizeof (tmp)); - free(p); } return MHD_YES; @@ -2595,44 +3896,64 @@ int timeout; unsigned int poll_count; int poll_listen; + int poll_itc_idx; + MHD_socket ls; - memset (&p, 0, sizeof (p)); + memset (&p, + 0, + sizeof (p)); poll_count = 0; poll_listen = -1; - if (MHD_INVALID_SOCKET != daemon->socket_fd) + poll_itc_idx = -1; + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) ) + { - p[poll_count].fd = daemon->socket_fd; + p[poll_count].fd = ls; p[poll_count].events = POLLIN; p[poll_count].revents = 0; poll_listen = poll_count; poll_count++; } - if (MHD_INVALID_PIPE_ != daemon->wpipe[0]) + if (MHD_ITC_IS_VALID_(daemon->itc)) { - p[poll_count].fd = daemon->wpipe[0]; + p[poll_count].fd = MHD_itc_r_fd_ (daemon->itc); p[poll_count].events = POLLIN; p[poll_count].revents = 0; + poll_itc_idx = poll_count; poll_count++; } + + if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + (void)resume_suspended_connections (daemon); + if (MHD_NO == may_block) timeout = 0; else timeout = -1; if (0 == poll_count) return MHD_YES; - if (MHD_sys_poll_(p, poll_count, timeout) < 0) + if (MHD_sys_poll_(p, + poll_count, + timeout) < 0) { - if (EINTR == MHD_socket_errno_) + const int err = MHD_socket_get_error_ (); + + if (MHD_SCKT_ERR_IS_EINTR_ (err)) return MHD_YES; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "poll failed: %s\n", - MHD_socket_last_strerr_ ()); + _("poll failed: %s\n"), + MHD_socket_strerr_ (err)); #endif return MHD_NO; } + if ( (-1 != poll_itc_idx) && + (0 != (p[poll_itc_idx].revents & POLLIN)) ) + MHD_itc_clear_ (daemon->itc); + /* handle shutdown */ - if (MHD_YES == daemon->shutdown) + if (daemon->shutdown) return MHD_NO; if ( (-1 != poll_listen) && (0 != (p[poll_listen].revents & POLLIN)) ) @@ -2654,19 +3975,20 @@ int may_block) { #ifdef HAVE_POLL - if (MHD_YES == daemon->shutdown) + if (daemon->shutdown) return MHD_NO; if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) - return MHD_poll_all (daemon, may_block); - else - return MHD_poll_listen_socket (daemon, may_block); + return MHD_poll_all (daemon, + may_block); + return MHD_poll_listen_socket (daemon, + may_block); #else return MHD_NO; #endif } -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * How many events to we process at most per epoll() call? Trade-off @@ -2679,6 +4001,163 @@ #define MAX_EVENTS 128 +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + +/** + * Checks whether @a urh has some data to process. + * + * @param urh upgrade handler to analyse + * @return 'true' if @a urh has some data to process, + * 'false' otherwise + */ +static bool +is_urh_ready(struct MHD_UpgradeResponseHandle * const urh) +{ + const struct MHD_Connection * const connection = urh->connection; + + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + return false; + + if (connection->daemon->shutdown) + return true; + + if ( ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->app.celi)) || + (connection->tls_read_ready) ) && + (urh->in_buffer_used < urh->in_buffer_size) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + (urh->out_buffer_used < urh->out_buffer_size) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->app.celi)) && + (urh->out_buffer_used > 0) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->mhd.celi)) && + (urh->in_buffer_used > 0) ) + return true; + + return false; +} + +/** + * Do epoll()-based processing for TLS connections that have been + * upgraded. This requires a separate epoll() invocation as we + * cannot use the `struct MHD_Connection` data structures for + * the `union epoll_data` in this case. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + */ +static int +run_epoll_for_upgrade (struct MHD_Daemon *daemon) +{ + struct epoll_event events[MAX_EVENTS]; + int num_events; + struct MHD_UpgradeResponseHandle * pos; + struct MHD_UpgradeResponseHandle * prev; + + num_events = MAX_EVENTS; + while (MAX_EVENTS == num_events) + { + unsigned int i; + /* update event masks */ + num_events = epoll_wait (daemon->epoll_upgrade_fd, + events, + MAX_EVENTS, + 0); + if (-1 == num_events) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_YES; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_wait failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + return MHD_NO; + } + for (i = 0; i < (unsigned int) num_events; i++) + { + struct UpgradeEpollHandle * const ueh = events[i].data.ptr; + struct MHD_UpgradeResponseHandle * const urh = ueh->urh; + bool new_err_state = false; + + if (urh->clean_ready) + continue; + + /* Update ueh state based on what is ready according to epoll() */ + if (0 != (events[i].events & EPOLLIN)) + ueh->celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (events[i].events & EPOLLOUT)) + ueh->celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (events[i].events & EPOLLHUP)) + ueh->celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + + if ( (0 == (ueh->celi & MHD_EPOLL_STATE_ERROR)) && + (0 != (events[i].events & (EPOLLERR | EPOLLPRI))) ) + { + /* Process new error state only one time + * and avoid continuously marking this connection + * as 'ready'. */ + ueh->celi |= MHD_EPOLL_STATE_ERROR; + new_err_state = true; + } + + if (! urh->in_eready_list) + { + if (new_err_state || + is_urh_ready(urh)) + { + EDLL_insert (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = true; + } + } + } + } + prev = daemon->eready_urh_tail; + while (NULL != (pos = prev)) + { + prev = pos->prevE; + process_urh (pos); + if (! is_urh_ready(pos)) + { + EDLL_remove (daemon->eready_urh_head, + daemon->eready_urh_tail, + pos); + pos->in_eready_list = false; + } + /* Finished forwarding? */ + if ( (0 == pos->in_buffer_size) && + (0 == pos->out_buffer_size) && + (0 == pos->in_buffer_used) && + (0 == pos->out_buffer_used) ) + { + MHD_connection_finish_forward_ (pos->connection); + pos->clean_ready = true; + /* If 'pos->was_closed' already was set to true, connection + * will be moved immediately to cleanup list. Otherwise + * connection will stay in suspended list until 'pos' will + * be marked with 'was_closed' by application. */ + MHD_resume_connection(pos->connection); + } + } + + return MHD_YES; +} +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + +/** + * Pointer-marker to distinguish ITC slot in epoll sets. + */ +static const char * const epoll_itc_marker = "itc_marker"; + /** * Do epoll()-based processing (this function is allowed to * block if @a may_block is set to #MHD_YES). @@ -2691,53 +4170,99 @@ MHD_epoll (struct MHD_Daemon *daemon, int may_block) { +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + static const char * const upgrade_marker = "upgrade_ptr"; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ struct MHD_Connection *pos; - struct MHD_Connection *next; + struct MHD_Connection *prev; struct epoll_event events[MAX_EVENTS]; struct epoll_event event; int timeout_ms; MHD_UNSIGNED_LONG_LONG timeout_ll; int num_events; unsigned int i; - unsigned int series_length; - char tmp; + MHD_socket ls; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + int run_upgraded = MHD_NO; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ if (-1 == daemon->epoll_fd) return MHD_NO; /* we're down! */ - if (MHD_YES == daemon->shutdown) + if (daemon->shutdown) return MHD_NO; - if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && (daemon->connections < daemon->connection_limit) && - (MHD_NO == daemon->listen_socket_in_epoll) ) + (! daemon->listen_socket_in_epoll) && + (! daemon->at_limit) ) { event.events = EPOLLIN; event.data.ptr = daemon; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, - daemon->socket_fd, + ls, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_NO; + } + daemon->listen_socket_in_epoll = true; + } + if ( (daemon->was_quiesced) && + (daemon->listen_socket_in_epoll) ) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + ls, + NULL)) + MHD_PANIC ("Failed to remove listen FD from epoll set\n"); + daemon->listen_socket_in_epoll = false; + } + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if ( (! daemon->upgrade_fd_in_epoll) && + (-1 != daemon->epoll_upgrade_fd) ) + { + event.events = EPOLLIN | EPOLLOUT; + event.data.ptr = (void *) upgrade_marker; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + daemon->epoll_upgrade_fd, &event)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to epoll_ctl failed: %s\n", + _("Call to epoll_ctl failed: %s\n"), MHD_socket_last_strerr_ ()); #endif return MHD_NO; } - daemon->listen_socket_in_epoll = MHD_YES; + daemon->upgrade_fd_in_epoll = true; } - if ( (MHD_YES == daemon->listen_socket_in_epoll) && - (daemon->connections == daemon->connection_limit) ) +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if ( (daemon->listen_socket_in_epoll) && + ( (daemon->connections == daemon->connection_limit) || + (daemon->at_limit) || + (daemon->was_quiesced) ) ) { /* we're at the connection limit, disable listen socket for event loop for now */ if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_DEL, - daemon->socket_fd, + ls, NULL)) - MHD_PANIC ("Failed to remove listen FD from epoll set\n"); - daemon->listen_socket_in_epoll = MHD_NO; + MHD_PANIC (_("Failed to remove listen FD from epoll set\n")); + daemon->listen_socket_in_epoll = false; } + + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) ) + may_block = MHD_NO; + if (MHD_YES == may_block) { if (MHD_YES == MHD_get_timeout (daemon, @@ -2754,6 +4279,11 @@ else timeout_ms = 0; + /* Reset. New value will be set when connections are processed. */ + /* Note: Used mostly for uniformity here as same situation is + * signaled in epoll mode by non-empty eready DLL. */ + daemon->data_already_pending = false; + /* drain 'epoll' event queue; need to iterate as we get at most MAX_EVENTS in one system call here; in practice this should pretty much mean only one round, but better an extra loop here @@ -2763,91 +4293,138 @@ { /* update event masks */ num_events = epoll_wait (daemon->epoll_fd, - events, MAX_EVENTS, timeout_ms); + events, + MAX_EVENTS, + timeout_ms); if (-1 == num_events) { - if (EINTR == MHD_socket_errno_) + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) return MHD_YES; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to epoll_wait failed: %s\n", - MHD_socket_last_strerr_ ()); + _("Call to epoll_wait failed: %s\n"), + MHD_socket_strerr_ (err)); #endif return MHD_NO; } for (i=0;i<(unsigned int) num_events;i++) { + /* First, check for the values of `ptr` that would indicate + that this event is not about a normal connection. */ if (NULL == events[i].data.ptr) continue; /* shutdown signal! */ - if ( (MHD_INVALID_PIPE_ != daemon->wpipe[0]) && - (daemon->wpipe[0] == events[i].data.fd) ) +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (upgrade_marker == events[i].data.ptr) { - (void) MHD_pipe_read_ (daemon->wpipe[0], &tmp, sizeof (tmp)); + /* activity on an upgraded connection, we process + those in a separate epoll() */ + run_upgraded = MHD_YES; continue; } - if (daemon != events[i].data.ptr) - { - /* this is an event relating to a 'normal' connection, - remember the event and if appropriate mark the - connection as 'eready'. */ - pos = events[i].data.ptr; - if (0 != (events[i].events & EPOLLIN)) - { - pos->epoll_state |= MHD_EPOLL_STATE_READ_READY; - if ( ( (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info) || - (pos->read_buffer_size > pos->read_buffer_offset) ) && - (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) - { - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - pos); - pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - } - if (0 != (events[i].events & EPOLLOUT)) - { - pos->epoll_state |= MHD_EPOLL_STATE_WRITE_READY; - if ( (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info) && - (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) - { - EDLL_insert (daemon->eready_head, - daemon->eready_tail, - pos); - pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; - } - } - } - else /* must be listen socket */ +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if (epoll_itc_marker == events[i].data.ptr) + { + /* It's OK to clear ITC here as all external + conditions will be processed later. */ + MHD_itc_clear_ (daemon->itc); + continue; + } + if (daemon == events[i].data.ptr) { - /* run 'accept' until it fails or we are not allowed to take - on more connections */ - series_length = 0; - while ( (MHD_YES == MHD_accept_connection (daemon)) && - (daemon->connections < daemon->connection_limit) && - (series_length < 128) ) - series_length++; + /* Check for error conditions on listen socket. */ + /* FIXME: Initiate MHD_quiesce_daemon() to prevent busy waiting? */ + if (0 == (events[i].events & (EPOLLERR | EPOLLHUP))) + { + unsigned int series_length = 0; + /* Run 'accept' until it fails or daemon at limit of connections. + * Do not accept more then 10 connections at once. The rest will + * be accepted on next turn (level trigger is used for listen + * socket). */ + while ( (MHD_YES == MHD_accept_connection (daemon)) && + (series_length < 10) && + (daemon->connections < daemon->connection_limit) && + (! daemon->at_limit) ) + series_length++; + } + continue; } - } + /* this is an event relating to a 'normal' connection, + remember the event and if appropriate mark the + connection as 'eready'. */ + pos = events[i].data.ptr; + /* normal processing: update read/write data */ + if (0 != (events[i].events & (EPOLLPRI | EPOLLERR | EPOLLHUP))) + { + pos->epoll_state |= MHD_EPOLL_STATE_ERROR; + if (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + else + { + if (0 != (events[i].events & EPOLLIN)) + { + pos->epoll_state |= MHD_EPOLL_STATE_READ_READY; + if ( ( (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info) || + (pos->read_buffer_size > pos->read_buffer_offset) ) && + (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + if (0 != (events[i].events & EPOLLOUT)) + { + pos->epoll_state |= MHD_EPOLL_STATE_WRITE_READY; + if ( (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info) && + (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + } + } } - /* we handle resumes here because we may have ready connections - that will not be placed into the epoll list immediately. */ - if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) && - (MHD_YES == resume_suspended_connections (daemon)) ) - may_block = MHD_NO; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (MHD_YES == run_upgraded) + run_epoll_for_upgrade (daemon); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ /* process events for connections */ - while (NULL != (pos = daemon->eready_tail)) + prev = daemon->eready_tail; + while (NULL != (pos = prev)) { - EDLL_remove (daemon->eready_head, - daemon->eready_tail, - pos); - pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; - if (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info) - pos->read_handler (pos); - if (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info) - pos->write_handler (pos); - pos->idle_handler (pos); + prev = pos->prevE; + call_handlers (pos, + 0 != (pos->epoll_state & MHD_EPOLL_STATE_READ_READY), + 0 != (pos->epoll_state & MHD_EPOLL_STATE_WRITE_READY), + 0 != (pos->epoll_state & MHD_EPOLL_STATE_ERROR)); + if (MHD_EPOLL_STATE_IN_EREADY_EDLL == + (pos->epoll_state & (MHD_EPOLL_STATE_SUSPENDED | MHD_EPOLL_STATE_IN_EREADY_EDLL))) + { + if ( (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info && + 0 == (pos->epoll_state & MHD_EPOLL_STATE_READ_READY) ) || + (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info && + 0 == (pos->epoll_state & MHD_EPOLL_STATE_WRITE_READY) ) || + MHD_EVENT_LOOP_INFO_CLEANUP == pos->event_loop_info) + { + EDLL_remove (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } } /* Finally, handle timed-out connections; we need to do this here @@ -2858,20 +4435,20 @@ Connections with custom timeouts must all be looked at, as we do not bother to sort that (presumably very short) list. */ - next = daemon->manual_timeout_head; - while (NULL != (pos = next)) + prev = daemon->manual_timeout_tail; + while (NULL != (pos = prev)) { - next = pos->nextX; + prev = pos->prevX; pos->idle_handler (pos); } /* Connections with the default timeout are sorted by prepending them to the head of the list whenever we touch the connection; - thus it sufficies to iterate from the tail until the first + thus it suffices to iterate from the tail until the first connection is NOT timed out */ - next = daemon->normal_timeout_tail; - while (NULL != (pos = next)) + prev = daemon->normal_timeout_tail; + while (NULL != (pos = prev)) { - next = pos->prevX; + prev = pos->prevX; pos->idle_handler (pos); if (MHD_CONNECTION_CLOSED != pos->state) break; /* sorted by timeout, no need to visit the rest! */ @@ -2903,17 +4480,16 @@ int MHD_run (struct MHD_Daemon *daemon) { - if ( (MHD_YES == daemon->shutdown) || - (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || - (0 != (daemon->options & MHD_USE_SELECT_INTERNALLY)) ) + if ( (daemon->shutdown) || + (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) ) return MHD_NO; if (0 != (daemon->options & MHD_USE_POLL)) { MHD_poll (daemon, MHD_NO); MHD_cleanup_connections (daemon); } -#if EPOLL_SUPPORT - else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) +#ifdef EPOLL_SUPPORT + else if (0 != (daemon->options & MHD_USE_EPOLL)) { MHD_epoll (daemon, MHD_NO); MHD_cleanup_connections (daemon); @@ -2929,10 +4505,54 @@ /** + * Close the given connection, remove it from all of its + * DLLs and move it into the cleanup queue. + * @remark To be called only from thread that + * process daemon's select()/poll()/etc. + * + * @param pos connection to move to cleanup + */ +static void +close_connection (struct MHD_Connection *pos) +{ + struct MHD_Daemon *daemon = pos->daemon; + + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + MHD_connection_mark_closed_ (pos); + return; /* must let thread to do the rest */ + } + MHD_connection_close_ (pos, + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + + EXTRA_CHECK (! pos->suspended); + EXTRA_CHECK (! pos->resuming); + if (pos->connection_timeout == pos->daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + pos); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + pos); + DLL_remove (daemon->connections_head, + daemon->connections_tail, + pos); + DLL_insert (daemon->cleanup_head, + daemon->cleanup_tail, + pos); + + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** * Thread that runs the select loop until the daemon * is explicitly shut down. * - * @param cls 'struct MHD_Deamon' to run select loop in a thread for + * @param cls `struct MHD_Deamon` to run select loop in a thread for * @return always 0 (on shutdown) */ static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ @@ -2940,18 +4560,24 @@ { struct MHD_Daemon *daemon = cls; - while (MHD_YES != daemon->shutdown) + while (! daemon->shutdown) { if (0 != (daemon->options & MHD_USE_POLL)) MHD_poll (daemon, MHD_YES); -#if EPOLL_SUPPORT - else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) +#ifdef EPOLL_SUPPORT + else if (0 != (daemon->options & MHD_USE_EPOLL)) MHD_epoll (daemon, MHD_YES); #endif else MHD_select (daemon, MHD_YES); MHD_cleanup_connections (daemon); } + + /* Resume any pending for resume connections, join + * all connection's threads (if any) and finally cleanup + * everything. */ + close_all_connections (daemon); + return (MHD_THRD_RTRN_TYPE_)0; } @@ -2997,13 +4623,22 @@ uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, - MHD_AccessHandlerCallback dh, void *dh_cls, ...) + MHD_AccessHandlerCallback dh, + void *dh_cls, + ...) { struct MHD_Daemon *daemon; va_list ap; - va_start (ap, dh_cls); - daemon = MHD_start_daemon_va (flags, port, apc, apc_cls, dh, dh_cls, ap); + va_start (ap, + dh_cls); + daemon = MHD_start_daemon_va (flags, + port, + apc, + apc_cls, + dh, + dh_cls, + ap); va_end (ap); return daemon; } @@ -3014,12 +4649,12 @@ * clients to continue processing, but stops accepting new * connections. Note that the caller is responsible for closing the * returned socket; however, if MHD is run using threads (anything but - * external select mode), it must not be closed until AFTER - * #MHD_stop_daemon has been called (as it is theoretically possible - * that an existing thread is still using it). + * external select mode), socket will be removed from existing threads + * with some delay and it must not be closed while it's in use. To make + * sure that the socket is not used anymore, call #MHD_stop_daemon. * * Note that some thread modes require the caller to have passed - * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is + * #MHD_USE_ITC when using this API. If this daemon is * in one of those modes and this option was not given to * #MHD_start_daemon, this function will return #MHD_INVALID_SOCKET. * @@ -3034,15 +4669,15 @@ unsigned int i; MHD_socket ret; - ret = daemon->socket_fd; + ret = daemon->listen_fd; if (MHD_INVALID_SOCKET == ret) return MHD_INVALID_SOCKET; - if ( (MHD_INVALID_PIPE_ == daemon->wpipe[1]) && - (0 != (daemon->options & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) ) + if ( (0 == (daemon->options & (MHD_USE_ITC))) && + (0 != (daemon->options & (MHD_USE_INTERNAL_POLLING_THREAD))) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Using MHD_quiesce_daemon in this mode requires MHD_USE_PIPE_FOR_SHUTDOWN\n"); + "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC\n"); #endif return MHD_INVALID_SOCKET; } @@ -3050,35 +4685,44 @@ if (NULL != daemon->worker_pool) for (i = 0; i < daemon->worker_pool_size; i++) { - daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET; -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && + daemon->worker_pool[i].was_quiesced = true; +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && (-1 != daemon->worker_pool[i].epoll_fd) && - (MHD_YES == daemon->worker_pool[i].listen_socket_in_epoll) ) + (daemon->worker_pool[i].listen_socket_in_epoll) ) { if (0 != epoll_ctl (daemon->worker_pool[i].epoll_fd, EPOLL_CTL_DEL, ret, NULL)) - MHD_PANIC ("Failed to remove listen FD from epoll set\n"); - daemon->worker_pool[i].listen_socket_in_epoll = MHD_NO; + MHD_PANIC (_("Failed to remove listen FD from epoll set\n")); + daemon->worker_pool[i].listen_socket_in_epoll = false; } + else #endif + if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) + { + if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "q")) + MHD_PANIC (_("Failed to signal quiesce via inter-thread communication channel")); + } } - daemon->socket_fd = MHD_INVALID_SOCKET; -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && + daemon->was_quiesced = true; +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && (-1 != daemon->epoll_fd) && - (MHD_YES == daemon->listen_socket_in_epoll) ) + (daemon->listen_socket_in_epoll) ) { if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_DEL, ret, NULL)) MHD_PANIC ("Failed to remove listen FD from epoll set\n"); - daemon->listen_socket_in_epoll = MHD_NO; + daemon->listen_socket_in_epoll = false; } #endif + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "q")) ) + MHD_PANIC (_("failed to signal quiesce via inter-thread communication channel")); return ret; } @@ -3090,9 +4734,10 @@ * @param format format string * @param va arguments to the format string (fprintf-style) */ -typedef void (*VfprintfFunctionPointerType)(void *cls, - const char *format, - va_list va); +typedef void +(*VfprintfFunctionPointerType)(void *cls, + const char *format, + va_list va); /** @@ -3126,7 +4771,9 @@ int ret; va_start (ap, servaddr); - ret = parse_options_va (daemon, servaddr, ap); + ret = parse_options_va (daemon, + servaddr, + ap); va_end (ap); return ret; } @@ -3148,144 +4795,210 @@ enum MHD_OPTION opt; struct MHD_OptionItem *oa; unsigned int i; -#if HTTPS_SUPPORT + unsigned int uv; +#ifdef HTTPS_SUPPORT int ret; const char *pstr; -#endif +#endif /* HTTPS_SUPPORT */ while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int))) { switch (opt) { case MHD_OPTION_CONNECTION_MEMORY_LIMIT: - daemon->pool_size = va_arg (ap, size_t); + daemon->pool_size = va_arg (ap, + size_t); break; case MHD_OPTION_CONNECTION_MEMORY_INCREMENT: - daemon->pool_increment= va_arg (ap, size_t); + daemon->pool_increment= va_arg (ap, + size_t); break; case MHD_OPTION_CONNECTION_LIMIT: - daemon->connection_limit = va_arg (ap, unsigned int); + daemon->connection_limit = va_arg (ap, + unsigned int); break; case MHD_OPTION_CONNECTION_TIMEOUT: - daemon->connection_timeout = va_arg (ap, unsigned int); + uv = va_arg (ap, + unsigned int); + if (TIME_T_MAX < uv) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: Too large timeout value, ignored.\n")); +#endif + daemon->connection_timeout = 0; + } + else + daemon->connection_timeout = (time_t)uv; break; case MHD_OPTION_NOTIFY_COMPLETED: - daemon->notify_completed = - va_arg (ap, MHD_RequestCompletedCallback); - daemon->notify_completed_cls = va_arg (ap, void *); + daemon->notify_completed = va_arg (ap, + MHD_RequestCompletedCallback); + daemon->notify_completed_cls = va_arg (ap, + void *); break; case MHD_OPTION_NOTIFY_CONNECTION: - daemon->notify_connection = - va_arg (ap, MHD_NotifyConnectionCallback); - daemon->notify_connection_cls = va_arg (ap, void *); + daemon->notify_connection = va_arg (ap, + MHD_NotifyConnectionCallback); + daemon->notify_connection_cls = va_arg (ap, + void *); break; case MHD_OPTION_PER_IP_CONNECTION_LIMIT: - daemon->per_ip_connection_limit = va_arg (ap, unsigned int); + daemon->per_ip_connection_limit = va_arg (ap, + unsigned int); break; case MHD_OPTION_SOCK_ADDR: - *servaddr = va_arg (ap, const struct sockaddr *); + *servaddr = va_arg (ap, + const struct sockaddr *); break; case MHD_OPTION_URI_LOG_CALLBACK: - daemon->uri_log_callback = - va_arg (ap, LogCallback); - daemon->uri_log_callback_cls = va_arg (ap, void *); + daemon->uri_log_callback = va_arg (ap, + LogCallback); + daemon->uri_log_callback_cls = va_arg (ap, + void *); break; case MHD_OPTION_THREAD_POOL_SIZE: - daemon->worker_pool_size = va_arg (ap, unsigned int); - if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon))) + daemon->worker_pool_size = va_arg (ap, + unsigned int); + if (0 == daemon->worker_pool_size) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: Zero size, specified for thread pool size, is ignored. " + "Thread pool is not used.\n")); +#endif + } + else if (1 == daemon->worker_pool_size) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: \"1\", specified for thread pool size, is ignored. " + "Thread pool is not used.\n")); +#endif + daemon->worker_pool_size = 0; + } + else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Specified thread pool size (%u) too big\n", + _("Specified thread pool size (%u) too big\n"), daemon->worker_pool_size); #endif return MHD_NO; } + else + { + if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_THREAD_POOL_SIZE option is specified but " + "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n")); +#endif + return MHD_NO; + } + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Both MHD_OPTION_THREAD_POOL_SIZE option and " + "MHD_USE_THREAD_PER_CONNECTION flag are specified.\n")); +#endif + return MHD_NO; + } + } break; -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT case MHD_OPTION_HTTPS_MEM_KEY: - if (0 != (daemon->options & MHD_USE_SSL)) - daemon->https_mem_key = va_arg (ap, const char *); -#if HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_key = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES else MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), opt); #endif break; case MHD_OPTION_HTTPS_KEY_PASSWORD: - if (0 != (daemon->options & MHD_USE_SSL)) - daemon->https_key_password = va_arg (ap, const char *); -#if HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_key_password = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES else MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), opt); #endif break; case MHD_OPTION_HTTPS_MEM_CERT: - if (0 != (daemon->options & MHD_USE_SSL)) - daemon->https_mem_cert = va_arg (ap, const char *); -#if HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_cert = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES else MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), opt); #endif break; case MHD_OPTION_HTTPS_MEM_TRUST: - if (0 != (daemon->options & MHD_USE_SSL)) - daemon->https_mem_trust = va_arg (ap, const char *); -#if HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_trust = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES else MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), opt); #endif break; case MHD_OPTION_HTTPS_CRED_TYPE: - daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap, int); + daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap, + int); break; case MHD_OPTION_HTTPS_MEM_DHPARAMS: - if (0 != (daemon->options & MHD_USE_SSL)) + if (0 != (daemon->options & MHD_USE_TLS)) { - const char *arg = va_arg (ap, const char *); + const char *arg = va_arg (ap, + const char *); gnutls_datum_t dhpar; if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0) { -#if HAVE_MESSAGES - MHD_DLOG(daemon, - "Error initializing DH parameters\n"); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error initializing DH parameters\n")); #endif return MHD_NO; } dhpar.data = (unsigned char *) arg; dhpar.size = strlen (arg); - if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, &dhpar, + if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, + &dhpar, GNUTLS_X509_FMT_PEM) < 0) { -#if HAVE_MESSAGES - MHD_DLOG(daemon, - "Bad Diffie-Hellman parameters format\n"); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Bad Diffie-Hellman parameters format\n")); #endif gnutls_dh_params_deinit (daemon->https_mem_dhparams); return MHD_NO; } - daemon->have_dhparams = MHD_YES; + daemon->have_dhparams = true; } else { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), opt); #endif return MHD_NO; } break; case MHD_OPTION_HTTPS_PRIORITIES: - if (0 != (daemon->options & MHD_USE_SSL)) + if (0 != (daemon->options & MHD_USE_TLS)) { gnutls_priority_deinit (daemon->priority_cache); ret = gnutls_priority_init (&daemon->priority_cache, @@ -3293,9 +5006,9 @@ NULL); if (GNUTLS_E_SUCCESS != ret) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Setting priorities to `%s' failed: %s\n", + _("Setting priorities to `%s' failed: %s\n"), pstr, gnutls_strerror (ret)); #endif @@ -3306,49 +5019,86 @@ break; case MHD_OPTION_HTTPS_CERT_CALLBACK: #if GNUTLS_VERSION_MAJOR < 3 -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n"); + _("MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n")); #endif return MHD_NO; #else - if (0 != (daemon->options & MHD_USE_SSL)) - daemon->cert_callback = va_arg (ap, gnutls_certificate_retrieve_function2 *); + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->cert_callback = va_arg (ap, + gnutls_certificate_retrieve_function2 *); break; #endif -#endif +#endif /* HTTPS_SUPPORT */ #ifdef DAUTH_SUPPORT case MHD_OPTION_DIGEST_AUTH_RANDOM: - daemon->digest_auth_rand_size = va_arg (ap, size_t); - daemon->digest_auth_random = va_arg (ap, const char *); + daemon->digest_auth_rand_size = va_arg (ap, + size_t); + daemon->digest_auth_random = va_arg (ap, + const char *); break; case MHD_OPTION_NONCE_NC_SIZE: - daemon->nonce_nc_size = va_arg (ap, unsigned int); + daemon->nonce_nc_size = va_arg (ap, + unsigned int); break; #endif case MHD_OPTION_LISTEN_SOCKET: - daemon->socket_fd = va_arg (ap, MHD_socket); + if (0 != (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_LISTEN_SOCKET specified for daemon " + "with MHD_USE_NO_LISTEN_SOCKET flag set.\n")); +#endif + return MHD_NO; + } + else + daemon->listen_fd = va_arg (ap, + MHD_socket); break; case MHD_OPTION_EXTERNAL_LOGGER: -#if HAVE_MESSAGES - daemon->custom_error_log = - va_arg (ap, VfprintfFunctionPointerType); - daemon->custom_error_log_cls = va_arg (ap, void *); +#ifdef HAVE_MESSAGES + daemon->custom_error_log = va_arg (ap, + VfprintfFunctionPointerType); + daemon->custom_error_log_cls = va_arg (ap, + void *); #else - va_arg (ap, VfprintfFunctionPointerType); - va_arg (ap, void *); + va_arg (ap, + VfprintfFunctionPointerType); + va_arg (ap, + void *); #endif break; case MHD_OPTION_THREAD_STACK_SIZE: - daemon->thread_stack_size = va_arg (ap, size_t); + daemon->thread_stack_size = va_arg (ap, + size_t); break; #ifdef TCP_FASTOPEN case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE: - daemon->fastopen_queue_size = va_arg (ap, unsigned int); + daemon->fastopen_queue_size = va_arg (ap, + unsigned int); break; #endif case MHD_OPTION_LISTENING_ADDRESS_REUSE: - daemon->listening_address_reuse = va_arg (ap, unsigned int) ? 1 : -1; + daemon->listening_address_reuse = va_arg (ap, + unsigned int) ? 1 : -1; + break; + case MHD_OPTION_LISTEN_BACKLOG_SIZE: + daemon->listen_backlog_size = va_arg (ap, + unsigned int); + break; + case MHD_OPTION_STRICT_FOR_CLIENT: + daemon->strict_for_client = va_arg (ap, int);; +#ifdef HAVE_MESSAGES + if ( (0 != (daemon->options & MHD_USE_PEDANTIC_CHECKS)) && + (1 != daemon->strict_for_client) ) + { + MHD_DLOG (daemon, + _("Flag MHD_USE_PEDANTIC_CHECKS is ignored because " + "another behavior is specified by MHD_OPTION_STRICT_CLIENT.\n")); + } +#endif /* HAVE_MESSAGES */ break; case MHD_OPTION_ARRAY: oa = va_arg (ap, struct MHD_OptionItem*); @@ -3376,6 +5126,7 @@ case MHD_OPTION_THREAD_POOL_SIZE: case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE: case MHD_OPTION_LISTENING_ADDRESS_REUSE: + case MHD_OPTION_LISTEN_BACKLOG_SIZE: if (MHD_YES != parse_options (daemon, servaddr, opt, @@ -3384,14 +5135,16 @@ return MHD_NO; break; /* all options taking 'enum' */ +#ifdef HTTPS_SUPPORT case MHD_OPTION_HTTPS_CRED_TYPE: if (MHD_YES != parse_options (daemon, servaddr, opt, - (int) oa[i].value, + (gnutls_credentials_type_t) oa[i].value, MHD_OPTION_END)) return MHD_NO; break; +#endif /* HTTPS_SUPPORT */ /* all options taking 'MHD_socket' */ case MHD_OPTION_LISTEN_SOCKET: if (MHD_YES != parse_options (daemon, @@ -3401,6 +5154,15 @@ MHD_OPTION_END)) return MHD_NO; break; + /* all options taking 'int' */ + case MHD_OPTION_STRICT_FOR_CLIENT: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (int) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; /* all options taking one pointer */ case MHD_OPTION_SOCK_ADDR: case MHD_OPTION_HTTPS_MEM_KEY: @@ -3449,23 +5211,25 @@ } break; case MHD_OPTION_UNESCAPE_CALLBACK: - daemon->unescape_callback = - va_arg (ap, UnescapeCallback); - daemon->unescape_callback_cls = va_arg (ap, void *); + daemon->unescape_callback = va_arg (ap, + UnescapeCallback); + daemon->unescape_callback_cls = va_arg (ap, + void *); break; default: -#if HAVE_MESSAGES - if (((opt >= MHD_OPTION_HTTPS_MEM_KEY) && - (opt <= MHD_OPTION_HTTPS_PRIORITIES)) || (opt == MHD_OPTION_HTTPS_MEM_TRUST)) +#ifdef HAVE_MESSAGES + if ( ( (opt >= MHD_OPTION_HTTPS_MEM_KEY) && + (opt <= MHD_OPTION_HTTPS_PRIORITIES) ) || + (opt == MHD_OPTION_HTTPS_MEM_TRUST)) { MHD_DLOG (daemon, - "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n", + _("MHD HTTPS option %d passed to MHD compiled without HTTPS support\n"), opt); } else { MHD_DLOG (daemon, - "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n", + _("Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n"), opt); } #endif @@ -3476,41 +5240,44 @@ } -/** - * Create a listen socket, if possible with SOCK_CLOEXEC flag set. - * - * @param daemon daemon for which we create the socket - * @param domain socket domain (i.e. PF_INET) - * @param type socket type (usually SOCK_STREAM) - * @param protocol desired protocol, 0 for default - */ -static MHD_socket -create_socket (struct MHD_Daemon *daemon, - int domain, int type, int protocol) +#ifdef EPOLL_SUPPORT +static int +setup_epoll_fd (struct MHD_Daemon *daemon) { - int ctype = type | SOCK_CLOEXEC; - MHD_socket fd; + int fd; - /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo - * implementations do not set ai_socktype, e.g. RHL6.2. */ - fd = socket (domain, ctype, protocol); - if ( (MHD_INVALID_SOCKET == fd) && (EINVAL == MHD_socket_errno_) && (0 != SOCK_CLOEXEC) ) - { - ctype = type; - fd = socket(domain, type, protocol); - } +#ifdef USE_EPOLL_CREATE1 + fd = epoll_create1 (EPOLL_CLOEXEC); +#else /* ! USE_EPOLL_CREATE1 */ + fd = epoll_create (MAX_EVENTS); +#endif /* ! USE_EPOLL_CREATE1 */ if (MHD_INVALID_SOCKET == fd) - return MHD_INVALID_SOCKET; - if (type == ctype) - make_nonblocking_noninheritable (daemon, fd); + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_create1 failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_INVALID_SOCKET; + } +#if !defined(USE_EPOLL_CREATE1) + if (! MHD_socket_noninheritable_ (fd)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on epoll FD.\n")); +#endif + } +#endif /* ! USE_EPOLL_CREATE1 */ return fd; } -#if EPOLL_SUPPORT /** * Setup epoll() FD for the daemon and initialize it to listen * on the listen FD. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. * * @param daemon daemon to initialize for epoll() * @return #MHD_YES on success, #MHD_NO on failure @@ -3519,74 +5286,54 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) { struct epoll_event event; + MHD_socket ls; -#ifdef HAVE_EPOLL_CREATE1 - daemon->epoll_fd = epoll_create1 (EPOLL_CLOEXEC); -#else /* !HAVE_EPOLL_CREATE1 */ - daemon->epoll_fd = epoll_create (MAX_EVENTS); -#endif /* !HAVE_EPOLL_CREATE1 */ + daemon->epoll_fd = setup_epoll_fd (daemon); if (-1 == daemon->epoll_fd) + return MHD_NO; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (0 != (MHD_ALLOW_UPGRADE & daemon->options)) { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Call to epoll_create1 failed: %s\n", - MHD_socket_last_strerr_ ()); -#endif - return MHD_NO; - } -#ifndef HAVE_EPOLL_CREATE1 - else - { - int fdflags = fcntl (daemon->epoll_fd, F_GETFD); - if (0 > fdflags || 0 > fcntl (daemon->epoll_fd, F_SETFD, fdflags | FD_CLOEXEC)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to change flags on epoll fd: %s\n", - MHD_socket_last_strerr_ ()); -#endif /* HAVE_MESSAGES */ - } - } -#endif /* !HAVE_EPOLL_CREATE1 */ - if (0 == EPOLL_CLOEXEC) - make_nonblocking_noninheritable (daemon, - daemon->epoll_fd); - if (MHD_INVALID_SOCKET == daemon->socket_fd) + daemon->epoll_upgrade_fd = setup_epoll_fd (daemon); + if (MHD_INVALID_SOCKET == daemon->epoll_upgrade_fd) + return MHD_NO; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if ( (MHD_INVALID_SOCKET == (ls = daemon->listen_fd)) || + (daemon->was_quiesced) ) return MHD_YES; /* non-listening daemon */ event.events = EPOLLIN; event.data.ptr = daemon; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, - daemon->socket_fd, + ls, &event)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to epoll_ctl failed: %s\n", + _("Call to epoll_ctl failed: %s\n"), MHD_socket_last_strerr_ ()); #endif return MHD_NO; } - if ( (MHD_INVALID_PIPE_ != daemon->wpipe[0]) && - (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) ) + daemon->listen_socket_in_epoll = true; + if (MHD_ITC_IS_VALID_(daemon->itc)) { - event.events = EPOLLIN | EPOLLET; - event.data.ptr = NULL; - event.data.fd = daemon->wpipe[0]; + event.events = EPOLLIN; + event.data.ptr = (void *) epoll_itc_marker; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, - daemon->wpipe[0], + MHD_itc_r_fd_ (daemon->itc), &event)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to epoll_ctl failed: %s\n", + _("Call to epoll_ctl failed: %s\n"), MHD_socket_last_strerr_ ()); #endif return MHD_NO; } } - daemon->listen_socket_in_epoll = MHD_YES; return MHD_YES; } #endif @@ -3614,16 +5361,13 @@ uint16_t port, MHD_AcceptPolicyCallback apc, void *apc_cls, - MHD_AccessHandlerCallback dh, void *dh_cls, + MHD_AccessHandlerCallback dh, + void *dh_cls, va_list ap) { -#if defined(MHD_POSIX_SOCKETS) - const int on = 1; -#elif defined(MHD_WINSOCK_SOCKETS) - const uint32_t on = 1; -#endif /* MHD_WINSOCK_SOCKETS */ + const MHD_SCKT_OPT_BOOL_ on = 1; struct MHD_Daemon *daemon; - MHD_socket socket_fd; + MHD_socket listen_fd; struct sockaddr_in servaddr4; #if HAVE_INET6 struct sockaddr_in6 servaddr6; @@ -3631,50 +5375,106 @@ const struct sockaddr *servaddr = NULL; socklen_t addrlen; unsigned int i; - int res_thread_create; - int use_pipe; + enum MHD_FLAG eflags; /* same type as in MHD_Daemon */ + enum MHD_FLAG *pflags; + eflags = (enum MHD_FLAG) flags; + pflags = &eflags; #ifndef HAVE_INET6 - if (0 != (flags & MHD_USE_IPv6)) + if (0 != (*pflags & MHD_USE_IPv6)) return NULL; #endif #ifndef HAVE_POLL - if (0 != (flags & MHD_USE_POLL)) + if (0 != (*pflags & MHD_USE_POLL)) return NULL; #endif -#if ! HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifndef EPOLL_SUPPORT + if (0 != (*pflags & MHD_USE_EPOLL)) return NULL; -#endif +#endif /* ! EPOLL_SUPPORT */ +#ifndef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + return NULL; +#endif /* ! HTTPS_SUPPORT */ #ifndef TCP_FASTOPEN - if (0 != (flags & MHD_USE_TCP_FASTOPEN)) + if (0 != (*pflags & MHD_USE_TCP_FASTOPEN)) return NULL; #endif + if (0 != (*pflags & MHD_ALLOW_UPGRADE)) + { +#ifdef UPGRADE_SUPPORT + *pflags |= MHD_ALLOW_SUSPEND_RESUME; +#else /* ! UPGRADE_SUPPORT */ + return NULL; +#endif /* ! UPGRADE_SUPPORT */ + } if (NULL == dh) return NULL; - if (NULL == (daemon = malloc (sizeof (struct MHD_Daemon)))) + + /* Check for invalid combinations of flags. */ + if ( ((0 != (*pflags & MHD_USE_POLL)) && (0 != (*pflags & MHD_USE_EPOLL))) || + ((0 != (*pflags & MHD_USE_EPOLL)) && (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))) || + ((0 != (*pflags & MHD_USE_POLL)) && + (0 == (*pflags & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION)))) || + ((0 != (*pflags & MHD_USE_AUTO)) && (0 != (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL)))) ) + return NULL; + + if (0 != (*pflags & MHD_USE_AUTO)) + { + if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) + { + /* Thread per connection with internal polling thread. */ +#ifdef HAVE_POLL + *pflags |= MHD_USE_POLL; +#else /* ! HAVE_POLL */ + /* use select() - do not modify flags */ +#endif /* ! HAVE_POLL */ + } + else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) + { + /* Internal polling thread. */ +#if defined(EPOLL_SUPPORT) + *pflags |= MHD_USE_EPOLL; +#elif defined(HAVE_POLL) + *pflags |= MHD_USE_POLL; +#else /* !HAVE_POLL && !EPOLL_SUPPORT */ + /* use select() - do not modify flags */ +#endif /* !HAVE_POLL && !EPOLL_SUPPORT */ + } + else + { + /* Internal threads are not used - "external" polling mode. */ +#if defined(EPOLL_SUPPORT) + *pflags |= MHD_USE_EPOLL; +#else /* ! EPOLL_SUPPORT */ + /* use select() - do not modify flags */ +#endif /* ! EPOLL_SUPPORT */ + } + } + + if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon)))) return NULL; - memset (daemon, 0, sizeof (struct MHD_Daemon)); -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT daemon->epoll_fd = -1; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + daemon->epoll_upgrade_fd = -1; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ #endif /* try to open listen socket */ -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + daemon->priority_cache = NULL; + if (0 != (*pflags & MHD_USE_TLS)) { gnutls_priority_init (&daemon->priority_cache, "NORMAL", NULL); } -#endif - daemon->socket_fd = MHD_INVALID_SOCKET; +#endif /* HTTPS_SUPPORT */ + daemon->listen_fd = MHD_INVALID_SOCKET; daemon->listening_address_reuse = 0; - daemon->options = flags; -#if defined(MHD_WINSOCK_SOCKETS) || defined(CYGWIN) - /* Winsock is broken with respect to 'shutdown'; - this disables us calling 'shutdown' on W32. */ - daemon->options |= MHD_USE_EPOLL_TURBO; -#endif + daemon->options = *pflags; + pflags = &daemon->options; + daemon->strict_for_client = (0 != (*pflags & MHD_USE_PEDANTIC_CHECKS)) ? 1 : 0; daemon->port = port; daemon->apc = apc; daemon->apc_cls = apc_cls; @@ -3686,113 +5486,140 @@ daemon->pool_increment = MHD_BUF_INC_SIZE; daemon->unescape_callback = &unescape_wrapper; daemon->connection_timeout = 0; /* no timeout */ - daemon->wpipe[0] = MHD_INVALID_PIPE_; - daemon->wpipe[1] = MHD_INVALID_PIPE_; -#if HAVE_MESSAGES + MHD_itc_set_invalid_ (daemon->itc); +#ifdef SOMAXCONN + daemon->listen_backlog_size = SOMAXCONN; +#else /* !SOMAXCONN */ + daemon->listen_backlog_size = 511; /* should be safe value */ +#endif /* !SOMAXCONN */ +#ifdef HAVE_MESSAGES daemon->custom_error_log = (MHD_LogCallback) &vfprintf; daemon->custom_error_log_cls = stderr; #endif -#ifdef HAVE_LISTEN_SHUTDOWN - use_pipe = (0 != (daemon->options & (MHD_USE_NO_LISTEN_SOCKET | MHD_USE_PIPE_FOR_SHUTDOWN))); -#else - use_pipe = 1; /* yes, must use pipe to signal shutdown */ -#endif - if (0 == (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) - use_pipe = 0; /* useless if we are using 'external' select */ - if ( (use_pipe) && (0 != MHD_pipe_ (daemon->wpipe)) ) + if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) && + (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to create control pipe: %s\n", - MHD_strerror_ (errno)); + _("Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " + "MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD " + "was added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n")); #endif - free (daemon); - return NULL; + *pflags |= MHD_USE_INTERNAL_POLLING_THREAD; } -#ifndef MHD_WINSOCK_SOCKETS - if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && - (1 == use_pipe) && - (daemon->wpipe[0] >= FD_SETSIZE) ) + if (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) + *pflags &= ~MHD_USE_ITC; /* useless if we are using 'external' select */ + else { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "file descriptor for control pipe exceeds maximum value\n"); +#ifdef HAVE_LISTEN_SHUTDOWN + if (0 != (*pflags & MHD_USE_NO_LISTEN_SOCKET)) #endif - if (0 != MHD_pipe_close_ (daemon->wpipe[0])) - MHD_PANIC ("close failed\n"); - if (0 != MHD_pipe_close_ (daemon->wpipe[1])) - MHD_PANIC ("close failed\n"); - free (daemon); - return NULL; + *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */ } -#endif #ifdef DAUTH_SUPPORT daemon->digest_auth_rand_size = 0; daemon->digest_auth_random = NULL; daemon->nonce_nc_size = 4; /* tiny */ #endif -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) { daemon->cred_type = GNUTLS_CRD_CERTIFICATE; } -#endif +#endif /* HTTPS_SUPPORT */ - if (MHD_YES != parse_options_va (daemon, &servaddr, ap)) + if (MHD_YES != parse_options_va (daemon, + &servaddr, + ap)) { -#if HTTPS_SUPPORT - if ( (0 != (flags & MHD_USE_SSL)) && +#ifdef HTTPS_SUPPORT + if ( (0 != (*pflags & MHD_USE_TLS)) && (NULL != daemon->priority_cache) ) gnutls_priority_deinit (daemon->priority_cache); -#endif +#endif /* HTTPS_SUPPORT */ free (daemon); return NULL; } + if ( (0 != (*pflags & MHD_USE_ITC)) && + (0 == daemon->worker_pool_size) ) + { + if (! MHD_itc_init_ (daemon->itc)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create inter-thread communication channel: %s\n"), + MHD_itc_last_strerror_ ()); +#endif +#ifdef HTTPS_SUPPORT + if (NULL != daemon->priority_cache) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && + (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (daemon->itc), + NULL)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("file descriptor for inter-thread communication channel exceeds maximum value\n")); +#endif + MHD_itc_destroy_chk_ (daemon->itc); +#ifdef HTTPS_SUPPORT + if (NULL != daemon->priority_cache) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + } + #ifdef DAUTH_SUPPORT if (daemon->nonce_nc_size > 0) { if ( ( (size_t) (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc))) / sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Specified value for NC_SIZE too large\n"); + _("Specified value for NC_SIZE too large\n")); #endif -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) gnutls_priority_deinit (daemon->priority_cache); -#endif +#endif /* HTTPS_SUPPORT */ free (daemon); return NULL; } daemon->nnc = malloc (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc)); if (NULL == daemon->nnc) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to allocate memory for nonce-nc map: %s\n", + _("Failed to allocate memory for nonce-nc map: %s\n"), MHD_strerror_ (errno)); #endif -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) gnutls_priority_deinit (daemon->priority_cache); -#endif +#endif /* HTTPS_SUPPORT */ free (daemon); return NULL; } } - if (MHD_YES != MHD_mutex_create_ (&daemon->nnc_lock)) + if (! MHD_mutex_init_ (&daemon->nnc_lock)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD failed to initialize nonce-nc mutex\n"); + _("MHD failed to initialize nonce-nc mutex\n")); #endif -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) gnutls_priority_deinit (daemon->priority_cache); -#endif +#endif /* HTTPS_SUPPORT */ free (daemon->nnc); free (daemon); return NULL; @@ -3800,51 +5627,36 @@ #endif /* Thread pooling currently works only with internal select thread model */ - if ( (0 == (flags & MHD_USE_SELECT_INTERNALLY)) && + if ( (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) && (daemon->worker_pool_size > 0) ) { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "MHD thread pooling only works with MHD_USE_SELECT_INTERNALLY\n"); -#endif - goto free_and_fail; - } - - if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && - (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ) - { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_SUSPEND_RESUME is not supported.\n"); + _("MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n")); #endif goto free_and_fail; } #ifdef __SYMBIAN32__ - if (0 != (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) + if (0 != (*pflags & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Threaded operations are not supported on Symbian.\n"); + _("Threaded operations are not supported on Symbian.\n")); #endif goto free_and_fail; } #endif - if ( (MHD_INVALID_SOCKET == daemon->socket_fd) && - (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) + if ( (MHD_INVALID_SOCKET == daemon->listen_fd) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) { /* try to open listen socket */ - if (0 != (flags & MHD_USE_IPv6)) - socket_fd = create_socket (daemon, - PF_INET6, SOCK_STREAM, 0); - else - socket_fd = create_socket (daemon, - PF_INET, SOCK_STREAM, 0); - if (MHD_INVALID_SOCKET == socket_fd) + listen_fd = MHD_socket_create_listen_(*pflags & MHD_USE_IPv6); + if (MHD_INVALID_SOCKET == listen_fd) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Call to socket failed: %s\n", + _("Failed to create socket for listening: %s\n"), MHD_socket_last_strerr_ ()); #endif goto free_and_fail; @@ -3853,107 +5665,114 @@ /* Apply the socket options according to listening_address_reuse. */ if (0 == daemon->listening_address_reuse) { - /* No user requirement, use "traditional" default SO_REUSEADDR, - and do not fail if it doesn't work */ - if (0 > setsockopt (socket_fd, +#ifndef _WIN32 + /* No user requirement, use "traditional" default SO_REUSEADDR + * on non-W32 platforms, and do not fail if it doesn't work. + * Don't use it on W32, because on W32 it will allow multiple + * bind to the same address:port, like SO_REUSEPORT on others. */ + if (0 > setsockopt (listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof (on))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif } +#endif /* ! _WIN32 */ } else if (daemon->listening_address_reuse > 0) { - /* User requested to allow reusing listening address:port. - * Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. - * Fail if SO_REUSEPORT does not exist or setsockopt fails. - */ -#ifdef _WIN32 - /* SO_REUSEADDR on W32 has the same semantics - as SO_REUSEPORT on BSD/Linux */ - if (0 > setsockopt (socket_fd, + /* User requested to allow reusing listening address:port. */ +#ifndef _WIN32 + /* Use SO_REUSEADDR on non-W32 platforms, and do not fail if + * it doesn't work. */ + if (0 > setsockopt (listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof (on))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif - goto free_and_fail; } -#else -#ifndef SO_REUSEPORT -#ifdef LINUX -/* Supported since Linux 3.9, but often not present (or commented out) - in the headers at this time; but 15 is reserved for this and - thus should be safe to use. */ -#define SO_REUSEPORT 15 -#endif -#endif -#ifdef SO_REUSEPORT - if (0 > setsockopt (socket_fd, +#endif /* ! _WIN32 */ + /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. + * Fail if SO_REUSEPORT is not defined or setsockopt fails. + */ + /* SO_REUSEADDR on W32 has the same semantics + as SO_REUSEPORT on BSD/Linux */ +#if defined(_WIN32) || defined(SO_REUSEPORT) + if (0 > setsockopt (listen_fd, SOL_SOCKET, +#ifndef _WIN32 SO_REUSEPORT, - (void*)&on, sizeof (on))) +#else /* _WIN32 */ + SO_REUSEADDR, +#endif /* _WIN32 */ + (void *) &on, + sizeof (on))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif goto free_and_fail; } -#else +#else /* !_WIN32 && !SO_REUSEPORT */ /* we're supposed to allow address:port re-use, but on this platform we cannot; fail hard */ -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Cannot allow listening address reuse: SO_REUSEPORT not defined\n"); + _("Cannot allow listening address reuse: SO_REUSEPORT not defined\n")); #endif goto free_and_fail; -#endif -#endif +#endif /* !_WIN32 && !SO_REUSEPORT */ } else /* if (daemon->listening_address_reuse < 0) */ { /* User requested to disallow reusing listening address:port. * Do nothing except for Windows where SO_EXCLUSIVEADDRUSE - * is used. Fail if it does not exist or setsockopt fails. + * is used and Solaris with SO_EXCLBIND. + * Fail if MHD was compiled for W32 without SO_EXCLUSIVEADDRUSE + * or setsockopt fails. */ -#ifdef _WIN32 -#ifdef SO_EXCLUSIVEADDRUSE - if (0 > setsockopt (socket_fd, +#if (defined(_WIN32) && defined(SO_EXCLUSIVEADDRUSE)) || \ + (defined(__sun) && defined(SO_EXCLBIND)) + if (0 > setsockopt (listen_fd, SOL_SOCKET, +#ifdef SO_EXCLUSIVEADDRUSE SO_EXCLUSIVEADDRUSE, - (void*)&on, sizeof (on))) +#else /* SO_EXCLBIND */ + SO_EXCLBIND, +#endif /* SO_EXCLBIND */ + (void *) &on, + sizeof (on))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif goto free_and_fail; } -#else /* SO_EXCLUSIVEADDRUSE not defined on W32? */ -#if HAVE_MESSAGES +#elif defined(_WIN32) /* SO_EXCLUSIVEADDRUSE not defined on W32? */ +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n"); + _("Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n")); #endif goto free_and_fail; -#endif #endif /* _WIN32 */ } /* check for user supplied sockaddr */ #if HAVE_INET6 - if (0 != (flags & MHD_USE_IPv6)) + if (0 != (*pflags & MHD_USE_IPv6)) addrlen = sizeof (struct sockaddr_in6); else #endif @@ -3961,9 +5780,11 @@ if (NULL == servaddr) { #if HAVE_INET6 - if (0 != (flags & MHD_USE_IPv6)) + if (0 != (*pflags & MHD_USE_IPv6)) { - memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); + memset (&servaddr6, + 0, + sizeof (struct sockaddr_in6)); servaddr6.sin6_family = AF_INET6; servaddr6.sin6_port = htons (port); #if HAVE_SOCKADDR_IN_SIN_LEN @@ -3974,7 +5795,9 @@ else #endif { - memset (&servaddr4, 0, sizeof (struct sockaddr_in)); + memset (&servaddr4, + 0, + sizeof (struct sockaddr_in)); servaddr4.sin_family = AF_INET; servaddr4.sin_port = htons (port); #if HAVE_SOCKADDR_IN_SIN_LEN @@ -3983,9 +5806,9 @@ servaddr = (struct sockaddr *) &servaddr4; } } - daemon->socket_fd = socket_fd; + daemon->listen_fd = listen_fd; - if (0 != (flags & MHD_USE_IPv6)) + if (0 != (*pflags & MHD_USE_IPv6)) { #ifdef IPPROTO_IPV6 #ifdef IPV6_V6ONLY @@ -3993,199 +5816,182 @@ (http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx); and may also be missing on older POSIX systems; good luck if you have any of those, your IPv6 socket may then also bind against IPv4 anyway... */ -#ifndef MHD_WINSOCK_SOCKETS - const int -#else - const uint32_t -#endif - v6_only = (MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK)); - if (0 > setsockopt (socket_fd, + const MHD_SCKT_OPT_BOOL_ v6_only = + (MHD_USE_DUAL_STACK != (*pflags & MHD_USE_DUAL_STACK)); + if (0 > setsockopt (listen_fd, IPPROTO_IPV6, IPV6_V6ONLY, - (const void*)&v6_only, sizeof (v6_only))) + (const void *) &v6_only, + sizeof (v6_only))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif } #endif #endif } - if (-1 == bind (socket_fd, servaddr, addrlen)) + if (-1 == bind (listen_fd, servaddr, addrlen)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to bind to port %u: %s\n", + _("Failed to bind to port %u: %s\n"), (unsigned int) port, MHD_socket_last_strerr_ ()); #endif - if (0 != MHD_socket_close_ (socket_fd)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } #ifdef TCP_FASTOPEN - if (0 != (flags & MHD_USE_TCP_FASTOPEN)) + if (0 != (*pflags & MHD_USE_TCP_FASTOPEN)) { if (0 == daemon->fastopen_queue_size) daemon->fastopen_queue_size = MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT; - if (0 != setsockopt (socket_fd, - IPPROTO_TCP, TCP_FASTOPEN, + if (0 != setsockopt (listen_fd, + IPPROTO_TCP, + TCP_FASTOPEN, &daemon->fastopen_queue_size, sizeof (daemon->fastopen_queue_size))) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "setsockopt failed: %s\n", + _("setsockopt failed: %s\n"), MHD_socket_last_strerr_ ()); #endif } } #endif -#if EPOLL_SUPPORT - if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) + if (listen (listen_fd, + daemon->listen_backlog_size) < 0) { - int sk_flags = fcntl (socket_fd, F_GETFL); - if (0 != fcntl (socket_fd, F_SETFL, sk_flags | O_NONBLOCK)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to make listen socket non-blocking: %s\n", - MHD_socket_last_strerr_ ()); -#endif - if (0 != MHD_socket_close_ (socket_fd)) - MHD_PANIC ("close failed\n"); - goto free_and_fail; - } - } -#endif - if (listen (socket_fd, 32) < 0) - { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to listen for connections: %s\n", + _("Failed to listen for connections: %s\n"), MHD_socket_last_strerr_ ()); #endif - if (0 != MHD_socket_close_ (socket_fd)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } } else { - socket_fd = daemon->socket_fd; + listen_fd = daemon->listen_fd; + } + + if ( (MHD_INVALID_SOCKET != listen_fd) && + (! MHD_socket_nonblocking_ (listen_fd)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on listening socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + if (0 != (*pflags & MHD_USE_EPOLL) || + daemon->worker_pool_size > 0) + { + /* Accept must be non-blocking. Multiple children may wake up + * to handle a new connection, but only one will win the race. + * The others must immediately return. */ + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } } -#ifndef MHD_WINSOCK_SOCKETS - if ( (socket_fd >= FD_SETSIZE) && - (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) ) + if ( (MHD_INVALID_SOCKET != listen_fd) && + (! MHD_SCKT_FD_FITS_FDSET_(listen_fd, + NULL)) && + (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Socket descriptor larger than FD_SETSIZE: %d > %d\n", - socket_fd, + _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"), + listen_fd, FD_SETSIZE); #endif - if (0 != MHD_socket_close_ (socket_fd)) - MHD_PANIC ("close failed\n"); + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } -#endif -#if EPOLL_SUPPORT - if ( (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) && +#ifdef EPOLL_SUPPORT + if ( (0 != (*pflags & MHD_USE_EPOLL)) && (0 == daemon->worker_pool_size) && - (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) { - if (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) + if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n"); + _("Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n")); #endif goto free_and_fail; } if (MHD_YES != setup_epoll_to_listen (daemon)) goto free_and_fail; } -#else - if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "epoll is not supported on this platform by this build.\n"); -#endif - goto free_and_fail; - } -#endif +#endif /* EPOLL_SUPPORT */ - if (MHD_YES != MHD_mutex_create_ (&daemon->per_ip_connection_mutex)) + if (! MHD_mutex_init_ (&daemon->per_ip_connection_mutex)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD failed to initialize IP connection limit mutex\n"); + _("MHD failed to initialize IP connection limit mutex\n")); #endif - if ( (MHD_INVALID_SOCKET != socket_fd) && - (0 != MHD_socket_close_ (socket_fd)) ) - MHD_PANIC ("close failed\n"); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } - if (MHD_YES != MHD_mutex_create_ (&daemon->cleanup_connection_mutex)) + if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD failed to initialize IP connection limit mutex\n"); + _("MHD failed to initialize IP connection limit mutex\n")); #endif - (void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex); - if ( (MHD_INVALID_SOCKET != socket_fd) && - (0 != MHD_socket_close_ (socket_fd)) ) - MHD_PANIC ("close failed\n"); + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT /* initialize HTTPS daemon certificate aspects & send / recv functions */ - if ((0 != (flags & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon))) + if ( (0 != (*pflags & MHD_USE_TLS)) && + (0 != MHD_TLS_init (daemon)) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to initialize TLS support\n"); + _("Failed to initialize TLS support\n")); #endif - if ( (MHD_INVALID_SOCKET != socket_fd) && - (0 != MHD_socket_close_ (socket_fd)) ) - MHD_PANIC ("close failed\n"); - (void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex); - (void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); goto free_and_fail; } -#endif - if ( ( (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) || - ( (0 != (flags & MHD_USE_SELECT_INTERNALLY)) && - (0 == daemon->worker_pool_size)) ) && - (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) && - (0 != (res_thread_create = - create_thread (&daemon->pid, daemon, &MHD_select_thread, daemon)))) +#endif /* HTTPS_SUPPORT */ + if ( ( (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) && + (0 == daemon->worker_pool_size) ) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) && + (! MHD_create_named_thread_ (&daemon->pid, + (*pflags & MHD_USE_THREAD_PER_CONNECTION) ? + "MHD-listen" : "MHD-single", + daemon->thread_stack_size, + &MHD_select_thread, + daemon) ) ) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to create listen thread: %s\n", - MHD_strerror_ (res_thread_create)); + _("Failed to create listen thread: %s\n"), + MHD_strerror_ (errno)); #endif - (void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex); - (void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex); - if ( (MHD_INVALID_SOCKET != socket_fd) && - (0 != MHD_socket_close_ (socket_fd)) ) - MHD_PANIC ("close failed\n"); + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); goto free_and_fail; } if ( (daemon->worker_pool_size > 0) && - (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) { -#if !defined(MHD_WINSOCK_SOCKETS) - int sk_flags; -#else - unsigned long sk_flags; -#endif - /* Coarse-grained count of connections per thread (note error * due to integer division). Also keep track of how many * connections are leftover after an equal split. */ @@ -4196,21 +6002,6 @@ i = 0; /* we need this in case fcntl or malloc fails */ - /* Accept must be non-blocking. Multiple children may wake up - * to handle a new connection, but only one will win the race. - * The others must immediately return. */ -#if !defined(MHD_WINSOCK_SOCKETS) - sk_flags = fcntl (socket_fd, F_GETFL); - if (sk_flags < 0) - goto thread_failed; - if (0 != fcntl (socket_fd, F_SETFL, sk_flags | O_NONBLOCK)) - goto thread_failed; -#else - sk_flags = 1; - if (SOCKET_ERROR == ioctlsocket (socket_fd, FIONBIO, &sk_flags)) - goto thread_failed; -#endif /* MHD_WINSOCK_SOCKETS */ - /* Allocate memory for pooled objects */ daemon->worker_pool = malloc (sizeof (struct MHD_Daemon) * daemon->worker_pool_size); @@ -4225,38 +6016,37 @@ memcpy (d, daemon, sizeof (struct MHD_Daemon)); /* Adjust pooling params for worker daemons; note that memcpy() - has already copied MHD_USE_SELECT_INTERNALLY thread model into + has already copied MHD_USE_INTERNAL_POLLING_THREAD thread model into the worker threads. */ d->master = daemon; d->worker_pool_size = 0; d->worker_pool = NULL; - if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && - (0 != MHD_pipe_ (d->wpipe)) ) + if (0 != (*pflags & MHD_USE_ITC)) { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "Failed to create worker control pipe: %s\n", - MHD_pipe_last_strerror_() ); + if (! MHD_itc_init_ (d->itc)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create worker inter-thread communication channel: %s\n"), + MHD_itc_last_strerror_() ); #endif - goto thread_failed; - } -#ifndef MHD_WINSOCK_SOCKETS - if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && - (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && - (d->wpipe[0] >= FD_SETSIZE) ) - { -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "File descriptor for worker control pipe exceeds maximum value\n"); + goto thread_failed; + } + if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && + (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (d->itc), + NULL)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("File descriptor for worker inter-thread communication channel exceeds maximum value\n")); #endif - if (0 != MHD_pipe_close_ (d->wpipe[0])) - MHD_PANIC ("close failed\n"); - if (0 != MHD_pipe_close_ (d->wpipe[1])) - MHD_PANIC ("close failed\n"); - goto thread_failed; + MHD_itc_destroy_chk_ (d->itc); + goto thread_failed; + } } -#endif + else + MHD_itc_set_invalid_ (d->itc); /* Divide available connections evenly amongst the threads. * Thread indexes in [0, leftover_conns) each get one of the @@ -4264,38 +6054,41 @@ d->connection_limit = conns_per_thread; if (i < leftover_conns) ++d->connection_limit; -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && +#ifdef EPOLL_SUPPORT + if ( (0 != (*pflags & MHD_USE_EPOLL)) && (MHD_YES != setup_epoll_to_listen (d)) ) goto thread_failed; #endif /* Must init cleanup connection mutex for each worker */ - if (MHD_YES != MHD_mutex_create_ (&d->cleanup_connection_mutex)) + if (! MHD_mutex_init_ (&d->cleanup_connection_mutex)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "MHD failed to initialize cleanup connection mutex for thread worker %d\n", i); + _("MHD failed to initialize cleanup connection mutex\n")); #endif goto thread_failed; } /* Spawn the worker thread */ - if (0 != (res_thread_create = - create_thread (&d->pid, daemon, &MHD_select_thread, d))) + if (! MHD_create_named_thread_ (&d->pid, + "MHD-worker", + daemon->thread_stack_size, + &MHD_select_thread, + d)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (daemon, - "Failed to create pool thread: %s\n", - MHD_strerror_ (res_thread_create)); + _("Failed to create pool thread: %s\n"), + MHD_strerror_ (errno)); #endif /* Free memory for this worker; cleanup below handles * all previously-created workers. */ - (void) MHD_mutex_destroy_ (&d->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&d->cleanup_connection_mutex); goto thread_failed; } } } -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT /* API promises to never use the password after initialization, so we additionally NULL it here to not deref a dangling pointer. */ daemon->https_key_password = NULL; @@ -4307,14 +6100,13 @@ /* If no worker threads created, then shut down normally. Calling MHD_stop_daemon (as we do below) doesn't work here since it assumes a 0-sized thread pool means we had been in the default - MHD_USE_SELECT_INTERNALLY mode. */ + MHD_USE_INTERNAL_POLLING_THREAD mode. */ if (0 == i) { - if ( (MHD_INVALID_SOCKET != socket_fd) && - (0 != MHD_socket_close_ (socket_fd)) ) - MHD_PANIC ("close failed\n"); - (void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex); - (void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); if (NULL != daemon->worker_pool) free (daemon->worker_pool); goto free_and_fail; @@ -4331,60 +6123,45 @@ free_and_fail: /* clean up basic memory state in 'daemon' and return NULL to indicate failure */ -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (daemon->upgrade_fd_in_epoll) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + daemon->epoll_upgrade_fd, + NULL)) + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + daemon->upgrade_fd_in_epoll = false; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ if (-1 != daemon->epoll_fd) close (daemon->epoll_fd); -#endif +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (-1 != daemon->epoll_upgrade_fd) + close (daemon->epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ #ifdef DAUTH_SUPPORT free (daemon->nnc); - (void) MHD_mutex_destroy_ (&daemon->nnc_lock); + MHD_mutex_destroy_chk_ (&daemon->nnc_lock); #endif -#if HTTPS_SUPPORT - if (0 != (flags & MHD_USE_SSL)) +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) gnutls_priority_deinit (daemon->priority_cache); -#endif +#endif /* HTTPS_SUPPORT */ + if (MHD_ITC_IS_VALID_(daemon->itc)) + MHD_itc_destroy_chk_ (daemon->itc); free (daemon); return NULL; } /** - * Close the given connection, remove it from all of its - * DLLs and move it into the cleanup queue. - * - * @param pos connection to move to cleanup - */ -static void -close_connection (struct MHD_Connection *pos) -{ - struct MHD_Daemon *daemon = pos->daemon; - - MHD_connection_close (pos, - MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); - if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) - return; /* must let thread to the rest */ - if (pos->connection_timeout == pos->daemon->connection_timeout) - XDLL_remove (daemon->normal_timeout_head, - daemon->normal_timeout_tail, - pos); - else - XDLL_remove (daemon->manual_timeout_head, - daemon->manual_timeout_tail, - pos); - DLL_remove (daemon->connections_head, - daemon->connections_tail, - pos); - pos->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; - DLL_insert (daemon->cleanup_head, - daemon->cleanup_tail, - pos); -} - - -/** - * Close all connections for the daemon; must only be called after - * all of the threads have been joined and there is no more concurrent - * activity on the connection lists. + * Close all connections for the daemon. + * Must only be called when MHD_Daemon::shutdown was set to true. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. * * @param daemon daemon to close down */ @@ -4392,72 +6169,142 @@ close_all_connections (struct MHD_Daemon *daemon) { struct MHD_Connection *pos; - + const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)); +#ifdef UPGRADE_SUPPORT + const bool upg_allowed = (0 != (daemon->options & MHD_ALLOW_UPGRADE)); +#endif /* UPGRADE_SUPPORT */ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; + const bool used_tls = (0 != (daemon->options & MHD_USE_TLS)); + + /* give upgraded HTTPS connections a chance to finish */ + /* 'daemon->urh_head' is not used in thread-per-connection mode. */ + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + urhn = urh->prev; + /* call generic forwarding function for passing data + with chance to detect that application is done. */ + process_urh (urh); + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* Resuming will move connection to cleanup list. */ + MHD_resume_connection(urh->connection); + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + /* Give suspended connections a chance to resume to avoid + running into the check for there not being any suspended + connections left in case of a tight race with a recently + resumed connection. */ + if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) + { + daemon->resuming = true; /* Force check for pending resume. */ + resume_suspended_connections (daemon); + } /* first, make sure all threads are aware of shutdown; need to traverse DLLs in peace... */ - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to acquire cleanup mutex\n"); - for (pos = daemon->connections_head; NULL != pos; pos = pos->next) + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); +#ifdef UPGRADE_SUPPORT + if (upg_allowed) + { + struct MHD_Connection * susp; + + susp = daemon->suspended_connections_tail; + while (NULL != susp) + { + if (NULL == susp->urh) /* "Upgraded" connection? */ + MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n")); +#ifdef HTTPS_SUPPORT + else if (used_tls && + used_thr_p_c && + (! susp->urh->clean_ready) ) + shutdown (susp->urh->app.socket, + SHUT_RDWR); /* Wake thread by shutdown of app socket. */ +#endif /* HTTPS_SUPPORT */ + else + { +#ifdef HAVE_MESSAGES + if (! susp->urh->was_closed) + MHD_DLOG (daemon, + _("Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); +#endif + susp->urh->was_closed = true; + /* If thread-per-connection is used, connection's thread + * may still processing "upgrade" (exiting). */ + if (! used_thr_p_c) + MHD_connection_finish_forward_ (susp); + /* Do not use MHD_resume_connection() as mutex is + * already locked. */ + susp->resuming = true; + daemon->resuming = true; + } + susp = susp->prev; + } + } + else /* This 'else' is combined with next 'if' */ +#endif /* UPGRADE_SUPPORT */ + if (NULL != daemon->suspended_connections_head) + MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n")); + for (pos = daemon->connections_tail; NULL != pos; pos = pos->prev) { shutdown (pos->socket_fd, - (pos->read_closed == MHD_YES) ? SHUT_WR : SHUT_RDWR); + SHUT_RDWR); #if MHD_WINSOCK_SOCKETS if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && - (1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1)) ) - MHD_PANIC ("failed to signal shutdown via pipe"); + (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "e")) ) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); #endif } - if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && - (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) ) - MHD_PANIC ("Failed to release cleanup mutex\n"); - /* now, collect threads from thread pool */ - if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + /* now, collect per-connection threads */ + if (used_thr_p_c) { - for (pos = daemon->connections_head; NULL != pos; pos = pos->next) - { - if (0 != MHD_join_thread_ (pos->pid)) - MHD_PANIC ("Failed to join a thread\n"); - pos->thread_joined = MHD_YES; - } + pos = daemon->connections_tail; + while (NULL != pos) + { + if (! pos->thread_joined) + { + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if (! MHD_join_thread_ (pos->pid)) + MHD_PANIC (_("Failed to join a thread\n")); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + pos->thread_joined = true; + /* The thread may have concurrently modified the DLL, + need to restart from the beginning */ + pos = daemon->connections_tail; + continue; + } + pos = pos->prev; + } + } + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + +#ifdef UPGRADE_SUPPORT + /* Finished threads with "upgraded" connections need to be moved + * to cleanup list by resume_suspended_connections(). */ + /* "Upgraded" connections that were not closed explicitly by + * application should be moved to cleanup list too. */ + if (upg_allowed) + { + daemon->resuming = true; /* Force check for pending resume. */ + resume_suspended_connections (daemon); } +#endif /* UPGRADE_SUPPORT */ /* now that we're alone, move everyone to cleanup */ - while (NULL != (pos = daemon->connections_head)) + while (NULL != (pos = daemon->connections_tail)) + { + if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! pos->thread_joined) ) + MHD_PANIC (_("Failed to join a thread\n")); close_connection (pos); + } MHD_cleanup_connections (daemon); } -#if EPOLL_SUPPORT -/** - * Shutdown epoll()-event loop by adding 'wpipe' to its event set. - * - * @param daemon daemon of which the epoll() instance must be signalled - */ -static void -epoll_shutdown (struct MHD_Daemon *daemon) -{ - struct epoll_event event; - - if (MHD_INVALID_PIPE_ == daemon->wpipe[1]) - { - /* wpipe was required in this mode, how could this happen? */ - MHD_PANIC ("Internal error\n"); - } - event.events = EPOLLOUT; - event.data.ptr = NULL; - if (0 != epoll_ctl (daemon->epoll_fd, - EPOLL_CTL_ADD, - daemon->wpipe[1], - &event)) - MHD_PANIC ("Failed to add wpipe to epoll set to signal termination\n"); -} -#endif - - /** * Shutdown an HTTP daemon. * @@ -4472,140 +6319,127 @@ if (NULL == daemon) return; - daemon->shutdown = MHD_YES; - fd = daemon->socket_fd; - daemon->socket_fd = MHD_INVALID_SOCKET; - /* Prepare workers for shutdown */ - if (NULL != daemon->worker_pool) - { - /* MHD_USE_NO_LISTEN_SOCKET disables thread pools, hence we need to check */ - for (i = 0; i < daemon->worker_pool_size; ++i) - { - daemon->worker_pool[i].shutdown = MHD_YES; - daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET; -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && - (-1 != daemon->worker_pool[i].epoll_fd) && - (MHD_INVALID_SOCKET == fd) ) - epoll_shutdown (&daemon->worker_pool[i]); -#endif - } - } - if (MHD_INVALID_PIPE_ != daemon->wpipe[1]) - { - if (1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1)) - MHD_PANIC ("failed to signal shutdown via pipe"); - } -#ifdef HAVE_LISTEN_SHUTDOWN - else - { - /* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */ - if ( (MHD_INVALID_SOCKET != fd) && - (0 == (daemon->options & MHD_USE_PIPE_FOR_SHUTDOWN)) ) - (void) shutdown (fd, SHUT_RDWR); - } -#endif -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && - (-1 != daemon->epoll_fd) && - (MHD_INVALID_SOCKET == fd) ) - epoll_shutdown (daemon); -#endif -#if DEBUG_CLOSE -#if HAVE_MESSAGES - MHD_DLOG (daemon, - "MHD listen socket shutdown\n"); -#endif -#endif + if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) + resume_suspended_connections (daemon); + daemon->shutdown = true; + fd = daemon->listen_fd; - /* Signal workers to stop and clean them up */ - if (NULL != daemon->worker_pool) + if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) { - /* MHD_USE_NO_LISTEN_SOCKET disables thread pools, hence we need to check */ - for (i = 0; i < daemon->worker_pool_size; ++i) - { - if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1]) - { - if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1], "e", 1)) - MHD_PANIC ("failed to signal shutdown via pipe"); - } - if (0 != MHD_join_thread_ (daemon->worker_pool[i].pid)) - MHD_PANIC ("Failed to join a thread\n"); - close_all_connections (&daemon->worker_pool[i]); - (void) MHD_mutex_destroy_ (&daemon->worker_pool[i].cleanup_connection_mutex); -#if EPOLL_SUPPORT - if ( (-1 != daemon->worker_pool[i].epoll_fd) && - (0 != MHD_socket_close_ (daemon->worker_pool[i].epoll_fd)) ) - MHD_PANIC ("close failed\n"); -#endif - if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) ) + /* Separate thread(s) is used for select()/poll()/etc. */ + if (NULL != daemon->worker_pool) + { + /* Pool of workers is used. */ + /* Initiate shutdown process in wokers. */ + for (i = 0; i < daemon->worker_pool_size; ++i) { - if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1]) + daemon->worker_pool[i].shutdown = true; + if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) { - if (0 != MHD_pipe_close_ (daemon->worker_pool[i].wpipe[0])) - MHD_PANIC ("close failed\n"); - if (0 != MHD_pipe_close_ (daemon->worker_pool[i].wpipe[1])) - MHD_PANIC ("close failed\n"); + if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "e")) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel.")); } - } - } - free (daemon->worker_pool); +#ifdef HAVE_LISTEN_SHUTDOWN + else if (MHD_INVALID_SOCKET != fd) + { + /* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */ + /* No problem if shutdown will be called several times for the same socket. */ + (void) shutdown (fd, + SHUT_RDWR); + } +#endif + } + /* Start harvesting. */ + for (i = 0; i < daemon->worker_pool_size; ++i) + { + if (! MHD_join_thread_ (daemon->worker_pool[i].pid)) + MHD_PANIC (_("Failed to join a thread\n")); +#ifdef EPOLL_SUPPORT + if (-1 != daemon->worker_pool[i].epoll_fd) + MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_fd); +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (-1 != daemon->worker_pool[i].epoll_upgrade_fd) + MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif + if (MHD_ITC_IS_VALID_ (daemon->worker_pool[i].itc) ) + MHD_itc_destroy_chk_ (daemon->worker_pool[i].itc); + MHD_mutex_destroy_chk_ (&daemon->worker_pool[i].cleanup_connection_mutex); + } + free (daemon->worker_pool); + } + else + { + /* Single internal thread is used for select()/poll()/etc. */ + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + if (! MHD_itc_activate_ (daemon->itc, "e")) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); + } +#ifdef HAVE_LISTEN_SHUTDOWN + else + { + /* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */ + if ( (MHD_INVALID_SOCKET != fd) && + (! daemon->was_quiesced) ) + (void) shutdown (fd, + SHUT_RDWR); + } +#endif + if (! MHD_join_thread_ (daemon->pid)) + { + MHD_PANIC (_("Failed to join a thread\n")); + } + } } else { - /* clean up master threads */ - if ((0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || - ((0 != (daemon->options & MHD_USE_SELECT_INTERNALLY)) - && (0 == daemon->worker_pool_size))) - { - if (0 != MHD_join_thread_ (daemon->pid)) - { - MHD_PANIC ("Failed to join a thread\n"); - } - } + /* Internal threads are not used for select()/poll()/etc. */ + close_all_connections (daemon); } - close_all_connections (daemon); + if ( (MHD_INVALID_SOCKET != fd) && - (0 != MHD_socket_close_ (fd)) ) - MHD_PANIC ("close failed\n"); + (! daemon->was_quiesced) ) + MHD_socket_close_chk_ (fd); + + if (MHD_ITC_IS_VALID_ (daemon->itc)) + MHD_itc_destroy_chk_ (daemon->itc); + +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->epoll_fd) ) + MHD_socket_close_chk_ (daemon->epoll_fd); +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->epoll_upgrade_fd) ) + MHD_socket_close_chk_ (daemon->epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif /* TLS clean up */ -#if HTTPS_SUPPORT - if (MHD_YES == daemon->have_dhparams) +#ifdef HTTPS_SUPPORT + if (daemon->have_dhparams) { gnutls_dh_params_deinit (daemon->https_mem_dhparams); - daemon->have_dhparams = MHD_NO; + daemon->have_dhparams = false; } - if (0 != (daemon->options & MHD_USE_SSL)) + if (0 != (daemon->options & MHD_USE_TLS)) { gnutls_priority_deinit (daemon->priority_cache); if (daemon->x509_cred) gnutls_certificate_free_credentials (daemon->x509_cred); } -#endif -#if EPOLL_SUPPORT - if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && - (-1 != daemon->epoll_fd) && - (0 != MHD_socket_close_ (daemon->epoll_fd)) ) - MHD_PANIC ("close failed\n"); -#endif +#endif /* HTTPS_SUPPORT */ #ifdef DAUTH_SUPPORT free (daemon->nnc); - (void) MHD_mutex_destroy_ (&daemon->nnc_lock); + MHD_mutex_destroy_chk_ (&daemon->nnc_lock); #endif - (void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex); - (void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); - if (MHD_INVALID_PIPE_ != daemon->wpipe[1]) - { - if (0 != MHD_pipe_close_ (daemon->wpipe[0])) - MHD_PANIC ("close failed\n"); - if (0 != MHD_pipe_close_ (daemon->wpipe[1])) - MHD_PANIC ("close failed\n"); - } free (daemon); } @@ -4626,6 +6460,8 @@ enum MHD_DaemonInfoType info_type, ...) { + if (NULL == daemon) + return NULL; switch (info_type) { case MHD_DAEMON_INFO_KEY_SIZE: @@ -4633,26 +6469,32 @@ case MHD_DAEMON_INFO_MAC_KEY_SIZE: return NULL; /* no longer supported */ case MHD_DAEMON_INFO_LISTEN_FD: - return (const union MHD_DaemonInfo *) &daemon->socket_fd; -#if EPOLL_SUPPORT - case MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY: + return (const union MHD_DaemonInfo *) &daemon->listen_fd; +#ifdef EPOLL_SUPPORT + case MHD_DAEMON_INFO_EPOLL_FD: return (const union MHD_DaemonInfo *) &daemon->epoll_fd; #endif case MHD_DAEMON_INFO_CURRENT_CONNECTIONS: - MHD_cleanup_connections (daemon); - if (daemon->worker_pool) + if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { + /* Assume that MHD_run() in not called in other thread + * at the same time. */ + MHD_cleanup_connections (daemon); + } + else if (daemon->worker_pool) { - /* Collect the connection information stored in the workers. */ unsigned int i; - + /* Collect the connection information stored in the workers. */ daemon->connections = 0; - for (i=0;iworker_pool_size;i++) + for (i = 0; i < daemon->worker_pool_size; i++) { - MHD_cleanup_connections (&daemon->worker_pool[i]); + /* FIXME: next line is thread-safe only if read is atomic. */ daemon->connections += daemon->worker_pool[i].connections; } } return (const union MHD_DaemonInfo *) &daemon->connections; + case MHD_DAEMON_INFO_FLAGS: + return (const union MHD_DaemonInfo *) &daemon->options; default: return NULL; }; @@ -4676,7 +6518,8 @@ * @ingroup logging */ void -MHD_set_panic_func (MHD_PanicCallback cb, void *cls) +MHD_set_panic_func (MHD_PanicCallback cb, + void *cls) { mhd_panic = cb; mhd_panic_cls = cls; @@ -4698,7 +6541,9 @@ static char ver[12] = "\0\0\0\0\0\0\0\0\0\0\0"; if (0 == ver[0]) { - int res = MHD_snprintf_(ver, sizeof(ver), "%x.%x.%x", + int res = MHD_snprintf_(ver, + sizeof(ver), + "%x.%x.%x", (((int)MHD_VERSION >> 24) & 0xFF), (((int)MHD_VERSION >> 16) & 0xFF), (((int)MHD_VERSION >> 8) & 0xFF)); @@ -4726,24 +6571,24 @@ { switch(feature) { - case MHD_FEATURE_MESSGES: -#if HAVE_MESSAGES + case MHD_FEATURE_MESSAGES: +#ifdef HAVE_MESSAGES return MHD_YES; #else return MHD_NO; #endif - case MHD_FEATURE_SSL: -#if HTTPS_SUPPORT + case MHD_FEATURE_TLS: +#ifdef HTTPS_SUPPORT return MHD_YES; -#else +#else /* ! HTTPS_SUPPORT */ return MHD_NO; -#endif +#endif /* ! HTTPS_SUPPORT */ case MHD_FEATURE_HTTPS_CERT_CALLBACK: -#if HTTPS_SUPPORT && GNUTLS_VERSION_MAJOR >= 3 +#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_MAJOR >= 3 return MHD_YES; -#else +#else /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */ return MHD_NO; -#endif +#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */ case MHD_FEATURE_IPv6: #ifdef HAVE_INET6 return MHD_YES; @@ -4763,7 +6608,7 @@ return MHD_NO; #endif case MHD_FEATURE_EPOLL: -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT return MHD_YES; #else return MHD_NO; @@ -4775,7 +6620,7 @@ return MHD_NO; #endif case MHD_FEATURE_SOCKETPAIR: -#ifdef MHD_DONT_USE_PIPES +#ifdef _MHD_ITC_SOCKETPAIR return MHD_YES; #else return MHD_NO; @@ -4787,52 +6632,75 @@ return MHD_NO; #endif case MHD_FEATURE_BASIC_AUTH: -#if BAUTH_SUPPORT +#ifdef BAUTH_SUPPORT return MHD_YES; #else return MHD_NO; #endif case MHD_FEATURE_DIGEST_AUTH: -#if DAUTH_SUPPORT +#ifdef DAUTH_SUPPORT return MHD_YES; #else return MHD_NO; #endif case MHD_FEATURE_POSTPROCESSOR: -#if HAVE_POSTPROCESSOR +#ifdef HAVE_POSTPROCESSOR return MHD_YES; #else return MHD_NO; #endif case MHD_FEATURE_HTTPS_KEY_PASSWORD: -#if HTTPS_SUPPORT && GNUTLS_VERSION_NUMBER >= 0x030111 +#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_NUMBER >= 0x030111 return MHD_YES; -#else +#else /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */ return MHD_NO; -#endif +#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */ case MHD_FEATURE_LARGE_FILE: -#if defined(HAVE___LSEEKI64) || defined(HAVE_LSEEK64) +#if defined(HAVE_PREAD64) || defined(_WIN32) + return MHD_YES; +#elif defined(HAVE_PREAD) + return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES; +#elif defined(HAVE_LSEEK64) return MHD_YES; #else return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES; #endif + case MHD_FEATURE_THREAD_NAMES: +#if defined(MHD_USE_THREAD_NAME_) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_UPGRADE: +#if defined(UPGRADE_SUPPORT) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_RESPONSES_SHARED_FD: +#if defined(HAVE_PREAD64) || defined(HAVE_PREAD) || defined(_WIN32) + return MHD_YES; +#else + return MHD_NO; +#endif } return MHD_NO; } -#if HTTPS_SUPPORT && GCRYPT_VERSION_NUMBER < 0x010600 +#if defined(HTTPS_SUPPORT) && GCRYPT_VERSION_NUMBER < 0x010600 #if defined(MHD_USE_POSIX_THREADS) GCRY_THREAD_OPTION_PTHREAD_IMPL; #elif defined(MHD_W32_MUTEX_) -static int gcry_w32_mutex_init (void **ppmtx) + +static int +gcry_w32_mutex_init (void **ppmtx) { *ppmtx = malloc (sizeof (MHD_mutex_)); if (NULL == *ppmtx) return ENOMEM; - - if (MHD_YES != MHD_mutex_create_ ((MHD_mutex_*)*ppmtx)) + if (!MHD_mutex_init_ ((MHD_mutex_*)*ppmtx)) { free (*ppmtx); *ppmtx = NULL; @@ -4841,13 +6709,30 @@ return 0; } -static int gcry_w32_mutex_destroy (void **ppmtx) - { int res = (MHD_YES == MHD_mutex_destroy_ ((MHD_mutex_*)*ppmtx)) ? 0 : 1; - free (*ppmtx); return res; } -static int gcry_w32_mutex_lock (void **ppmtx) - { return (MHD_YES == MHD_mutex_lock_ ((MHD_mutex_*)*ppmtx)) ? 0 : 1; } -static int gcry_w32_mutex_unlock (void **ppmtx) - { return (MHD_YES == MHD_mutex_unlock_ ((MHD_mutex_*)*ppmtx)) ? 0 : 1; } + + +static int +gcry_w32_mutex_destroy (void **ppmtx) +{ + int res = (MHD_mutex_destroy_ ((MHD_mutex_*)*ppmtx)) ? 0 : EINVAL; + free (*ppmtx); + return res; +} + + +static int +gcry_w32_mutex_lock (void **ppmtx) +{ + return MHD_mutex_lock_ ((MHD_mutex_*)*ppmtx) ? 0 : EINVAL; +} + + +static int +gcry_w32_mutex_unlock (void **ppmtx) +{ + return MHD_mutex_unlock_ ((MHD_mutex_*)*ppmtx) ? 0 : EINVAL; +} + static struct gcry_thread_cbs gcry_threads_w32 = { (GCRY_THREAD_OPTION_USER | (GCRY_THREAD_OPTION_VERSION << 8)), @@ -4862,44 +6747,50 @@ /** * Initialize do setup work. */ -void MHD_init(void) +void +MHD_init(void) { +#ifdef _WIN32 + WSADATA wsd; +#endif /* _WIN32 */ mhd_panic = &mhd_panic_std; mhd_panic_cls = NULL; #ifdef _WIN32 - WSADATA wsd; if (0 != WSAStartup(MAKEWORD(2, 2), &wsd)) - MHD_PANIC ("Failed to initialize winsock\n"); + MHD_PANIC (_("Failed to initialize winsock\n")); mhd_winsock_inited_ = 1; if (2 != LOBYTE(wsd.wVersion) && 2 != HIBYTE(wsd.wVersion)) - MHD_PANIC ("Winsock version 2.2 is not available\n"); + MHD_PANIC (_("Winsock version 2.2 is not available\n")); #endif -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT #if GCRYPT_VERSION_NUMBER < 0x010600 #if defined(MHD_USE_POSIX_THREADS) - if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread)) - MHD_PANIC ("Failed to initialise multithreading in libgcrypt\n"); + if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, + &gcry_threads_pthread)) + MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n")); #elif defined(MHD_W32_MUTEX_) - if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_w32)) - MHD_PANIC ("Failed to initialise multithreading in libgcrypt\n"); + if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, + &gcry_threads_w32)) + MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n")); #endif /* defined(MHD_W32_MUTEX_) */ gcry_check_version (NULL); #else if (NULL == gcry_check_version ("1.6.0")) - MHD_PANIC ("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n"); + MHD_PANIC (_("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n")); #endif gnutls_global_init (); -#endif +#endif /* HTTPS_SUPPORT */ MHD_monotonic_sec_counter_init(); } -void MHD_fini(void) +void +MHD_fini(void) { -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT gnutls_global_deinit (); -#endif +#endif /* HTTPS_SUPPORT */ #ifdef _WIN32 if (mhd_winsock_inited_) WSACleanup(); diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/digestauth.c libmicrohttpd-0.9.55/src/microhttpd/digestauth.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/digestauth.c 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/digestauth.c 2017-05-28 22:34:00.000000000 +0200 @@ -23,10 +23,12 @@ * @author Matthieu Speder */ #include "platform.h" -#include +#include "mhd_limits.h" #include "internal.h" #include "md5.h" #include "mhd_mono_clock.h" +#include "mhd_str.h" +#include "mhd_compat.h" #if defined(_WIN32) && defined(MHD_W32_MUTEX_) #ifndef WIN32_LEAN_AND_MEAN @@ -115,23 +117,48 @@ unsigned char ha1[MD5_DIGEST_SIZE]; MD5Init (&md5); - MD5Update (&md5, (const unsigned char*)username, strlen (username)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)realm, strlen (realm)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)password, strlen (password)); - MD5Final (ha1, &md5); - if (MHD_str_equal_caseless_(alg, "md5-sess")) + MD5Update (&md5, + (const unsigned char *) username, + strlen (username)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) realm, + strlen (realm)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) password, + strlen (password)); + MD5Final (ha1, + &md5); + if (MHD_str_equal_caseless_(alg, + "md5-sess")) { MD5Init (&md5); - MD5Update (&md5, (const unsigned char*)ha1, sizeof (ha1)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)nonce, strlen (nonce)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)cnonce, strlen (cnonce)); - MD5Final (ha1, &md5); - } - cvthex (ha1, sizeof (ha1), sessionkey); + MD5Update (&md5, + (const unsigned char *) ha1, + sizeof (ha1)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) nonce, + strlen (nonce)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) cnonce, + strlen (cnonce)); + MD5Final (ha1, + &md5); + } + cvthex (ha1, + sizeof (ha1), + sessionkey); } @@ -165,39 +192,78 @@ char ha2hex[HASH_MD5_HEX_LEN + 1]; MD5Init (&md5); - MD5Update (&md5, (const unsigned char*)method, strlen(method)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)uri, strlen(uri)); + MD5Update (&md5, + (const unsigned char *) method, + strlen (method)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) uri, + strlen (uri)); #if 0 - if (0 == strcasecmp(qop, "auth-int")) + if (0 == strcasecmp(qop, + "auth-int")) { /* This is dead code since the rest of this module does not support auth-int. */ - MD5Update (&md5, ":", 1); + MD5Update (&md5, + ":", + 1); if (NULL != hentity) - MD5Update (&md5, hentity, strlen(hentity)); + MD5Update (&md5, + hentity, + strlen (hentity)); } #endif - MD5Final (ha2, &md5); - cvthex (ha2, MD5_DIGEST_SIZE, ha2hex); + MD5Final (ha2, + &md5); + cvthex (ha2, + MD5_DIGEST_SIZE, + ha2hex); MD5Init (&md5); /* calculate response */ - MD5Update (&md5, (const unsigned char*)ha1, HASH_MD5_HEX_LEN); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)nonce, strlen(nonce)); - MD5Update (&md5, (const unsigned char*)":", 1); + MD5Update (&md5, + (const unsigned char *) ha1, + HASH_MD5_HEX_LEN); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) nonce, + strlen (nonce)); + MD5Update (&md5, + (const unsigned char*) ":", + 1); if ('\0' != *qop) { - MD5Update (&md5, (const unsigned char*)noncecount, strlen(noncecount)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)cnonce, strlen(cnonce)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)qop, strlen(qop)); - MD5Update (&md5, (const unsigned char*)":", 1); - } - MD5Update (&md5, (const unsigned char*)ha2hex, HASH_MD5_HEX_LEN); - MD5Final (resphash, &md5); - cvthex (resphash, sizeof(resphash), response); + MD5Update (&md5, + (const unsigned char *) noncecount, + strlen (noncecount)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) cnonce, + strlen (cnonce)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) qop, + strlen (qop)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + } + MD5Update (&md5, + (const unsigned char *) ha2hex, + HASH_MD5_HEX_LEN); + MD5Final (resphash, + &md5); + cvthex (resphash, + sizeof(resphash), + response); } @@ -235,27 +301,30 @@ ptr = data; while ('\0' != *ptr) { - if (NULL == (eq = strchr (ptr, '='))) + if (NULL == (eq = strchr (ptr, + '='))) return 0; q1 = eq + 1; while (' ' == *q1) q1++; if ('\"' != *q1) { - q2 = strchr (q1, ','); + q2 = strchr (q1, + ','); qn = q2; } else { q1++; - q2 = strchr (q1, '\"'); + q2 = strchr (q1, + '\"'); if (NULL == q2) return 0; /* end quote not found */ qn = q2 + 1; } - if ((MHD_str_equal_caseless_n_(ptr, - key, - keylen)) && + if ( (MHD_str_equal_caseless_n_(ptr, + key, + keylen)) && (eq == &ptr[keylen]) ) { if (NULL == q2) @@ -284,7 +353,8 @@ } if (NULL == qn) return 0; - ptr = strchr (qn, ','); + ptr = strchr (qn, + ','); if (NULL == ptr) return 0; ptr++; @@ -302,18 +372,25 @@ * @param connection The MHD connection structure * @param nonce A pointer that referenced a zero-terminated array of nonce * @param nc The nonce counter, zero to add the nonce to the array - * @return MHD_YES if successful, MHD_NO if invalid (or we have no NC array) + * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array) */ static int check_nonce_nc (struct MHD_Connection *connection, const char *nonce, - unsigned long int nc) + uint64_t nc) { + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_NonceNc *nn; uint32_t off; uint32_t mod; const char *np; - mod = connection->daemon->nonce_nc_size; + if (MAX_NONCE_LENGTH <= strlen (nonce)) + return MHD_NO; /* This should be impossible, but static analysis + tools have a hard time with it *and* this also + protects against unsafe modifications that may + happen in the future... */ + mod = daemon->nonce_nc_size; if (0 == mod) return MHD_NO; /* no array! */ /* super-fast xor-based "hash" function for HT lookup in nonce array */ @@ -330,28 +407,50 @@ * nonce counter is less than the current nonce counter by 1, * then only increase the nonce counter by one. */ - - (void) MHD_mutex_lock_ (&connection->daemon->nnc_lock); + nn = &daemon->nnc[off]; + MHD_mutex_lock_chk_ (&daemon->nnc_lock); if (0 == nc) { - strcpy(connection->daemon->nnc[off].nonce, - nonce); - connection->daemon->nnc[off].nc = 0; - (void) MHD_mutex_unlock_ (&connection->daemon->nnc_lock); + /* Fresh nonce, reinitialize array */ + strcpy (nn->nonce, + nonce); + nn->nc = 0; + nn->nmask = 0; + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); return MHD_YES; } - if ( (nc <= connection->daemon->nnc[off].nc) || - (0 != strcmp(connection->daemon->nnc[off].nonce, nonce)) ) - { - (void) MHD_mutex_unlock_ (&connection->daemon->nnc_lock); -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Stale nonce received. If this happens a lot, you should probably increase the size of the nonce array.\n"); + /* Note that we use 64 here, as we do not store the + bit for 'nn->nc' itself in 'nn->nmask' */ + if ( (nc < nn->nc) && + (nc + 64 > nc /* checking for overflow */) && + (nc + 64 >= nn->nc) && + (0 == ((1LLU << (nn->nc - nc - 1)) & nn->nmask)) ) + { + /* Out-of-order nonce, but within 64-bit bitmask, set bit */ + nn->nmask |= (1LLU < (nn->nc - nc - 1)); + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); + return MHD_YES; + } + + if ( (nc <= nn->nc) || + (0 != strcmp (nn->nonce, + nonce)) ) + { + /* Nonce does not match, fail */ + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Stale nonce received. If this happens a lot, you should probably increase the size of the nonce array.\n")); #endif return MHD_NO; } - connection->daemon->nnc[off].nc = nc; - (void) MHD_mutex_unlock_ (&connection->daemon->nnc_lock); + /* Nonce is larger, shift bitmask and bump limit */ + if (64 > nc - nn->nc) + nn->nmask <<= (nc - nn->nc); /* small jump, less than mask width */ + else + nn->nmask = 0; /* big jump, unset all bits in the mask */ + nn->nc = nc; + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); return MHD_YES; } @@ -371,13 +470,16 @@ char user[MAX_USERNAME_LENGTH]; const char *header; - if (NULL == (header = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - MHD_HTTP_HEADER_AUTHORIZATION))) + if (NULL == (header = + MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_AUTHORIZATION))) return NULL; - if (0 != strncmp (header, _BASE, strlen (_BASE))) + if (0 != strncmp (header, + _BASE, + MHD_STATICSTR_LEN_ (_BASE))) return NULL; - header += strlen (_BASE); + header += MHD_STATICSTR_LEN_ (_BASE); if (0 == (len = lookup_sub_value (user, sizeof (user), header, @@ -419,20 +521,45 @@ timestamp[1] = (unsigned char)((nonce_time & 0x00ff0000) >> 0x10); timestamp[2] = (unsigned char)((nonce_time & 0x0000ff00) >> 0x08); timestamp[3] = (unsigned char)((nonce_time & 0x000000ff)); - MD5Update (&md5, timestamp, sizeof(timestamp)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)method, strlen (method)); - MD5Update (&md5, (const unsigned char*)":", 1); + MD5Update (&md5, + timestamp, + sizeof (timestamp)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) method, + strlen (method)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); if (rnd_size > 0) - MD5Update (&md5, (const unsigned char*)rnd, rnd_size); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)uri, strlen (uri)); - MD5Update (&md5, (const unsigned char*)":", 1); - MD5Update (&md5, (const unsigned char*)realm, strlen (realm)); - MD5Final (tmpnonce, &md5); - cvthex (tmpnonce, sizeof (tmpnonce), nonce); - cvthex (timestamp, sizeof(timestamp), timestamphex); - strncat (nonce, timestamphex, 8); + MD5Update (&md5, + (const unsigned char *) rnd, + rnd_size); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) uri, + strlen (uri)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) realm, + strlen (realm)); + MD5Final (tmpnonce, + &md5); + cvthex (tmpnonce, + sizeof (tmpnonce), + nonce); + cvthex (timestamp, + sizeof (timestamp), + timestamphex); + strncat (nonce, + timestamphex, + 8); } @@ -443,28 +570,32 @@ * @param connection the connection * @param key the key * @param value the value, can be NULL + * @param kind type of the header * @return #MHD_YES if the key-value pair is in the headers, * #MHD_NO if not */ static int test_header (struct MHD_Connection *connection, const char *key, - const char *value) + const char *value, + enum MHD_ValueKind kind) { struct MHD_HTTP_Header *pos; for (pos = connection->headers_received; NULL != pos; pos = pos->next) { - if (MHD_GET_ARGUMENT_KIND != pos->kind) + if (kind != pos->kind) continue; - if (0 != strcmp (key, pos->header)) + if (0 != strcmp (key, + pos->header)) continue; if ( (NULL == value) && (NULL == pos->value) ) return MHD_YES; if ( (NULL == value) || (NULL == pos->value) || - (0 != strcmp (value, pos->value)) ) + (0 != strcmp (value, + pos->value)) ) continue; return MHD_YES; } @@ -488,114 +619,26 @@ { struct MHD_HTTP_Header *pos; char *argb; - char *argp; - char *equals; - char *amper; unsigned int num_headers; + int ret; argb = strdup (args); if (NULL == argb) - { -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Failed to allocate memory for copy of URI arguments\n"); + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to allocate memory for copy of URI arguments\n")); #endif /* HAVE_MESSAGES */ - return MHD_NO; - } - num_headers = 0; - argp = argb; - while ( (NULL != argp) && - ('\0' != argp[0]) ) - { - equals = strchr (argp, '='); - amper = strchr (argp, '&'); - if (NULL == amper) - { - /* last argument */ - if (NULL == equals) - { - /* last argument, without '=' */ - MHD_unescape_plus (argp); - if (MHD_YES != test_header (connection, - argp, - NULL)) - { - free (argb); - return MHD_NO; - } - num_headers++; - break; - } - /* got 'foo=bar' */ - equals[0] = '\0'; - equals++; - MHD_unescape_plus (argp); - /* add with 'value' NULL */ - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - argp); - MHD_unescape_plus (equals); - /* add with 'value' NULL */ - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - equals); - if (MHD_YES != test_header (connection, - argp, - equals)) - { - free (argb); - return MHD_NO; - } - num_headers++; - break; - } - /* amper is non-NULL here */ - amper[0] = '\0'; - amper++; - if ( (NULL == equals) || - (equals >= amper) ) - { - /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ - MHD_unescape_plus (argp); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - argp); - if (MHD_YES != - test_header (connection, - argp, - NULL)) - { - free (argb); - return MHD_NO; - } - /* continue with 'bar' */ - num_headers++; - args = amper; - continue; - } - equals[0] = '\0'; - equals++; - MHD_unescape_plus (argp); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - argp); - MHD_unescape_plus (equals); - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - equals); - if (MHD_YES != - test_header (connection, - argp, - equals)) - { - free (argb); - return MHD_NO; - } - num_headers++; - argp = amper; + return MHD_NO; } + ret = MHD_parse_arguments_ (connection, + MHD_GET_ARGUMENT_KIND, + argb, + &test_header, + &num_headers); free (argb); - + if (MHD_YES != ret) + return MHD_NO; /* also check that the number of headers matches */ for (pos = connection->headers_received; NULL != pos; pos = pos->next) { @@ -632,9 +675,9 @@ const char *password, unsigned int nonce_timeout) { + struct MHD_Daemon *daemon = connection->daemon; size_t len; const char *header; - char *end; char nonce[MAX_NONCE_LENGTH]; char cnonce[MAX_NONCE_LENGTH]; char qop[15]; /* auth,auth-int */ @@ -647,16 +690,18 @@ uint32_t nonce_time; uint32_t t; size_t left; /* number of characters left in 'header' for 'uri' */ - unsigned long int nci; + uint64_t nci; header = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_AUTHORIZATION); if (NULL == header) return MHD_NO; - if (0 != strncmp(header, _BASE, strlen(_BASE))) + if (0 != strncmp (header, + _BASE, + MHD_STATICSTR_LEN_(_BASE))) return MHD_NO; - header += strlen (_BASE); + header += MHD_STATICSTR_LEN_ (_BASE); left = strlen (header); { @@ -664,9 +709,11 @@ len = lookup_sub_value (un, sizeof (un), - header, "username"); + header, + "username"); if ( (0 == len) || - (0 != strcmp(username, un)) ) + (0 != strcmp (username, + un)) ) return MHD_NO; left -= strlen ("username") + len; } @@ -676,16 +723,19 @@ len = lookup_sub_value (r, sizeof (r), - header, "realm"); + header, + "realm"); if ( (0 == len) || - (0 != strcmp(realm, r)) ) + (0 != strcmp (realm, + r)) ) return MHD_NO; left -= strlen ("realm") + len; } if (0 == (len = lookup_sub_value (nonce, sizeof (nonce), - header, "nonce"))) + header, + "nonce"))) return MHD_NO; left -= strlen ("nonce") + len; if (left > 32 * 1024) @@ -699,7 +749,17 @@ header value. */ return MHD_NO; } - nonce_time = strtoul (nonce + len - TIMESTAMP_HEX_LEN, (char **)NULL, 16); + if (TIMESTAMP_HEX_LEN != + MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_HEX_LEN, + TIMESTAMP_HEX_LEN, + &nonce_time)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid timestamp format.\n")); +#endif + return MHD_NO; + } t = (uint32_t) MHD_monotonic_sec_counter(); /* * First level vetting for the nonce validity: if the timestamp @@ -715,8 +775,8 @@ calculate_nonce (nonce_time, connection->method, - connection->daemon->digest_auth_random, - connection->daemon->digest_auth_rand_size, + daemon->digest_auth_random, + daemon->digest_auth_rand_size, connection->url, realm, noncehashexp); @@ -736,37 +796,51 @@ } if ( (0 == lookup_sub_value (cnonce, sizeof (cnonce), - header, "cnonce")) || - (0 == lookup_sub_value (qop, sizeof (qop), header, "qop")) || - ( (0 != strcmp (qop, "auth")) && - (0 != strcmp (qop, "")) ) || - (0 == lookup_sub_value (nc, sizeof (nc), header, "nc")) || - (0 == lookup_sub_value (response, sizeof (response), header, "response")) ) - { -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Authentication failed, invalid format.\n"); + header, + "cnonce")) || + (0 == lookup_sub_value (qop, + sizeof (qop), + header, + "qop")) || + ( (0 != strcmp (qop, + "auth")) && + (0 != strcmp (qop, + "")) ) || + (0 == (len = lookup_sub_value (nc, + sizeof (nc), + header, + "nc")) ) || + (0 == lookup_sub_value (response, + sizeof (response), + header, + "response")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid format.\n")); #endif return MHD_NO; } - nci = strtoul (nc, &end, 16); - if ( ('\0' != *end) || - ( (LONG_MAX == nci) && - (ERANGE == errno) ) ) - { -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Authentication failed, invalid format.\n"); + if (len != MHD_strx_to_uint64_n_ (nc, + len, + &nci)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid nc format.\n")); #endif return MHD_NO; /* invalid nonce format */ } + /* * Checking if that combination of nonce and nc is sound * and not a replay attack attempt. Also adds the nonce * to the nonce-nc map if it does not exist there. */ - - if (MHD_YES != check_nonce_nc (connection, nonce, nci)) + if (MHD_YES != + check_nonce_nc (connection, + nonce, + nci)) { return MHD_NO; } @@ -777,27 +851,28 @@ uri = malloc (left + 1); if (NULL == uri) { -#if HAVE_MESSAGES - MHD_DLOG(connection->daemon, - "Failed to allocate memory for auth header processing\n"); +#ifdef HAVE_MESSAGES + MHD_DLOG(daemon, + _("Failed to allocate memory for auth header processing\n")); #endif /* HAVE_MESSAGES */ return MHD_NO; } if (0 == lookup_sub_value (uri, left + 1, - header, "uri")) + header, + "uri")) { free (uri); return MHD_NO; } - digest_calc_ha1("md5", - username, - realm, - password, - nonce, - cnonce, - ha1); + digest_calc_ha1 ("md5", + username, + realm, + password, + nonce, + cnonce, + ha1); digest_calc_response (ha1, nonce, nc, @@ -809,23 +884,24 @@ respexp); /* Need to unescape URI before comparing with connection->url */ - connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, - connection, - uri); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + uri); if (0 != strncmp (uri, connection->url, strlen (connection->url))) { -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Authentication failed, URI does not match.\n"); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, URI does not match.\n")); #endif free (uri); return MHD_NO; } { - const char *args = strchr (uri, '?'); + const char *args = strchr (uri, + '?'); if (NULL == args) args = ""; @@ -835,16 +911,17 @@ check_argument_match (connection, args) ) { -#if HAVE_MESSAGES - MHD_DLOG (connection->daemon, - "Authentication failed, arguments do not match.\n"); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, arguments do not match.\n")); #endif free (uri); return MHD_NO; } } free (uri); - return (0 == strcmp(response, respexp)) + return (0 == strcmp(response, + respexp)) ? MHD_YES : MHD_NO; } @@ -873,7 +950,7 @@ int signal_stale) { int ret; - size_t hlen; + int hlen; char nonce[NONCE_STD_LEN + 1]; /* Generating the server nonce */ @@ -884,55 +961,73 @@ connection->url, realm, nonce); - if (MHD_YES != check_nonce_nc (connection, nonce, 0)) + if (MHD_YES != + check_nonce_nc (connection, + nonce, + 0)) { -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES MHD_DLOG (connection->daemon, - "Could not register nonce (is the nonce array size zero?).\n"); + _("Could not register nonce (is the nonce array size zero?).\n")); #endif return MHD_NO; } /* Building the authentication header */ - hlen = MHD_snprintf_(NULL, - 0, - "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", - realm, - nonce, - opaque, - signal_stale - ? ",stale=\"true\"" - : ""); - { - char *header; - - header = malloc(hlen + 1); - if (NULL == header) + hlen = MHD_snprintf_ (NULL, + 0, + "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", + realm, + nonce, + opaque, + signal_stale + ? ",stale=\"true\"" + : ""); + if (hlen > 0) { -#if HAVE_MESSAGES - MHD_DLOG(connection->daemon, - "Failed to allocate memory for auth response header\n"); + char *header; + + header = MHD_calloc_ (1, hlen + 1); + if (NULL == header) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(connection->daemon, + _("Failed to allocate memory for auth response header\n")); #endif /* HAVE_MESSAGES */ - return MHD_NO; + return MHD_NO; + } + + if (MHD_snprintf_ (header, + hlen + 1, + "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", + realm, + nonce, + opaque, + signal_stale + ? ",stale=\"true\"" + : "") == hlen) + ret = MHD_add_response_header(response, + MHD_HTTP_HEADER_WWW_AUTHENTICATE, + header); + else + ret = MHD_NO; + free (header); } + else + ret = MHD_NO; - MHD_snprintf_(header, - hlen + 1, - "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", - realm, - nonce, - opaque, - signal_stale - ? ",stale=\"true\"" - : ""); - ret = MHD_add_response_header(response, - MHD_HTTP_HEADER_WWW_AUTHENTICATE, - header); - free(header); - } if (MHD_YES == ret) - ret = MHD_queue_response(connection, - MHD_HTTP_UNAUTHORIZED, - response); + { + ret = MHD_queue_response (connection, + MHD_HTTP_UNAUTHORIZED, + response); + } + else + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to add Digest auth header\n")); +#endif /* HAVE_MESSAGES */ + } return ret; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/internal.c libmicrohttpd-0.9.55/src/microhttpd/internal.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/internal.c 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/internal.c 2017-05-28 22:34:00.000000000 +0200 @@ -25,8 +25,9 @@ */ #include "internal.h" +#include "mhd_str.h" -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #if DEBUG_STATES /** * State to string dictionary. @@ -85,27 +86,32 @@ #endif #endif -#if HAVE_MESSAGES + +#ifdef HAVE_MESSAGES /** * fprintf-like helper function for logging debug * messages. */ void -MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...) +MHD_DLOG (const struct MHD_Daemon *daemon, + const char *format, + ...) { va_list va; - if (0 == (daemon->options & MHD_USE_DEBUG)) + if (0 == (daemon->options & MHD_USE_ERROR_LOG)) return; va_start (va, format); - daemon->custom_error_log (daemon->custom_error_log_cls, format, va); + daemon->custom_error_log (daemon->custom_error_log_cls, + format, + va); va_end (va); } #endif /** - * Convert all occurences of '+' to ' '. + * Convert all occurrences of '+' to ' '. * * @param arg string that is modified (in place), must be 0-terminated */ @@ -133,32 +139,23 @@ { char *rpos = val; char *wpos = val; - char *end; - unsigned int num; - char buf3[3]; while ('\0' != *rpos) { + uint32_t num; switch (*rpos) { case '%': - if ( ('\0' == rpos[1]) || - ('\0' == rpos[2]) ) - { - *wpos = '\0'; - return wpos - val; - } - buf3[0] = rpos[1]; - buf3[1] = rpos[2]; - buf3[2] = '\0'; - num = strtoul (buf3, &end, 16); - if ('\0' == *end) + if (2 == MHD_strx_to_uint32_n_ (rpos + 1, + 2, + &num)) { *wpos = (char)((unsigned char) num); wpos++; rpos += 3; break; } + /* TODO: add bad sequence handling */ /* intentional fall through! */ default: *wpos = *rpos; @@ -171,4 +168,116 @@ } +/** + * Parse and unescape the arguments given by the client + * as part of the HTTP request URI. + * + * @param kind header kind to pass to @a cb + * @param connection connection to add headers to + * @param[in|out] args argument URI string (after "?" in URI), + * clobbered in the process! + * @param cb function to call on each key-value pair found + * @param[out] num_headers set to the number of headers found + * @return #MHD_NO on failure (@a cb returned #MHD_NO), + * #MHD_YES for success (parsing succeeded, @a cb always + * returned #MHD_YES) + */ +int +MHD_parse_arguments_ (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + char *args, + MHD_ArgumentIterator_ cb, + unsigned int *num_headers) +{ + struct MHD_Daemon *daemon = connection->daemon; + char *equals; + char *amper; + + *num_headers = 0; + while ( (NULL != args) && + ('\0' != args[0]) ) + { + equals = strchr (args, '='); + amper = strchr (args, '&'); + if (NULL == amper) + { + /* last argument */ + if (NULL == equals) + { + /* last argument, without '=' */ + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + if (MHD_YES != cb (connection, + args, + NULL, + kind)) + return MHD_NO; + (*num_headers)++; + break; + } + /* got 'foo=bar' */ + equals[0] = '\0'; + equals++; + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + MHD_unescape_plus (equals); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + equals); + if (MHD_YES != cb (connection, + args, + equals, + kind)) + return MHD_NO; + (*num_headers)++; + break; + } + /* amper is non-NULL here */ + amper[0] = '\0'; + amper++; + if ( (NULL == equals) || + (equals >= amper) ) + { + /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + if (MHD_YES != cb (connection, + args, + NULL, + kind)) + return MHD_NO; + /* continue with 'bar' */ + (*num_headers)++; + args = amper; + continue; + } + /* equals and amper are non-NULL here, and equals < amper, + so we got regular 'foo=value&bar...'-kind of argument */ + equals[0] = '\0'; + equals++; + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + MHD_unescape_plus (equals); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + equals); + if (MHD_YES != cb (connection, + args, + equals, + kind)) + return MHD_NO; + (*num_headers)++; + args = amper; + } + return MHD_YES; +} + /* end of internal.c */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/internal.h libmicrohttpd-0.9.55/src/microhttpd/internal.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/internal.h 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/internal.h 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007-2015 Daniel Pittman and Christian Grothoff + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -27,23 +27,56 @@ #ifndef INTERNAL_H #define INTERNAL_H +#include "mhd_options.h" #include "platform.h" #include "microhttpd.h" -#include "platform_interface.h" -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT #include #if GNUTLS_VERSION_MAJOR >= 3 #include #endif +#endif /* HTTPS_SUPPORT */ + +#ifdef HAVE_STDBOOL_H +#include #endif -#if EPOLL_SUPPORT -#include -#endif -#if HAVE_NETINET_TCP_H -/* for TCP_FASTOPEN */ -#include + + +#ifdef MHD_PANIC +/* Override any defined MHD_PANIC macro with proper one */ +#undef MHD_PANIC +#endif /* MHD_PANIC */ + +#ifdef HAVE_MESSAGES +/** + * Trigger 'panic' action based on fatal errors. + * + * @param msg error message (const char *) + */ +#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); BUILTIN_NOT_REACHED; } while (0) +#else +/** + * Trigger 'panic' action based on fatal errors. + * + * @param msg error message (const char *) + */ +#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); BUILTIN_NOT_REACHED; } while (0) #endif +#include "mhd_threads.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_itc_types.h" + + +/** + * Close FD and abort execution if error is detected. + * @param fd the FD to close + */ +#define MHD_fd_close_chk_(fd) do { \ + if (0 == close ((fd)) && (EBADF == errno)) \ + MHD_PANIC(_("Failed to close FD.\n")); \ + } while(0) /** * Should we perform additional sanity checks at runtime (on our internal @@ -84,91 +117,92 @@ #define BUILTIN_NOT_REACHED #endif - -#if HAVE_MESSAGES +#ifndef MHD_STATICSTR_LEN_ /** - * Trigger 'panic' action based on fatal errors. - * - * @param msg error message (const char *) + * Determine length of static string / macro strings at compile time. */ -#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); BUILTIN_NOT_REACHED; } while (0) -#else -/** - * Trigger 'panic' action based on fatal errors. - * - * @param msg error message (const char *) - */ -#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); BUILTIN_NOT_REACHED; } while (0) -#endif +#define MHD_STATICSTR_LEN_(macro) (sizeof(macro)/sizeof(char) - 1) +#endif /* ! MHD_STATICSTR_LEN_ */ /** * State of the socket with respect to epoll (bitmask). */ enum MHD_EpollState - { +{ + + /** + * The socket is not involved with a defined state in epoll() right + * now. + */ + MHD_EPOLL_STATE_UNREADY = 0, + + /** + * epoll() told us that data was ready for reading, and we did + * not consume all of it yet. + */ + MHD_EPOLL_STATE_READ_READY = 1, + + /** + * epoll() told us that space was available for writing, and we did + * not consume all of it yet. + */ + MHD_EPOLL_STATE_WRITE_READY = 2, - /** - * The socket is not involved with a defined state in epoll right - * now. - */ - MHD_EPOLL_STATE_UNREADY = 0, - - /** - * epoll told us that data was ready for reading, and we did - * not consume all of it yet. - */ - MHD_EPOLL_STATE_READ_READY = 1, - - /** - * epoll told us that space was available for writing, and we did - * not consume all of it yet. - */ - MHD_EPOLL_STATE_WRITE_READY = 2, - - /** - * Is this connection currently in the 'eready' EDLL? - */ - MHD_EPOLL_STATE_IN_EREADY_EDLL = 4, - - /** - * Is this connection currently in the 'epoll' set? - */ - MHD_EPOLL_STATE_IN_EPOLL_SET = 8, - - /** - * Is this connection currently suspended? - */ - MHD_EPOLL_STATE_SUSPENDED = 16 - }; + /** + * Is this connection currently in the 'eready' EDLL? + */ + MHD_EPOLL_STATE_IN_EREADY_EDLL = 4, + + /** + * Is this connection currently in the epoll() set? + */ + MHD_EPOLL_STATE_IN_EPOLL_SET = 8, + + /** + * Is this connection currently suspended? + */ + MHD_EPOLL_STATE_SUSPENDED = 16, + + /** + * Is this connection in some error state? + */ + MHD_EPOLL_STATE_ERROR = 128 +}; /** * What is this connection waiting for? */ enum MHD_ConnectionEventLoopInfo - { - /** - * We are waiting to be able to read. - */ - MHD_EVENT_LOOP_INFO_READ = 0, - - /** - * We are waiting to be able to write. - */ - MHD_EVENT_LOOP_INFO_WRITE = 1, - - /** - * We are waiting for the application to provide data. - */ - MHD_EVENT_LOOP_INFO_BLOCK = 2, - - /** - * We are finished and are awaiting cleanup. - */ - MHD_EVENT_LOOP_INFO_CLEANUP = 3 - }; +{ + /** + * We are waiting to be able to read. + */ + MHD_EVENT_LOOP_INFO_READ = 0, + /** + * We are waiting to be able to write. + */ + MHD_EVENT_LOOP_INFO_WRITE = 1, + + /** + * We are waiting for the application to provide data. + */ + MHD_EVENT_LOOP_INFO_BLOCK = 2, + + /** + * We are finished and are awaiting cleanup. + */ + MHD_EVENT_LOOP_INFO_CLEANUP = 3 +}; + + +/** + * Additional test value for enum MHD_FLAG to check only for MHD_ALLOW_SUSPEND_RESUME and + * NOT for MHD_USE_ITC. + */ +#define MHD_TEST_ALLOW_SUSPEND_RESUME 8192 /** * Maximum length of a nonce in digest authentication. 32(MD5 Hex) + @@ -190,7 +224,13 @@ * Nonce counter, a value that increases for each subsequent * request for the same nonce. */ - unsigned long int nc; + uint64_t nc; + + /** + * Bitmask over the nc-64 previous nonce values. Used to + * allow out-of-order nonces. + */ + uint64_t nmask; /** * Nonce value: @@ -199,14 +239,15 @@ }; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES /** - * fprintf-like helper function for logging debug + * fprintf()-like helper function for logging debug * messages. */ void MHD_DLOG (const struct MHD_Daemon *daemon, - const char *format, ...); + const char *format, + ...); #endif @@ -221,8 +262,7 @@ struct MHD_HTTP_Header *next; /** - * The name of the header (key), without - * the colon. + * The name of the header (key), without the colon. */ char *header; @@ -232,8 +272,8 @@ char *value; /** - * Type of the header (where in the HTTP - * protocol is this header from). + * Type of the header (where in the HTTP protocol is this header + * from). */ enum MHD_ValueKind kind; @@ -277,6 +317,20 @@ */ MHD_ContentReaderFreeCallback crfc; +#ifdef UPGRADE_SUPPORT + /** + * Application function to call once we are done sending the headers + * of the response; NULL unless this is a response created with + * #MHD_create_response_for_upgrade(). + */ + MHD_UpgradeHandler upgrade_handler; + + /** + * Closure for @e uh. + */ + void *upgrade_handler_cls; +#endif /* UPGRADE_SUPPORT */ + /** * Mutex to synchronize access to @e data, @e size and * @e reference_count. @@ -311,8 +365,8 @@ size_t data_buffer_size; /** - * Reference count for this response. Free - * once the counter hits zero. + * Reference count for this response. Free once the counter hits + * zero. */ unsigned int reference_count; @@ -332,16 +386,17 @@ /** * States in a state machine for a connection. * - * Transitions are any-state to CLOSED, any state to state+1, - * FOOTERS_SENT to INIT. CLOSED is the terminal state and - * INIT the initial state. - * - * Note that transitions for *reading* happen only after - * the input has been processed; transitions for - * *writing* happen after the respective data has been - * put into the write buffer (the write does not have - * to be completed yet). A transition to CLOSED or INIT - * requires the write to be complete. + * The main transitions are any-state to #MHD_CONNECTION_CLOSED, any + * state to state+1, #MHD_CONNECTION_FOOTERS_SENT to + * #MHD_CONNECTION_INIT. #MHD_CONNECTION_CLOSED is the terminal state + * and #MHD_CONNECTION_INIT the initial state. + * + * Note that transitions for *reading* happen only after the input has + * been processed; transitions for *writing* happen after the + * respective data has been put into the write buffer (the write does + * not have to be completed yet). A transition to + * #MHD_CONNECTION_CLOSED or #MHD_CONNECTION_INIT requires the write + * to be complete. */ enum MHD_CONNECTION_STATE { @@ -462,9 +517,17 @@ /** * The initial connection state for all secure connectoins * Handshake messages will be processed in this state & while - * in the 'MHD_TLS_HELLO_REQUEST' state + * in the #MHD_TLS_HELLO_REQUEST state + */ + MHD_TLS_CONNECTION_INIT = MHD_CONNECTION_IN_CLEANUP + 1, + +#ifdef UPGRADE_SUPPORT + /** + * Connection was "upgraded" and socket is now under the + * control of the application. */ - MHD_TLS_CONNECTION_INIT = MHD_CONNECTION_IN_CLEANUP + 1 + MHD_CONNECTION_UPGRADE = MHD_TLS_CONNECTION_INIT + 1, +#endif /* UPGRADE_SUPPORT */ }; @@ -474,7 +537,7 @@ #define DEBUG_STATES MHD_NO -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES #if DEBUG_STATES const char * MHD_state_to_string (enum MHD_CONNECTION_STATE state); @@ -487,7 +550,7 @@ * @param conn the connection struct * @param write_to where to write received data * @param max_bytes maximum number of bytes to receive - * @return number of bytes written to write_to + * @return number of bytes written to @a write_to */ typedef ssize_t (*ReceiveCallback) (struct MHD_Connection *conn, @@ -505,17 +568,38 @@ */ typedef ssize_t (*TransmitCallback) (struct MHD_Connection *conn, - const void *write_to, + const void *read_from, size_t max_bytes); /** + * Ability to use same connection for next request + */ +enum MHD_ConnKeepAlive +{ + /** + * Connection must be closed after sending response. + */ + MHD_CONN_MUST_CLOSE = -1, + + /** + * KeelAlive state is not yet determined + */ + MHD_CONN_KEEPALIVE_UNKOWN = 0, + + /** + * Connection can be used for serving next request + */ + MHD_CONN_USE_KEEPALIVE = 1 +}; + +/** * State kept for each HTTP request. */ struct MHD_Connection { -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * Next pointer for the EDLL listing connections that are epoll-ready. */ @@ -572,14 +656,12 @@ struct MHD_Response *response; /** - * The memory pool is created whenever we first read - * from the TCP stream and destroyed at the end of - * each request (and re-created for the next request). - * In the meantime, this pointer is NULL. The - * pool is used for all connection-related data - * except for the response (which maybe shared between - * connections) and the IP address (which persists - * across individual requests). + * The memory pool is created whenever we first read from the TCP + * stream and destroyed at the end of each request (and re-created + * for the next request). In the meantime, this pointer is NULL. + * The pool is used for all connection-related data except for the + * response (which maybe shared between connections) and the IP + * address (which persists across individual requests). */ struct MemoryPool *pool; @@ -601,8 +683,7 @@ void *socket_context; /** - * Request method. Should be GET/POST/etc. Allocated - * in pool. + * Request method. Should be GET/POST/etc. Allocated in pool. */ char *method; @@ -610,7 +691,7 @@ * Requested URL (everything after "GET" only). Allocated * in pool. */ - char *url; + const char *url; /** * HTTP version string (i.e. http/1.1). Allocated @@ -619,9 +700,15 @@ char *version; /** - * Buffer for reading requests. Allocated - * in pool. Actually one byte larger than - * @e read_buffer_size (if non-NULL) to allow for + * Close connection after sending response? + * Functions may change value from "Unknown" or "KeepAlive" to "Must close", + * but no functions reset value "Must Close" to any other value. + */ + enum MHD_ConnKeepAlive keepalive; + + /** + * Buffer for reading requests. Allocated in pool. Actually one + * byte larger than @e read_buffer_size (if non-NULL) to allow for * 0-termination. */ char *read_buffer; @@ -662,7 +749,7 @@ MHD_thread_handle_ pid; /** - * Size of read_buffer (in bytes). This value indicates + * Size of @e read_buffer (in bytes). This value indicates * how many bytes we're willing to read into the buffer; * the real buffer is one byte longer to allow for * adding zero-termination (when needed). @@ -671,12 +758,12 @@ /** * Position where we currently append data in - * read_buffer (last valid position). + * @e read_buffer (last valid position). */ size_t read_buffer_offset; /** - * Size of write_buffer (in bytes). + * Size of @e write_buffer (in bytes). */ size_t write_buffer_size; @@ -692,6 +779,12 @@ size_t write_buffer_append_offset; /** + * Number of bytes we had in the HTTP header, set once we + * pass #MHD_CONNECTION_HEADERS_RECEIVED. + */ + size_t header_size; + + /** * How many more bytes of the body do we expect * to read? #MHD_SIZE_UNKNOWN for unknown. */ @@ -704,6 +797,14 @@ */ uint64_t response_write_position; +#if LINUX + enum MHD_resp_sender_ + { + MHD_resp_sender_std = 0, + MHD_resp_sender_sendfile + } resp_sender; +#endif /* LINUX */ + /** * Position in the 100 CONTINUE message that * we need to send when receiving http 1.1 requests. @@ -725,14 +826,19 @@ * After how many seconds of inactivity should * this connection time out? Zero for no timeout. */ - unsigned int connection_timeout; + time_t connection_timeout; /** - * Did we ever call the "default_handler" on this connection? - * (this flag will determine if we call the 'notify_completed' + * Special member to be returned by #MHD_get_connection_info() + */ + unsigned int connection_timeout_dummy; + + /** + * Did we ever call the "default_handler" on this connection? (this + * flag will determine if we call the #MHD_OPTION_NOTIFY_COMPLETED * handler when the connection closes down). */ - int client_aware; + bool client_aware; /** * Socket for this connection. Set to #MHD_INVALID_SOCKET if @@ -742,24 +848,36 @@ MHD_socket socket_fd; /** + * true if #socket_fd is non-blocking, false otherwise. + */ + bool sk_nonblck; + + /** * Has this socket been closed for reading (i.e. other side closed * the connection)? If so, we must completely close the connection * once we are done sending our response (and stop trying to read * from this socket). */ - int read_closed; + bool read_closed; + + /** + * Set to `true` if the thread has been joined. + */ + bool thread_joined; /** - * Set to #MHD_YES if the thread has been joined. + * Are we currently inside the "idle" handler (to avoid recursively + * invoking it). */ - int thread_joined; + bool in_idle; /** - * Are we currently inside the "idle" handler (to avoid recursively invoking it). + * Are we currently inside the "idle" handler (to avoid recursively + * invoking it). */ - int in_idle; + bool in_cleanup; -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * What is the state of this socket in relation to epoll? */ @@ -783,22 +901,13 @@ unsigned int responseCode; /** - * Set to MHD_YES if the response's content reader - * callback failed to provide data the last time - * we tried to read from it. In that case, the - * write socket should be marked as unready until - * the CRC call succeeds. - */ - int response_unready; - - /** * Are we receiving with chunked encoding? This will be set to - * MHD_YES after we parse the headers and are processing the body + * #MHD_YES after we parse the headers and are processing the body * with chunks. After we are done with the body and we are * processing the footers; once the footers are also done, this will - * be set to MHD_NO again (before the final call to the handler). + * be set to #MHD_NO again (before the final call to the handler). */ - int have_chunked_upload; + bool have_chunked_upload; /** * If we are receiving with chunked encoding, where are we right @@ -806,26 +915,29 @@ * otherwise, this is the size of the current chunk. A value of * zero is also used when we're at the end of the chunks. */ - size_t current_chunk_size; + uint64_t current_chunk_size; /** * If we are receiving with chunked encoding, where are we currently * with respect to the current chunk (at what offset / position)? */ - size_t current_chunk_offset; + uint64_t current_chunk_offset; /** * Handler used for processing read connection operations + * @sa #MHD_connection_handle_read, #MHD_tls_connection_handle_read */ int (*read_handler) (struct MHD_Connection *connection); /** * Handler used for processing write connection operations + * @sa #MHD_connection_handle_write, #MHD_tls_connection_handle_write */ int (*write_handler) (struct MHD_Connection *connection); /** * Handler used for processing idle connection operations + * @sa #MHD_connection_handle_idle, #MHD_tls_connection_handle_idle */ int (*idle_handler) (struct MHD_Connection *connection); @@ -839,7 +951,18 @@ */ TransmitCallback send_cls; -#if HTTPS_SUPPORT +#ifdef UPGRADE_SUPPORT + /** + * If this connection was upgraded, this points to + * the upgrade response details such that the + * #thread_main_connection_upgrade()-logic can perform the + * bi-directional forwarding. + */ + struct MHD_UpgradeResponseHandle *urh; +#endif /* UPGRADE_SUPPORT */ + +#ifdef HTTPS_SUPPORT + /** * State required for HTTPS/SSL/TLS support. */ @@ -859,20 +982,227 @@ * Could it be that we are ready to read due to TLS buffers * even though the socket is not? */ - int tls_read_ready; -#endif + bool tls_read_ready; + + /** + * TLS layer was shut down? + */ + bool tls_closed; +#endif /* HTTPS_SUPPORT */ /** * Is the connection suspended? */ - int suspended; + bool suspended; + + /** + * Special member to be returned by #MHD_get_connection_info() + */ + int suspended_dummy; /** * Is the connection wanting to resume? */ - int resuming; + bool resuming; }; + +#ifdef UPGRADE_SUPPORT +/** + * Buffer we use for upgrade response handling in the unlikely + * case where the memory pool was so small it had no buffer + * capacity left. Note that we don't expect to _ever_ use this + * buffer, so it's mostly wasted memory (except that it allows + * us to handle a tricky error condition nicely). So no need to + * make this one big. Applications that want to perform well + * should just pick an adequate size for the memory pools. + */ +#define RESERVE_EBUF_SIZE 8 + +/** + * Context we pass to epoll() for each of the two sockets + * of a `struct MHD_UpgradeResponseHandle`. We need to do + * this so we can distinguish the two sockets when epoll() + * gives us event notifications. + */ +struct UpgradeEpollHandle +{ + /** + * Reference to the overall response handle this struct is + * included within. + */ + struct MHD_UpgradeResponseHandle *urh; + + /** + * The socket this event is kind-of about. Note that this is NOT + * necessarily the socket we are polling on, as for when we read + * from TLS, we epoll() on the connection's socket + * (`urh->connection->socket_fd`), while this then the application's + * socket (where the application will read from). Nevertheless, for + * the application to read, we need to first read from TLS, hence + * the two are related. + * + * Similarly, for writing to TLS, this epoll() will be on the + * connection's `socket_fd`, and this will merely be the FD which + * the applicatio would write to. Hence this struct must always be + * interpreted based on which field in `struct + * MHD_UpgradeResponseHandle` it is (`app` or `mhd`). + */ + MHD_socket socket; + + /** + * IO-state of the @e socket (or the connection's `socket_fd`). + */ + enum MHD_EpollState celi; + +}; + + +/** + * Handle given to the application to manage special + * actions relating to MHD responses that "upgrade" + * the HTTP protocol (i.e. to WebSockets). + */ +struct MHD_UpgradeResponseHandle +{ + /** + * The connection for which this is an upgrade handle. Note that + * because a response may be shared over many connections, this may + * not be the only upgrade handle for the response of this connection. + */ + struct MHD_Connection *connection; + +#ifdef HTTPS_SUPPORT + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *next; + + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *prev; + +#ifdef EPOLL_SUPPORT + /** + * Next pointer for the EDLL listing urhs that are epoll-ready. + */ + struct MHD_UpgradeResponseHandle *nextE; + + /** + * Previous pointer for the EDLL listing urhs that are epoll-ready. + */ + struct MHD_UpgradeResponseHandle *prevE; + + /** + * Specifies whether urh already in EDLL list of ready connections. + */ + bool in_eready_list; +#endif + + /** + * The buffer for receiving data from TLS to + * be passed to the application. Contains @e in_buffer_size + * bytes (unless @e in_buffer_size is zero). Do not free! + */ + char *in_buffer; + + /** + * The buffer for receiving data from the application to + * be passed to TLS. Contains @e out_buffer_size + * bytes (unless @e out_buffer_size is zero). Do not free! + */ + char *out_buffer; + + /** + * Size of the @e in_buffer. + * Set to 0 if the TLS connection went down for reading or socketpair + * went down for writing. + */ + size_t in_buffer_size; + + /** + * Size of the @e out_buffer. + * Set to 0 if the TLS connection went down for writing or socketpair + * went down for reading. + */ + size_t out_buffer_size; + + /** + * Number of bytes actually in use in the @e in_buffer. Can be larger + * than @e in_buffer_size if and only if @a in_buffer_size is zero and + * we still have bytes that can be forwarded. + * Reset to zero if all data was forwarded to socketpair or + * if socketpair went down for writing. + */ + size_t in_buffer_used; + + /** + * Number of bytes actually in use in the @e out_buffer. Can be larger + * than @e out_buffer_size if and only if @a out_buffer_size is zero and + * we still have bytes that can be forwarded. + * Reset to zero if all data was forwarded to TLS connection or + * if TLS connection went down for writing. + */ + size_t out_buffer_used; + + /** + * The socket we gave to the application (r/w). + */ + struct UpgradeEpollHandle app; + + /** + * If @a app_sock was a socketpair, our end of it, otherwise + * #MHD_INVALID_SOCKET; (r/w). + */ + struct UpgradeEpollHandle mhd; + + /** + * Emergency IO buffer we use in case the memory pool has literally + * nothing left. + */ + char e_buf[RESERVE_EBUF_SIZE]; + +#endif /* HTTPS_SUPPORT */ + + /** + * Set to true after the application finished with the socket + * by #MHD_UPGRADE_ACTION_CLOSE. + * + * When BOTH @e was_closed (changed by command from application) + * AND @e clean_ready (changed internally by MHD) are set to + * #MHD_YES, function #MHD_resume_connection() will move this + * connection to cleanup list. + * @remark This flag could be changed from any thread. + */ + volatile bool was_closed; + + /** + * Set to true if connection is ready for cleanup. + * + * In TLS mode functions #MHD_connection_finish_forward_() must + * be called before setting this flag to true. + * + * In thread-per-connection mode, true in this flag means + * that connection's thread exited or about to exit and will + * not use MHD_Connection::urh data anymore. + * + * In any mode true in this flag also means that + * MHD_Connection::urh data will not be used for socketpair + * forwarding and forwarding itself is finished. + * + * When BOTH @e was_closed (changed by command from application) + * AND @e clean_ready (changed internally by MHD) are set to + * true, function #MHD_resume_connection() will move this + * connection to cleanup list. + * @remark This flag could be changed from thread that process + * connection's recv(), send() and response. + */ + bool clean_ready; +}; +#endif /* UPGRADE_SUPPORT */ + + /** * Signature of function called to log URI accesses. * @@ -882,8 +1212,8 @@ * @return new closure */ typedef void * -(*LogCallback)(void * cls, - const char * uri, +(*LogCallback)(void *cls, + const char *uri, struct MHD_Connection *con); /** @@ -951,7 +1281,7 @@ */ struct MHD_Connection *cleanup_tail; -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * Head of EDLL of connections ready for processing (in epoll mode). */ @@ -961,7 +1291,19 @@ * Tail of EDLL of connections ready for processing (in epoll mode) */ struct MHD_Connection *eready_tail; -#endif + +#ifdef UPGRADE_SUPPORT + /** + * Head of EDLL of upgraded connections ready for processing (in epoll mode). + */ + struct MHD_UpgradeResponseHandle *eready_urh_head; + + /** + * Tail of EDLL of upgraded connections ready for processing (in epoll mode) + */ + struct MHD_UpgradeResponseHandle *eready_urh_tail; +#endif /* UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ /** * Head of the XDLL of ALL connections with a default ('normal') @@ -972,14 +1314,17 @@ * moved back to the tail of the list. * * All connections by default start in this list; if a custom - * timeout that does not match 'connection_timeout' is set, they - * are moved to the 'manual_timeout_head'-XDLL. + * timeout that does not match @e connection_timeout is set, they + * are moved to the @e manual_timeout_head-XDLL. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode as each thread + * needs only one connection-specific timeout. */ struct MHD_Connection *normal_timeout_head; /** * Tail of the XDLL of ALL connections with a default timeout, * sorted by timeout (earliest timeout at the tail). + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. */ struct MHD_Connection *normal_timeout_tail; @@ -987,12 +1332,14 @@ * Head of the XDLL of ALL connections with a non-default/custom * timeout, unsorted. MHD will do a O(n) scan over this list to * determine the current timeout. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. */ struct MHD_Connection *manual_timeout_head; /** * Tail of the XDLL of ALL connections with a non-default/custom * timeout, unsorted. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. */ struct MHD_Connection *manual_timeout_tail; @@ -1014,7 +1361,7 @@ MHD_RequestCompletedCallback notify_completed; /** - * Closure argument to notify_completed. + * Closure argument to @e notify_completed. */ void *notify_completed_cls; @@ -1025,7 +1372,7 @@ MHD_NotifyConnectionCallback notify_connection; /** - * Closure argument to notify_connection. + * Closure argument to @e notify_connection. */ void *notify_connection_cls; @@ -1053,7 +1400,7 @@ */ void *unescape_callback_cls; -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES /** * Function for logging error messages (if we * support error reporting). @@ -1061,7 +1408,7 @@ void (*custom_error_log) (void *cls, const char *fmt, va_list va); /** - * Closure argument to custom_error_log. + * Closure argument to @e custom_error_log. */ void *custom_error_log_cls; #endif @@ -1112,55 +1459,96 @@ MHD_mutex_ per_ip_connection_mutex; /** - * Mutex for (modifying) access to the "cleanup" connection DLL. + * Mutex for (modifying) access to the "cleanup", "normal_timeout" and + * "manual_timeout" DLLs. */ MHD_mutex_ cleanup_connection_mutex; /** * Listen socket. */ - MHD_socket socket_fd; + MHD_socket listen_fd; /** * Whether to allow/disallow/ignore reuse of listening address. * The semantics is the following: - * 0: ignore (user did not ask for neither allow/disallow, use SO_REUSEADDR) + * 0: ignore (user did not ask for neither allow/disallow, use SO_REUSEADDR + * except W32) * >0: allow (use SO_REUSEPORT on most platforms, SO_REUSEADDR on Windows) - * <0: disallow (mostly no action, SO_EXCLUSIVEADDRUSE on Windows) + * <0: disallow (mostly no action, SO_EXCLUSIVEADDRUSE on Windows or SO_EXCLBIND + * on Solaris) */ int listening_address_reuse; -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT /** * File descriptor associated with our epoll loop. */ int epoll_fd; /** - * MHD_YES if the listen socket is in the 'epoll' set, - * MHD_NO if not. + * true if the listen socket is in the 'epoll' set, + * false if not. */ - int listen_socket_in_epoll; + bool listen_socket_in_epoll; + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + /** + * File descriptor associated with the #run_epoll_for_upgrade() loop. + * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set. + */ + int epoll_upgrade_fd; + + /** + * true if @e epoll_upgrade_fd is in the 'epoll' set, + * false if not. + */ + bool upgrade_fd_in_epoll; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + #endif /** - * Pipe we use to signal shutdown, unless - * 'HAVE_LISTEN_SHUTDOWN' is defined AND we have a listen - * socket (which we can then 'shutdown' to stop listening). - * MHD can be build with usage of socketpair instead of - * pipe (forced on W32). + * Inter-thread communication channel. */ - MHD_pipe wpipe[2]; + struct MHD_itc_ itc; /** * Are we shutting down? */ - int shutdown; + volatile bool shutdown; + + /** + * Has this deamon been quiesced via #MHD_quiesce_daemon()? + * If so, we should no longer use the @e listen_fd (including + * removing it from the @e epoll_fd when possible). + */ + volatile bool was_quiesced; + + /** + * Did we hit some system or process-wide resource limit while + * trying to accept() the last time? If so, we don't accept new + * connections until we close an existing one. This effectively + * temporarily lowers the "connection_limit" to the current + * number of connections. + */ + bool at_limit; /* * Do we need to process resuming connections? */ - int resuming; + bool resuming; + + /** + * 'True' if some data is already waiting to be processed. + * If set to 'true' - zero timeout for select()/poll*() + * is used. + * Should be reset each time before processing connections + * and raised by any connection which require additional + * immediately processing (application does not provide + * data for response, data waiting in TLS buffers etc.) + */ + bool data_already_pending; /** * Number of active parallel connections. @@ -1176,7 +1564,7 @@ * After how many seconds of inactivity should * connections time out? Zero for no timeout. */ - unsigned int connection_timeout; + time_t connection_timeout; /** * Maximum number of connections per IP, or 0 for @@ -1194,7 +1582,28 @@ */ uint16_t port; -#if HTTPS_SUPPORT + /** + * Be neutral (zero), strict (1) or permissive (-1) to client. + */ + int strict_for_client; + +#ifdef HTTPS_SUPPORT +#ifdef UPGRADE_SUPPORT + /** + * Head of DLL of upgrade response handles we are processing. + * Used for upgraded TLS connections when thread-per-connection + * is not used. + */ + struct MHD_UpgradeResponseHandle *urh_head; + + /** + * Tail of DLL of upgrade response handles we are processing. + * Used for upgraded TLS connections when thread-per-connection + * is not used. + */ + struct MHD_UpgradeResponseHandle *urh_tail; +#endif /* UPGRADE_SUPPORT */ + /** * Desired cipher algorithms. */ @@ -1250,19 +1659,11 @@ gnutls_dh_params_t https_mem_dhparams; /** - * #MHD_YES if we have initialized @e https_mem_dhparams. + * true if we have initialized @e https_mem_dhparams. */ - int have_dhparams; + bool have_dhparams; - /** - * For how many connections do we have 'tls_read_ready' set to MHD_YES? - * Used to avoid O(n) traversal over all connections when determining - * event-loop timeout (as it needs to be zero if there is any connection - * which might have ready data within TLS). - */ - unsigned int num_tls_read_ready; - -#endif +#endif /* HTTPS_SUPPORT */ #ifdef DAUTH_SUPPORT @@ -1277,7 +1678,7 @@ struct MHD_NonceNc *nnc; /** - * A rw-lock for synchronizing access to `nnc'. + * A rw-lock for synchronizing access to @e nnc. */ MHD_mutex_ nnc_lock; @@ -1299,6 +1700,11 @@ */ unsigned int fastopen_queue_size; #endif + + /** + * The size of queue for listen socket. + */ + unsigned int listen_backlog_size; }; @@ -1439,7 +1845,7 @@ /** - * Convert all occurences of '+' to ' '. + * Convert all occurrences of '+' to ' '. * * @param arg string that is modified (in place), must be 0-terminated */ @@ -1447,4 +1853,89 @@ MHD_unescape_plus (char *arg); +/** + * Callback invoked when iterating over @a key / @a value + * argument pairs during parsing. + * + * @param connection context of the iteration + * @param key 0-terminated key string, never NULL + * @param value 0-terminated value string, may be NULL + * @param kind origin of the key-value pair + * @return #MHD_YES on success (continue to iterate) + * #MHD_NO to signal failure (and abort iteration) + */ +typedef int +(*MHD_ArgumentIterator_)(struct MHD_Connection *connection, + const char *key, + const char *value, + enum MHD_ValueKind kind); + + +/** + * Parse and unescape the arguments given by the client + * as part of the HTTP request URI. + * + * @param kind header kind to pass to @a cb + * @param connection connection to add headers to + * @param[in,out] args argument URI string (after "?" in URI), + * clobbered in the process! + * @param cb function to call on each key-value pair found + * @param[out] num_headers set to the number of headers found + * @return #MHD_NO on failure (@a cb returned #MHD_NO), + * #MHD_YES for success (parsing succeeded, @a cb always + * returned #MHD_YES) + */ +int +MHD_parse_arguments_ (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + char *args, + MHD_ArgumentIterator_ cb, + unsigned int *num_headers); + + +/** + * Check whether response header contains particular @a token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param response the response to query + * @param key header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +bool +MHD_check_response_header_token_ci (const struct MHD_Response *response, + const char *key, + const char *token, + size_t token_len); + +/** + * Check whether response header contains particular static @a tkn. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param r the response to query + * @param k header name + * @param tkn the static string of token to find + * @return true if token is found in specified header, + * false otherwise + */ +#define MHD_check_response_header_s_token_ci(r,k,tkn) \ + MHD_check_response_header_token_ci((r),(k),(tkn),MHD_STATICSTR_LEN_(tkn)) + +/** + * Internal version of ::MHD_suspend_connection(). + * + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the connection to suspend + */ +void +internal_suspend_connection_ (struct MHD_Connection *connection); + #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/Makefile.am libmicrohttpd-0.9.55/src/microhttpd/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/Makefile.am 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -5,10 +5,6 @@ AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) -if HAVE_W32 -MHD_W32_LIB = $(top_builddir)/src/platform/libplatform_interface.la -endif - lib_LTLIBRARIES = \ libmicrohttpd.la @@ -64,7 +60,15 @@ memorypool.c memorypool.h \ mhd_mono_clock.c mhd_mono_clock.h \ mhd_limits.h mhd_byteorder.h \ + sysfdsetsize.c sysfdsetsize.h \ + mhd_str.c mhd_str.h \ + mhd_threads.c mhd_threads.h \ + mhd_locks.h \ + mhd_sockets.c mhd_sockets.h \ + mhd_itc.c mhd_itc.h mhd_itc_types.h \ + mhd_compat.c mhd_compat.h \ response.c response.h + libmicrohttpd_la_CPPFLAGS = \ $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ -DBUILDING_MHD_LIB=1 @@ -75,9 +79,7 @@ $(W32_MHD_LIB_LDFLAGS) \ -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ libmicrohttpd_la_LIBADD = \ - $(MHD_W32_LIB) $(MHD_LIBDEPS) -libmicrohttpd_la_DEPENDENCIES = \ - $(MHD_W32_LIB) + $(MHD_LIBDEPS) if HAVE_W32 MHD_DLL_RES_SRC = microhttpd_dll_res.rc @@ -108,7 +110,7 @@ AM_CFLAGS += --coverage endif -if !HAVE_TSEARCH +if !MHD_HAVE_TSEARCH libmicrohttpd_la_SOURCES += \ tsearch.c tsearch.h endif @@ -138,8 +140,23 @@ check_PROGRAMS = \ + test_str_compare \ + test_str_to_value \ + test_str_token \ + test_http_reasons \ + test_shutdown_select \ + test_shutdown_poll \ test_daemon +if HAVE_POSIX_THREADS +if ENABLE_UPGRADE + check_PROGRAMS += test_upgrade +if ENABLE_HTTPS + check_PROGRAMS += test_upgrade_tls +endif +endif +endif + if HAVE_POSTPROCESSOR check_PROGRAMS += \ test_postprocessor \ @@ -149,23 +166,56 @@ TESTS = $(check_PROGRAMS) +if !HAVE_LISTEN_SHUTDOWN +XFAIL_TESTS = \ + test_shutdown_select \ + test_shutdown_poll +endif + test_daemon_SOURCES = \ test_daemon.c test_daemon_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_upgrade_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h +test_upgrade_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_upgrade_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) +test_upgrade_LDFLAGS = \ + $(GNUTLS_LDFLAGS) +test_upgrade_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_upgrade_tls_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h +test_upgrade_tls_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_upgrade_tls_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) +test_upgrade_tls_LDFLAGS = \ + $(GNUTLS_LDFLAGS) +test_upgrade_tls_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + test_postprocessor_SOURCES = \ test_postprocessor.c test_postprocessor_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) test_postprocessor_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la test_postprocessor_amp_SOURCES = \ test_postprocessor_amp.c test_postprocessor_amp_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_amp_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) test_postprocessor_amp_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la @@ -173,6 +223,38 @@ test_postprocessor_large.c test_postprocessor_large_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_large_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) test_postprocessor_large_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_shutdown_select_SOURCES = \ + test_shutdown_select.c +if USE_POSIX_THREADS +test_shutdown_select_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_select_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_shutdown_poll_SOURCES = \ + test_shutdown_select.c mhd_threads.h +if USE_POSIX_THREADS +test_shutdown_poll_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_poll_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_str_compare_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_to_value_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_token_SOURCES = \ + test_str_token.c mhd_str.c + +test_http_reasons_SOURCES = \ + test_http_reasons.c \ + reason_phrase.c mhd_str.c mhd_str.h diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/Makefile.in libmicrohttpd-0.9.55/src/microhttpd/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/Makefile.in 2015-10-01 21:22:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -95,8 +95,8 @@ @W32_STATIC_LIB_TRUE@am__append_4 = $(lt_cv_objdir)/libmicrohttpd-static.lib @HAVE_W32_TRUE@am__append_5 = $(MHD_DLL_RES_LO) @USE_COVERAGE_TRUE@am__append_6 = --coverage -@HAVE_TSEARCH_FALSE@am__append_7 = \ -@HAVE_TSEARCH_FALSE@ tsearch.c tsearch.h +@MHD_HAVE_TSEARCH_FALSE@am__append_7 = \ +@MHD_HAVE_TSEARCH_FALSE@ tsearch.c tsearch.h @HAVE_POSTPROCESSOR_TRUE@am__append_8 = \ @HAVE_POSTPROCESSOR_TRUE@ postprocessor.c @@ -112,19 +112,27 @@ @ENABLE_HTTPS_TRUE@am__append_11 = \ @ENABLE_HTTPS_TRUE@ connection_https.c connection_https.h -check_PROGRAMS = test_daemon$(EXEEXT) $(am__EXEEXT_1) -@HAVE_POSTPROCESSOR_TRUE@am__append_12 = \ +check_PROGRAMS = test_str_compare$(EXEEXT) test_str_to_value$(EXEEXT) \ + test_str_token$(EXEEXT) test_http_reasons$(EXEEXT) \ + test_shutdown_select$(EXEEXT) test_shutdown_poll$(EXEEXT) \ + test_daemon$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_12 = test_upgrade +@ENABLE_HTTPS_TRUE@@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_13 = test_upgrade_tls +@HAVE_POSTPROCESSOR_TRUE@am__append_14 = \ @HAVE_POSTPROCESSOR_TRUE@ test_postprocessor \ @HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_large \ @HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_amp +@HAVE_LISTEN_SHUTDOWN_FALSE@XFAIL_TESTS = \ +@HAVE_LISTEN_SHUTDOWN_FALSE@ test_shutdown_select$(EXEEXT) \ +@HAVE_LISTEN_SHUTDOWN_FALSE@ test_shutdown_poll$(EXEEXT) subdir = src/microhttpd ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -132,8 +140,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -171,13 +182,18 @@ am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = +libmicrohttpd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_5) am__libmicrohttpd_la_SOURCES_DIST = connection.c connection.h \ reason_phrase.c daemon.c internal.c internal.h memorypool.c \ memorypool.h mhd_mono_clock.c mhd_mono_clock.h mhd_limits.h \ - mhd_byteorder.h response.c response.h tsearch.c tsearch.h \ - postprocessor.c digestauth.c md5.c md5.h basicauth.c base64.c \ - base64.h connection_https.c connection_https.h -@HAVE_TSEARCH_FALSE@am__objects_1 = libmicrohttpd_la-tsearch.lo + mhd_byteorder.h sysfdsetsize.c sysfdsetsize.h mhd_str.c \ + mhd_str.h mhd_threads.c mhd_threads.h mhd_locks.h \ + mhd_sockets.c mhd_sockets.h mhd_itc.c mhd_itc.h \ + mhd_itc_types.h mhd_compat.c mhd_compat.h response.c \ + response.h tsearch.c tsearch.h postprocessor.c digestauth.c \ + md5.c md5.h basicauth.c base64.c base64.h connection_https.c \ + connection_https.h +@MHD_HAVE_TSEARCH_FALSE@am__objects_1 = libmicrohttpd_la-tsearch.lo @HAVE_POSTPROCESSOR_TRUE@am__objects_2 = \ @HAVE_POSTPROCESSOR_TRUE@ libmicrohttpd_la-postprocessor.lo @ENABLE_DAUTH_TRUE@am__objects_3 = libmicrohttpd_la-digestauth.lo \ @@ -190,8 +206,12 @@ libmicrohttpd_la-reason_phrase.lo libmicrohttpd_la-daemon.lo \ libmicrohttpd_la-internal.lo libmicrohttpd_la-memorypool.lo \ libmicrohttpd_la-mhd_mono_clock.lo \ - libmicrohttpd_la-response.lo $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) $(am__objects_4) $(am__objects_5) + libmicrohttpd_la-sysfdsetsize.lo libmicrohttpd_la-mhd_str.lo \ + libmicrohttpd_la-mhd_threads.lo \ + libmicrohttpd_la-mhd_sockets.lo libmicrohttpd_la-mhd_itc.lo \ + libmicrohttpd_la-mhd_compat.lo libmicrohttpd_la-response.lo \ + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) libmicrohttpd_la_OBJECTS = $(am_libmicrohttpd_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -201,29 +221,91 @@ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libmicrohttpd_la_CFLAGS) $(CFLAGS) \ $(libmicrohttpd_la_LDFLAGS) $(LDFLAGS) -o $@ -@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_1 = test_postprocessor$(EXEEXT) \ +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_1 = test_upgrade$(EXEEXT) +@ENABLE_HTTPS_TRUE@@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_2 = test_upgrade_tls$(EXEEXT) +@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_3 = test_postprocessor$(EXEEXT) \ @HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_large$(EXEEXT) \ @HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_amp$(EXEEXT) am_test_daemon_OBJECTS = test_daemon.$(OBJEXT) test_daemon_OBJECTS = $(am_test_daemon_OBJECTS) test_daemon_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_http_reasons_OBJECTS = test_http_reasons.$(OBJEXT) \ + reason_phrase.$(OBJEXT) mhd_str.$(OBJEXT) +test_http_reasons_OBJECTS = $(am_test_http_reasons_OBJECTS) +test_http_reasons_LDADD = $(LDADD) am_test_postprocessor_OBJECTS = \ test_postprocessor-test_postprocessor.$(OBJEXT) test_postprocessor_OBJECTS = $(am_test_postprocessor_OBJECTS) test_postprocessor_DEPENDENCIES = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_test_postprocessor_amp_OBJECTS = \ test_postprocessor_amp-test_postprocessor_amp.$(OBJEXT) test_postprocessor_amp_OBJECTS = $(am_test_postprocessor_amp_OBJECTS) test_postprocessor_amp_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_amp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_amp_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_test_postprocessor_large_OBJECTS = \ test_postprocessor_large-test_postprocessor_large.$(OBJEXT) test_postprocessor_large_OBJECTS = \ $(am_test_postprocessor_large_OBJECTS) test_postprocessor_large_DEPENDENCIES = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_large_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_large_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_poll_OBJECTS = \ + test_shutdown_poll-test_shutdown_select.$(OBJEXT) +test_shutdown_poll_OBJECTS = $(am_test_shutdown_poll_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_poll_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_poll_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_select_OBJECTS = \ + test_shutdown_select-test_shutdown_select.$(OBJEXT) +test_shutdown_select_OBJECTS = $(am_test_shutdown_select_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_select_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_select_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_select_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_str_compare_OBJECTS = test_str.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_compare_OBJECTS = $(am_test_str_compare_OBJECTS) +test_str_compare_LDADD = $(LDADD) +am_test_str_to_value_OBJECTS = test_str.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_to_value_OBJECTS = $(am_test_str_to_value_OBJECTS) +test_str_to_value_LDADD = $(LDADD) +am_test_str_token_OBJECTS = test_str_token.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_token_OBJECTS = $(am_test_str_token_OBJECTS) +test_str_token_LDADD = $(LDADD) +am_test_upgrade_OBJECTS = test_upgrade-test_upgrade.$(OBJEXT) +test_upgrade_OBJECTS = $(am_test_upgrade_OBJECTS) +test_upgrade_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_upgrade_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_upgrade_CFLAGS) \ + $(CFLAGS) $(test_upgrade_LDFLAGS) $(LDFLAGS) -o $@ +am_test_upgrade_tls_OBJECTS = test_upgrade_tls-test_upgrade.$(OBJEXT) +test_upgrade_tls_OBJECTS = $(am_test_upgrade_tls_OBJECTS) +test_upgrade_tls_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_upgrade_tls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_upgrade_tls_CFLAGS) $(CFLAGS) \ + $(test_upgrade_tls_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -259,13 +341,22 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmicrohttpd_la_SOURCES) $(test_daemon_SOURCES) \ - $(test_postprocessor_SOURCES) \ + $(test_http_reasons_SOURCES) $(test_postprocessor_SOURCES) \ $(test_postprocessor_amp_SOURCES) \ - $(test_postprocessor_large_SOURCES) + $(test_postprocessor_large_SOURCES) \ + $(test_shutdown_poll_SOURCES) $(test_shutdown_select_SOURCES) \ + $(test_str_compare_SOURCES) $(test_str_to_value_SOURCES) \ + $(test_str_token_SOURCES) $(test_upgrade_SOURCES) \ + $(test_upgrade_tls_SOURCES) DIST_SOURCES = $(am__libmicrohttpd_la_SOURCES_DIST) \ - $(test_daemon_SOURCES) $(test_postprocessor_SOURCES) \ + $(test_daemon_SOURCES) $(test_http_reasons_SOURCES) \ + $(test_postprocessor_SOURCES) \ $(test_postprocessor_amp_SOURCES) \ - $(test_postprocessor_large_SOURCES) + $(test_postprocessor_large_SOURCES) \ + $(test_shutdown_poll_SOURCES) $(test_shutdown_select_SOURCES) \ + $(test_str_compare_SOURCES) $(test_str_to_value_SOURCES) \ + $(test_str_token_SOURCES) $(test_upgrade_SOURCES) \ + $(test_upgrade_tls_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -497,8 +588,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -506,6 +599,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -521,9 +615,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -531,6 +622,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -545,9 +637,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -569,13 +658,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -583,6 +669,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -627,6 +714,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -642,7 +730,6 @@ -I$(top_srcdir)/src/microhttpd AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) $(am__append_6) -@HAVE_W32_TRUE@MHD_W32_LIB = $(top_builddir)/src/platform/libplatform_interface.la lib_LTLIBRARIES = \ libmicrohttpd.la @@ -653,8 +740,12 @@ libmicrohttpd_la_SOURCES = connection.c connection.h reason_phrase.c \ daemon.c internal.c internal.h memorypool.c memorypool.h \ mhd_mono_clock.c mhd_mono_clock.h mhd_limits.h mhd_byteorder.h \ - response.c response.h $(am__append_7) $(am__append_8) \ - $(am__append_9) $(am__append_10) $(am__append_11) + sysfdsetsize.c sysfdsetsize.h mhd_str.c mhd_str.h \ + mhd_threads.c mhd_threads.h mhd_locks.h mhd_sockets.c \ + mhd_sockets.h mhd_itc.c mhd_itc.h mhd_itc_types.h mhd_compat.c \ + mhd_compat.h response.c response.h $(am__append_7) \ + $(am__append_8) $(am__append_9) $(am__append_10) \ + $(am__append_11) libmicrohttpd_la_CPPFLAGS = \ $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ -DBUILDING_MHD_LIB=1 @@ -667,11 +758,7 @@ $(W32_MHD_LIB_LDFLAGS) \ -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ -libmicrohttpd_la_LIBADD = $(MHD_W32_LIB) $(MHD_LIBDEPS) \ - $(am__append_5) -libmicrohttpd_la_DEPENDENCIES = \ - $(MHD_W32_LIB) - +libmicrohttpd_la_LIBADD = $(MHD_LIBDEPS) $(am__append_5) @HAVE_W32_TRUE@MHD_DLL_RES_SRC = microhttpd_dll_res.rc @HAVE_W32_TRUE@MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo) @HAVE_W32_TRUE@EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO) @@ -682,15 +769,49 @@ test_daemon_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_upgrade_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h + +test_upgrade_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_upgrade_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + +test_upgrade_LDFLAGS = \ + $(GNUTLS_LDFLAGS) + +test_upgrade_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_upgrade_tls_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h + +test_upgrade_tls_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_upgrade_tls_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + +test_upgrade_tls_LDFLAGS = \ + $(GNUTLS_LDFLAGS) + +test_upgrade_tls_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + test_postprocessor_SOURCES = \ test_postprocessor.c test_postprocessor_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + test_postprocessor_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la test_postprocessor_amp_SOURCES = \ test_postprocessor_amp.c @@ -698,6 +819,9 @@ test_postprocessor_amp_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_amp_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + test_postprocessor_amp_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la @@ -707,9 +831,42 @@ test_postprocessor_large_CPPFLAGS = \ $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_large_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + test_postprocessor_large_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - $(MHD_W32_LIB) + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_shutdown_select_SOURCES = \ + test_shutdown_select.c + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_shutdown_poll_SOURCES = \ + test_shutdown_select.c mhd_threads.h + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_str_compare_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_to_value_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_token_SOURCES = \ + test_str_token.c mhd_str.c + +test_http_reasons_SOURCES = \ + test_http_reasons.c \ + reason_phrase.c mhd_str.c mhd_str.h all: all-am @@ -798,17 +955,49 @@ @rm -f test_daemon$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_daemon_OBJECTS) $(test_daemon_LDADD) $(LIBS) +test_http_reasons$(EXEEXT): $(test_http_reasons_OBJECTS) $(test_http_reasons_DEPENDENCIES) $(EXTRA_test_http_reasons_DEPENDENCIES) + @rm -f test_http_reasons$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_http_reasons_OBJECTS) $(test_http_reasons_LDADD) $(LIBS) + test_postprocessor$(EXEEXT): $(test_postprocessor_OBJECTS) $(test_postprocessor_DEPENDENCIES) $(EXTRA_test_postprocessor_DEPENDENCIES) @rm -f test_postprocessor$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_postprocessor_OBJECTS) $(test_postprocessor_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_postprocessor_LINK) $(test_postprocessor_OBJECTS) $(test_postprocessor_LDADD) $(LIBS) test_postprocessor_amp$(EXEEXT): $(test_postprocessor_amp_OBJECTS) $(test_postprocessor_amp_DEPENDENCIES) $(EXTRA_test_postprocessor_amp_DEPENDENCIES) @rm -f test_postprocessor_amp$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_postprocessor_amp_OBJECTS) $(test_postprocessor_amp_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_postprocessor_amp_LINK) $(test_postprocessor_amp_OBJECTS) $(test_postprocessor_amp_LDADD) $(LIBS) test_postprocessor_large$(EXEEXT): $(test_postprocessor_large_OBJECTS) $(test_postprocessor_large_DEPENDENCIES) $(EXTRA_test_postprocessor_large_DEPENDENCIES) @rm -f test_postprocessor_large$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_postprocessor_large_OBJECTS) $(test_postprocessor_large_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_postprocessor_large_LINK) $(test_postprocessor_large_OBJECTS) $(test_postprocessor_large_LDADD) $(LIBS) + +test_shutdown_poll$(EXEEXT): $(test_shutdown_poll_OBJECTS) $(test_shutdown_poll_DEPENDENCIES) $(EXTRA_test_shutdown_poll_DEPENDENCIES) + @rm -f test_shutdown_poll$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_poll_LINK) $(test_shutdown_poll_OBJECTS) $(test_shutdown_poll_LDADD) $(LIBS) + +test_shutdown_select$(EXEEXT): $(test_shutdown_select_OBJECTS) $(test_shutdown_select_DEPENDENCIES) $(EXTRA_test_shutdown_select_DEPENDENCIES) + @rm -f test_shutdown_select$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_select_LINK) $(test_shutdown_select_OBJECTS) $(test_shutdown_select_LDADD) $(LIBS) + +test_str_compare$(EXEEXT): $(test_str_compare_OBJECTS) $(test_str_compare_DEPENDENCIES) $(EXTRA_test_str_compare_DEPENDENCIES) + @rm -f test_str_compare$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_compare_OBJECTS) $(test_str_compare_LDADD) $(LIBS) + +test_str_to_value$(EXEEXT): $(test_str_to_value_OBJECTS) $(test_str_to_value_DEPENDENCIES) $(EXTRA_test_str_to_value_DEPENDENCIES) + @rm -f test_str_to_value$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_to_value_OBJECTS) $(test_str_to_value_LDADD) $(LIBS) + +test_str_token$(EXEEXT): $(test_str_token_OBJECTS) $(test_str_token_DEPENDENCIES) $(EXTRA_test_str_token_DEPENDENCIES) + @rm -f test_str_token$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_token_OBJECTS) $(test_str_token_LDADD) $(LIBS) + +test_upgrade$(EXEEXT): $(test_upgrade_OBJECTS) $(test_upgrade_DEPENDENCIES) $(EXTRA_test_upgrade_DEPENDENCIES) + @rm -f test_upgrade$(EXEEXT) + $(AM_V_CCLD)$(test_upgrade_LINK) $(test_upgrade_OBJECTS) $(test_upgrade_LDADD) $(LIBS) + +test_upgrade_tls$(EXEEXT): $(test_upgrade_tls_OBJECTS) $(test_upgrade_tls_DEPENDENCIES) $(EXTRA_test_upgrade_tls_DEPENDENCIES) + @rm -f test_upgrade_tls$(EXEEXT) + $(AM_V_CCLD)$(test_upgrade_tls_LINK) $(test_upgrade_tls_OBJECTS) $(test_upgrade_tls_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -825,15 +1014,30 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-internal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-memorypool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_itc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_mono_clock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_sockets.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_str.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_threads.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-postprocessor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-reason_phrase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-response.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-tsearch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reason_phrase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_http_reasons.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor-test_postprocessor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_select-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_str_token.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_upgrade-test_upgrade.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_upgrade_tls-test_upgrade.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -901,6 +1105,48 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_mono_clock.lo `test -f 'mhd_mono_clock.c' || echo '$(srcdir)/'`mhd_mono_clock.c +libmicrohttpd_la-sysfdsetsize.lo: sysfdsetsize.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-sysfdsetsize.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Tpo -c -o libmicrohttpd_la-sysfdsetsize.lo `test -f 'sysfdsetsize.c' || echo '$(srcdir)/'`sysfdsetsize.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Tpo $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sysfdsetsize.c' object='libmicrohttpd_la-sysfdsetsize.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-sysfdsetsize.lo `test -f 'sysfdsetsize.c' || echo '$(srcdir)/'`sysfdsetsize.c + +libmicrohttpd_la-mhd_str.lo: mhd_str.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_str.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_str.Tpo -c -o libmicrohttpd_la-mhd_str.lo `test -f 'mhd_str.c' || echo '$(srcdir)/'`mhd_str.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_str.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_str.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_str.c' object='libmicrohttpd_la-mhd_str.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_str.lo `test -f 'mhd_str.c' || echo '$(srcdir)/'`mhd_str.c + +libmicrohttpd_la-mhd_threads.lo: mhd_threads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_threads.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_threads.Tpo -c -o libmicrohttpd_la-mhd_threads.lo `test -f 'mhd_threads.c' || echo '$(srcdir)/'`mhd_threads.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_threads.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_threads.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_threads.c' object='libmicrohttpd_la-mhd_threads.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_threads.lo `test -f 'mhd_threads.c' || echo '$(srcdir)/'`mhd_threads.c + +libmicrohttpd_la-mhd_sockets.lo: mhd_sockets.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_sockets.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Tpo -c -o libmicrohttpd_la-mhd_sockets.lo `test -f 'mhd_sockets.c' || echo '$(srcdir)/'`mhd_sockets.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_sockets.c' object='libmicrohttpd_la-mhd_sockets.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_sockets.lo `test -f 'mhd_sockets.c' || echo '$(srcdir)/'`mhd_sockets.c + +libmicrohttpd_la-mhd_itc.lo: mhd_itc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_itc.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_itc.Tpo -c -o libmicrohttpd_la-mhd_itc.lo `test -f 'mhd_itc.c' || echo '$(srcdir)/'`mhd_itc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_itc.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_itc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_itc.c' object='libmicrohttpd_la-mhd_itc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_itc.lo `test -f 'mhd_itc.c' || echo '$(srcdir)/'`mhd_itc.c + +libmicrohttpd_la-mhd_compat.lo: mhd_compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_compat.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_compat.Tpo -c -o libmicrohttpd_la-mhd_compat.lo `test -f 'mhd_compat.c' || echo '$(srcdir)/'`mhd_compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_compat.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_compat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_compat.c' object='libmicrohttpd_la-mhd_compat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_compat.lo `test -f 'mhd_compat.c' || echo '$(srcdir)/'`mhd_compat.c + libmicrohttpd_la-response.lo: response.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-response.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-response.Tpo -c -o libmicrohttpd_la-response.lo `test -f 'response.c' || echo '$(srcdir)/'`response.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-response.Tpo $(DEPDIR)/libmicrohttpd_la-response.Plo @@ -958,46 +1204,102 @@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-connection_https.lo `test -f 'connection_https.c' || echo '$(srcdir)/'`connection_https.c test_postprocessor-test_postprocessor.o: test_postprocessor.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.o -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.o -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo $(DEPDIR)/test_postprocessor-test_postprocessor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor.c' object='test_postprocessor-test_postprocessor.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c test_postprocessor-test_postprocessor.obj: test_postprocessor.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.obj -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.obj -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo $(DEPDIR)/test_postprocessor-test_postprocessor.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor.c' object='test_postprocessor-test_postprocessor.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` test_postprocessor_amp-test_postprocessor_amp.o: test_postprocessor_amp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.o -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.o -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_amp.c' object='test_postprocessor_amp-test_postprocessor_amp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c test_postprocessor_amp-test_postprocessor_amp.obj: test_postprocessor_amp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_amp.c' object='test_postprocessor_amp-test_postprocessor_amp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` test_postprocessor_large-test_postprocessor_large.o: test_postprocessor_large.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.o -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.o -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_large.c' object='test_postprocessor_large-test_postprocessor_large.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c test_postprocessor_large-test_postprocessor_large.obj: test_postprocessor_large.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_large.c' object='test_postprocessor_large-test_postprocessor_large.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` + +test_shutdown_poll-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -MT test_shutdown_poll-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo -c -o test_shutdown_poll-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_poll-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -MT test_shutdown_poll-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo -c -o test_shutdown_poll-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_shutdown_select-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -MT test_shutdown_select-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo -c -o test_shutdown_select-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -c -o test_shutdown_select-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_select-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -MT test_shutdown_select-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo -c -o test_shutdown_select-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -c -o test_shutdown_select-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_upgrade-test_upgrade.o: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -MT test_upgrade-test_upgrade.o -MD -MP -MF $(DEPDIR)/test_upgrade-test_upgrade.Tpo -c -o test_upgrade-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade-test_upgrade.Tpo $(DEPDIR)/test_upgrade-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade-test_upgrade.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -c -o test_upgrade-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c + +test_upgrade-test_upgrade.obj: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -MT test_upgrade-test_upgrade.obj -MD -MP -MF $(DEPDIR)/test_upgrade-test_upgrade.Tpo -c -o test_upgrade-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade-test_upgrade.Tpo $(DEPDIR)/test_upgrade-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade-test_upgrade.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -c -o test_upgrade-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` + +test_upgrade_tls-test_upgrade.o: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -MT test_upgrade_tls-test_upgrade.o -MD -MP -MF $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo -c -o test_upgrade_tls-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo $(DEPDIR)/test_upgrade_tls-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade_tls-test_upgrade.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -c -o test_upgrade_tls-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c + +test_upgrade_tls-test_upgrade.obj: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -MT test_upgrade_tls-test_upgrade.obj -MD -MP -MF $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo -c -o test_upgrade_tls-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo $(DEPDIR)/test_upgrade_tls-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade_tls-test_upgrade.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -c -o test_upgrade_tls-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` mostlyclean-libtool: -rm -f *.lo @@ -1198,12 +1500,68 @@ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? +test_str_compare.log: test_str_compare$(EXEEXT) + @p='test_str_compare$(EXEEXT)'; \ + b='test_str_compare'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_str_to_value.log: test_str_to_value$(EXEEXT) + @p='test_str_to_value$(EXEEXT)'; \ + b='test_str_to_value'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_str_token.log: test_str_token$(EXEEXT) + @p='test_str_token$(EXEEXT)'; \ + b='test_str_token'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_http_reasons.log: test_http_reasons$(EXEEXT) + @p='test_http_reasons$(EXEEXT)'; \ + b='test_http_reasons'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_select.log: test_shutdown_select$(EXEEXT) + @p='test_shutdown_select$(EXEEXT)'; \ + b='test_shutdown_select'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_poll.log: test_shutdown_poll$(EXEEXT) + @p='test_shutdown_poll$(EXEEXT)'; \ + b='test_shutdown_poll'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test_daemon.log: test_daemon$(EXEEXT) @p='test_daemon$(EXEEXT)'; \ b='test_daemon'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_upgrade.log: test_upgrade$(EXEEXT) + @p='test_upgrade$(EXEEXT)'; \ + b='test_upgrade'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_upgrade_tls.log: test_upgrade_tls$(EXEEXT) + @p='test_upgrade_tls$(EXEEXT)'; \ + b='test_upgrade_tls'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_postprocessor.log: test_postprocessor$(EXEEXT) @p='test_postprocessor$(EXEEXT)'; \ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/memorypool.c libmicrohttpd-0.9.55/src/microhttpd/memorypool.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/memorypool.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/memorypool.c 2017-05-28 22:34:00.000000000 +0200 @@ -96,19 +96,26 @@ pool->memory = MAP_FAILED; else #if defined(MAP_ANONYMOUS) && !defined(_WIN32) - pool->memory = mmap (NULL, max, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + pool->memory = mmap (NULL, + max, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, + -1, + 0); #elif defined(_WIN32) - pool->memory = VirtualAlloc(NULL, max, MEM_COMMIT | MEM_RESERVE, - PAGE_READWRITE); + pool->memory = VirtualAlloc (NULL, + max, + MEM_COMMIT | MEM_RESERVE, + PAGE_READWRITE); #endif #else pool->memory = MAP_FAILED; #endif - if ((pool->memory == MAP_FAILED) || (pool->memory == NULL)) + if ( (MAP_FAILED == pool->memory) || + (NULL == pool->memory)) { pool->memory = malloc (max); - if (pool->memory == NULL) + if (NULL == pool->memory) { free (pool); return NULL; @@ -134,23 +141,39 @@ void MHD_pool_destroy (struct MemoryPool *pool) { - if (pool == NULL) + if (NULL == pool) return; - if (pool->is_mmap == MHD_NO) + if (MHD_NO == pool->is_mmap) free (pool->memory); else #if defined(MAP_ANONYMOUS) && !defined(_WIN32) - munmap (pool->memory, pool->size); + munmap (pool->memory, + pool->size); #elif defined(_WIN32) - VirtualFree(pool->memory, 0, MEM_RELEASE); + VirtualFree (pool->memory, + 0, + MEM_RELEASE); #else - abort(); + abort (); #endif free (pool); } /** + * Check how much memory is left in the @a pool + * + * @param pool pool to check + * @return number of bytes still available in @a pool + */ +size_t +MHD_pool_get_free (struct MemoryPool *pool) +{ + return (pool->end - pool->pos); +} + + +/** * Allocate size bytes from the pool. * * @param pool memory pool to use for the operation @@ -163,7 +186,8 @@ */ void * MHD_pool_allocate (struct MemoryPool *pool, - size_t size, int from_end) + size_t size, + int from_end) { void *ret; size_t asize; @@ -171,7 +195,8 @@ asize = ROUND_TO_ALIGN (size); if ( (0 == asize) && (0 != size) ) return NULL; /* size too close to SIZE_MAX */ - if ((pool->pos + asize > pool->end) || (pool->pos + asize < pool->pos)) + if ( (pool->pos + asize > pool->end) || + (pool->pos + asize < pool->pos)) return NULL; if (from_end == MHD_YES) { @@ -191,7 +216,7 @@ * Reallocate a block of memory obtained from the pool. * This is particularly efficient when growing or * shrinking the block that was last (re)allocated. - * If the given block is not the most recenlty + * If the given block is not the most recently * (re)allocated block, the memory of the previous * allocation may be leaked until the pool is * destroyed (and copying the data maybe required). @@ -214,12 +239,15 @@ size_t asize; asize = ROUND_TO_ALIGN (new_size); - if ( (0 == asize) && (0 != new_size) ) + if ( (0 == asize) && + (0 != new_size) ) return NULL; /* new_size too close to SIZE_MAX */ - if ((pool->end < old_size) || (pool->end < asize)) + if ( (pool->end < old_size) || + (pool->end < asize) ) return NULL; /* unsatisfiable or bogus request */ - if ((pool->pos >= old_size) && (&pool->memory[pool->pos - old_size] == old)) + if ( (pool->pos >= old_size) && + (&pool->memory[pool->pos - old_size] == old) ) { /* was the previous allocation - optimize! */ if (pool->pos + asize - old_size <= pool->end) @@ -227,7 +255,9 @@ /* fits */ pool->pos += asize - old_size; if (asize < old_size) /* shrinking - zero again! */ - memset (&pool->memory[pool->pos], 0, old_size - asize); + memset (&pool->memory[pool->pos], + 0, + old_size - asize); return old; } /* does not fit */ @@ -240,7 +270,10 @@ { /* fits */ ret = &pool->memory[pool->pos]; - memcpy (ret, old, old_size); + if (0 != old_size) + memmove (ret, + old, + old_size); pool->pos += asize; return ret; } @@ -251,32 +284,40 @@ /** * Clear all entries from the memory pool except - * for @a keep of the given @a size. + * for @a keep of the given @a size. The pointer + * returned should be a buffer of @a new_size where + * the first @a copy_bytes are from @a keep. * * @param pool memory pool to use for the operation * @param keep pointer to the entry to keep (maybe NULL) - * @param size how many bytes need to be kept at this address + * @param copy_bytes how many bytes need to be kept at this address + * @param new_size how many bytes should the allocation we return have? + * (should be larger or equal to @a copy_bytes) * @return addr new address of @a keep (if it had to change) */ void * MHD_pool_reset (struct MemoryPool *pool, void *keep, - size_t size) + size_t copy_bytes, + size_t new_size) { - if (NULL != keep) + if ( (NULL != keep) && + (keep != pool->memory) ) { - if (keep != pool->memory) - { - memmove (pool->memory, keep, size); - keep = pool->memory; - } + if (0 != copy_bytes) + memmove (pool->memory, + keep, + copy_bytes); + keep = pool->memory; } pool->end = pool->size; - memset (&pool->memory[size], - 0, - pool->size - size); + /* technically not needed, but safer to zero out */ + if (pool->size > copy_bytes) + memset (&pool->memory[copy_bytes], + 0, + pool->size - copy_bytes); if (NULL != keep) - pool->pos = ROUND_TO_ALIGN(size); + pool->pos = ROUND_TO_ALIGN (new_size); return keep; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/memorypool.h libmicrohttpd-0.9.55/src/microhttpd/memorypool.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/memorypool.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/memorypool.h 2017-05-28 22:34:00.000000000 +0200 @@ -62,7 +62,7 @@ * * @param pool memory pool to use for the operation * @param size number of bytes to allocate - * @param from_end allocate from end of pool (set to MHD_YES); + * @param from_end allocate from end of pool (set to #MHD_YES); * use this for small, persistent allocations that * will never be reallocated * @return NULL if the pool cannot support size more @@ -70,14 +70,15 @@ */ void * MHD_pool_allocate (struct MemoryPool *pool, - size_t size, int from_end); + size_t size, + int from_end); /** * Reallocate a block of memory obtained from the pool. * This is particularly efficient when growing or * shrinking the block that was last (re)allocated. - * If the given block is not the most recenlty + * If the given block is not the most recently * (re)allocated block, the memory of the previous * allocation may be leaked until the pool is * destroyed (and copying the data maybe required). @@ -98,17 +99,32 @@ /** + * Check how much memory is left in the @a pool + * + * @param pool pool to check + * @return number of bytes still available in @a pool + */ +size_t +MHD_pool_get_free (struct MemoryPool *pool); + + +/** * Clear all entries from the memory pool except - * for "keep" of the given "size". + * for @a keep of the given @a copy_bytes. The pointer + * returned should be a buffer of @a new_size where + * the first @a copy_bytes are from @a keep. * * @param pool memory pool to use for the operation * @param keep pointer to the entry to keep (maybe NULL) - * @param size how many bytes need to be kept at this address - * @return addr new address of "keep" (if it had to change) + * @param copy_bytes how many bytes need to be kept at this address + * @param new_size how many bytes should the allocation we return have? + * (should be larger or equal to @a copy_bytes) + * @return addr new address of @a keep (if it had to change) */ void * MHD_pool_reset (struct MemoryPool *pool, void *keep, - size_t size); + size_t copy_bytes, + size_t new_size); #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_compat.c libmicrohttpd-0.9.55/src/microhttpd/mhd_compat.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_compat.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_compat.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,114 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_compat.c + * @brief Implementation of platform missing functions. + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_compat.h" +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#include +#ifndef HAVE_SNPRINTF +#include +#include +#endif /* HAVE_SNPRINTF */ +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef HAVE_CALLOC +#include /* for memset() */ +#endif /* ! HAVE_CALLOC */ + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#ifndef HAVE_SNPRINTF +/* Emulate snprintf function on W32 */ +int +W32_snprintf (char *__restrict s, + size_t n, + const char *__restrict format, + ...) +{ + int ret; + va_list args; + + if ( (0 != n) && + (NULL != s) ) + { + va_start (args, + format); + ret = _vsnprintf (s, + n, + format, + args); + va_end (args); + if ((int)n == ret) + s[n - 1] = 0; + if (ret >= 0) + return ret; + } + va_start(args, + format); + ret = _vscprintf (format, + args); + va_end(args); + if ( (0 <= ret) && + (0 != n) && + (NULL == s) ) + return -1; + + return ret; +} + +#endif /* HAVE_SNPRINTF */ +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef HAVE_CALLOC + +#ifdef __has_builtin +# if __has_builtin(__builtin_mul_overflow) +# define MHD_HAVE_NUL_OVERFLOW 1 +# endif +#elif __GNUC__+0 >= 5 +# define MHD_HAVE_NUL_OVERFLOW 1 +#endif /* __GNUC__ >= 5 */ + + +void *MHD_calloc_(size_t nelem, size_t elsize) +{ + size_t alloc_size; + void *ptr; +#ifdef MHD_HAVE_NUL_OVERFLOW + if (__builtin_mul_overflow(nelem, elsize, &alloc_size) || 0 == alloc_size) + return NULL; +#else /* ! MHD_HAVE_NUL_OVERFLOW */ + alloc_size = nelem * elsize; + if (0 == alloc_size || elsize != alloc_size / nelem) + return NULL; +#endif /* ! MHD_HAVE_NUL_OVERFLOW */ + ptr = malloc (alloc_size); + if (NULL == ptr) + return NULL; + memset(ptr, 0, alloc_size); + return ptr; +} +#endif /* ! HAVE_CALLOC */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_compat.h libmicrohttpd-0.9.55/src/microhttpd/mhd_compat.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_compat.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_compat.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,87 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_compat.h + * @brief Header for platform missing functions. + * @author Karlson2k (Evgeny Grin) + * + * Provides compatibility for platforms with some missing + * functionality. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ + +#ifndef MHD_COMPAT_H +#define MHD_COMPAT_H 1 + +#include "mhd_options.h" +#include +#ifdef HAVE_STRING_H /* for strerror() */ +#include +#endif /* HAVE_STRING_H */ + + /* MHD_strerror_ is strerror */ +#define MHD_strerror_(errnum) strerror((errnum)) + +/* Platform-independent snprintf name */ +#if defined(HAVE_SNPRINTF) +#define MHD_snprintf_ snprintf +#else /* ! HAVE_SNPRINTF */ +#if defined(_WIN32) +/* Emulate snprintf function on W32 */ +int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...); +#define MHD_snprintf_ W32_snprintf +#else /* ! _WIN32*/ +#error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. +#endif /* ! _WIN32*/ +#endif /* ! HAVE_SNPRINTF */ + +#ifdef HAVE_RANDOM +/** + * Generate pseudo random number at least 30-bit wide. + * @return pseudo random number at least 30-bit wide. + */ +#define MHD_random_() random() +#else /* HAVE_RANDOM */ +#ifdef HAVE_RAND +/** + * Generate pseudo random number at least 30-bit wide. + * @return pseudo random number at least 30-bit wide. + */ +#define MHD_random_() ( (((long)rand()) << 15) + (long)rand() ) +#endif /* HAVE_RAND */ +#endif /* HAVE_RANDOM */ + +#ifdef HAVE_CALLOC +/** + * MHD_calloc_ is platform-independent calloc() + */ +#define MHD_calloc_(n,s) calloc((n),(s)) +#else /* ! HAVE_CALLOC */ +/** + * MHD_calloc_ is platform-independent calloc() + */ +void *MHD_calloc_(size_t nelem, size_t elsize); +#endif /* ! HAVE_CALLOC */ + +#endif /* MHD_COMPAT_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc.c libmicrohttpd-0.9.55/src/microhttpd/mhd_itc.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_itc.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,70 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc.c + * @brief Implementation of inter-thread communication functions + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + */ + +#include "mhd_itc.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include +#include "internal.h" + + +#if defined(_MHD_ITC_PIPE) +#if !defined(_WIN32) || defined(__CYGWIN__) + +#ifndef HAVE_PIPE2_FUNC +/** + * Change itc FD options to be non-blocking. + * + * @param itc the inter-thread communication primitive to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_itc_nonblocking_ (struct MHD_itc_ itc) +{ + unsigned int i; + + for (i=0;i<2;i++) + { + int flags; + + flags = fcntl (itc.fd[i], + F_GETFL); + if (-1 == flags) + return 0; + + if ( ((flags | O_NONBLOCK) != flags) && + (0 != fcntl (itc.fd[i], + F_SETFL, + flags | O_NONBLOCK)) ) + return 0; + } + return !0; +} +#endif /* ! HAVE_PIPE2_FUNC */ +#endif /* !_WIN32 || __CYGWIN__ */ +#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc.h libmicrohttpd-0.9.55/src/microhttpd/mhd_itc.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_itc.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,361 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc.h + * @brief Header for platform-independent inter-thread communication + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic abstraction for inter-thread communication. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ +#ifndef MHD_ITC_H +#define MHD_ITC_H 1 +#include "mhd_itc_types.h" + +#include + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#if defined(_MHD_ITC_EVENTFD) + +/* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */ +#include +#include /* for uint64_t */ +#ifdef HAVE_UNISTD_H +#include /* for read(), write(), errno */ +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_STRING_H +#include /* for strerror() */ +#endif + + +/** + * Initialise ITC by generating eventFD + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_init_(itc) (-1 != ((itc).fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK))) + +/** + * Get description string of last errno for itc operations. + */ +#define MHD_itc_last_strerror_() strerror(errno) + +/** + * Internal static const helper for MHD_itc_activate_() + */ +static const uint64_t _MHD_itc_wr_data = 1; + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str ignored + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((write((itc).fd, (const void*)&_MHD_itc_wr_data, 8) > 0) || (EAGAIN == errno)) + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).fd) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).fd) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) \ + do { uint64_t __b; int __r; \ + __r = read((itc).fd, &__b, sizeof(__b)); \ + (void)__r; } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) ((0 != close ((itc).fd)) || (EBADF != errno)) + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (-1 != ((itc).fd)) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).fd = -1) + + +#elif defined(_MHD_ITC_PIPE) + +/* **************** Standard UNIX ITC implementation by pipe ********** */ + +#if defined(HAVE_PIPE2_FUNC) && defined(HAVE_FCNTL_H) +# include /* for O_CLOEXEC, O_NONBLOCK */ +#endif /* HAVE_PIPE2_FUNC && HAVE_FCNTL_H */ +#ifdef HAVE_UNISTD_H +#include /* for read(), write(), errno */ +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_STRING_H +#include /* for strerror() */ +#endif + + +/** + * Initialise ITC by generating pipe + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#ifdef HAVE_PIPE2_FUNC +# define MHD_itc_init_(itc) (!pipe2((itc).fd, O_CLOEXEC | O_NONBLOCK)) +#else /* ! HAVE_PIPE2_FUNC */ +# define MHD_itc_init_(itc) \ + ( (!pipe((itc).fd)) ? \ + (MHD_itc_nonblocking_((itc)) ? \ + (!0) : \ + (MHD_itc_destroy_((itc)), 0) ) \ + : (0) ) +#endif /* ! HAVE_PIPE2_FUNC */ + +/** + * Get description string of last errno for itc operations. + */ +#define MHD_itc_last_strerror_() strerror(errno) + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str one-symbol string, useful only for strace debug + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((write((itc).fd[1], (const void*)(str), 1) > 0) || (EAGAIN == errno)) + + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).fd[0]) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).fd[1]) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) do \ + { long __b; \ + while(0 < read((itc).fd[0], &__b, sizeof(__b))) \ + {} } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) \ + ( (0 == close ((itc).fd[0])) ? \ + (0 == close ((itc).fd[1])) : \ + ((close ((itc).fd[1])), 0) ) + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (-1 != (itc).fd[0]) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).fd[0] = (itc).fd[1] = -1) + +#ifndef HAVE_PIPE2_FUNC + /** + * Change itc FD options to be non-blocking. + * + * @param fd the FD to manipulate + * @return non-zero if succeeded, zero otherwise + */ + int + MHD_itc_nonblocking_ (struct MHD_itc_ itc); +#endif /* ! HAVE_PIPE2_FUNC */ + + +#elif defined(_MHD_ITC_SOCKETPAIR) + +/* **************** ITC implementation by socket pair ********** */ + +#include "mhd_sockets.h" + + +/** + * Initialise ITC by generating socketpair + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#ifdef MHD_socket_pair_nblk_ +# define MHD_itc_init_(itc) MHD_socket_pair_nblk_((itc).sk) +#else /* ! MHD_socket_pair_nblk_ */ +# define MHD_itc_init_(itc) \ + (MHD_socket_pair_((itc).sk) ? \ + (MHD_itc_nonblocking_((itc)) ? \ + (!0) : \ + (MHD_itc_destroy_((itc)), 0) ) \ + : (0)) +#endif /* ! MHD_socket_pair_nblk_ */ + +/** + * Get description string of last error for itc operations. + */ +#define MHD_itc_last_strerror_() MHD_socket_last_strerr_() + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str one-symbol string, useful only for strace debug + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((MHD_send_((itc).sk[1], (str), 1) > 0) || \ + (MHD_SCKT_ERR_IS_EAGAIN_(MHD_socket_get_error_()))) + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).sk[0]) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).sk[1]) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) do \ + { long __b; \ + while(0 < recv((itc).sk[0], \ + (char*)&__b, \ + sizeof(__b), 0)) \ + {} } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) \ + ( MHD_socket_close_((itc).sk[0]) ? \ + MHD_socket_close_((itc).sk[1]) : \ + ((void)MHD_socket_close_((itc).sk[1]), 0) ) + + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (MHD_INVALID_SOCKET != (itc).sk[0]) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).sk[0] = (itc).sk[1] = MHD_INVALID_SOCKET) + +#ifndef MHD_socket_pair_nblk_ +# define MHD_itc_nonblocking_(pip) (MHD_socket_nonblocking_((pip).sk[0]) && MHD_socket_nonblocking_((pip).sk[1])) +#endif /* ! MHD_socket_pair_nblk_ */ + +#endif /* _MHD_ITC_SOCKETPAIR */ + +/** + * Destroy previously initialised ITC and abort execution + * if error is detected. + * @param itc the itc to destroy + */ +#define MHD_itc_destroy_chk_(itc) do { \ + if (!MHD_itc_destroy_(itc)) \ + MHD_PANIC(_("Failed to destroy ITC.\n")); \ + } while(0) + +/** + * Check whether ITC has invalid value. + * + * Macro check whether @a itc value is invalid, + * macro does not check whether @a itc was destroyed. + * @param itc the itc to check + * @return boolean true if @a itc has invalid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_INVALID_(itc) (! MHD_ITC_IS_VALID_(itc)) + +#endif /* MHD_ITC_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc_types.h libmicrohttpd-0.9.55/src/microhttpd/mhd_itc_types.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_itc_types.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_itc_types.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,77 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin), Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc_types.h + * @brief Types for platform-independent inter-thread communication + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic types for inter-thread communication. + * Designed to be included by other headers. + */ +#ifndef MHD_ITC_TYPES_H +#define MHD_ITC_TYPES_H 1 +#include "mhd_options.h" + +/* Force socketpair on native W32 */ +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(_MHD_ITC_SOCKETPAIR) +#error _MHD_ITC_SOCKETPAIR is not defined on naitive W32 platform +#endif /* _WIN32 && !__CYGWIN__ && !_MHD_ITC_SOCKETPAIR */ + +#if defined(_MHD_ITC_EVENTFD) +/* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */ + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + int fd; +}; + +#elif defined(_MHD_ITC_PIPE) +/* **************** Standard UNIX ITC implementation by pipe ********** */ + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + int fd[2]; +}; + + +#elif defined(_MHD_ITC_SOCKETPAIR) +/* **************** ITC implementation by socket pair ********** */ + +#include "mhd_sockets.h" + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + MHD_socket sk[2]; +}; + +#endif /* _MHD_ITC_SOCKETPAIR */ + +#endif /* ! MHD_ITC_TYPES_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_limits.h libmicrohttpd-0.9.55/src/microhttpd/mhd_limits.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_limits.h 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_limits.h 2017-05-28 22:34:00.000000000 +0200 @@ -32,20 +32,56 @@ #include #endif /* HAVE_LIMITS_H */ +#ifndef UINT_MAX +#ifdef __UINT_MAX__ +#define UINT_MAX __UINT_MAX__ +#else /* ! __UINT_MAX__ */ +#define UINT_MAX ((unsigned int) ~((unsigned int)0)) +#endif /* ! __UINT_MAX__ */ +#endif /* !UINT_MAX */ + #ifndef LONG_MAX +#ifdef __LONG_MAX__ +#define LONG_MAX __LONG_MAX__ +#else /* ! __LONG_MAX__ */ #define LONG_MAX ((long) ~(((uint64_t) 1) << (8 * sizeof(long) - 1))) +#endif /* ! __LONG_MAX__ */ #endif /* !OFF_T_MAX */ #ifndef ULLONG_MAX -#define ((MHD_UNSIGNED_LONG_LONG) ~((MHD_UNSIGNED_LONG_LONG)0)) +#define ULLONG_MAX ((MHD_UNSIGNED_LONG_LONG) ~((MHD_UNSIGNED_LONG_LONG)0)) #endif /* !ULLONG_MAX */ #ifndef INT32_MAX +#ifdef __INT32_MAX__ +#define INT32_MAX __INT32_MAX__ +#else /* ! __INT32_MAX__ */ #define INT32_MAX ((int32_t)0x7FFFFFFF) +#endif /* ! __INT32_MAX__ */ +#endif /* !INT32_MAX */ + +#ifndef UINT32_MAX +#ifdef __UINT32_MAX__ +#define UINT32_MAX __UINT32_MAX__ +#else /* ! __UINT32_MAX__ */ +#define UINT32_MAX ((int32_t)0xFFFFFFFF) +#endif /* ! __UINT32_MAX__ */ +#endif /* !UNT32_MAX */ + +#ifndef UINT64_MAX +#ifdef __UINT64_MAX__ +#define UINT64_MAX __UINT64_MAX__ +#else /* ! __UINT64_MAX__ */ +#define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFF) +#endif /* ! __UINT64_MAX__ */ #endif /* !INT32_MAX */ #ifndef SIZE_MAX +#ifdef __SIZE_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#else /* ! __SIZE_MAX__ */ #define SIZE_MAX ((size_t) ~((size_t)0)) +#endif /* ! __SIZE_MAX__ */ #endif /* !SIZE_MAX */ #ifndef OFF_T_MAX diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_locks.h libmicrohttpd-0.9.55/src/microhttpd/mhd_locks.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_locks.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_locks.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,174 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_locks.h + * @brief Header for platform-independent locks abstraction + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic abstraction for locks/mutex. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + * + * @warning Unlike pthread functions, most of functions return + * nonzero on success. + */ + +#ifndef MHD_LOCKS_H +#define MHD_LOCKS_H 1 + +#include "mhd_options.h" + +#if defined(MHD_USE_W32_THREADS) +# define MHD_W32_MUTEX_ 1 +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +#elif defined(HAVE_PTHREAD_H) && defined(MHD_USE_POSIX_THREADS) +# define MHD_PTHREAD_MUTEX_ 1 +# undef HAVE_CONFIG_H +# include +# define HAVE_CONFIG_H 1 +#else +# error No base mutex API is available. +#endif + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#if defined(MHD_PTHREAD_MUTEX_) + typedef pthread_mutex_t MHD_mutex_; +#elif defined(MHD_W32_MUTEX_) + typedef CRITICAL_SECTION MHD_mutex_; +#endif + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Initialise new mutex. + * @param pmutex pointer to the mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_init_(pmutex) (!(pthread_mutex_init((pmutex), NULL))) +#elif defined(MHD_W32_MUTEX_) +/** + * Initialise new mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_init_(pmutex) (InitializeCriticalSectionAndSpinCount((pmutex),16)) +#endif + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Destroy previously initialised mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_destroy_(pmutex) (!(pthread_mutex_destroy((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Destroy previously initialised mutex. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_destroy_(pmutex) (DeleteCriticalSection((pmutex)), !0) +#endif + +/** + * Destroy previously initialised mutex and abort execution + * if error is detected. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_destroy_chk_(pmutex) do { \ + if (!MHD_mutex_destroy_(pmutex)) \ + MHD_PANIC(_("Failed to destroy mutex.\n")); \ + } while(0) + + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_lock_(pmutex) (!(pthread_mutex_lock((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_lock_(pmutex) (EnterCriticalSection((pmutex)), !0) +#endif + +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * If error is detected, execution will be aborted. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_lock_chk_(pmutex) do { \ + if (!MHD_mutex_lock_(pmutex)) \ + MHD_PANIC(_("Failed to lock mutex.\n")); \ + } while(0) + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Unlock previously initialised and locked mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_unlock_(pmutex) (!(pthread_mutex_unlock((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Unlock previously initialised and locked mutex. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_unlock_(pmutex) (LeaveCriticalSection((pmutex)), !0) +#endif + +/** + * Unlock previously initialised and locked mutex. + * If error is detected, execution will be aborted. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_unlock_chk_(pmutex) do { \ + if (!MHD_mutex_unlock_(pmutex)) \ + MHD_PANIC(_("Failed to unlock mutex.\n")); \ + } while(0) + + +#endif /* ! MHD_LOCKS_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_mono_clock.c libmicrohttpd-0.9.55/src/microhttpd/mhd_mono_clock.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_mono_clock.c 2015-09-17 18:31:19.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_mono_clock.c 2017-05-28 22:34:00.000000000 +0200 @@ -25,6 +25,26 @@ #include "mhd_mono_clock.h" +#if defined(_WIN32) && defined(HAVE_CLOCK_GETTIME) +/* Prefer native clock source over wrappers */ +#undef HAVE_CLOCK_GETTIME +#endif /* _WIN32 && HAVE_CLOCK_GETTIME */ + +#ifdef HAVE_CLOCK_GETTIME +#include +#endif /* HAVE_CLOCK_GETTIME */ + +#ifdef HAVE_GETHRTIME +#ifdef HAVE_SYS_TIME_H +/* Solaris defines gethrtime() in sys/time.h */ +#include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX defines gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ +#endif /* HAVE_GETHRTIME */ + #ifdef HAVE_CLOCK_GET_TIME #include /* for host_get_clock_service(), mach_host_self(), mach_task_self() */ @@ -36,6 +56,15 @@ static clock_serv_t mono_clock_service = _MHD_INVALID_CLOCK_SERV; #endif /* HAVE_CLOCK_GET_TIME */ +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#include +#endif /* _WIN32 */ + #ifdef HAVE_CLOCK_GETTIME #ifdef CLOCK_REALTIME #define _MHD_UNWANTED_CLOCK CLOCK_REALTIME @@ -47,7 +76,9 @@ #endif /* HAVE_CLOCK_GETTIME */ /* sync clocks; reduce chance of value wrap */ +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_GET_TIME) || defined(HAVE_GETHRTIME) static time_t mono_clock_start; +#endif /* HAVE_CLOCK_GETTIME || HAVE_CLOCK_GET_TIME || HAVE_GETHRTIME */ static time_t sys_clock_start; #ifdef HAVE_GETHRTIME static hrtime_t hrtime_start; @@ -99,6 +130,7 @@ _MHD_CLOCK_PERFCOUNTER }; + /** * Initialise monotonic seconds counter. */ @@ -118,74 +150,91 @@ mono_clock_service = _MHD_INVALID_CLOCK_SERV; #endif /* HAVE_CLOCK_GET_TIME */ + /* just a little syntactic trick to get the + various following ifdef's to work out nicely */ if (0) - { - } else + { + } + else #ifdef HAVE_CLOCK_GETTIME #ifdef CLOCK_MONOTONIC_COARSE /* Linux-specific fast value-getting clock */ /* Can be affected by frequency adjustment and don't count time in suspend, */ /* but preferred since it's fast */ - if (0 == clock_gettime (CLOCK_MONOTONIC_COARSE, &ts)) + if (0 == clock_gettime (CLOCK_MONOTONIC_COARSE, + &ts)) { mono_clock_id = CLOCK_MONOTONIC_COARSE; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_MONOTONIC_COARSE */ #ifdef CLOCK_MONOTONIC_FAST /* FreeBSD/DragonFly fast value-getting clock */ /* Can be affected by frequency adjustment, but preferred since it's fast */ - if (0 == clock_gettime (CLOCK_MONOTONIC_FAST, &ts)) + if (0 == clock_gettime (CLOCK_MONOTONIC_FAST, + &ts)) { mono_clock_id = CLOCK_MONOTONIC_FAST; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_MONOTONIC_COARSE */ #ifdef CLOCK_MONOTONIC_RAW /* Linux-specific clock */ /* Not affected by frequency adjustment, but don't count time in suspend */ - if (0 == clock_gettime (CLOCK_MONOTONIC_RAW , &ts)) + if (0 == clock_gettime (CLOCK_MONOTONIC_RAW, + &ts)) { mono_clock_id = CLOCK_MONOTONIC_RAW; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_MONOTONIC_RAW */ #ifdef CLOCK_BOOTTIME /* Linux-specific clock */ /* Count time in suspend so it's real monotonic on Linux, */ /* but can be slower value-getting than other clocks */ - if (0 == clock_gettime(CLOCK_BOOTTIME, &ts)) + if (0 == clock_gettime (CLOCK_BOOTTIME, + &ts)) { mono_clock_id = CLOCK_BOOTTIME; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_BOOTTIME */ #ifdef CLOCK_MONOTONIC /* Monotonic clock */ /* Widely supported, may be affected by frequency adjustment */ /* On Linux it's not truly monotonic as it doesn't count time in suspend */ - if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) + if (0 == clock_gettime (CLOCK_MONOTONIC, + &ts)) { mono_clock_id = CLOCK_MONOTONIC; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_BOOTTIME */ #endif /* HAVE_CLOCK_GETTIME */ #ifdef HAVE_CLOCK_GET_TIME /* Darwin-specific monotonic clock */ /* Should be monotonic as clock_set_time function always unconditionally */ /* failed on latest kernels */ - if (KERN_SUCCESS == host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &mono_clock_service) && - KERN_SUCCESS == clock_get_time(mono_clock_service, &cur_time)) + if ( (KERN_SUCCESS == host_get_clock_service (mach_host_self(), + SYSTEM_CLOCK, + &mono_clock_service)) && + (KERN_SUCCESS == clock_get_time (mono_clock_service, + &cur_time)) ) { mono_clock_start = cur_time.tv_sec; mono_clock_source = _MHD_CLOCK_GET_TIME; - } else + } + else #endif /* HAVE_CLOCK_GET_TIME */ #ifdef _WIN32 #if _WIN32_WINNT >= 0x0600 @@ -193,33 +242,39 @@ /* Available since Vista, ~15ms accuracy */ if (1) { - tick_start = GetTickCount64(); + tick_start = GetTickCount64 (); mono_clock_source = _MHD_CLOCK_GETTICKCOUNT64; - } else + } + else #else /* _WIN32_WINNT < 0x0600 */ /* W32 specific monotonic clock */ /* Available on Windows 2000 and later */ if (1) { - LARGE_INTEGER freq, perf_counter; - QueryPerformanceFrequency(&freq); /* never fail on XP and later */ - QueryPerformanceCounter(&perf_counter); /* never fail on XP and later */ + LARGE_INTEGER freq; + LARGE_INTEGER perf_counter; + + QueryPerformanceFrequency (&freq); /* never fail on XP and later */ + QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */ perf_freq = freq.QuadPart; perf_start = perf_counter.QuadPart; mono_clock_source = _MHD_CLOCK_PERFCOUNTER; - } else + } + else #endif /* _WIN32_WINNT < 0x0600 */ #endif /* _WIN32 */ #ifdef HAVE_CLOCK_GETTIME #ifdef CLOCK_HIGHRES /* Solaris-specific monotonic high-resolution clock */ /* Not preferred due to be potentially resource-hungry */ - if (0 == clock_gettime (CLOCK_HIGHRES, &ts)) + if (0 == clock_gettime (CLOCK_HIGHRES, + &ts)) { mono_clock_id = CLOCK_HIGHRES; mono_clock_start = ts.tv_sec; mono_clock_source = _MHD_CLOCK_GETTIME; - } else + } + else #endif /* CLOCK_HIGHRES */ #endif /* HAVE_CLOCK_GETTIME */ #ifdef HAVE_GETHRTIME @@ -227,9 +282,10 @@ /* Not preferred due to be potentially resource-hungry */ if (1) { - hrtime_start = gethrtime(); + hrtime_start = gethrtime (); mono_clock_source = _MHD_CLOCK_GETHRTIME; - } else + } + else #endif /* HAVE_GETHRTIME */ { /* no suitable clock source was found */ @@ -241,7 +297,8 @@ (_MHD_INVALID_CLOCK_SERV != mono_clock_service) ) { /* clock service was initialised but clock_get_time failed */ - mach_port_deallocate (mach_task_self(), mono_clock_service); + mach_port_deallocate (mach_task_self(), + mono_clock_service); mono_clock_service = _MHD_INVALID_CLOCK_SERV; } #else @@ -261,12 +318,14 @@ #ifdef HAVE_CLOCK_GET_TIME if (_MHD_INVALID_CLOCK_SERV != mono_clock_service) { - mach_port_deallocate(mach_task_self(), mono_clock_service); + mach_port_deallocate (mach_task_self(), + mono_clock_service); mono_clock_service = _MHD_INVALID_CLOCK_SERV; } #endif /* HAVE_CLOCK_GET_TIME */ } + /** * Monotonic seconds counter, useful for timeout calculation. * Tries to be not affected by manually setting the system real time @@ -280,15 +339,18 @@ #ifdef HAVE_CLOCK_GETTIME struct timespec ts; - if (_MHD_UNWANTED_CLOCK != mono_clock_id && - 0 == clock_gettime (mono_clock_id , &ts)) + if ( (_MHD_UNWANTED_CLOCK != mono_clock_id) && + (0 == clock_gettime (mono_clock_id , + &ts)) ) return ts.tv_sec - mono_clock_start; #endif /* HAVE_CLOCK_GETTIME */ #ifdef HAVE_CLOCK_GET_TIME if (_MHD_INVALID_CLOCK_SERV != mono_clock_service) { mach_timespec_t cur_time; - if (KERN_SUCCESS == clock_get_time(mono_clock_service, &cur_time)) + + if (KERN_SUCCESS == clock_get_time(mono_clock_service, + &cur_time)) return cur_time.tv_sec - mono_clock_start; } #endif /* HAVE_CLOCK_GET_TIME */ @@ -300,14 +362,15 @@ if (0 != perf_freq) { LARGE_INTEGER perf_counter; - QueryPerformanceCounter(&perf_counter); /* never fail on XP and later */ + + QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */ return (time_t)(((uint64_t)(perf_counter.QuadPart - perf_start)) / perf_freq); } #endif /* _WIN32_WINNT < 0x0600 */ #endif /* _WIN32 */ #ifdef HAVE_GETHRTIME if (1) - return (time_t)(((uint64_t)(gethrtime() - hrtime_start)) / 1000000000); + return (time_t)(((uint64_t) (gethrtime () - hrtime_start)) / 1000000000); #endif /* HAVE_GETHRTIME */ return time (NULL) - sys_clock_start; diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_mono_clock.h libmicrohttpd-0.9.55/src/microhttpd/mhd_mono_clock.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_mono_clock.h 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_mono_clock.h 2017-05-28 22:34:00.000000000 +0200 @@ -25,7 +25,13 @@ #ifndef MHD_MONO_CLOCK_H #define MHD_MONO_CLOCK_H 1 -#include "platform.h" +#include "mhd_options.h" + +#if defined(HAVE_TIME_H) +#include +#elif defined(HAVE_SYS_TYPES_H) +#include +#endif /** * Initialise monotonic seconds counter. diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_sockets.c libmicrohttpd-0.9.55/src/microhttpd/mhd_sockets.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_sockets.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_sockets.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,523 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_sockets.c + * @brief Implementation for sockets functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_sockets.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include + +#ifdef MHD_WINSOCK_SOCKETS + +/** + * Return pointer to string description of specified WinSock error + * @param err the WinSock error code. + * @return pointer to string description of specified WinSock error. + */ +const char* MHD_W32_strerror_winsock_(int err) +{ + switch (err) + { + case 0: + return "No error"; + case WSA_INVALID_HANDLE: + return "Specified event object handle is invalid"; + case WSA_NOT_ENOUGH_MEMORY: + return "Insufficient memory available"; + case WSA_INVALID_PARAMETER: + return "One or more parameters are invalid"; + case WSA_OPERATION_ABORTED: + return "Overlapped operation aborted"; + case WSA_IO_INCOMPLETE: + return "Overlapped I/O event object not in signaled state"; + case WSA_IO_PENDING: + return "Overlapped operations will complete later"; + case WSAEINTR: + return "Interrupted function call"; + case WSAEBADF: + return "File handle is not valid"; + case WSAEACCES: + return "Permission denied"; + case WSAEFAULT: + return "Bad address"; + case WSAEINVAL: + return "Invalid argument"; + case WSAEMFILE: + return "Too many open files"; + case WSAEWOULDBLOCK: + return "Resource temporarily unavailable"; + case WSAEINPROGRESS: + return "Operation now in progress"; + case WSAEALREADY: + return "Operation already in progress"; + case WSAENOTSOCK: + return "Socket operation on nonsocket"; + case WSAEDESTADDRREQ: + return "Destination address required"; + case WSAEMSGSIZE: + return "Message too long"; + case WSAEPROTOTYPE: + return "Protocol wrong type for socket"; + case WSAENOPROTOOPT: + return "Bad protocol option"; + case WSAEPROTONOSUPPORT: + return "Protocol not supported"; + case WSAESOCKTNOSUPPORT: + return "Socket type not supported"; + case WSAEOPNOTSUPP: + return "Operation not supported"; + case WSAEPFNOSUPPORT: + return "Protocol family not supported"; + case WSAEAFNOSUPPORT: + return "Address family not supported by protocol family"; + case WSAEADDRINUSE: + return "Address already in use"; + case WSAEADDRNOTAVAIL: + return "Cannot assign requested address"; + case WSAENETDOWN: + return "Network is down"; + case WSAENETUNREACH: + return "Network is unreachable"; + case WSAENETRESET: + return "Network dropped connection on reset"; + case WSAECONNABORTED: + return "Software caused connection abort"; + case WSAECONNRESET: + return "Connection reset by peer"; + case WSAENOBUFS: + return "No buffer space available"; + case WSAEISCONN: + return "Socket is already connected"; + case WSAENOTCONN: + return "Socket is not connected"; + case WSAESHUTDOWN: + return "Cannot send after socket shutdown"; + case WSAETOOMANYREFS: + return "Too many references"; + case WSAETIMEDOUT: + return "Connection timed out"; + case WSAECONNREFUSED: + return "Connection refused"; + case WSAELOOP: + return "Cannot translate name"; + case WSAENAMETOOLONG: + return "Name too long"; + case WSAEHOSTDOWN: + return "Host is down"; + case WSAEHOSTUNREACH: + return "No route to host"; + case WSAENOTEMPTY: + return "Directory not empty"; + case WSAEPROCLIM: + return "Too many processes"; + case WSAEUSERS: + return "User quota exceeded"; + case WSAEDQUOT: + return "Disk quota exceeded"; + case WSAESTALE: + return "Stale file handle reference"; + case WSAEREMOTE: + return "Item is remote"; + case WSASYSNOTREADY: + return "Network subsystem is unavailable"; + case WSAVERNOTSUPPORTED: + return "Winsock.dll version out of range"; + case WSANOTINITIALISED: + return "Successful WSAStartup not yet performed"; + case WSAEDISCON: + return "Graceful shutdown in progress"; + case WSAENOMORE: + return "No more results"; + case WSAECANCELLED: + return "Call has been canceled"; + case WSAEINVALIDPROCTABLE: + return "Procedure call table is invalid"; + case WSAEINVALIDPROVIDER: + return "Service provider is invalid"; + case WSAEPROVIDERFAILEDINIT: + return "Service provider failed to initialize"; + case WSASYSCALLFAILURE: + return "System call failure"; + case WSASERVICE_NOT_FOUND: + return "Service not found"; + case WSATYPE_NOT_FOUND: + return "Class type not found"; + case WSA_E_NO_MORE: + return "No more results"; + case WSA_E_CANCELLED: + return "Call was canceled"; + case WSAEREFUSED: + return "Database query was refused"; + case WSAHOST_NOT_FOUND: + return "Host not found"; + case WSATRY_AGAIN: + return "Nonauthoritative host not found"; + case WSANO_RECOVERY: + return "This is a nonrecoverable error"; + case WSANO_DATA: + return "Valid name, no data record of requested type"; + case WSA_QOS_RECEIVERS: + return "QoS receivers"; + case WSA_QOS_SENDERS: + return "QoS senders"; + case WSA_QOS_NO_SENDERS: + return "No QoS senders"; + case WSA_QOS_NO_RECEIVERS: + return "QoS no receivers"; + case WSA_QOS_REQUEST_CONFIRMED: + return "QoS request confirmed"; + case WSA_QOS_ADMISSION_FAILURE: + return "QoS admission error"; + case WSA_QOS_POLICY_FAILURE: + return "QoS policy failure"; + case WSA_QOS_BAD_STYLE: + return "QoS bad style"; + case WSA_QOS_BAD_OBJECT: + return "QoS bad object"; + case WSA_QOS_TRAFFIC_CTRL_ERROR: + return "QoS traffic control error"; + case WSA_QOS_GENERIC_ERROR: + return "QoS generic error"; + case WSA_QOS_ESERVICETYPE: + return "QoS service type error"; + case WSA_QOS_EFLOWSPEC: + return "QoS flowspec error"; + case WSA_QOS_EPROVSPECBUF: + return "Invalid QoS provider buffer"; + case WSA_QOS_EFILTERSTYLE: + return "Invalid QoS filter style"; + case WSA_QOS_EFILTERTYPE: + return "Invalid QoS filter type"; + case WSA_QOS_EFILTERCOUNT: + return "Incorrect QoS filter count"; + case WSA_QOS_EOBJLENGTH: + return "Invalid QoS object length"; + case WSA_QOS_EFLOWCOUNT: + return "Incorrect QoS flow count"; + case WSA_QOS_EUNKOWNPSOBJ: + return "Unrecognized QoS object"; + case WSA_QOS_EPOLICYOBJ: + return "Invalid QoS policy object"; + case WSA_QOS_EFLOWDESC: + return "Invalid QoS flow descriptor"; + case WSA_QOS_EPSFLOWSPEC: + return "Invalid QoS provider-specific flowspec"; + case WSA_QOS_EPSFILTERSPEC: + return "Invalid QoS provider-specific filterspec"; + case WSA_QOS_ESDMODEOBJ: + return "Invalid QoS shape discard mode object"; + case WSA_QOS_ESHAPERATEOBJ: + return "Invalid QoS shaping rate object"; + case WSA_QOS_RESERVED_PETYPE: + return "Reserved policy QoS element type"; + } + return "Unknown winsock error"; +} + + +/** + * Create pair of mutually connected TCP/IP sockets on loopback address + * @param sockets_pair array to receive resulted sockets + * @param non_blk if set to non-zero value, sockets created in non-blocking mode + * otherwise sockets will be in blocking mode + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_W32_socket_pair_(SOCKET sockets_pair[2], int non_blk) +{ + int i; + + if (! sockets_pair) + { + WSASetLastError (WSAEFAULT); + return 0; + } + +#define PAIRMAXTRYIES 800 + for (i = 0; i < PAIRMAXTRYIES; i++) + { + struct sockaddr_in listen_addr; + SOCKET listen_s; + static const int c_addinlen = sizeof(struct sockaddr_in); /* help compiler to optimize */ + int addr_len = c_addinlen; + unsigned long on_val = 1; + unsigned long off_val = 0; + + listen_s = socket (AF_INET, + SOCK_STREAM, + IPPROTO_TCP); + if (INVALID_SOCKET == listen_s) + break; /* can't create even single socket */ + + listen_addr.sin_family = AF_INET; + listen_addr.sin_port = 0; /* same as htons(0) */ + listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if ( (0 == bind (listen_s, + (struct sockaddr*) &listen_addr, + c_addinlen) && + (0 == listen (listen_s, + 1) ) && + (0 == getsockname (listen_s, + (struct sockaddr*) &listen_addr, + &addr_len))) ) + { + SOCKET client_s = socket(AF_INET, + SOCK_STREAM, + IPPROTO_TCP); + struct sockaddr_in accepted_from_addr; + struct sockaddr_in client_addr; + SOCKET server_s; + + if (INVALID_SOCKET == client_s) + { + /* try again */ + closesocket (listen_s); + continue; + } + + if ( (0 != ioctlsocket (client_s, + FIONBIO, + &on_val)) || + ( (0 != connect (client_s, + (struct sockaddr*) &listen_addr, + c_addinlen)) && + (WSAGetLastError() != WSAEWOULDBLOCK)) ) + { + /* try again */ + closesocket (listen_s); + closesocket (client_s); + continue; + } + + addr_len = c_addinlen; + server_s = accept (listen_s, + (struct sockaddr*) &accepted_from_addr, + &addr_len); + if (INVALID_SOCKET == server_s) + { + /* try again */ + closesocket (listen_s); + closesocket (client_s); + continue; + } + + addr_len = c_addinlen; + if ( (0 == getsockname (client_s, + (struct sockaddr*) &client_addr, + &addr_len)) && + (accepted_from_addr.sin_family == client_addr.sin_family) && + (accepted_from_addr.sin_port == client_addr.sin_port) && + (accepted_from_addr.sin_addr.s_addr == client_addr.sin_addr.s_addr) && + ( (0 != non_blk) ? + (0 == ioctlsocket(server_s, + FIONBIO, + &on_val)) : + (0 == ioctlsocket(client_s, + FIONBIO, + &off_val)) ) ) + { + closesocket (listen_s); + sockets_pair[0] = server_s; + sockets_pair[1] = client_s; + return !0; + } + closesocket (server_s); + closesocket (client_s); + } + closesocket(listen_s); + } + + sockets_pair[0] = INVALID_SOCKET; + sockets_pair[1] = INVALID_SOCKET; + WSASetLastError(WSAECONNREFUSED); + + return 0; +} + +#endif /* MHD_WINSOCK_SOCKETS */ + + +/** + * Add @a fd to the @a set. If @a fd is + * greater than @a max_fd, set @a max_fd to @a fd. + * + * @param fd file descriptor to add to the @a set + * @param set set to modify + * @param max_fd maximum value to potentially update + * @param fd_setsize value of FD_SETSIZE + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_add_to_fd_set_ (MHD_socket fd, + fd_set *set, + MHD_socket *max_fd, + unsigned int fd_setsize) +{ + if ( (NULL == set) || + (MHD_INVALID_SOCKET == fd) ) + return 0; + if (! MHD_SCKT_FD_FITS_FDSET_SETSIZE_ (fd, + set, + fd_setsize)) + return 0; + MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd, + set, + fd_setsize); + if ( (NULL != max_fd) && + ( (fd > *max_fd) || + (MHD_INVALID_SOCKET == *max_fd) ) ) + *max_fd = fd; + return ! 0; +} + + +/** + * Change socket options to be non-blocking. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_socket_nonblocking_ (MHD_socket sock) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (sock, + F_GETFL); + if (-1 == flags) + return 0; + + if ( ((flags | O_NONBLOCK) != flags) && + (0 != fcntl (sock, + F_SETFL, + flags | O_NONBLOCK)) ) + return 0; +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + if (0 != ioctlsocket (sock, + FIONBIO, + &flags)) + return 0; +#endif /* MHD_WINSOCK_SOCKETS */ + return !0; +} + + +/** + * Change socket options to be non-inheritable. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + * @warning Does not set socket error on W32. + */ +int +MHD_socket_noninheritable_ (MHD_socket sock) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (sock, + F_GETFD); + if (-1 == flags) + return 0; + + if ( ((flags | FD_CLOEXEC) != flags) && + (0 != fcntl (sock, + F_SETFD, + flags | FD_CLOEXEC)) ) + return 0; +#elif defined(MHD_WINSOCK_SOCKETS) + if (! SetHandleInformation ((HANDLE)sock, + HANDLE_FLAG_INHERIT, + 0)) + return 0; +#endif /* MHD_WINSOCK_SOCKETS */ + return !0; +} + + +/** + * Create a listen socket, with noninheritable flag if possible. + * + * @param use_ipv6 if set to non-zero IPv6 is used + * @return created socket or MHD_INVALID_SOCKET in case of errors + */ +MHD_socket +MHD_socket_create_listen_ (int use_ipv6) +{ + int domain; + MHD_socket fd; + int cloexec_set; + +#ifdef HAVE_INET6 + domain = (use_ipv6) ? PF_INET6 : PF_INET; +#else /* ! HAVE_INET6 */ + if (use_ipv6) + return MHD_INVALID_SOCKET; + domain = PF_INET; +#endif /* ! HAVE_INET6 */ + +#if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC) + fd = socket (domain, + SOCK_STREAM | SOCK_CLOEXEC, + 0); + cloexec_set = !0; +#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT) + fd = WSASocketW (domain, + SOCK_STREAM, + 0, + NULL, + 0, + WSA_FLAG_NO_HANDLE_INHERIT); + cloexec_set = !0; +#else /* !SOCK_CLOEXEC */ + fd = MHD_INVALID_SOCKET; +#endif /* !SOCK_CLOEXEC */ + if (MHD_INVALID_SOCKET == fd) + { + fd = socket (domain, + SOCK_STREAM, + 0); + cloexec_set = 0; + } + if (MHD_INVALID_SOCKET == fd) + return MHD_INVALID_SOCKET; +#ifdef MHD_socket_nosignal_ + if(! MHD_socket_nosignal_(fd)) + { + const int err = MHD_socket_get_error_ (); + (void) MHD_socket_close_ (fd); + MHD_socket_fset_error_ (err); + return MHD_INVALID_SOCKET; + } +#endif /* MHD_socket_nosignal_ */ + if (! cloexec_set) + (void) MHD_socket_noninheritable_ (fd); + + return fd; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_sockets.h libmicrohttpd-0.9.55/src/microhttpd/mhd_sockets.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_sockets.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_sockets.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,760 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_sockets.c + * @brief Header for platform-independent sockets abstraction + * @author Karlson2k (Evgeny Grin) + * + * Provides basic abstraction for sockets. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ + +#ifndef MHD_SOCKETS_H +#define MHD_SOCKETS_H 1 +#include "mhd_options.h" + +#include + +#if !defined(MHD_POSIX_SOCKETS) && !defined(MHD_WINSOCK_SOCKETS) +# if !defined(_WIN32) || defined(__CYGWIN__) +# define MHD_POSIX_SOCKETS 1 +# else /* defined(_WIN32) && !defined(__CYGWIN__) */ +# define MHD_WINSOCK_SOCKETS 1 +# endif /* defined(_WIN32) && !defined(__CYGWIN__) */ +#endif /* !MHD_POSIX_SOCKETS && !MHD_WINSOCK_SOCKETS */ + +/* + * MHD require headers that define socket type, socket basic functions + * (socket(), accept(), listen(), bind(), send(), recv(), select()), socket + * parameters like SOCK_CLOEXEC, SOCK_NONBLOCK, additional socket functions + * (poll(), epoll(), accept4()), struct timeval and other types, required + * for socket function. + */ +#if defined(MHD_POSIX_SOCKETS) +# ifdef HAVE_SYS_TYPES_H +# include /* required on old platforms */ +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +# ifdef HAVE_SOCKLIB_H +# include +# endif /* HAVE_SOCKLIB_H */ +# ifdef HAVE_INETLIB_H +# include +# endif /* HAVE_INETLIB_H */ +# include /* required for FD_SET (bzero() function) */ +# endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */ +# ifdef HAVE_NETINET_IN_H +# include +# endif /* HAVE_NETINET_IN_H */ +# ifdef HAVE_ARPA_INET_H +# include +# endif +# ifdef HAVE_NET_IF_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_TIME_H +# include +# endif +# ifdef HAVE_NETDB_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef EPOLL_SUPPORT +# include +# endif +# ifdef HAVE_NETINET_TCP_H + /* for TCP_FASTOPEN and TCP_CORK */ +# include +# endif +# ifdef HAVE_STRING_H +# include /* for strerror() */ +# endif +#elif defined(MHD_WINSOCK_SOCKETS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +# include +#endif /* MHD_WINSOCK_SOCKETS */ + +#if defined(HAVE_POLL_H) && defined(HAVE_POLL) +# include +#endif + +#include +#if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) +# include +# define _SSIZE_T_DEFINED + typedef intptr_t ssize_t; +#endif /* !_SSIZE_T_DEFINED */ + +#include "mhd_limits.h" + +#ifdef _MHD_FD_SETSIZE_IS_DEFAULT +# define _MHD_SYS_DEFAULT_FD_SETSIZE FD_SETSIZE +#else /* ! _MHD_FD_SETSIZE_IS_DEFAULT */ +# include "sysfdsetsize.h" +# define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value() +#endif /* ! _MHD_FD_SETSIZE_IS_DEFAULT */ + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#ifndef MHD_SOCKET_DEFINED +/** + * MHD_socket is type for socket FDs + */ +# if defined(MHD_POSIX_SOCKETS) + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# elif defined(MHD_WINSOCK_SOCKETS) + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# endif /* MHD_WINSOCK_SOCKETS */ + +# define MHD_SOCKET_DEFINED 1 +#endif /* ! MHD_SOCKET_DEFINED */ + +#ifdef SOCK_CLOEXEC +# define MAYBE_SOCK_CLOEXEC SOCK_CLOEXEC +#else /* ! SOCK_CLOEXEC */ +# define MAYBE_SOCK_CLOEXEC 0 +#endif /* ! SOCK_CLOEXEC */ + +#ifdef HAVE_SOCK_NONBLOCK +# define MAYBE_SOCK_NONBLOCK SOCK_NONBLOCK +#else /* ! HAVE_SOCK_NONBLOCK */ +# define MAYBE_SOCK_NONBLOCK 0 +#endif /* ! HAVE_SOCK_NONBLOCK */ + +#ifdef MSG_NOSIGNAL +# define MAYBE_MSG_NOSIGNAL MSG_NOSIGNAL +#else /* ! MSG_NOSIGNAL */ +# define MAYBE_MSG_NOSIGNAL 0 +#endif /* ! MSG_NOSIGNAL */ + +#if !defined(SHUT_WR) && defined(SD_SEND) +# define SHUT_WR SD_SEND +#endif +#if !defined(SHUT_RD) && defined(SD_RECEIVE) +# define SHUT_RD SD_RECEIVE +#endif +#if !defined(SHUT_RDWR) && defined(SD_BOTH) +# define SHUT_RDWR SD_BOTH +#endif + +#if HAVE_ACCEPT4+0 != 0 && (defined(HAVE_SOCK_NONBLOCK) || defined(SOCK_CLOEXEC)) +# define USE_ACCEPT4 1 +#endif + +#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) +# define USE_EPOLL_CREATE1 1 +#endif /* HAVE_EPOLL_CREATE1 && EPOLL_CLOEXEC */ + +#ifdef TCP_FASTOPEN +/** + * Default TCP fastopen queue size. + */ +#define MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT 10 +#endif + + +/** + * MHD_SCKT_OPT_BOOL_ is type for bool parameters for setsockopt()/getsockopt() + */ +#ifdef MHD_POSIX_SOCKETS + typedef int MHD_SCKT_OPT_BOOL_; +#else /* MHD_WINSOCK_SOCKETS */ + typedef BOOL MHD_SCKT_OPT_BOOL_; +#endif /* MHD_WINSOCK_SOCKETS */ + +/** + * MHD_SCKT_SEND_SIZE_ is type used to specify size for send and recv + * functions + */ +#if !defined(MHD_WINSOCK_SOCKETS) + typedef size_t MHD_SCKT_SEND_SIZE_; +#else + typedef int MHD_SCKT_SEND_SIZE_; +#endif + +/** + * MHD_SCKT_SEND_MAX_SIZE_ is maximum send()/recv() size value. + */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_SEND_MAX_SIZE_ SSIZE_MAX +#else +# define MHD_SCKT_SEND_MAX_SIZE_ INT_MAX +#endif + +/** + * MHD_socket_close_(fd) close any FDs (non-W32) / close only socket + * FDs (W32). Note that on HP-UNIX, this function may leak the FD if + * errno is set to EINTR. Do not use HP-UNIX. + * + * @param fd descriptor to close + * @return boolean true on success (error codes like EINTR and EIO are + * counted as success, only EBADF counts as an error!), + * boolean false otherwise. + */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_close_(fd) ((0 == close((fd))) || (EBADF != errno)) +#else +# define MHD_socket_close_(fd) (0 == closesocket((fd))) +#endif + +/** + * MHD_socket_close_chk_(fd) close socket and abort execution + * if error is detected. + * @param fd socket to close + */ +#define MHD_socket_close_chk_(fd) do { \ + if (!MHD_socket_close_(fd)) \ + MHD_PANIC(_("Close socket failed.\n")); \ + } while(0) + + +/** + * MHD_send_ is wrapper for system's send() + * @param s the socket to use + * @param b the buffer with data to send + * @param l the length of data in @a b + * @return ssize_t type value + */ +#define MHD_send_(s,b,l) \ + ((ssize_t)send((s),(const void*)(b),((MHD_SCKT_SEND_SIZE_)l), MAYBE_MSG_NOSIGNAL)) + + +/** + * MHD_recv_ is wrapper for system's recv() + * @param s the socket to use + * @param b the buffer for data to receive + * @param l the length of @a b + * @return ssize_t type value + */ +#define MHD_recv_(s,b,l) \ + ((ssize_t)recv((s),(void*)(b),((MHD_SCKT_SEND_SIZE_)l), 0)) + + +/** + * Check whether FD can be added to fd_set with specified FD_SETSIZE. + * @param fd the fd to check + * @param pset the pointer to fd_set to check or NULL to check + * whether FD can be used with fd_sets. + * @param setsize the value of FD_SETSIZE. + * @return boolean true if FD can be added to fd_set, + * boolean false otherwise. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd,pset,setsize) ((fd) < ((MHD_socket)setsize)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd,pset,setsize) ( ((void*)(pset)==(void*)0) || \ + (((fd_set*)(pset))->fd_count < ((unsigned)setsize)) || \ + (FD_ISSET((fd),(pset))) ) +#endif + +/** + * Check whether FD can be added to fd_set with current FD_SETSIZE. + * @param fd the fd to check + * @param pset the pointer to fd_set to check or NULL to check + * whether FD can be used with fd_sets. + * @return boolean true if FD can be added to fd_set, + * boolean false otherwise. + */ +#define MHD_SCKT_FD_FITS_FDSET_(fd,pset) MHD_SCKT_FD_FITS_FDSET_SETSIZE_((fd),(pset),FD_SETSIZE) + +/** + * Add FD to fd_set with specified FD_SETSIZE. + * @param fd the fd to add + * @param pset the valid pointer to fd_set. + * @param setsize the value of FD_SETSIZE. + * @note To work on W32 with value of FD_SETSIZE different from currently defined value, + * system definition of FD_SET() is not used. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd,pset,setsize) FD_SET((fd),(pset)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd,pset,setsize) \ + do { \ + u_int _i_ = 0; \ + fd_set* const _s_ = (fd_set*)(pset); \ + while((_i_ < _s_->fd_count) && ((fd) != _s_->fd_array[_i_])) {++_i_;} \ + if ((_i_ == _s_->fd_count)) {_s_->fd_array[_s_->fd_count++] = (fd);} \ + } while(0) +#endif + + /* MHD_SYS_select_ is wrapper macro for system select() function */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_SYS_select_(n,r,w,e,t) select((n),(r),(w),(e),(t)) +#else +# define MHD_SYS_select_(n,r,w,e,t) \ +( ( (((void*)(r) == (void*)0) || ((fd_set*)(r))->fd_count == 0) && \ + (((void*)(w) == (void*)0) || ((fd_set*)(w))->fd_count == 0) && \ + (((void*)(e) == (void*)0) || ((fd_set*)(e))->fd_count == 0) ) ? \ + ( ((void*)(t) == (void*)0) ? 0 : \ + (Sleep(((struct timeval*)(t))->tv_sec * 1000 + \ + ((struct timeval*)(t))->tv_usec / 1000), 0) ) : \ + (select((int)0,(r),(w),(e),(t))) ) +#endif + +#if defined(HAVE_POLL) +/* MHD_sys_poll_ is wrapper macro for system poll() function */ +# if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_sys_poll_ poll +# else /* MHD_WINSOCK_SOCKETS */ +# define MHD_sys_poll_ WSAPoll +# endif /* MHD_WINSOCK_SOCKETS */ + +# ifdef POLLPRI +# define MHD_POLLPRI_OR_ZERO POLLPRI +# else /* ! POLLPRI */ +# define MHD_POLLPRI_OR_ZERO 0 +# endif /* ! POLLPRI */ +# ifdef POLLRDBAND +# define MHD_POLLRDBAND_OR_ZERO POLLRDBAND +# else /* ! POLLRDBAND */ +# define MHD_POLLRDBAND_OR_ZERO 0 +# endif /* ! POLLRDBAND */ +# ifdef POLLNVAL +# define MHD_POLLNVAL_OR_ZERO POLLNVAL +# else /* ! POLLNVAL */ +# define MHD_POLLNVAL_OR_ZERO 0 +# endif /* ! POLLNVAL */ + +/* MHD_POLL_EVENTS_ERR_DISC is 'events' mask for errors and disconnect. + * Note: Out-of-band data is treated as error. */ +# if defined(_WIN32) +# define MHD_POLL_EVENTS_ERR_DISC POLLRDBAND +# elif defined(__linux__) +# define MHD_POLL_EVENTS_ERR_DISC POLLPRI +# else /* ! __linux__ */ +# define MHD_POLL_EVENTS_ERR_DISC (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO) +# endif /* ! __linux__ */ +/* MHD_POLL_REVENTS_ERR_DISC is 'revents' mask for errors and disconnect. + * Note: Out-of-band data is treated as error. */ +# define MHD_POLL_REVENTS_ERR_DISC \ + (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO | MHD_POLLNVAL_OR_ZERO | POLLERR | POLLHUP) +/* MHD_POLL_REVENTS_ERRROR is 'revents' mask for errors. + * Note: Out-of-band data is treated as error. */ +# define MHD_POLL_REVENTS_ERRROR \ + (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO | MHD_POLLNVAL_OR_ZERO | POLLERR) +#endif /* HAVE_POLL */ + +#define MHD_SCKT_MISSING_ERR_CODE_ 31450 + +#if defined(MHD_POSIX_SOCKETS) +# if defined(EAGAIN) +# define MHD_SCKT_EAGAIN_ EAGAIN +# elif defined(EWOULDBLOCK) +# define MHD_SCKT_EAGAIN_ EWOULDBLOCK +# else /* !EAGAIN && !EWOULDBLOCK */ +# define MHD_SCKT_EAGAIN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* !EAGAIN && !EWOULDBLOCK */ +# if defined(EWOULDBLOCK) +# define MHD_SCKT_EWOULDBLOCK_ EWOULDBLOCK +# elif defined(EAGAIN) +# define MHD_SCKT_EWOULDBLOCK_ EAGAIN +# else /* !EWOULDBLOCK && !EAGAIN */ +# define MHD_SCKT_EWOULDBLOCK_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* !EWOULDBLOCK && !EAGAIN */ +# ifdef EINTR +# define MHD_SCKT_EINTR_ EINTR +# else /* ! EINTR */ +# define MHD_SCKT_EINTR_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EINTR */ +# ifdef ECONNRESET +# define MHD_SCKT_ECONNRESET_ ECONNRESET +# else /* ! ECONNRESET */ +# define MHD_SCKT_ECONNRESET_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ECONNRESET */ +# ifdef ECONNABORTED +# define MHD_SCKT_ECONNABORTED_ ECONNABORTED +# else /* ! ECONNABORTED */ +# define MHD_SCKT_ECONNABORTED_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ECONNABORTED */ +# ifdef ENOTCONN +# define MHD_SCKT_ENOTCONN_ ENOTCONN +# else /* ! ENOTCONN */ +# define MHD_SCKT_ENOTCONN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTCONN */ +# ifdef EMFILE +# define MHD_SCKT_EMFILE_ EMFILE +# else /* ! EMFILE */ +# define MHD_SCKT_EMFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EMFILE */ +# ifdef ENFILE +# define MHD_SCKT_ENFILE_ ENFILE +# else /* ! ENFILE */ +# define MHD_SCKT_ENFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENFILE */ +# ifdef ENOMEM +# define MHD_SCKT_ENOMEM_ ENOMEM +# else /* ! ENOMEM */ +# define MHD_SCKT_ENOMEM_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOMEM */ +# ifdef ENOBUFS +# define MHD_SCKT_ENOBUFS_ ENOBUFS +# else /* ! ENOBUFS */ +# define MHD_SCKT_ENOBUFS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOBUFS */ +# ifdef EBADF +# define MHD_SCKT_EBADF_ EBADF +# else /* ! EBADF */ +# define MHD_SCKT_EBADF_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EBADF */ +# ifdef ENOTSOCK +# define MHD_SCKT_ENOTSOCK_ ENOTSOCK +# else /* ! ENOTSOCK */ +# define MHD_SCKT_ENOTSOCK_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTSOCK */ +# ifdef EINVAL +# define MHD_SCKT_EINVAL_ EINVAL +# else /* ! EINVAL */ +# define MHD_SCKT_EINVAL_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EINVAL */ +# ifdef EFAULT +# define MHD_SCKT_EFAUL_ EFAULT +# else /* ! EFAULT */ +# define MHD_SCKT_EFAUL_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EFAULT */ +# ifdef ENOSYS +# define MHD_SCKT_ENOSYS_ ENOSYS +# else /* ! ENOSYS */ +# define MHD_SCKT_ENOSYS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOSYS */ +# ifdef ENOTSUP +# define MHD_SCKT_ENOTSUP_ ENOTSUP +# else /* ! ENOTSUP */ +# define MHD_SCKT_ENOTSUP_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTSUP */ +# ifdef EOPNOTSUPP +# define MHD_SCKT_EOPNOTSUPP_ EOPNOTSUPP +# else /* ! EOPNOTSUPP */ +# define MHD_SCKT_EOPNOTSUPP_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EOPNOTSUPP */ +# ifdef EACCES +# define MHD_SCKT_EACCESS_ EACCES +# else /* ! EACCES */ +# define MHD_SCKT_EACCESS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EACCES */ +# ifdef ENETDOWN +# define MHD_SCKT_ENETDOWN_ ENETDOWN +# else /* ! ENETDOWN */ +# define MHD_SCKT_ENETDOWN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENETDOWN */ +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_EAGAIN_ WSAEWOULDBLOCK +# define MHD_SCKT_EWOULDBLOCK_ WSAEWOULDBLOCK +# define MHD_SCKT_EINTR_ WSAEINTR +# define MHD_SCKT_ECONNRESET_ WSAECONNRESET +# define MHD_SCKT_ECONNABORTED_ WSAECONNABORTED +# define MHD_SCKT_ENOTCONN_ WSAENOTCONN +# define MHD_SCKT_EMFILE_ WSAEMFILE +# define MHD_SCKT_ENFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOMEM_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOBUFS_ WSAENOBUFS +# define MHD_SCKT_EBADF_ WSAEBADF +# define MHD_SCKT_ENOTSOCK_ WSAENOTSOCK +# define MHD_SCKT_EINVAL_ WSAEINVAL +# define MHD_SCKT_EFAUL_ WSAEFAULT +# define MHD_SCKT_ENOSYS_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOTSUP_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_EOPNOTSUPP_ WSAEOPNOTSUPP +# define MHD_SCKT_EACCESS_ WSAEACCES +# define MHD_SCKT_ENETDOWN_ WSAENETDOWN +#endif + +/** + * MHD_socket_error_ return system native error code for last socket error. + * @return system error code for last socket error. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_get_error_() (errno) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_get_error_() WSAGetLastError() +#endif + +#ifdef MHD_WINSOCK_SOCKETS + /* POSIX-W32 sockets compatibility functions */ + +/** + * Return pointer to string description of specified WinSock error + * @param err the WinSock error code. + * @return pointer to string description of specified WinSock error. + */ + const char* MHD_W32_strerror_winsock_(int err); +#endif /* MHD_WINSOCK_SOCKETS */ + +/* MHD_socket_last_strerr_ is description string of specified socket error code */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_strerr_(err) strerror((err)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_strerr_(err) MHD_W32_strerror_winsock_((err)) +#endif + +/* MHD_socket_last_strerr_ is description string of last errno (non-W32) / + * description string of last socket error (W32) */ +#define MHD_socket_last_strerr_() MHD_socket_strerr_(MHD_socket_get_error_()) + +/** + * MHD_socket_fset_error_() set socket system native error code. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_fset_error_(err) (errno = (err)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_fset_error_(err) (WSASetLastError((err))) +#endif + +/** + * MHD_socket_try_set_error_() set socket system native error code if + * specified code is defined on system. + * @return non-zero if specified @a err code is defined on system + * and error was set; + * zero if specified @a err code is not defined on system + * and error was not set. + */ +#define MHD_socket_try_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ != (err)) ? \ + (MHD_socket_fset_error_((err)), !0) : 0 ) + +/** + * MHD_socket_set_error_() set socket system native error code to + * specified code or replacement code if specified code is not + * defined on system. + */ +#if defined(MHD_POSIX_SOCKETS) +# if defined(ENOSYS) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = ENOSYS) : (errno = (err)) ) +# elif defined(EOPNOTSUPP) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EOPNOTSUPP) : (errno = (err)) ) +# elif defined (EFAULT) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EFAULT) : (errno = (err)) ) +# elif defined (EINVAL) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EINVAL) : (errno = (err)) ) +# else /* !EOPNOTSUPP && !EFAULT && !EINVAL */ +# warning No suitable replacement for missing socket error code is found. Edit this file and add replacement code which is defined on system. +# define MHD_socket_set_error_(err) (errno = (err)) +# endif /* !EOPNOTSUPP && !EFAULT && !EINVAL*/ +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (WSASetLastError((WSAEOPNOTSUPP))) : \ + (WSASetLastError((err))) ) +#endif + +/** + * Check whether given socket error is equal to specified system + * native MHD_SCKT_E*_ code. + * If platform don't have specific error code, result is + * always boolean false. + * @return boolean true if @a code is real error code and + * @a err equals to MHD_SCKT_E*_ @a code; + * boolean false otherwise + */ +#define MHD_SCKT_ERR_IS_(err,code) ( (MHD_SCKT_MISSING_ERR_CODE_ != (code)) && \ + ((code) == (err)) ) + +/** + * Check whether last socket error is equal to specified system + * native MHD_SCKT_E*_ code. + * If platform don't have specific error code, result is + * always boolean false. + * @return boolean true if @a code is real error code and + * last socket error equals to MHD_SCKT_E*_ @a code; + * boolean false otherwise + */ +#define MHD_SCKT_LAST_ERR_IS_(code) MHD_SCKT_ERR_IS_(MHD_socket_get_error_() ,(code)) + +/* Specific error code checks */ + +/** + * Check whether given socket error is equal to system's + * socket error codes for EINTR. + * @return boolean true if @a err is equal to sockets' EINTR code; + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_EINTR_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_EINTR_) + +/** + * Check whether given socket error is equal to system's + * socket error codes for EAGAIN or EWOULDBLOCK. + * @return boolean true if @a err is equal to sockets' EAGAIN or EWOULDBLOCK codes; + * boolean false otherwise. + */ +#if MHD_SCKT_EAGAIN_ == MHD_SCKT_EWOULDBLOCK_ +# define MHD_SCKT_ERR_IS_EAGAIN_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_EAGAIN_) +#else /* MHD_SCKT_EAGAIN_ != MHD_SCKT_EWOULDBLOCK_ */ +# define MHD_SCKT_ERR_IS_EAGAIN_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_EAGAIN_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_EWOULDBLOCK_) ) +#endif /* MHD_SCKT_EAGAIN_ != MHD_SCKT_EWOULDBLOCK_ */ + +/** + * Check whether given socket error is any kind of "low resource" error. + * @return boolean true if @a err is any kind of "low resource" error, + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_LOW_RESOURCES_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_EMFILE_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENFILE_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENOMEM_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENOBUFS_) ) + +/** + * Check whether is given socket error is type of "incoming connection + * was disconnected before 'accept()' is called". + * @return boolean true is @a err match described socket error code, + * boolean false otherwise. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNABORTED_) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNRESET_) +#endif + +/** + * Check whether is given socket error is type of "connection was terminated + * by remote side". + * @return boolean true is @a err match described socket error code, + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNRESET_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNABORTED_)) + +/* Specific error code set */ + +/** + * Set socket's error code to ENOMEM or equivalent if ENOMEM is not + * available on platform. + */ +#if MHD_SCKT_MISSING_ERR_CODE_ != MHD_SCKT_ENOMEM_ +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOMEM_) +#elif MHD_SCKT_MISSING_ERR_CODE_ != MHD_SCKT_ENOBUFS_ +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOBUFS_) +#else +# warning No suitable replacement for ENOMEM error codes is found. Edit this file and add replacement code which is defined on system. +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOMEM_) +#endif + +/* Socket functions */ + +#if defined(AF_LOCAL) +# define MHD_SCKT_LOCAL AF_LOCAL +#elif defined(AF_UNIX) +# define MHD_SCKT_LOCAL AF_UNIX +#endif /* AF_UNIX */ + +#if defined(MHD_POSIX_SOCKETS) && defined(MHD_SCKT_LOCAL) +# define MHD_socket_pair_(fdarr) (!socketpair(MHD_SCKT_LOCAL, SOCK_STREAM, 0, (fdarr))) +# if defined(HAVE_SOCK_NONBLOCK) +# define MHD_socket_pair_nblk_(fdarr) (!socketpair(MHD_SCKT_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0, (fdarr))) +# endif /* HAVE_SOCK_NONBLOCK*/ +#elif defined(MHD_WINSOCK_SOCKETS) + /** + * Create pair of mutually connected TCP/IP sockets on loopback address + * @param sockets_pair array to receive resulted sockets + * @param non_blk if set to non-zero value, sockets created in non-blocking mode + * otherwise sockets will be in blocking mode + * @return non-zero if succeeded, zero otherwise + */ + int MHD_W32_socket_pair_(SOCKET sockets_pair[2], int non_blk); + +# define MHD_socket_pair_(fdarr) MHD_W32_socket_pair_((fdarr), 0) +# define MHD_socket_pair_nblk_(fdarr) MHD_W32_socket_pair_((fdarr), 1) +#endif + +/** + * Add @a fd to the @a set. If @a fd is + * greater than @a max_fd, set @a max_fd to @a fd. + * + * @param fd file descriptor to add to the @a set + * @param set set to modify + * @param max_fd maximum value to potentially update + * @param fd_setsize value of FD_SETSIZE + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_add_to_fd_set_ (MHD_socket fd, + fd_set *set, + MHD_socket *max_fd, + unsigned int fd_setsize); + + +/** + * Change socket options to be non-blocking. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_socket_nonblocking_ (MHD_socket sock); + + +/** + * Change socket options to be non-inheritable. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + * @warning Does not set socket error on W32. + */ +int +MHD_socket_noninheritable_ (MHD_socket sock); + + +#if defined(SOL_SOCKET) && defined(SO_NOSIGPIPE) + static const int _MHD_socket_int_one = 1; +/** + * Change socket options to no signal on remote disconnect. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +# define MHD_socket_nosignal_(sock) \ + (!setsockopt((sock),SOL_SOCKET,SO_NOSIGPIPE,&_MHD_socket_int_one,sizeof(_MHD_socket_int_one))) +#endif /* SOL_SOCKET && SO_NOSIGPIPE */ + +/** + * Create a listen socket, with noninheritable flag if possible. + * + * @param use_ipv6 if set to non-zero IPv6 is used + * @return created socket or MHD_INVALID_SOCKET in case of errors + */ +MHD_socket +MHD_socket_create_listen_ (int use_ipv6); + +#endif /* ! MHD_SOCKETS_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_str.c libmicrohttpd-0.9.55/src/microhttpd/mhd_str.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_str.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_str.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,748 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015, 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_str.c + * @brief Functions implementations for string manipulating + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_str.h" + +#ifdef HAVE_STDBOOL_H +#include +#endif + +#include "mhd_limits.h" + +#ifdef MHD_FAVOR_SMALL_CODE +#ifdef _MHD_inline +#undef _MHD_inline +#endif /* _MHD_inline */ +/* Do not force inlining and do not use macro functions, use normal static + functions instead. + This may give more flexibility for size optimizations. */ +#define _MHD_inline static +#ifndef INLINE_FUNC +#define INLINE_FUNC 1 +#endif /* !INLINE_FUNC */ +#endif /* MHD_FAVOR_SMALL_CODE */ + +/* + * Block of functions/macros that use US-ASCII charset as required by HTTP + * standards. Not affected by current locale settings. + */ + +#ifdef INLINE_FUNC +/** + * Check whether character is lower case letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is lower case letter, zero otherwise + */ +_MHD_inline bool +isasciilower (char c) +{ + return (c >= 'a') && (c <= 'z'); +} + + +/** + * Check whether character is upper case letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is upper case letter, zero otherwise + */ +_MHD_inline bool +isasciiupper (char c) +{ + return (c >= 'A') && (c <= 'Z'); +} + + +/** + * Check whether character is letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is letter in US-ASCII, zero otherwise + */ +_MHD_inline bool +isasciialpha (char c) +{ + return isasciilower (c) || isasciiupper (c); +} + + +/** + * Check whether character is decimal digit in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit, zero otherwise + */ +_MHD_inline bool +isasciidigit (char c) +{ + return (c >= '0') && (c <= '9'); +} + + +/** + * Check whether character is hexadecimal digit in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit, zero otherwise + */ +_MHD_inline bool +isasciixdigit (char c) +{ + return isasciidigit (c) || + ( (c >= 'A') && (c <= 'F') ) || + ( (c >= 'a') && (c <= 'f') ); +} + + +/** + * Check whether character is decimal digit or letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit or letter, zero otherwise + */ +_MHD_inline bool +isasciialnum (char c) +{ + return isasciialpha (c) || isasciidigit (c); +} + + +/** + * Convert US-ASCII character to lower case. + * If character is upper case letter in US-ASCII than it's converted to lower + * case analog. If character is NOT upper case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to lower case character + */ +_MHD_inline char +toasciilower (char c) +{ + return isasciiupper (c) ? (c - 'A' + 'a') : c; +} + + +/** + * Convert US-ASCII character to upper case. + * If character is lower case letter in US-ASCII than it's converted to upper + * case analog. If character is NOT lower case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to upper case character + */ +_MHD_inline char +toasciiupper (char c) +{ + return isasciilower (c) ? (c - 'a' + 'A') : c; +} + + +/** + * Convert US-ASCII decimal digit to its value. + * + * @param c character to convert + * @return value of decimal digit or -1 if @ c is not decimal digit + */ +_MHD_inline int +todigitvalue (char c) +{ + if (isasciidigit (c)) + return (unsigned char)(c - '0'); + + return -1; +} + + +/** + * Convert US-ASCII hexadecimal digit to its value. + * + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +_MHD_inline int +toxdigitvalue (char c) +{ + if (isasciidigit (c)) + return (unsigned char)(c - '0'); + if ( (c >= 'A') && (c <= 'F') ) + return (unsigned char)(c - 'A' + 10); + if ( (c >= 'a') && (c <= 'f') ) + return (unsigned char)(c - 'a' + 10); + + return -1; +} +#else /* !INLINE_FUNC */ + + +/** + * Checks whether character is lower case letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is lower case letter, + * boolean false otherwise + */ +#define isasciilower(c) (((char)(c)) >= 'a' && ((char)(c)) <= 'z') + + +/** + * Checks whether character is upper case letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is upper case letter, + * boolean false otherwise + */ +#define isasciiupper(c) (((char)(c)) >= 'A' && ((char)(c)) <= 'Z') + + +/** + * Checks whether character is letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is letter, boolean false + * otherwise + */ +#define isasciialpha(c) (isasciilower(c) || isasciiupper(c)) + + +/** + * Check whether character is decimal digit in US-ASCII + * + * @param c character to check + * @return boolean true if character is decimal digit, boolean false + * otherwise + */ +#define isasciidigit(c) (((char)(c)) >= '0' && ((char)(c)) <= '9') + + +/** + * Check whether character is hexadecimal digit in US-ASCII + * + * @param c character to check + * @return boolean true if character is hexadecimal digit, + * boolean false otherwise + */ +#define isasciixdigit(c) (isasciidigit((c)) || \ + (((char)(c)) >= 'A' && ((char)(c)) <= 'F') || \ + (((char)(c)) >= 'a' && ((char)(c)) <= 'f') ) + + +/** + * Check whether character is decimal digit or letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is decimal digit or letter, + * boolean false otherwise + */ +#define isasciialnum(c) (isasciialpha(c) || isasciidigit(c)) + + +/** + * Convert US-ASCII character to lower case. + * If character is upper case letter in US-ASCII than it's converted to lower + * case analog. If character is NOT upper case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to lower case character + */ +#define toasciilower(c) ((isasciiupper(c)) ? (((char)(c)) - 'A' + 'a') : ((char)(c))) + + +/** + * Convert US-ASCII character to upper case. + * If character is lower case letter in US-ASCII than it's converted to upper + * case analog. If character is NOT lower case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to upper case character + */ +#define toasciiupper(c) ((isasciilower(c)) ? (((char)(c)) - 'a' + 'A') : ((char)(c))) + + +/** + * Convert US-ASCII decimal digit to its value. + * + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +#define todigitvalue(c) (isasciidigit(c) ? (int)(((char)(c)) - '0') : (int)(-1)) + + +/** + * Convert US-ASCII hexadecimal digit to its value. + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +#define toxdigitvalue(c) ( isasciidigit(c) ? (int)(((char)(c)) - '0') : \ + ( (((char)(c)) >= 'A' && ((char)(c)) <= 'F') ? \ + (int)(((unsigned char)(c)) - 'A' + 10) : \ + ( (((char)(c)) >= 'a' && ((char)(c)) <= 'f') ? \ + (int)(((unsigned char)(c)) - 'a' + 10) : (int)(-1) ))) +#endif /* !INLINE_FUNC */ + + +#ifndef MHD_FAVOR_SMALL_CODE +/** + * Check two string for equality, ignoring case of US-ASCII letters. + * + * @param str1 first string to compare + * @param str2 second string to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_ (const char * str1, + const char * str2) +{ + while (0 != (*str1)) + { + const char c1 = *str1; + const char c2 = *str2; + if ( (c1 != c2) && + (toasciilower (c1) != toasciilower (c2)) ) + return 0; + str1++; + str2++; + } + return 0 == (*str2); +} +#endif /* ! MHD_FAVOR_SMALL_CODE */ + + +/** + * Check two string for equality, ignoring case of US-ASCII letters and + * checking not more than @a maxlen characters. + * Compares up to first terminating null character, but not more than + * first @a maxlen characters. + * + * @param str1 first string to compare + * @param str2 second string to compare + * @param maxlen maximum number of characters to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_n_ (const char * const str1, + const char * const str2, + size_t maxlen) +{ + size_t i; + + for (i = 0; i < maxlen; ++i) + { + const char c1 = str1[i]; + const char c2 = str2[i]; + if (0 == c2) + return 0 == c1; + if ( (c1 != c2) && + (toasciilower (c1) != toasciilower (c2)) ) + return 0; + } + return !0; +} + + +/** + * Check whether @a str has case-insensitive @a token. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end (of string) or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning token must not contain null-charters except optional + * terminating null-character. + * @param str the string to check + * @param token the token to find + * @param token_len length of token, not including optional terminating + * null-character. + * @return non-zero if two strings are equal, zero otherwise. + */ +bool +MHD_str_has_token_caseless_ (const char * str, + const char * const token, + size_t token_len) +{ + if (0 == token_len) + return false; + + while (0 != *str) + { + size_t i; + /* Skip all whitespaces and empty tokens. */ + while (' ' == *str || '\t' == *str || ',' == *str) str++; + + /* Check for token match. */ + i = 0; + while (1) + { + const char sc = *(str++); + const char tc = token[i++]; + + if (0 == sc) + return false; + if ( (sc != tc) && + (toasciilower (sc) != toasciilower (tc)) ) + break; + if (i >= token_len) + { + /* Check whether substring match token fully or + * has additional unmatched chars at tail. */ + while (' ' == *str || '\t' == *str) str++; + /* End of (sub)string? */ + if (0 == *str || ',' == *str) + return true; + /* Unmatched chars at end of substring. */ + break; + } + } + /* Find next substring. */ + while (0 != *str && ',' != *str) str++; + } + return false; +} + +#ifndef MHD_FAVOR_SMALL_CODE +/* Use individual function for each case */ + +/** + * Convert decimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_ (const char *str, + uint64_t *out_val) +{ + const char * const start = str; + uint64_t res; + + if (!str || !out_val || !isasciidigit(str[0])) + return 0; + + res = 0; + do + { + const int digit = (unsigned char)(*str) - '0'; + if ( (res > (UINT64_MAX / 10)) || + ( (res == (UINT64_MAX / 10)) && + ((uint64_t)digit > (UINT64_MAX % 10)) ) ) + return 0; + + res *= 10; + res += digit; + str++; + } while (isasciidigit (*str)); + + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen decimal US-ASCII digits in string to + * number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t *out_val) +{ + uint64_t res; + size_t i; + + if (!str || !maxlen || !out_val || !isasciidigit (str[0])) + return 0; + + res = 0; + i = 0; + do + { + const int digit = (unsigned char)str[i] - '0'; + + if ( (res > (UINT64_MAX / 10)) || + ( (res == (UINT64_MAX / 10)) && + ((uint64_t)digit > (UINT64_MAX % 10)) ) ) + return 0; + + res *= 10; + res += digit; + i++; + } while ( (i < maxlen) && + isasciidigit (str[i]) ); + + *out_val= res; + return i; +} + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint32_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_ (const char * str, + uint32_t *out_val) +{ + const char * const start = str; + uint32_t res; + int digit; + + if (!str || !out_val) + return 0; + + res = 0; + digit = toxdigitvalue (*str); + while (digit >= 0) + { + if ( (res < (UINT32_MAX / 16)) || + (res == (UINT32_MAX / 16) && (uint32_t)digit <= (UINT32_MAX % 16)) ) + { + res *= 16; + res += digit; + } + else + return 0; + str++; + digit = toxdigitvalue (*str); + } + + if (str - start > 0) + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint32_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_n_ (const char *str, + size_t maxlen, + uint32_t *out_val) +{ + size_t i; + uint32_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + i = 0; + while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) + { + if ( (res > (UINT32_MAX / 16)) || + (res == (UINT32_MAX / 16) && (uint32_t)digit > (UINT32_MAX % 16)) ) + return 0; + + res *= 16; + res += digit; + i++; + } + + if (i) + *out_val = res; + return i; +} + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_ (const char *str, + uint64_t *out_val) +{ + const char * const start = str; + uint64_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + digit = toxdigitvalue (*str); + while (digit >= 0) + { + if ( (res < (UINT64_MAX / 16)) || + (res == (UINT64_MAX / 16) && (uint64_t)digit <= (UINT64_MAX % 16)) ) + { + res *= 16; + res += digit; + } + else + return 0; + str++; + digit = toxdigitvalue (*str); + } + + if (str - start > 0) + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t *out_val) +{ + size_t i; + uint64_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + i = 0; + while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) + { + if ( (res > (UINT64_MAX / 16)) || + (res == (UINT64_MAX / 16) && (uint64_t)digit > (UINT64_MAX % 16)) ) + return 0; + + res *= 16; + res += digit; + i++; + } + + if (i) + *out_val = res; + return i; +} + +#else /* MHD_FAVOR_SMALL_CODE */ + +/** + * Generic function for converting not more then @a maxlen + * hexadecimal or decimal US-ASCII digits in string to number. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * To be used only within macro. + * + * @param str the string to convert + * @param maxlen the maximum number of characters to process + * @param out_val the pointer to variable to store result of conversion + * @param val_size the size of variable pointed by @a out_val, in bytes, 4 or 8 + * @param max_val the maximum decoded number + * @param base the numeric base, 10 or 16 + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then @max_val, @val_size is not 16/32 or @a out_val is NULL + */ +size_t +MHD_str_to_uvalue_n_ (const char *str, + size_t maxlen, + void * out_val, + size_t val_size, + uint64_t max_val, + int base) +{ + size_t i; + uint64_t res; + int digit; + const uint64_t max_v_div_b = max_val / base; + const uint64_t max_v_mod_b = max_val % base; + /* 'digit->value' must be function, not macro */ + int (*const dfunc)(char) = (base == 16) ? + toxdigitvalue : todigitvalue; + + if ( !str || !out_val || + (base != 16 && base != 10) ) + return 0; + + res = 0; + i = 0; + while (maxlen > i && 0 <= (digit = dfunc (str[i]))) + { + if ( ((max_v_div_b) < res) || + ((max_v_div_b) == res && (max_v_mod_b) < (uint64_t)digit) ) + return 0; + + res *= base; + res += digit; + i++; + } + + if (i) + { + if (8 == val_size) + *(uint64_t*)out_val = res; + else if (4 == val_size) + *(uint32_t*)out_val = (uint32_t)res; + else + return 0; + } + return i; +} +#endif /* MHD_FAVOR_SMALL_CODE */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_str.h libmicrohttpd-0.9.55/src/microhttpd/mhd_str.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_str.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_str.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,266 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015, 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_str.h + * @brief Header for string manipulating helpers + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_STR_H +#define MHD_STR_H 1 + +#include "mhd_options.h" + +#include +#include +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#ifdef MHD_FAVOR_SMALL_CODE +#include "mhd_limits.h" +#endif /* MHD_FAVOR_SMALL_CODE */ + +#ifndef MHD_STATICSTR_LEN_ +/** + * Determine length of static string / macro strings at compile time. + */ +#define MHD_STATICSTR_LEN_(macro) (sizeof(macro)/sizeof(char) - 1) +#endif /* ! MHD_STATICSTR_LEN_ */ + +/* + * Block of functions/macros that use US-ASCII charset as required by HTTP + * standards. Not affected by current locale settings. + */ + +#ifndef MHD_FAVOR_SMALL_CODE +/** + * Check two string for equality, ignoring case of US-ASCII letters. + * @param str1 first string to compare + * @param str2 second string to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_ (const char * str1, + const char * str2); +#else /* MHD_FAVOR_SMALL_CODE */ +/* Reuse MHD_str_equal_caseless_n_() to reduce size */ +#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_((s1),(s2), SIZE_MAX) +#endif /* MHD_FAVOR_SMALL_CODE */ + + +/** + * Check two string for equality, ignoring case of US-ASCII letters and + * checking not more than @a maxlen characters. + * Compares up to first terminating null character, but not more than + * first @a maxlen characters. + * @param str1 first string to compare + * @param str2 second string to compare + * @param maxlen maximum number of characters to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_n_ (const char * const str1, + const char * const str2, + size_t maxlen); + + +/** + * Check whether @a str has case-insensitive @a token. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end of string or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning token must not contain null-charters except optional + * terminating null-character. + * @param str the string to check + * @param token the token to find + * @param token_len length of token, not including optional terminating + * null-character. + * @return non-zero if two strings are equal, zero otherwise. + */ +bool +MHD_str_has_token_caseless_ (const char * str, + const char * const token, + size_t token_len); + +/** + * Check whether @a str has case-insensitive static @a tkn. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end of string or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning tkn must be static string + * @param str the string to check + * @param tkn the static string of token to find + * @return non-zero if two strings are equal, zero otherwise. + */ +#define MHD_str_has_s_token_caseless_(str,tkn) \ + MHD_str_has_token_caseless_((str),(tkn),MHD_STATICSTR_LEN_(tkn)) + +#ifndef MHD_FAVOR_SMALL_CODE +/* Use individual function for each case to improve speed */ + +/** + * Convert decimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_ (const char * str, + uint64_t * out_val); + +/** + * Convert not more then @a maxlen decimal US-ASCII digits in string to + * number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t * out_val); + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint32_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_ (const char * str, + uint32_t * out_val); + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint32_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_n_ (const char * str, + size_t maxlen, + uint32_t * out_val); + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_ (const char * str, + uint64_t * out_val); + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t * out_val); + +#else /* MHD_FAVOR_SMALL_CODE */ +/* Use one universal function and macros to reduce size */ + +/** + * Generic function for converting not more then @a maxlen + * hexadecimal or decimal US-ASCII digits in string to number. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * To be used only within macro. + * @param str the string to convert + * @param maxlen the maximum number of characters to process + * @param out_val the pointer to uint64_t to store result of conversion + * @param val_size the size of variable pointed by @a out_val + * @param max_val the maximum decoded number + * @param base the numeric base, 10 or 16 + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then @ max_val or @a out_val is NULL + */ +size_t +MHD_str_to_uvalue_n_ (const char * str, + size_t maxlen, + void * out_val, + size_t val_size, + uint64_t max_val, + int base); + +#define MHD_str_to_uint64_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint64_t),UINT64_MAX,10) + +#define MHD_str_to_uint64_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint64_t),UINT64_MAX,10) + +#define MHD_strx_to_sizet_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(size_t),SIZE_MAX,16) + +#define MHD_strx_to_sizet_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(size_t),SIZE_MAX,16) + +#define MHD_strx_to_uint32_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint32_t),UINT32_MAX,16) + +#define MHD_strx_to_uint32_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint32_t),UINT32_MAX,16) + +#define MHD_strx_to_uint64_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint64_t),UINT64_MAX,16) + +#define MHD_strx_to_uint64_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint64_t),UINT64_MAX,16) + +#endif /* MHD_FAVOR_SMALL_CODE */ + +#endif /* MHD_STR_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_threads.c libmicrohttpd-0.9.55/src/microhttpd/mhd_threads.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_threads.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_threads.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,369 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_threads.c + * @brief Implementation for thread functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_threads.h" +#ifdef MHD_USE_W32_THREADS +#include "mhd_limits.h" +#include +#endif +#ifdef MHD_USE_THREAD_NAME_ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif /* HAVE_PTHREAD_NP_H */ +#endif /* MHD_USE_THREAD_NAME_ */ +#include + + + +#if defined(MHD_USE_POSIX_THREADS) +typedef pthread_t MHD_thread_ID_; +#elif defined(MHD_USE_W32_THREADS) +typedef DWORD MHD_thread_ID_; +#endif + + +#ifndef MHD_USE_THREAD_NAME_ + +#define MHD_set_thread_name_(t, n) (void) +#define MHD_set_cur_thread_name_(n) (void) + +#else /* MHD_USE_THREAD_NAME_ */ + +#if defined(MHD_USE_POSIX_THREADS) +#if defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) +# define MHD_USE_THREAD_ATTR_SETNAME 1 +#endif /* HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD || HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI */ + +#if defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) \ + || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) + +/** + * Set thread name + * + * @param thread_id ID of thread + * @param thread_name name to set + * @return non-zero on success, zero otherwise + */ +static int +MHD_set_thread_name_(const MHD_thread_ID_ thread_id, + const char *thread_name) +{ + if (NULL == thread_name) + return 0; + +#if defined(HAVE_PTHREAD_SETNAME_NP_GNU) + return !pthread_setname_np (thread_id, thread_name); +#elif defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) + /* FreeBSD and OpenBSD use different name and void return type */ + pthread_set_name_np (thread_id, thread_name); + return !0; +#elif defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) + /* NetBSD use 3 arguments: second argument is string in printf-like format, + * third argument is single argument for printf; + * OSF1 use 3 arguments too, but last one always must be zero (NULL). + * MHD doesn't use '%' in thread names, so both form are used in same way. + */ + return !pthread_setname_np (thread_id, thread_name, 0); +#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ +} + + +#ifndef __QNXNTO__ +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(pthread_self(),(n)) +#else /* __QNXNTO__ */ +/* Special case for QNX Neutrino - using zero for thread ID sets name faster. */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(0,(n)) +#endif /* __QNXNTO__ */ +#elif defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) + +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) (!(pthread_setname_np((n)))) +#endif /* HAVE_PTHREAD_SETNAME_NP_DARWIN */ + +#elif defined(MHD_USE_W32_THREADS) +#ifndef _MSC_FULL_VER +/* Thread name available only for VC-compiler */ +#else /* _MSC_FULL_VER */ +/** + * Set thread name + * + * @param thread_id ID of thread, -1 for current thread + * @param thread_name name to set + * @return non-zero on success, zero otherwise + */ +static int +MHD_set_thread_name_(const MHD_thread_ID_ thread_id, + const char *thread_name) +{ + static const DWORD VC_SETNAME_EXC = 0x406D1388; +#pragma pack(push,8) + struct thread_info_struct + { + DWORD type; /* Must be 0x1000. */ + LPCSTR name; /* Pointer to name (in user address space). */ + DWORD ID; /* Thread ID (-1 = caller thread). */ + DWORD flags; /* Reserved for future use, must be zero. */ + } thread_info; +#pragma pack(pop) + + if (NULL == thread_name) + return 0; + + thread_info.type = 0x1000; + thread_info.name = thread_name; + thread_info.ID = thread_id; + thread_info.flags = 0; + + __try + { /* This exception is intercepted by debugger */ + RaiseException (VC_SETNAME_EXC, + 0, + sizeof (thread_info) / sizeof(ULONG_PTR), + (ULONG_PTR *) &thread_info); + } + __except (EXCEPTION_EXECUTE_HANDLER) + {} + + return !0; +} + + +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(-1,(n)) +#endif /* _MSC_FULL_VER */ +#endif /* MHD_USE_W32_THREADS */ + +#endif /* MHD_USE_THREAD_NAME_ */ + + +/** + * Create a thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise (with errno set) + */ +int +MHD_create_thread_ (MHD_thread_handle_ *thread, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg) +{ +#if defined(MHD_USE_POSIX_THREADS) + int res; + + if (0 != stack_size) + { + pthread_attr_t attr; + res = pthread_attr_init (&attr); + if (0 == res) + { + res = pthread_attr_setstacksize (&attr, + stack_size); + if (0 == res) + res = pthread_create (thread, + &attr, + start_routine, + arg); + pthread_attr_destroy (&attr); + } + } + else + res = pthread_create (thread, + NULL, + start_routine, + arg); + + if (0 != res) + errno = res; + + return !res; +#elif defined(MHD_USE_W32_THREADS) +#if SIZE_MAX != UINT_MAX + if (stack_size > UINT_MAX) + { + errno = EINVAL; + return 0; + } +#endif /* SIZE_MAX != UINT_MAX */ + + *thread = (HANDLE) _beginthreadex (NULL, + (unsigned int) stack_size, + start_routine, + arg, + 0, + NULL); + if ((MHD_thread_handle_)-1 == (*thread)) + return 0; + + return !0; +#endif +} + +#ifdef MHD_USE_THREAD_NAME_ + +#ifndef MHD_USE_THREAD_ATTR_SETNAME +struct MHD_named_helper_param_ +{ + /** + * Real thread start routine + */ + MHD_THREAD_START_ROUTINE_ start_routine; + + /** + * Argument for thread start routine + */ + void *arg; + + /** + * Name for thread + */ + const char *name; +}; + + +static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +named_thread_starter (void *data) +{ + struct MHD_named_helper_param_ * const param = + (struct MHD_named_helper_param_ *) data; + void * arg; + MHD_THREAD_START_ROUTINE_ thr_func; + + if (NULL == data) + return (MHD_THRD_RTRN_TYPE_)0; + + MHD_set_cur_thread_name_ (param->name); + + arg = param->arg; + thr_func = param->start_routine; + free(data); + + return thr_func(arg); +} +#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ + + +/** + * Create a named thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param thread_name name for new thread + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise (with errno set) + */ +int +MHD_create_named_thread_ (MHD_thread_handle_ *thread, + const char* thread_name, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg) +{ +#if defined(MHD_USE_THREAD_ATTR_SETNAME) + int res; + pthread_attr_t attr; + + res = pthread_attr_init (&attr); + if (0 == res) + { +#if defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) + /* NetBSD use 3 arguments: second argument is string in printf-like format, + * third argument is single argument for printf; + * OSF1 use 3 arguments too, but last one always must be zero (NULL). + * MHD doesn't use '%' in thread names, so both form are used in same way. + */ + res = pthread_attr_setname_np (&attr, thread_name, 0); +#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) + res = pthread_attr_setname_np (&attr, thread_name); +#else +#error No pthread_attr_setname_np() function. +#endif + if (res == 0 && 0 != stack_size) + res = pthread_attr_setstacksize (&attr, + stack_size); + if (0 == res) + res = pthread_create (thread, + &attr, + start_routine, + arg); + pthread_attr_destroy (&attr); + } + if (0 != res) + errno = res; + + return !res; +#else /* ! MHD_USE_THREAD_ATTR_SETNAME */ + struct MHD_named_helper_param_ *param; + + if (NULL == thread_name) + { + errno = EINVAL; + return 0; + } + + param = malloc (sizeof (struct MHD_named_helper_param_)); + if (NULL == param) + return 0; + + param->start_routine = start_routine; + param->arg = arg; + param->name = thread_name; + + /* Set thread name in thread itself to avoid problems with + * threads which terminated before name is set in other thread. + */ + if (! MHD_create_thread_(thread, + stack_size, + &named_thread_starter, + (void*)param)) + { + free (param); + return 0; + } + + return !0; +#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ +} + +#endif /* MHD_USE_THREAD_NAME_ */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_threads.h libmicrohttpd-0.9.55/src/microhttpd/mhd_threads.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/mhd_threads.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/mhd_threads.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,153 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_threads.h + * @brief Header for platform-independent threads abstraction + * @author Karlson2k (Evgeny Grin) + * + * Provides basic abstraction for threads. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + * + * @warning Unlike pthread functions, most of functions return + * nonzero on success. + */ + +#ifndef MHD_THREADS_H +#define MHD_THREADS_H 1 + +#include "mhd_options.h" +#ifdef HAVE_STDDEF_H +# include /* for size_t */ +#else /* ! HAVE_STDDEF_H */ +# include /* for size_t */ +#endif /* ! HAVE_STDDEF_H */ + +#if defined(MHD_USE_POSIX_THREADS) +# undef HAVE_CONFIG_H +# include +# define HAVE_CONFIG_H 1 +#elif defined(MHD_USE_W32_THREADS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +#else +# error No threading API is available. +#endif + +#ifndef MHD_NO_THREAD_NAMES +# if defined(MHD_USE_POSIX_THREADS) +# if defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || \ + defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) || \ + defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) +# define MHD_USE_THREAD_NAME_ +# endif /* HAVE_PTHREAD_SETNAME_NP */ +# elif defined(MHD_USE_W32_THREADS) +# ifdef _MSC_FULL_VER + /* Thread names only available with VC compiler */ +# define MHD_USE_THREAD_NAME_ +# endif /* _MSC_FULL_VER */ +# endif +#endif + +#if defined(MHD_USE_POSIX_THREADS) + typedef pthread_t MHD_thread_handle_; +#elif defined(MHD_USE_W32_THREADS) + typedef HANDLE MHD_thread_handle_; +#endif + +#if defined(MHD_USE_POSIX_THREADS) +# define MHD_THRD_RTRN_TYPE_ void* +# define MHD_THRD_CALL_SPEC_ +#elif defined(MHD_USE_W32_THREADS) +# define MHD_THRD_RTRN_TYPE_ unsigned +# define MHD_THRD_CALL_SPEC_ __stdcall +#endif + +#if defined(MHD_USE_POSIX_THREADS) +/** + * Wait until specified thread is ended and free thread handle on success. + * @param thread handle to watch + * @return nonzero on success, zero otherwise + */ +#define MHD_join_thread_(thread) (!pthread_join((thread), NULL)) +#elif defined(MHD_USE_W32_THREADS) +/** + * Wait until specified thread is ended and free thread handle on success. + * @param thread handle to watch + * @return nonzero on success, zero otherwise + */ +#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject((thread), INFINITE) ? (CloseHandle((thread)), !0) : 0) +#endif + +/** + * Signature of main function for a thread. + * + * @param cls closure argument for the function + * @return termination code from the thread + */ +typedef MHD_THRD_RTRN_TYPE_ +(MHD_THRD_CALL_SPEC_ *MHD_THREAD_START_ROUTINE_)(void *cls); + + +/** + * Create a thread and set the attributes according to our options. + * + * If thread is created, thread handle must be freed by #MHD_join_thread_(). + * + * @param thread handle to initialize + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise + */ +int +MHD_create_thread_ (MHD_thread_handle_ *thread, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg); + +#ifndef MHD_USE_THREAD_NAME_ +#define MHD_create_named_thread_(t,n,s,r,a) MHD_create_thread_((t),(s),(r),(a)) +#else /* MHD_USE_THREAD_NAME_ */ +/** + * Create a named thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param thread_name name for new thread + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise + */ +int +MHD_create_named_thread_ (MHD_thread_handle_ *thread, + const char* thread_name, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg); + +#endif /* MHD_USE_THREAD_NAME_ */ + +#endif /* ! MHD_THREADS_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/postprocessor.c libmicrohttpd-0.9.55/src/microhttpd/postprocessor.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/postprocessor.c 2015-07-07 23:23:21.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/postprocessor.c 2017-05-28 22:34:00.000000000 +0200 @@ -24,6 +24,8 @@ */ #include "internal.h" +#include "mhd_str.h" +#include "mhd_compat.h" /** * Size of on-stack buffer that we use for un-escaping of the value. @@ -186,7 +188,7 @@ size_t buffer_pos; /** - * Current position in xbuf. + * Current position in @e xbuf. */ size_t xbuf_pos; @@ -271,38 +273,48 @@ struct MHD_PostProcessor * MHD_create_post_processor (struct MHD_Connection *connection, size_t buffer_size, - MHD_PostDataIterator iter, void *iter_cls) + MHD_PostDataIterator iter, + void *iter_cls) { struct MHD_PostProcessor *ret; const char *encoding; const char *boundary; size_t blen; - if ((buffer_size < 256) || (connection == NULL) || (iter == NULL)) - mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); + if ( (buffer_size < 256) || + (NULL == connection) || + (NULL == iter)) + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); encoding = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_CONTENT_TYPE); - if (encoding == NULL) + if (NULL == encoding) return NULL; boundary = NULL; - if (!MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, encoding, - strlen (MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) + if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, + encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) { - if (!MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, encoding, - strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) + if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, + encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) return NULL; boundary = - &encoding[strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)]; + &encoding[MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)]; /* Q: should this be "strcasestr"? */ boundary = strstr (boundary, "boundary="); if (NULL == boundary) return NULL; /* failed to determine boundary */ - boundary += strlen ("boundary="); + boundary += MHD_STATICSTR_LEN_ ("boundary="); blen = strlen (boundary); - if ((blen == 0) || (blen * 2 + 2 > buffer_size)) + if ( (blen == 0) || + (blen * 2 + 2 > buffer_size) ) return NULL; /* (will be) out of memory or invalid boundary */ - if ( (boundary[0] == '"') && (boundary[blen - 1] == '"') ) + if ( (boundary[0] == '"') && + (boundary[blen - 1] == '"') ) { /* remove enclosing quotes */ ++boundary; @@ -314,9 +326,8 @@ buffer_size += 4; /* round up to get nice block sizes despite boundary search */ /* add +1 to ensure we ALWAYS have a zero-termination at the end */ - if (NULL == (ret = malloc (sizeof (struct MHD_PostProcessor) + buffer_size + 1))) + if (NULL == (ret = MHD_calloc_ (1, sizeof (struct MHD_PostProcessor) + buffer_size + 1))) return NULL; - memset (ret, 0, sizeof (struct MHD_PostProcessor) + buffer_size + 1); ret->connection = connection; ret->ikvi = iter; ret->cls = iter_cls; @@ -419,16 +430,20 @@ if so, exclude those from processing (reduce delta to point at end of processed region) */ delta = xoff; - if ((delta > 0) && (xbuf[delta - 1] == '%')) + if ((delta > 0) && + ('%' == xbuf[delta - 1])) delta--; - else if ((delta > 1) && (xbuf[delta - 2] == '%')) + else if ((delta > 1) && + ('%' == xbuf[delta - 2])) delta -= 2; /* if we have an incomplete escape sequence, save it to pp->xbuf for later */ if (delta < xoff) { - memcpy (pp->xbuf, &xbuf[delta], xoff - delta); + memcpy (pp->xbuf, + &xbuf[delta], + xoff - delta); pp->xbuf_pos = xoff - delta; xoff = delta; } @@ -436,7 +451,8 @@ /* If we have nothing to do (delta == 0) and not just because the value is empty (are waiting for more data), go for next iteration */ - if ((xoff == 0) && (poff == post_data_len)) + if ( (0 == xoff) && + (poff == post_data_len)) continue; /* unescape */ @@ -445,8 +461,14 @@ xoff = MHD_http_unescape (xbuf); /* finally: call application! */ pp->must_ikvi = MHD_NO; - if (MHD_NO == pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) &pp[1], /* key */ - NULL, NULL, NULL, xbuf, pp->value_offset, + if (MHD_NO == pp->ikvi (pp->cls, + MHD_POSTDATA_KIND, + (const char *) &pp[1], /* key */ + NULL, + NULL, + NULL, + xbuf, + pp->value_offset, xoff)) { pp->state = PP_Error; @@ -458,11 +480,12 @@ if (end_of_value_found) { /* we found the end of the value! */ - if ((post_data[poff] == '\n') || (post_data[poff] == '\r')) + if ( ('\n' == post_data[poff]) || + ('\r' == post_data[poff]) ) { pp->state = PP_ExpectNewLine; } - else if (post_data[poff] == '&') + else if ('&' == post_data[poff]) { poff++; /* skip '&' */ pp->state = PP_Init; @@ -470,7 +493,8 @@ } break; case PP_ExpectNewLine: - if ((post_data[poff] == '\n') || (post_data[poff] == '\r')) + if ( ('\n' == post_data[poff]) || + ('\r' == post_data[poff]) ) { poff++; /* we are done, report error if we receive any more... */ @@ -479,7 +503,10 @@ } return MHD_NO; default: - mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); /* should never happen! */ + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); /* should never happen! */ } } return MHD_YES; @@ -496,13 +523,17 @@ * @return #MHD_YES if there was a match, #MHD_NO if not */ static int -try_match_header (const char *prefix, char *line, char **suffix) +try_match_header (const char *prefix, + char *line, + char **suffix) { if (NULL != *suffix) return MHD_NO; - while (*line != 0) + while (0 != *line) { - if (MHD_str_equal_caseless_n_ (prefix, line, strlen (prefix))) + if (MHD_str_equal_caseless_n_ (prefix, + line, + strlen (prefix))) { *suffix = strdup (&line[strlen (prefix)]); return MHD_YES; @@ -531,7 +562,8 @@ const char *boundary, size_t blen, size_t *ioffptr, - enum PP_State next_state, enum PP_State next_dash_state) + enum PP_State next_state, + enum PP_State next_dash_state) { char *buf = (char *) &pp[1]; const char *dash; @@ -543,7 +575,12 @@ /* ++(*ioffptr); */ return MHD_NO; /* not enough data */ } - if ((0 != memcmp ("--", buf, 2)) || (0 != memcmp (&buf[2], boundary, blen))) + if ( (0 != memcmp ("--", + buf, + 2)) || + (0 != memcmp (&buf[2], + boundary, + blen))) { if (pp->state != PP_Init) { @@ -553,7 +590,9 @@ else { /* skip over garbage (RFC 2046, 5.1.1) */ - dash = memchr (buf, '-', pp->buffer_pos); + dash = memchr (buf, + '-', + pp->buffer_pos); if (NULL == dash) (*ioffptr) += pp->buffer_pos; /* skip entire buffer */ else @@ -597,7 +636,9 @@ klen = strlen (key); while (NULL != (spos = strstr (bpos, key))) { - if ((spos[klen] != '=') || ((spos != buf) && (spos[-1] != ' '))) + if ( (spos[klen] != '=') || + ( (spos != buf) && + (spos[-1] != ' ') ) ) { /* no match */ bpos = spos + 1; @@ -605,14 +646,17 @@ } if (spos[klen + 1] != '"') return; /* not quoted */ - if (NULL == (endv = strchr (&spos[klen + 2], '\"'))) + if (NULL == (endv = strchr (&spos[klen + 2], + '\"'))) return; /* no end-quote */ vlen = endv - spos - klen - 1; *destination = malloc (vlen); if (NULL == *destination) return; /* out of memory */ (*destination)[vlen - 1] = '\0'; - memcpy (*destination, &spos[klen + 2], vlen - 1); + memcpy (*destination, + &spos[klen + 2], + vlen - 1); return; /* success */ } } @@ -635,14 +679,16 @@ */ static int process_multipart_headers (struct MHD_PostProcessor *pp, - size_t *ioffptr, enum PP_State next_state) + size_t *ioffptr, + enum PP_State next_state) { char *buf = (char *) &pp[1]; size_t newline; newline = 0; - while ((newline < pp->buffer_pos) && - (buf[newline] != '\r') && (buf[newline] != '\n')) + while ( (newline < pp->buffer_pos) && + (buf[newline] != '\r') && + (buf[newline] != '\n') ) newline++; if (newline == pp->buffer_size) { @@ -663,18 +709,24 @@ pp->skip_rn = RN_OptN; buf[newline] = '\0'; if (MHD_str_equal_caseless_n_ ("Content-disposition: ", - buf, strlen ("Content-disposition: "))) + buf, + MHD_STATICSTR_LEN_ ("Content-disposition: "))) { - try_get_value (&buf[strlen ("Content-disposition: ")], - "name", &pp->content_name); - try_get_value (&buf[strlen ("Content-disposition: ")], - "filename", &pp->content_filename); + try_get_value (&buf[MHD_STATICSTR_LEN_ ("Content-disposition: ")], + "name", + &pp->content_name); + try_get_value (&buf[MHD_STATICSTR_LEN_ ("Content-disposition: ")], + "filename", + &pp->content_filename); } else { - try_match_header ("Content-type: ", buf, &pp->content_type); + try_match_header ("Content-type: ", + buf, + &pp->content_type); try_match_header ("Content-Transfer-Encoding: ", - buf, &pp->content_transfer_encoding); + buf, + &pp->content_transfer_encoding); } (*ioffptr) += newline + 1; return MHD_YES; @@ -716,21 +768,27 @@ { while (newline + 4 < pp->buffer_pos) { - r = memchr (&buf[newline], '\r', pp->buffer_pos - newline - 4); + r = memchr (&buf[newline], + '\r', + pp->buffer_pos - newline - 4); if (NULL == r) { newline = pp->buffer_pos - 4; break; } newline = r - buf; - if (0 == memcmp ("\r\n--", &buf[newline], 4)) + if (0 == memcmp ("\r\n--", + &buf[newline], + 4)) break; newline++; } if (newline + pp->blen + 4 <= pp->buffer_pos) { /* can check boundary */ - if (0 != memcmp (&buf[newline + 4], boundary, pp->blen)) + if (0 != memcmp (&buf[newline + 4], + boundary, + pp->blen)) { /* no boundary, "\r\n--" is part of content, skip */ newline += 4; @@ -753,7 +811,8 @@ /* cannot check for boundary, process content that we have and check again later; except, if we have no content, abort (out of memory) */ - if ((0 == newline) && (pp->buffer_pos == pp->buffer_size)) + if ( (0 == newline) && + (pp->buffer_pos == pp->buffer_size) ) { pp->state = PP_Error; return MHD_NO; @@ -772,7 +831,9 @@ pp->content_filename, pp->content_type, pp->content_transfer_encoding, - buf, pp->value_offset, newline)) ) + buf, + pp->value_offset, + newline)) ) { pp->state = PP_Error; return MHD_NO; @@ -791,24 +852,26 @@ static void free_unmarked (struct MHD_PostProcessor *pp) { - if ((NULL != pp->content_name) && (0 == (pp->have & NE_content_name))) + if ( (NULL != pp->content_name) && + (0 == (pp->have & NE_content_name)) ) { free (pp->content_name); pp->content_name = NULL; } - if ((NULL != pp->content_type) && (0 == (pp->have & NE_content_type))) + if ( (NULL != pp->content_type) && + (0 == (pp->have & NE_content_type)) ) { free (pp->content_type); pp->content_type = NULL; } - if ((NULL != pp->content_filename) && - (0 == (pp->have & NE_content_filename))) + if ( (NULL != pp->content_filename) && + (0 == (pp->have & NE_content_filename)) ) { free (pp->content_filename); pp->content_filename = NULL; } - if ((NULL != pp->content_transfer_encoding) && - (0 == (pp->have & NE_content_transfer_encoding))) + if ( (NULL != pp->content_transfer_encoding) && + (0 == (pp->have & NE_content_transfer_encoding)) ) { free (pp->content_transfer_encoding); pp->content_transfer_encoding = NULL; @@ -839,18 +902,23 @@ ioff = 0; poff = 0; state_changed = 1; - while ((poff < post_data_len) || - ((pp->buffer_pos > 0) && (state_changed != 0))) + while ( (poff < post_data_len) || + ( (pp->buffer_pos > 0) && + (0 != state_changed) ) ) { /* first, move as much input data as possible to our internal buffer */ max = pp->buffer_size - pp->buffer_pos; if (max > post_data_len - poff) max = post_data_len - poff; - memcpy (&buf[pp->buffer_pos], &post_data[poff], max); + memcpy (&buf[pp->buffer_pos], + &post_data[poff], + max); poff += max; pp->buffer_pos += max; - if ((max == 0) && (state_changed == 0) && (poff < post_data_len)) + if ( (0 == max) && + (0 == state_changed) && + (poff < post_data_len) ) { pp->state = PP_Error; return MHD_NO; /* out of memory */ @@ -882,7 +950,8 @@ case RN_Full: if (buf[0] == '\r') { - if ((pp->buffer_pos > 1) && (buf[1] == '\n')) + if ( (pp->buffer_pos > 1) && + ('\n' == buf[1]) ) { pp->skip_rn = RN_Inactive; ioff += 2; @@ -940,14 +1009,16 @@ pp->boundary, pp->blen, &ioff, - PP_ProcessEntryHeaders, PP_Done); + PP_ProcessEntryHeaders, + PP_Done); break; case PP_NextBoundary: if (MHD_NO == find_boundary (pp, pp->boundary, pp->blen, &ioff, - PP_ProcessEntryHeaders, PP_Done)) + PP_ProcessEntryHeaders, + PP_Done)) { if (pp->state == PP_Error) return MHD_NO; @@ -957,7 +1028,9 @@ case PP_ProcessEntryHeaders: pp->must_ikvi = MHD_YES; if (MHD_NO == - process_multipart_headers (pp, &ioff, PP_PerformCheckMultipart)) + process_multipart_headers (pp, + &ioff, + PP_PerformCheckMultipart)) { if (pp->state == PP_Error) return MHD_NO; @@ -967,20 +1040,21 @@ state_changed = 1; break; case PP_PerformCheckMultipart: - if ((pp->content_type != NULL) && - (MHD_str_equal_caseless_n_ (pp->content_type, - "multipart/mixed", - strlen ("multipart/mixed")))) - { - pp->nested_boundary = strstr (pp->content_type, "boundary="); - if (pp->nested_boundary == NULL) + if ( (NULL != pp->content_type) && + (MHD_str_equal_caseless_n_ (pp->content_type, + "multipart/mixed", + MHD_STATICSTR_LEN_ ("multipart/mixed")))) + { + pp->nested_boundary = strstr (pp->content_type, + "boundary="); + if (NULL == pp->nested_boundary) { pp->state = PP_Error; return MHD_NO; } pp->nested_boundary = - strdup (&pp->nested_boundary[strlen ("boundary=")]); - if (pp->nested_boundary == NULL) + strdup (&pp->nested_boundary[MHD_STATICSTR_LEN_ ("boundary=")]); + if (NULL == pp->nested_boundary) { /* out of memory */ pp->state = PP_Error; @@ -1016,7 +1090,7 @@ /* clean up state of one multipart form-data element! */ pp->have = NE_none; free_unmarked (pp); - if (pp->nested_boundary != NULL) + if (NULL != pp->nested_boundary) { free (pp->nested_boundary); pp->nested_boundary = NULL; @@ -1025,7 +1099,7 @@ state_changed = 1; break; case PP_Nested_Init: - if (pp->nested_boundary == NULL) + if (NULL == pp->nested_boundary) { pp->state = PP_Error; return MHD_NO; @@ -1046,13 +1120,13 @@ /* remember what headers were given globally */ pp->have = NE_none; - if (pp->content_name != NULL) + if (NULL != pp->content_name) pp->have |= NE_content_name; - if (pp->content_type != NULL) + if (NULL != pp->content_type) pp->have |= NE_content_type; - if (pp->content_filename != NULL) + if (NULL != pp->content_filename) pp->have |= NE_content_filename; - if (pp->content_transfer_encoding != NULL) + if (NULL != pp->content_transfer_encoding) pp->have |= NE_content_transfer_encoding; pp->state = PP_Nested_ProcessEntryHeaders; state_changed = 1; @@ -1060,7 +1134,8 @@ case PP_Nested_ProcessEntryHeaders: pp->value_offset = 0; if (MHD_NO == - process_multipart_headers (pp, &ioff, + process_multipart_headers (pp, + &ioff, PP_Nested_ProcessValueToBoundary)) { if (pp->state == PP_Error) @@ -1089,21 +1164,28 @@ state_changed = 1; break; default: - mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); /* should never happen! */ + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); /* should never happen! */ } AGAIN: if (ioff > 0) { - memmove (buf, &buf[ioff], pp->buffer_pos - ioff); + memmove (buf, + &buf[ioff], + pp->buffer_pos - ioff); pp->buffer_pos -= ioff; ioff = 0; state_changed = 1; } } END: - if (ioff != 0) + if (0 != ioff) { - memmove (buf, &buf[ioff], pp->buffer_pos - ioff); + memmove (buf, + &buf[ioff], + pp->buffer_pos - ioff); pp->buffer_pos -= ioff; } if (poff < post_data_len) @@ -1130,18 +1212,25 @@ */ int MHD_post_process (struct MHD_PostProcessor *pp, - const char *post_data, size_t post_data_len) + const char *post_data, + size_t post_data_len) { if (0 == post_data_len) return MHD_YES; if (NULL == pp) return MHD_NO; - if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, pp->encoding, - strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) - return post_process_urlencoded (pp, post_data, post_data_len); - if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, pp->encoding, - strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) - return post_process_multipart (pp, post_data, post_data_len); + if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, + pp->encoding, + MHD_STATICSTR_LEN_(MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) + return post_process_urlencoded (pp, + post_data, + post_data_len); + if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, + pp->encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) + return post_process_multipart (pp, + post_data, + post_data_len); /* this should never be reached */ return MHD_NO; } @@ -1169,20 +1258,22 @@ /* key without terminated value left at the end of the buffer; fake receiving a termination character to ensure it is also processed */ - post_process_urlencoded (pp, "\n", 1); + post_process_urlencoded (pp, + "\n", + 1); } /* These internal strings need cleaning up since the post-processing may have been interrupted at any stage */ - if ((pp->xbuf_pos > 0) || - ( (pp->state != PP_Done) && - (pp->state != PP_ExpectNewLine))) + if ( (pp->xbuf_pos > 0) || + ( (pp->state != PP_Done) && + (pp->state != PP_ExpectNewLine) ) ) ret = MHD_NO; else ret = MHD_YES; pp->have = NE_none; free_unmarked (pp); - if (pp->nested_boundary != NULL) + if (NULL != pp->nested_boundary) free (pp->nested_boundary); free (pp); return ret; diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/reason_phrase.c libmicrohttpd-0.9.55/src/microhttpd/reason_phrase.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/reason_phrase.c 2015-08-21 22:08:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/reason_phrase.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007, 2011 Christian Grothoff + Copyright (C) 2007, 2011, 2017 Christian Grothoff, Karlson2k (Evgeny Grin) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -22,15 +22,18 @@ * @brief Tables of the string response phrases * @author Elliot Glaysher * @author Christian Grothoff (minor code clean up) + * @author Karlson2k (Evgeny Grin) */ #include "platform.h" #include "microhttpd.h" #ifndef NULL -#define NULL (void*)0 +#define NULL ((void*)0) #endif -static const char *invalid_hundred[] = { NULL }; +static const char *const invalid_hundred[] = { + NULL +}; static const char *const one_hundred[] = { "Continue", @@ -46,18 +49,38 @@ "No Content", "Reset Content", "Partial Content", - "Multi Status" + "Multi-Status", + "Already Reported", + "Unknown", + "Unknown", /* 210 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 215 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 220 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 225 */ + "IM Used" }; static const char *const three_hundred[] = { "Multiple Choices", "Moved Permanently", - "Moved Temporarily", + "Found", "See Other", "Not Modified", "Use Proxy", "Switch Proxy", - "Temporary Redirect" + "Temporary Redirect", + "Permanent Redirect" }; static const char *const four_hundred[] = { @@ -69,30 +92,30 @@ "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", - "Request Time-out", + "Request Timeout", "Conflict", "Gone", "Length Required", "Precondition Failed", - "Request Entity Too Large", - "Request-URI Too Large", + "Payload Too Large", + "URI Too Long", "Unsupported Media Type", - "Requested Range Not Satisfiable", + "Range Not Satisfiable", "Expectation Failed", "Unknown", "Unknown", "Unknown", /* 420 */ - "Unknown", + "Misdirected Request", "Unprocessable Entity", "Locked", "Failed Dependency", "Unordered Collection", "Upgrade Required", "Unknown", - "Unknown", - "Unknown", + "Precondition Required", + "Too Many Requests", "Unknown", /* 430 */ - "Unknown", + "Request Header Fields Too Large", "Unknown", "Unknown", "Unknown", @@ -120,19 +143,20 @@ "Not Implemented", "Bad Gateway", "Service Unavailable", - "Gateway Time-out", - "HTTP Version not supported", + "Gateway Timeout", + "HTTP Version Not Supported", "Variant Also Negotiates", "Insufficient Storage", - "Unknown", + "Loop Detected", "Bandwidth Limit Exceeded", - "Not Extended" + "Not Extended", + "Network Authentication Required" }; struct MHD_Reason_Block { - unsigned int max; + size_t max; const char *const*data; }; diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/response.c libmicrohttpd-0.9.55/src/microhttpd/response.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/response.c 2015-08-30 14:54:17.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/response.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007, 2009, 2010 Daniel Pittman and Christian Grothoff + Copyright (C) 2007, 2009, 2010, 2016, 2017 Daniel Pittman and Christian Grothoff This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,19 +16,34 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - /** * @file response.c * @brief Methods for managing response objects * @author Daniel Pittman * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) */ #define MHD_NO_DEPRECATION 1 +#include "mhd_options.h" +#ifdef HAVE_SYS_IOCTL_H +#include +#endif /* HAVE_SYS_IOCTL_H */ +#ifdef _WIN32 +#include +#endif /* _WIN32 */ + #include "internal.h" #include "response.h" #include "mhd_limits.h" +#include "mhd_sockets.h" +#include "mhd_itc.h" +#include "mhd_str.h" +#include "connection.h" +#include "memorypool.h" +#include "mhd_compat.h" + #if defined(_WIN32) && defined(MHD_W32_MUTEX_) #ifndef WIN32_LEAN_AND_MEAN @@ -61,8 +76,8 @@ if ( (NULL == response) || (NULL == header) || (NULL == content) || - (0 == strlen (header)) || - (0 == strlen (content)) || + (0 == header[0]) || + (0 == content[0]) || (NULL != strchr (header, '\t')) || (NULL != strchr (header, '\r')) || (NULL != strchr (header, '\n')) || @@ -101,7 +116,8 @@ */ int MHD_add_response_header (struct MHD_Response *response, - const char *header, const char *content) + const char *header, + const char *content) { return add_response_entry (response, MHD_HEADER_KIND, @@ -121,7 +137,8 @@ */ int MHD_add_response_footer (struct MHD_Response *response, - const char *footer, const char *content) + const char *footer, + const char *content) { return add_response_entry (response, MHD_FOOTER_KIND, @@ -147,14 +164,17 @@ struct MHD_HTTP_Header *pos; struct MHD_HTTP_Header *prev; - if ( (NULL == header) || (NULL == content) ) + if ( (NULL == header) || + (NULL == content) ) return MHD_NO; prev = NULL; pos = response->first_header; while (pos != NULL) { - if ((0 == strcmp (header, pos->header)) && - (0 == strcmp (content, pos->value))) + if ((0 == strcmp (header, + pos->header)) && + (0 == strcmp (content, + pos->value))) { free (pos->header); free (pos->value); @@ -184,7 +204,8 @@ */ int MHD_get_response_headers (struct MHD_Response *response, - MHD_KeyValueIterator iterator, void *iterator_cls) + MHD_KeyValueIterator iterator, + void *iterator_cls) { struct MHD_HTTP_Header *pos; int numHeaders = 0; @@ -194,7 +215,9 @@ numHeaders++; if ((NULL != iterator) && (MHD_YES != iterator (iterator_cls, - pos->kind, pos->header, pos->value))) + pos->kind, + pos->header, + pos->value))) break; } return numHeaders; @@ -218,11 +241,47 @@ if (NULL == key) return NULL; for (pos = response->first_header; NULL != pos; pos = pos->next) - if (0 == strcmp (key, pos->header)) - return pos->value; + { + if ( MHD_str_equal_caseless_ (pos->header, key) ) + return pos->value; + } return NULL; } +/** + * Check whether response header contains particular token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param response the response to query + * @param key header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +bool +MHD_check_response_header_token_ci (const struct MHD_Response *response, + const char *key, + const char *token, + size_t token_len) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == key || 0 == key[0] || NULL == token || 0 == token[0]) + return false; + + for (pos = response->first_header; NULL != pos; pos = pos->next) + { + if ( (pos->kind == MHD_HEADER_KIND) && + MHD_str_equal_caseless_ (pos->header, key) && + MHD_str_has_token_caseless_ (pos->value, token, token_len) ) + return true; + } + return false; +} + /** * Create a response object. The response object can be extended with @@ -251,13 +310,12 @@ if ((NULL == crc) || (0 == block_size)) return NULL; - if (NULL == (response = malloc (sizeof (struct MHD_Response) + block_size))) + if (NULL == (response = MHD_calloc_ (1, sizeof (struct MHD_Response) + block_size))) return NULL; - memset (response, 0, sizeof (struct MHD_Response)); response->fd = -1; response->data = (void *) &response[1]; response->data_buffer_size = block_size; - if (MHD_YES != MHD_mutex_create_ (&response->mutex)) + if (! MHD_mutex_init_ (&response->mutex)) { free (response); return NULL; @@ -316,46 +374,80 @@ * @return number of bytes written */ static ssize_t -file_reader (void *cls, uint64_t pos, char *buf, size_t max) +file_reader (void *cls, + uint64_t pos, + char *buf, + size_t max) { struct MHD_Response *response = cls; +#ifndef _WIN32 ssize_t n; +#else /* _WIN32 */ + const HANDLE fh = (HANDLE) _get_osfhandle (response->fd); +#endif /* _WIN32 */ const int64_t offset64 = (int64_t)(pos + response->fd_off); if (offset64 < 0) return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ +#ifndef _WIN32 + if (max > SSIZE_MAX) + max = SSIZE_MAX; /* Clamp to maximum return value. */ + +#if defined(HAVE_PREAD64) + n = pread64(response->fd, buf, max, offset64); +#elif defined(HAVE_PREAD) + if ( (sizeof(off_t) < sizeof (uint64_t)) && + (offset64 > (uint64_t)INT32_MAX) ) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Read at required position is not possible. */ + + n = pread(response->fd, buf, max, (off_t) offset64); +#else /* ! HAVE_PREAD */ #if defined(HAVE_LSEEK64) - if (lseek64 (response->fd, offset64, SEEK_SET) != offset64) - return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ -#elif defined(HAVE___LSEEKI64) - if (_lseeki64 (response->fd, offset64, SEEK_SET) != offset64) + if (lseek64 (response->fd, + offset64, + SEEK_SET) != offset64) return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ -#else /* !HAVE___LSEEKI64 */ - if (sizeof(off_t) < sizeof(uint64_t) && offset64 > (uint64_t)INT32_MAX) +#else /* ! HAVE_LSEEK64 */ + if ( (sizeof(off_t) < sizeof (uint64_t)) && + (offset64 > (uint64_t)INT32_MAX) ) return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ - if (lseek (response->fd, (off_t)offset64, SEEK_SET) != (off_t)offset64) + if (lseek (response->fd, + (off_t) offset64, + SEEK_SET) != (off_t) offset64) return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ -#endif - -#ifndef _WIN32 - if (max > SSIZE_MAX) - max = SSIZE_MAX; - - n = read (response->fd, buf, max); -#else /* _WIN32 */ - if (max > INT32_MAX) - max = INT32_MAX; - - n = read (response->fd, buf, (unsigned int)max); -#endif /* _WIN32 */ +#endif /* ! HAVE_LSEEK64 */ + n = read (response->fd, + buf, + max); +#endif /* ! HAVE_PREAD */ if (0 == n) return MHD_CONTENT_READER_END_OF_STREAM; if (n < 0) return MHD_CONTENT_READER_END_WITH_ERROR; return n; +#else /* _WIN32 */ + if (INVALID_HANDLE_VALUE == fh) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Value of 'response->fd' is not valid. */ + else + { + OVERLAPPED f_ol = {0, 0, {{0, 0}}, 0}; /* Initialize to zero. */ + ULARGE_INTEGER pos_uli; + DWORD toRead = (max > INT32_MAX) ? INT32_MAX : (DWORD) max; + DWORD resRead; + + pos_uli.QuadPart = (uint64_t) offset64; /* Simple transformation 64bit -> 2x32bit. */ + f_ol.Offset = pos_uli.LowPart; + f_ol.OffsetHigh = pos_uli.HighPart; + if (! ReadFile(fh, (void*)buf, toRead, &resRead, &f_ol)) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Read error. */ + if (0 == resRead) + return MHD_CONTENT_READER_END_OF_STREAM; + return (ssize_t) resRead; + } +#endif /* _WIN32 */ } @@ -397,7 +489,9 @@ int fd, off_t offset) { - return MHD_create_response_from_fd_at_offset64 (size, fd, offset); + return MHD_create_response_from_fd_at_offset64 (size, + fd, + offset); } @@ -425,11 +519,15 @@ struct MHD_Response *response; #if !defined(HAVE___LSEEKI64) && !defined(HAVE_LSEEK64) - if (sizeof(uint64_t) > sizeof(off_t) && - (size > (uint64_t)INT32_MAX || offset > (uint64_t)INT32_MAX || (size + offset) >= (uint64_t)INT32_MAX)) + if ( (sizeof(uint64_t) > sizeof(off_t)) && + ( (size > (uint64_t)INT32_MAX) || + (offset > (uint64_t)INT32_MAX) || + ((size + offset) >= (uint64_t)INT32_MAX) ) ) return NULL; #endif - if ((int64_t)size < 0 || (int64_t)offset < 0 || (int64_t)(size + offset) < 0) + if ( ((int64_t)size < 0) || + ((int64_t)offset < 0) || + ((int64_t)(size + offset) < 0) ) return NULL; response = MHD_create_response_from_callback (size, @@ -459,7 +557,9 @@ MHD_create_response_from_fd (size_t size, int fd) { - return MHD_create_response_from_fd_at_offset64 (size, fd, 0); + return MHD_create_response_from_fd_at_offset64 (size, + fd, + 0); } @@ -477,10 +577,12 @@ * @ingroup response */ _MHD_EXTERN struct MHD_Response * -MHD_create_response_from_fd64(uint64_t size, - int fd) +MHD_create_response_from_fd64 (uint64_t size, + int fd) { - return MHD_create_response_from_fd_at_offset64 (size, fd, 0); + return MHD_create_response_from_fd_at_offset64 (size, + fd, + 0); } @@ -500,18 +602,19 @@ */ struct MHD_Response * MHD_create_response_from_data (size_t size, - void *data, int must_free, int must_copy) + void *data, + int must_free, + int must_copy) { struct MHD_Response *response; void *tmp; if ((NULL == data) && (size > 0)) return NULL; - if (NULL == (response = malloc (sizeof (struct MHD_Response)))) + if (NULL == (response = MHD_calloc_ (1, sizeof (struct MHD_Response)))) return NULL; - memset (response, 0, sizeof (struct MHD_Response)); response->fd = -1; - if (MHD_YES != MHD_mutex_create_ (&response->mutex)) + if (! MHD_mutex_init_ (&response->mutex)) { free (response); return NULL; @@ -520,7 +623,7 @@ { if (NULL == (tmp = malloc (size))) { - (void) MHD_mutex_destroy_ (&response->mutex); + MHD_mutex_destroy_chk_ (&response->mutex); free (response); return NULL; } @@ -528,9 +631,11 @@ must_free = MHD_YES; data = tmp; } - response->crc = NULL; - response->crfc = must_free ? &free : NULL; - response->crc_cls = must_free ? data : NULL; + if (must_free) + { + response->crfc = &free; + response->crc_cls = data; + } response->reference_count = 1; response->total_size = size; response->data = data; @@ -561,11 +666,388 @@ } +#ifdef UPGRADE_SUPPORT +/** + * This connection-specific callback is provided by MHD to + * applications (unusual) during the #MHD_UpgradeHandler. + * It allows applications to perform 'special' actions on + * the underlying socket from the upgrade. + * + * @param urh the handle identifying the connection to perform + * the upgrade @a action on. + * @param action which action should be performed + * @param ... arguments to the action (depends on the action) + * @return #MHD_NO on error, #MHD_YES on success + */ +_MHD_EXTERN int +MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, + enum MHD_UpgradeAction action, + ...) +{ + struct MHD_Connection *connection; + struct MHD_Daemon *daemon; + + if (NULL == urh) + return MHD_NO; + connection = urh->connection; + + /* Precaution checks on external data. */ + if (NULL == connection) + return MHD_NO; + daemon = connection->daemon; + if (NULL == daemon) + return MHD_NO; + + switch (action) + { + case MHD_UPGRADE_ACTION_CLOSE: + if (urh->was_closed) + return MHD_NO; /* Already closed. */ + + /* transition to special 'closed' state for start of cleanup */ +#ifdef HTTPS_SUPPORT + if (0 != (daemon->options & MHD_USE_TLS) ) + { + /* signal that app is done by shutdown() of 'app' socket */ + /* Application will not use anyway this socket after this command. */ + shutdown (urh->app.socket, + SHUT_RDWR); + } +#endif /* HTTPS_SUPPORT */ + EXTRA_CHECK (MHD_CONNECTION_UPGRADE == connection->state); + urh->was_closed = true; + /* As soon as connection will be marked with BOTH + * 'urh->was_closed' AND 'urh->clean_ready', it will + * be moved to cleanup list by MHD_resume_connection(). */ + MHD_resume_connection (connection); + return MHD_YES; + default: + /* we don't understand this one */ + return MHD_NO; + } +} + + +/** + * We are done sending the header of a given response to the client. + * Now it is time to perform the upgrade and hand over the connection + * to the application. + * @remark To be called only from thread that process connection's + * recv(), send() and response. Must be called right after sending + * response headers. + * + * @param response the response that was created for an upgrade + * @param connection the specific connection we are upgrading + * @return #MHD_YES on success, #MHD_NO on failure (will cause + * connection to be closed) + */ +int +MHD_response_execute_upgrade_ (struct MHD_Response *response, + struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_UpgradeResponseHandle *urh; + size_t rbo; + + if (0 == (daemon->options & MHD_ALLOW_UPGRADE)) + return MHD_NO; + + if (NULL == + MHD_get_response_header (response, + MHD_HTTP_HEADER_UPGRADE)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Invalid response for upgrade: application failed to set the 'Upgrade' header!\n")); +#endif + return MHD_NO; + } + + urh = MHD_calloc_ (1, sizeof (struct MHD_UpgradeResponseHandle)); + if (NULL == urh) + return MHD_NO; + urh->connection = connection; + rbo = connection->read_buffer_offset; + connection->read_buffer_offset = 0; +#ifdef HTTPS_SUPPORT + if (0 != (daemon->options & MHD_USE_TLS) ) + { + struct MemoryPool *pool; + size_t avail; + char *buf; + MHD_socket sv[2]; +#if defined(MHD_socket_nosignal_) || !defined(MHD_socket_pair_nblk_) + int res1; + int res2; +#endif /* MHD_socket_nosignal_ || !MHD_socket_pair_nblk_ */ + +#ifdef MHD_socket_pair_nblk_ + if (! MHD_socket_pair_nblk_ (sv)) + { + free (urh); + return MHD_NO; + } +#else /* !MHD_socket_pair_nblk_ */ + if (! MHD_socket_pair_ (sv)) + { + free (urh); + return MHD_NO; + } + res1 = MHD_socket_nonblocking_(sv[0]); + res2 = MHD_socket_nonblocking_(sv[1]); + if ( (! res1) || (! res2) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to make loopback sockets non-blocking.\n")); +#endif + if (! res2) + { + /* Socketpair cannot be used. */ + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + } +#endif /* !MHD_socket_pair_nblk_ */ +#ifdef MHD_socket_nosignal_ + res1 = MHD_socket_nosignal_(sv[0]); + res2 = MHD_socket_nosignal_(sv[1]); + if ( (! res1) || (! res2) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set SO_NOSIGPIPE on loopback sockets.\n")); +#endif +#ifndef MSG_NOSIGNAL + if (!res2) + { + /* Socketpair cannot be used. */ + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } +#endif /* ! MSG_NOSIGNAL */ + } +#endif /* MHD_socket_nosignal_ */ + if ( (! MHD_SCKT_FD_FITS_FDSET_ (sv[1], + NULL)) && + (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Socketpair descriptor larger than FD_SETSIZE: %d > %d\n"), + (int) sv[1], + (int) FD_SETSIZE); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + urh->app.socket = sv[0]; + urh->app.urh = urh; + urh->app.celi = MHD_EPOLL_STATE_UNREADY; + urh->mhd.socket = sv[1]; + urh->mhd.urh = urh; + urh->mhd.celi = MHD_EPOLL_STATE_UNREADY; + pool = connection->pool; + avail = MHD_pool_get_free (pool); + if (avail < RESERVE_EBUF_SIZE) + { + /* connection's pool is totally at the limit, + use our 'emergency' buffer of #RESERVE_EBUF_SIZE bytes. */ + avail = RESERVE_EBUF_SIZE; + buf = urh->e_buf; + } + else + { + /* Normal case: grab all remaining memory from the + connection's pool for the IO buffers; the connection + certainly won't need it anymore as we've upgraded + to another protocol. */ + buf = MHD_pool_allocate (pool, + avail, + MHD_NO); + } + /* use half the buffer for inbound, half for outbound */ + urh->in_buffer_size = avail / 2; + urh->out_buffer_size = avail - urh->in_buffer_size; + urh->in_buffer = buf; + urh->out_buffer = &buf[urh->in_buffer_size]; +#ifdef EPOLL_SUPPORT + /* Launch IO processing by the event loop */ + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + /* We're running with epoll(), need to add the sockets + to the event set of the daemon's `epoll_upgrade_fd` */ + struct epoll_event event; + + EXTRA_CHECK (-1 != daemon->epoll_upgrade_fd); + /* First, add network socket */ + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = &urh->app; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_ADD, + connection->socket_fd, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + + /* Second, add our end of the UNIX socketpair() */ + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = &urh->mhd; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_ADD, + urh->mhd.socket, + &event)) + { + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI; + event.data.ptr = &urh->app; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + connection->socket_fd, + &event)) + MHD_PANIC (_("Error cleaning up while handling epoll error")); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + EDLL_insert (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = true; + } +#endif /* EPOLL_SUPPORT */ + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION) ) + { + /* This takes care of further processing for most event loops: + simply add to DLL for bi-direcitonal processing */ + DLL_insert (daemon->urh_head, + daemon->urh_tail, + urh); + } + /* In thread-per-connection mode, thread will switch to forwarding once + * connection.urh is not NULL and connection.state == MHD_CONNECTION_UPGRADE. + */ + } + else + { + urh->app.socket = MHD_INVALID_SOCKET; + urh->mhd.socket = MHD_INVALID_SOCKET; + /* Non-TLS connection do not hold any additional resources. */ + urh->clean_ready = true; + } +#else /* ! HTTPS_SUPPORT */ + urh->clean_ready = true; +#endif /* ! HTTPS_SUPPORT */ + connection->urh = urh; + /* As far as MHD's event loops are concerned, this connection is + suspended; it will be resumed once application is done by the + #MHD_upgrade_action() function */ + internal_suspend_connection_ (connection); + + /* hand over socket to application */ + response->upgrade_handler (response->upgrade_handler_cls, + connection, + connection->client_context, + connection->read_buffer, + rbo, +#ifdef HTTPS_SUPPORT + (0 == (daemon->options & MHD_USE_TLS) ) ? + connection->socket_fd : urh->app.socket, +#else /* ! HTTPS_SUPPORT */ + connection->socket_fd, +#endif /* ! HTTPS_SUPPORT */ + urh); + return MHD_YES; +} + + +/** + * Create a response object that can be used for 101 UPGRADE + * responses, for example to implement WebSockets. After sending the + * response, control over the data stream is given to the callback (which + * can then, for example, start some bi-directional communication). + * If the response is queued for multiple connections, the callback + * will be called for each connection. The callback + * will ONLY be called after the response header was successfully passed + * to the OS; if there are communication errors before, the usual MHD + * connection error handling code will be performed. + * + * Setting the correct HTTP code (i.e. MHD_HTTP_SWITCHING_PROTOCOLS) + * and setting correct HTTP headers for the upgrade must be done + * manually (this way, it is possible to implement most existing + * WebSocket versions using this API; in fact, this API might be useful + * for any protocol switch, not just WebSockets). Note that + * draft-ietf-hybi-thewebsocketprotocol-00 cannot be implemented this + * way as the header "HTTP/1.1 101 WebSocket Protocol Handshake" + * cannot be generated; instead, MHD will always produce "HTTP/1.1 101 + * Switching Protocols" (if the response code 101 is used). + * + * As usual, the response object can be extended with header + * information and then be used any number of times (as long as the + * header information is not connection-specific). + * + * @param upgrade_handler function to call with the 'upgraded' socket + * @param upgrade_handler_cls closure for @a upgrade_handler + * @return NULL on error (i.e. invalid arguments, out of memory) + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, + void *upgrade_handler_cls) +{ + struct MHD_Response *response; + + if (NULL == upgrade_handler) + return NULL; /* invalid request */ + response = MHD_calloc_ (1, sizeof (struct MHD_Response)); + if (NULL == response) + return NULL; + if (! MHD_mutex_init_ (&response->mutex)) + { + free (response); + return NULL; + } + response->upgrade_handler = upgrade_handler; + response->upgrade_handler_cls = upgrade_handler_cls; + response->total_size = MHD_SIZE_UNKNOWN; + response->reference_count = 1; + if (MHD_NO == + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "Upgrade")) + { + MHD_destroy_response (response); + return NULL; + } + return response; +} +#endif /* UPGRADE_SUPPORT */ + + /** * Destroy a response object and associated resources. Note that * libmicrohttpd may keep some of the resources around if the response * is still in the queue for some clients, so the memory may not - * necessarily be freed immediatley. + * necessarily be freed immediately. * * @param response response to destroy * @ingroup response @@ -577,15 +1059,15 @@ if (NULL == response) return; - (void) MHD_mutex_lock_ (&response->mutex); + MHD_mutex_lock_chk_ (&response->mutex); if (0 != --(response->reference_count)) { - (void) MHD_mutex_unlock_ (&response->mutex); + MHD_mutex_unlock_chk_ (&response->mutex); return; } - (void) MHD_mutex_unlock_ (&response->mutex); - (void) MHD_mutex_destroy_ (&response->mutex); - if (response->crfc != NULL) + MHD_mutex_unlock_chk_ (&response->mutex); + MHD_mutex_destroy_chk_ (&response->mutex); + if (NULL != response->crfc) response->crfc (response->crc_cls); while (NULL != response->first_header) { @@ -599,12 +1081,17 @@ } +/** + * Increments the reference counter for the @a response. + * + * @param response object to modify + */ void MHD_increment_response_rc (struct MHD_Response *response) { - (void) MHD_mutex_lock_ (&response->mutex); + MHD_mutex_lock_chk_ (&response->mutex); (response->reference_count)++; - (void) MHD_mutex_unlock_ (&response->mutex); + MHD_mutex_unlock_chk_ (&response->mutex); } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/response.h libmicrohttpd-0.9.55/src/microhttpd/response.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/response.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/response.h 2017-05-28 22:34:00.000000000 +0200 @@ -28,11 +28,30 @@ #define RESPONSE_H /** - * Increment response RC. Should this be part of the - * public API? + * Increments the reference counter for the @a response. + * + * @param response object to modify */ void MHD_increment_response_rc (struct MHD_Response *response); +/** + * We are done sending the header of a given response + * to the client. Now it is time to perform the upgrade + * and hand over the connection to the application. + * @remark To be called only from thread that process connection's + * recv(), send() and response. Must be called right after sending + * response headers. + * + * @param response the response that was created for an upgrade + * @param connection the specific connection we are upgrading + * @return #MHD_YES on success, #MHD_NO on failure (will cause + * connection to be closed) + */ +int +MHD_response_execute_upgrade_ (struct MHD_Response *response, + struct MHD_Connection *connection); + + #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/sysfdsetsize.c libmicrohttpd-0.9.55/src/microhttpd/sysfdsetsize.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/sysfdsetsize.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/sysfdsetsize.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,80 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/sysfdsetsize.c + * @brief Helper for obtaining FD_SETSIZE system default value + * @author Karlson2k (Evgeny Grin) + */ + + +#include "MHD_config.h" + +#ifdef FD_SETSIZE +/* FD_SETSIZE was defined before system headers. */ +/* To get system value of FD_SETSIZE, undefine FD_SETSIZE + here. */ +#undef FD_SETSIZE +#endif /* FD_SETSIZE */ + +#include +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +#include +#endif /* OS_VXWORKS */ +#if HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ +#if HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#if HAVE_SYS_TIME_H +#include +#endif /* HAVE_SYS_TIME_H */ +#if HAVE_TIME_H +#include +#endif /* HAVE_TIME_H */ +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#if HAVE_SYS_SOCKET_H +#include +#endif /* HAVE_SYS_SOCKET_H */ + +#if defined(_WIN32) && !defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef FD_SETSIZE +#error FD_SETSIZE must be defined in system headers +#endif /* !FD_SETSIZE */ + +#include "sysfdsetsize.h" + +/** + * Get system default value of FD_SETSIZE + * @return system default value of FD_SETSIZE + */ +int +get_system_fdsetsize_value (void) +{ + return FD_SETSIZE; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/sysfdsetsize.h libmicrohttpd-0.9.55/src/microhttpd/sysfdsetsize.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/sysfdsetsize.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/sysfdsetsize.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,36 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/sysfdsetsize.h + * @brief Helper for obtaining FD_SETSIZE system default value + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef SYSFDSETSIZE_H +#define SYSFDSETSIZE_H 1 + +/** + * Get system default value of FD_SETSIZE + * @return system default value of FD_SETSIZE + */ +int +get_system_fdsetsize_value (void); + +#endif /* !SYSFDSETSIZE_H */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_daemon.c libmicrohttpd-0.9.55/src/microhttpd/test_daemon.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_daemon.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/test_daemon.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007 Christian Grothoff + Copyright (C) 2007, 2017 Christian Grothoff libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -40,24 +40,35 @@ { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_DEBUG, 0, NULL, NULL, NULL, NULL); - if (d != NULL) + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, NULL, NULL, NULL, NULL); + if (NULL != d) + { + fprintf (stderr, + "Succeeded at binding to port 0?\n"); return 1; + } return 0; } + static int -apc_nothing (void *cls, const struct sockaddr *addr, socklen_t addrlen) +apc_nothing (void *cls, + const struct sockaddr *addr, + socklen_t addrlen) { return MHD_NO; } + static int -apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) +apc_all (void *cls, + const struct sockaddr *addr, + socklen_t addrlen) { return MHD_YES; } + static int ahc_nothing (void *cls, struct MHD_Connection *connection, @@ -70,21 +81,29 @@ return MHD_NO; } + static int testStartStop () { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, - &apc_nothing, - NULL, &ahc_nothing, NULL, MHD_OPTION_END); - if (d == NULL) - return 2; + &apc_nothing, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 1080); + exit (77); + } MHD_stop_daemon (d); return 0; } + static int testExternalRun () { @@ -93,25 +112,36 @@ MHD_socket maxfd; int i; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1081, - &apc_all, NULL, &ahc_nothing, NULL, MHD_OPTION_END); - - if (d == NULL) - return 4; + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 1081); + exit (77); + } i = 0; while (i < 15) { maxfd = 0; FD_ZERO (&rs); if (MHD_YES != MHD_get_fdset (d, &rs, &rs, &rs, &maxfd)) - { - MHD_stop_daemon (d); - return 256; - } + { + MHD_stop_daemon (d); + fprintf (stderr, + "Failed in MHD_get_fdset()\n"); + return 256; + } if (MHD_run (d) == MHD_NO) { MHD_stop_daemon (d); + fprintf (stderr, + "Failed in MHD_run()\n"); return 8; } i++; @@ -120,48 +150,79 @@ return 0; } + static int testThread () { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SELECT_INTERNALLY, - 1082, - &apc_all, NULL, &ahc_nothing, NULL, MHD_OPTION_END); - if (d == NULL) - return 16; + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD, + 1082, + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 1082); + exit (77); + } if (MHD_run (d) != MHD_NO) - return 32; + { + fprintf (stderr, + "Failed in MHD_run()\n"); + return 32; + } MHD_stop_daemon (d); return 0; } + static int testMultithread () { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION, - 1083, - &apc_all, NULL, &ahc_nothing, NULL, MHD_OPTION_END); - if (d == NULL) - return 64; + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 1083, + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 1083); + exit (77); + } if (MHD_run (d) != MHD_NO) - return 128; + { + fprintf (stderr, + "Failed in MHD_run()\n"); + return 128; + } MHD_stop_daemon (d); return 0; } + int -main (int argc, char *const *argv) +main (int argc, + char *const *argv) { int errorCount = 0; + errorCount += testStartError (); errorCount += testStartStop (); errorCount += testExternalRun (); errorCount += testThread (); errorCount += testMultithread (); - if (errorCount != 0) - fprintf (stderr, "Error (code: %u)\n", errorCount); - return errorCount != 0; /* 0 == pass */ + if (0 != errorCount) + fprintf (stderr, + "Error (code: %u)\n", + errorCount); + return 0 != errorCount; /* 0 == pass */ } diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_helpers.h libmicrohttpd-0.9.55/src/microhttpd/test_helpers.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_helpers.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_helpers.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_helpers.h + * @brief Static functions and macros helpers for testsuite. + * @author Karlson2k (Evgeny Grin) + */ + +#include + +/** + * Check whether program name contains specific @a marker string. + * Only last component in pathname is checked for marker presence, + * all leading directories names (if any) are ignored. Directories + * separators are handled correctly on both non-W32 and W32 + * platforms. + * @param prog_name program name, may include path + * @param marker marker to look for. + * @return zero if any parameter is NULL or empty string or + * @prog_name ends with slash or @marker is not found in + * program name, non-zero if @maker is found in program + * name. + */ +static int +has_in_name(const char *prog_name, const char *marker) +{ + size_t name_pos; + size_t pos; + + if (!prog_name || !marker || !prog_name[0] || !marker[0]) + return 0; + + pos = 0; + name_pos = 0; + while (prog_name[pos]) + { + if ('/' == prog_name[pos]) + name_pos = pos + 1; +#ifdef _WIN32 + else if ('\\' == prog_name[pos]) + name_pos = pos + 1; +#endif /* _WIN32 */ + pos++; + } + if (name_pos == pos) + return 0; + return strstr(prog_name + name_pos, marker) != (char*)0; +} + +/** + * Check whether one of strings in array is equal to @a param. + * String @a argv[0] is ignored. + * @param argc number of strings in @a argv, as passed to main function + * @param argv array of strings, as passed to main function + * @param param parameter to look for. + * @return zero if @a argv is NULL, @a param is NULL or empty string, + * @a argc is less then 2 or @a param is not found in @a argv, + * non-zero if one of strings in @a argv is equal to @a param. + */ +static int +has_param(int argc, char * const argv[], const char * param) +{ + int i; + if (!argv || !param || !param[0]) + return 0; + + for(i = 1; i < argc; i++) + { + if(argv[i] && strcmp(argv[i], param) == 0) + return !0; + } + + return 0; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_http_reasons.c libmicrohttpd-0.9.55/src/microhttpd/test_http_reasons.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_http_reasons.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_http_reasons.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,131 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Karlson2k (Evgeny Grin) + + This test tool is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + This test tool is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_http_reasons.c + * @brief Unit tests for MHD_get_reason_phrase_for() function + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include "microhttpd.h" +#include "mhd_str.h" + +static int expect_result(int code, const char* expected) +{ + const char* const reason = MHD_get_reason_phrase_for(code); + if (MHD_str_equal_caseless_(reason, expected)) + return 0; + fprintf(stderr, "Incorrect reason returned for code %d:\n Returned: \"%s\" \tExpected: \"%s\"\n", + code, reason, expected); + return 1; +} + +static int expect_absent(int code) +{ + return expect_result(code, "unknown"); +} + +static int test_absent_codes(void) +{ + int errcount = 0; + errcount += expect_absent(0); + errcount += expect_absent(1); + errcount += expect_absent(50); + errcount += expect_absent(99); + errcount += expect_absent(600); + errcount += expect_absent(601); + errcount += expect_absent(900); + errcount += expect_absent(10000); + return errcount; +} + +static int test_1xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_CONTINUE, "continue"); + errcount += expect_result(MHD_HTTP_PROCESSING, "processing"); + errcount += expect_absent(110); + errcount += expect_absent(190); + return errcount; +} + +static int test_2xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_OK, "ok"); + errcount += expect_result(MHD_HTTP_ALREADY_REPORTED, "already reported"); + errcount += expect_absent(217); + errcount += expect_result(MHD_HTTP_IM_USED, "im used"); + errcount += expect_absent(230); + errcount += expect_absent(295); + return errcount; +} + +static int test_3xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); + errcount += expect_result(MHD_HTTP_SEE_OTHER, "see other"); + errcount += expect_result(MHD_HTTP_PERMANENT_REDIRECT, "permanent redirect"); + errcount += expect_absent(311); + errcount += expect_absent(399); + return errcount; +} + +static int test_4xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_BAD_REQUEST, "bad request"); + errcount += expect_result(MHD_HTTP_NOT_FOUND, "not found"); + errcount += expect_result(MHD_HTTP_URI_TOO_LONG, "uri too long"); + errcount += expect_result(MHD_HTTP_EXPECTATION_FAILED, "expectation failed"); + errcount += expect_result(MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, "request header fields too large"); + errcount += expect_absent(441); + errcount += expect_result(MHD_HTTP_NO_RESPONSE, "no response"); + errcount += expect_result(MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS, "unavailable for legal reasons"); + errcount += expect_absent(470); + errcount += expect_absent(493); + return errcount; +} + +static int test_5xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_INTERNAL_SERVER_ERROR, "internal server error"); + errcount += expect_result(MHD_HTTP_BAD_GATEWAY, "bad gateway"); + errcount += expect_result(MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED, "http version not supported"); + errcount += expect_result(MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED, "network authentication required"); + errcount += expect_absent(520); + errcount += expect_absent(597); + return errcount; +} + +int main(int argc, char * argv[]) +{ + int errcount = 0; + errcount += test_absent_codes(); + errcount += test_1xx(); + errcount += test_2xx(); + errcount += test_3xx(); + errcount += test_4xx(); + errcount += test_5xx(); + return errcount == 0 ? 0 : 1; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_postprocessor.c libmicrohttpd-0.9.55/src/microhttpd/test_postprocessor.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_postprocessor.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/test_postprocessor.c 2017-05-28 22:34:00.000000000 +0200 @@ -30,6 +30,7 @@ #include #include #include +#include "mhd_compat.h" #ifndef WINDOWS #include @@ -168,9 +169,9 @@ xdata[1] = 'x'; xdata[2] = '\r'; memcpy (&xdata[3], FORM_DATA, size); - size += 3; size = strlen (FORM_DATA); + size += 3; for (splitpoint = 1; splitpoint < size; splitpoint++) { want_off = FORM_START; diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_postprocessor_large.c libmicrohttpd-0.9.55/src/microhttpd/test_postprocessor_large.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_postprocessor_large.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/test_postprocessor_large.c 2017-05-28 22:34:00.000000000 +0200 @@ -27,6 +27,7 @@ #include "platform.h" #include "microhttpd.h" #include "internal.h" +#include "mhd_compat.h" #ifndef WINDOWS #include diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_shutdown_select.c libmicrohttpd-0.9.55/src/microhttpd/test_shutdown_select.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_shutdown_select.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_shutdown_select.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,383 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + libmicrohttpd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + libmicrohttpd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file microhttpd/test_shutdown_select.c + * @brief Test whether shutdown socket triggers select()/poll() + * @details On some platforms shutting down the socket in one thread + * trigger select() or poll() waiting for this socket in + * other thread. libmicrohttpd depend on this behavior on + * those platforms. This program check whether select() + * and poll() (if available) works as expected. + * @author Karlson2k (Evgeny Grin) + */ + +#include "MHD_config.h" +#include "platform.h" +#include "mhd_sockets.h" +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#ifdef HAVE_TIME_H +#include +#endif /* HAVE_TIME_H */ + +#if defined(MHD_USE_POSIX_THREADS) +#include +#endif /* MHD_USE_POSIX_THREADS */ + +#if defined(MHD_WINSOCK_SOCKETS) +#include +#include +#define sock_errno (WSAGetLastError()) +#elif defined(MHD_POSIX_SOCKETS) +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif /* HAVE_SYS_SOCKET_H */ +#ifdef HAVE_NETINET_IN_H +#include +#endif /* HAVE_NETINET_IN_H */ +#ifdef HAVE_ARPA_INET_H +#include +#endif /* HAVE_ARPA_INET_H */ +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ +#if defined(HAVE_POLL) && defined(HAVE_POLL_H) +#include +#endif /* HAVE_POLL && HAVE_POLL_H */ +#define sock_errno (errno) +#endif /* MHD_POSIX_SOCKETS */ + +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#include "mhd_threads.h" + +#ifndef SOMAXCONN +#define SOMAXCONN 511 +#endif /* ! SOMAXCONN */ + +#if !defined(SHUT_RDWR) && defined(SD_BOTH) +#define SHUT_RDWR SD_BOTH +#endif + +static bool check_err; + + +static bool +has_in_name(const char *prog_name, const char *marker) +{ + size_t name_pos; + size_t pos; + + if (!prog_name || !marker) + return 0; + + pos = 0; + name_pos = 0; + while (prog_name[pos]) + { + if ('/' == prog_name[pos]) + name_pos = pos + 1; +#ifdef _WIN32 + else if ('\\' == prog_name[pos]) + name_pos = pos + 1; +#endif /* _WIN32 */ + pos++; + } + if (name_pos == pos) + return !0; + return strstr(prog_name + name_pos, marker) != NULL; +} + +static MHD_socket +start_socket_listen(int domain) +{ +/* Create sockets similarly to daemon.c */ + MHD_socket fd; + int cloexec_set; + struct sockaddr_in sock_addr; + socklen_t addrlen; + +#ifdef MHD_WINSOCK_SOCKETS + unsigned long flags = 1; +#else /* MHD_POSIX_SOCKETS */ + int flags; +#endif /* MHD_POSIX_SOCKETS */ + +#if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC) + fd = socket (domain, SOCK_STREAM | SOCK_CLOEXEC, 0); + cloexec_set = 1; +#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT) + fd = WSASocketW (domain, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT); + cloexec_set = 1; +#else /* !SOCK_CLOEXEC */ + fd = socket (domain, SOCK_STREAM, 0); + cloexec_set = 0; +#endif /* !SOCK_CLOEXEC */ + if ( (MHD_INVALID_SOCKET == fd) && (cloexec_set) ) + { + fd = socket (domain, SOCK_STREAM, 0); + cloexec_set = 0; + } + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, "Can't create socket: %u\n", + (unsigned)sock_errno); + return MHD_INVALID_SOCKET; + } + + if (!cloexec_set) + { +#ifdef MHD_WINSOCK_SOCKETS + if (!SetHandleInformation ((HANDLE)fd, HANDLE_FLAG_INHERIT, 0)) + fprintf (stderr, "Failed to make socket non-inheritable: %u\n", + (unsigned int)GetLastError ()); +#else /* MHD_POSIX_SOCKETS */ + flags = fcntl (fd, F_GETFD); + if ( ( (-1 == flags) || + ( (flags != (flags | FD_CLOEXEC)) && + (0 != fcntl (fd, F_SETFD, flags | FD_CLOEXEC)) ) ) ) + fprintf (stderr, "Failed to make socket non-inheritable: %s\n", + MHD_socket_last_strerr_ ()); +#endif /* MHD_POSIX_SOCKETS */ + } + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons (0); +#if HAVE_SOCKADDR_IN_SIN_LEN + sock_addr.sin_len = sizeof (struct sockaddr_in); +#endif + addrlen = sizeof (struct sockaddr_in); + + if (bind (fd, (const struct sockaddr*) &sock_addr, addrlen) < 0) + { + fprintf (stderr, "Failed to bind socket: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } + +#ifdef MHD_WINSOCK_SOCKETS + if (0 != ioctlsocket (fd, FIONBIO, &flags)) + { + fprintf (stderr, "Failed to make socket non-blocking: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } +#else /* MHD_POSIX_SOCKETS */ + flags = fcntl (fd, F_GETFL); + if ( ( (-1 == flags) || + ( (flags != (flags | O_NONBLOCK)) && + (0 != fcntl (fd, F_SETFL, flags | O_NONBLOCK)) ) ) ) + { + fprintf (stderr, "Failed to make socket non-blocking: %s\n", + MHD_socket_last_strerr_ ()); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } +#endif /* MHD_POSIX_SOCKETS */ + + if (listen(fd, SOMAXCONN) < 0) + { + fprintf (stderr, "Failed to listen on socket: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } + + return fd; +} + + +MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +select_thread(void* data) +{ + /* use select() like in daemon.c */ + MHD_socket listen_sock = *((MHD_socket*)data); + fd_set rs, ws; + struct timeval timeout; + + FD_ZERO(&rs); + FD_ZERO(&ws); + FD_SET(listen_sock, &rs); + timeout.tv_usec = 0; + timeout.tv_sec = 7; + + check_err = (0 > MHD_SYS_select_(listen_sock + 1, &rs, &ws, NULL, &timeout)); + + return (MHD_THRD_RTRN_TYPE_)0; +} + + +#ifdef HAVE_POLL +MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +poll_thread(void* data) +{ + /* use poll() like in daemon.c */ + struct pollfd p[1]; + MHD_socket listen_sock = *((MHD_socket*)data); + + p[0].fd = listen_sock; + p[0].events = POLLIN; + p[0].revents = 0; + + check_err = (0 > MHD_sys_poll_ (p, 1, 7000)); + + return (MHD_THRD_RTRN_TYPE_)0; +} +#endif /* HAVE_POLL */ + + +static void +local_sleep(unsigned seconds) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + Sleep(seconds * 1000); +#else + unsigned seconds_left = seconds; + do + { + seconds_left = sleep(seconds_left); + } while (seconds_left > 0); +#endif +} + + +int +main (int argc, char *const *argv) +{ + int i; + time_t start_t, end_t; + int result = 0; + MHD_THRD_RTRN_TYPE_ (MHD_THRD_CALL_SPEC_ *test_func)(void* data); +#ifdef MHD_WINSOCK_SOCKETS + WORD ver_req; + WSADATA wsa_data; + int err; +#endif /* MHD_WINSOCK_SOCKETS */ + bool test_poll; + + test_poll = has_in_name(argv[0], "_poll"); + if (!test_poll) + test_func = &select_thread; + else + { +#ifndef HAVE_POLL + return 77; +#else /* ! HAVE_POLL */ + test_func = &poll_thread; +#endif /* ! HAVE_POLL */ + } + +#ifdef MHD_WINSOCK_SOCKETS + ver_req = MAKEWORD(2, 2); + + err = WSAStartup(ver_req, &wsa_data); + if (err != 0 || MAKEWORD(2, 2) != wsa_data.wVersion) + { + printf("WSAStartup() failed\n"); + WSACleanup(); + return 99; + } +#endif /* MHD_WINSOCK_SOCKETS */ + + /* try several times to ensure that accidental incoming connection + * didn't interfere with test results + */ + for (i = 0; i < 5 && result == 0; i++) + { + MHD_thread_handle_ sel_thrd; + /* fprintf(stdout, "Creating, binding and listening socket...\n"); */ + MHD_socket listen_socket = start_socket_listen (AF_INET); + if (MHD_INVALID_SOCKET == listen_socket) + return 99; + + check_err = !0; + /* fprintf (stdout, "Starting select() thread...\n"); */ +#if defined(MHD_USE_POSIX_THREADS) + if (0 != pthread_create (&sel_thrd, NULL, test_func, &listen_socket)) + { + MHD_socket_close_chk_ (listen_socket); + fprintf (stderr, "Can't start thread\n"); + return 99; + } +#elif defined(MHD_USE_W32_THREADS) + sel_thrd = (HANDLE)_beginthreadex (NULL, 0, test_func, &listen_socket, 0, NULL); + if (0 == (sel_thrd)) + { + MHD_socket_close_chk_ (listen_socket); + fprintf (stderr, "Can't start select() thread\n"); + return 99; + } +#else +#error No threading lib available +#endif + /* fprintf (stdout, "Waiting...\n"); */ + local_sleep(1); /* make sure that select() is started */ + + /* fprintf (stdout, "Shutting down socket...\n"); */ + start_t = time (NULL); + shutdown (listen_socket, SHUT_RDWR); + + /* fprintf (stdout, "Waiting for thread to finish...\n"); */ + if (!MHD_join_thread_(sel_thrd)) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Can't join select() thread\n"); + return 99; + } + if (check_err) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Error in waiting thread\n"); + return 99; + } + end_t = time (NULL); + /* fprintf (stdout, "Thread finished.\n"); */ + MHD_socket_close_chk_(listen_socket); + + if (start_t == (time_t)-1 || end_t == (time_t)-1) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Can't get current time\n"); + return 99; + } + if (end_t - start_t > 3) + result++; + } + +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ + + return result; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_str.c libmicrohttpd-0.9.55/src/microhttpd/test_str.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_str.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_str.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,2852 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This test tool is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + This test tool is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/unit_str_test.h + * @brief Unit tests for mhd_str functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include +#include +#ifdef HAVE_INTTYPES_H +#include +#else /* ! HAVE_INTTYPES_H */ +#define PRIu64 "llu" +#define PRIuPTR "u" +#define PRIX64 "llX" +#endif /* ! HAVE_INTTYPES_H */ +#include +#include "mhd_limits.h" +#include "mhd_str.h" +#include "test_helpers.h" + + +static int verbose = 0; /* verbose level (0-3)*/ + +/* Locale names to test. + * Functions must not depend of current current locale, + * so result must be the same in any locale. + */ +static const char * const locale_names[] = { + "C", + "", /* System default locale */ +#if defined(_WIN32) && !defined(__CYGWIN__) + ".OCP", /* W32 system default OEM code page */ + ".ACP", /* W32 system default ANSI code page */ + ".65001", /* UTF-8 */ + ".437", + ".850", + ".857", + ".866", + ".1250", + ".1251", + ".1252", + ".1254", + ".20866", /* number for KOI8-R */ + ".28591", /* number for ISO-8859-1 */ + ".28595", /* number for ISO-8859-5 */ + ".28599", /* number for ISO-8859-9 */ + ".28605", /* number for ISO-8859-15 */ + "en", + "english", + "en-US", + "English-US", + "en-US.437", + "English_United States.437", + "en-US.1252", + "English_United States.1252", + "English_United States.28591", + "English_United States.65001", + "fra", + "french", + "fr-FR", + "French_France", + "fr-FR.850", + "french_france.850", + "fr-FR.1252", + "French_france.1252", + "French_france.28605", + "French_France.65001", + "de", + "de-DE", + "de-DE.850", + "German_Germany.850", + "German_Germany.1250", + "de-DE.1252", + "German_Germany.1252", + "German_Germany.28605", + "German_Germany.65001", + "tr", + "trk", + "turkish", + "tr-TR", + "tr-TR.1254", + "Turkish_Turkey.1254", + "tr-TR.857", + "Turkish_Turkey.857", + "Turkish_Turkey.28599", + "Turkish_Turkey.65001", + "ru", + "ru-RU", + "Russian", + "ru-RU.866", + "Russian_Russia.866", + "ru-RU.1251", + "Russian_Russia.1251", + "Russian_Russia.20866", + "Russian_Russia.28595", + "Russian_Russia.65001", + "zh-Hans", + "zh-Hans.936", + "chinese-simplified" +#else /* ! _WIN32 || __CYGWIN__ */ + "C.UTF-8", + "POSIX", + "en", + "en_US", + "en_US.ISO-8859-1", + "en_US.ISO_8859-1", + "en_US.ISO8859-1", + "en_US.iso88591", + "en_US.ISO-8859-15", + "en_US.DIS_8859-15", + "en_US.ISO8859-15", + "en_US.iso885915", + "en_US.1252", + "en_US.CP1252", + "en_US.UTF-8", + "en_US.utf8", + "fr", + "fr_FR", + "fr_FR.850", + "fr_FR.IBM850", + "fr_FR.1252", + "fr_FR.CP1252", + "fr_FR.ISO-8859-1", + "fr_FR.ISO_8859-1", + "fr_FR.ISO8859-1", + "fr_FR.iso88591", + "fr_FR.ISO-8859-15", + "fr_FR.DIS_8859-15", + "fr_FR.ISO8859-15", + "fr_FR.iso8859-15", + "fr_FR.UTF-8", + "fr_FR.utf8", + "de", + "de_DE", + "de_DE.850", + "de_DE.IBM850", + "de_DE.1250", + "de_DE.CP1250", + "de_DE.1252", + "de_DE.CP1252", + "de_DE.ISO-8859-1", + "de_DE.ISO_8859-1", + "de_DE.ISO8859-1", + "de_DE.iso88591", + "de_DE.ISO-8859-15", + "de_DE.DIS_8859-15", + "de_DE.ISO8859-15", + "de_DE.iso885915", + "de_DE.UTF-8", + "de_DE.utf8", + "tr", + "tr_TR", + "tr_TR.1254", + "tr_TR.CP1254", + "tr_TR.857", + "tr_TR.IBM857", + "tr_TR.ISO-8859-9", + "tr_TR.ISO8859-9", + "tr_TR.iso88599", + "tr_TR.UTF-8", + "tr_TR.utf8", + "ru", + "ru_RU", + "ru_RU.1251", + "ru_RU.CP1251", + "ru_RU.866", + "ru_RU.IBM866", + "ru_RU.KOI8-R", + "ru_RU.koi8-r", + "ru_RU.KOI8-RU", + "ru_RU.ISO-8859-5", + "ru_RU.ISO_8859-5", + "ru_RU.ISO8859-5", + "ru_RU.iso88595", + "ru_RU.UTF-8", + "zh_CN", + "zh_CN.GB2312", + "zh_CN.UTF-8", +#endif /* ! _WIN32 || __CYGWIN__ */ +}; + +static const unsigned int locale_name_count = sizeof(locale_names) / sizeof(locale_names[0]); + + +/* + * Helper functions + */ + +int set_test_locale(unsigned int num) +{ + if (num >= locale_name_count) + return -1; + if (verbose > 2) + printf("Setting locale \"%s\":", locale_names[num]); + if (setlocale(LC_ALL, locale_names[num])) + { + if (verbose > 2) + printf(" succeed.\n"); + return 1; + } + if (verbose > 2) + printf(" failed.\n"); + return 0; +} + +const char * get_current_locale_str(void) +{ + char const * loc_str = setlocale(LC_ALL, NULL); + return loc_str ? loc_str : "unknown"; +} + +static char tmp_bufs[4][4*1024]; /* should be enough for testing */ +static size_t buf_idx = 0; + +/* print non-printable chars as char codes */ +char * n_prnt(const char * str) +{ + static char * buf; /* should be enough for testing */ + static const size_t buf_size = sizeof(tmp_bufs[0]); + const unsigned char * p = (const unsigned char*)str; + size_t w_pos = 0; + if (++buf_idx > 3) + buf_idx = 0; + buf = tmp_bufs[buf_idx]; + + while(*p && w_pos + 1 < buf_size) + { + const unsigned char c = *p; + if (c == '\\' || c == '"') + { + if (w_pos + 2 >= buf_size) + break; + buf[w_pos++] = '\\'; + buf[w_pos++] = c; + } + else if (c >= 0x20 && c <= 0x7E) + buf[w_pos++] = c; + else + { + if (w_pos + 4 >= buf_size) + break; + if (snprintf(buf + w_pos, buf_size - w_pos, "\\x%02hX", (short unsigned int)c) != 4) + break; + w_pos += 4; + } + p++; + } + if (*p) + { /* not full string is printed */ + /* enough space for "..." ? */ + if (w_pos + 3 > buf_size) + w_pos = buf_size - 4; + buf[w_pos++] = '.'; + buf[w_pos++] = '.'; + buf[w_pos++] = '.'; + } + buf[w_pos] = 0; + return buf; +} + + +struct str_with_len +{ + const char * const str; + const size_t len; +}; + +#define D_STR_W_LEN(s) {(s), (sizeof((s)) / sizeof(char)) - 1} + +/* + * String caseless equality functions tests + */ + +struct two_eq_strs +{ + const struct str_with_len s1; + const struct str_with_len s2; +}; + +static const struct two_eq_strs eq_strings[] = { + {D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`.")}, + {D_STR_W_LEN("Simple string."), D_STR_W_LEN("Simple string.")}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("SIMPLE STRING.")}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("simple string.")}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("Simple String.")}, + {D_STR_W_LEN("sImPlE StRiNg."), D_STR_W_LEN("SiMpLe sTrInG.")}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("simple string.")}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz"), D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz")}, + {D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}, + {D_STR_W_LEN("zyxwvutsrqponMLKJIHGFEDCBA"), D_STR_W_LEN("ZYXWVUTSRQPONmlkjihgfedcba")}, + + {D_STR_W_LEN("Cha\x8cne pour le test."), + D_STR_W_LEN("Cha\x8cne pour le test.")}, /* "Chaîne pour le test." in CP850 */ + {D_STR_W_LEN("cha\x8cne pOur Le TEst."), + D_STR_W_LEN("Cha\x8cne poUr Le teST.")}, + {D_STR_W_LEN("Cha\xeene pour le test."), + D_STR_W_LEN("Cha\xeene pour le test.")}, /* "Chaîne pour le test." in CP1252/ISO-8859-1/ISO-8859-15 */ + {D_STR_W_LEN("CHa\xeene POUR le test."), + D_STR_W_LEN("Cha\xeeNe pour lE TEST.")}, + {D_STR_W_LEN("Cha\xc3\xaene pour le Test."), + D_STR_W_LEN("Cha\xc3\xaene pour le Test.")}, /* "Chaîne pour le test." in UTF-8 */ + {D_STR_W_LEN("ChA\xc3\xaene pouR lE TesT."), + D_STR_W_LEN("Cha\xc3\xaeNe Pour le teSt.")}, + + {D_STR_W_LEN(".Beispiel Zeichenfolge"), + D_STR_W_LEN(".Beispiel Zeichenfolge")}, + {D_STR_W_LEN(".bEisPiel ZEIchenfoLgE"), + D_STR_W_LEN(".BEiSpiEl zeIcheNfolge")}, + + {D_STR_W_LEN("Do\xa7rulama \x87izgi!"), + D_STR_W_LEN("Do\xa7rulama \x87izgi!")}, /* "Doğrulama çizgi!" in CP857 */ + {D_STR_W_LEN("Do\xa7rulama \x87IzgI!"), /* Spelling intentionally incorrect here */ + D_STR_W_LEN("Do\xa7rulama \x87izgi!")}, /* Note: 'i' is not caseless equal to 'I' in Turkish */ + {D_STR_W_LEN("Do\xf0rulama \xe7izgi!"), + D_STR_W_LEN("Do\xf0rulama \xe7izgi!")}, /* "Doğrulama çizgi!" in CP1254/ISO-8859-9 */ + {D_STR_W_LEN("Do\xf0rulamA \xe7Izgi!"), + D_STR_W_LEN("do\xf0rulama \xe7izgi!")}, + {D_STR_W_LEN("Do\xc4\x9frulama \xc3\xa7izgi!"), + D_STR_W_LEN("Do\xc4\x9frulama \xc3\xa7izgi!")}, /* "Doğrulama çizgi!" in UTF-8 */ + {D_STR_W_LEN("do\xc4\x9fruLAMA \xc3\xa7Izgi!"), /* Spelling intentionally incorrect here */ + D_STR_W_LEN("DO\xc4\x9frulama \xc3\xa7izgI!")}, /* Spelling intentionally incorrect here */ + + {D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0."), + D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0.")}, /* "Тестовая Строка." in CP866 */ + {D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0."), + D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0.")}, /* "Тестовая Строка." in CP1251 */ + {D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1."), + D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1.")}, /* "Тестовая Строка." in KOI8-R */ + {D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0."), + D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0.")}, /* "Тестовая Строка." in ISO-8859-5 */ + {D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0."), + D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0.")}, /* "Тестовая Строка." in UTF-8 */ + + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@[\\]" + "^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" + "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" + "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8" + "\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc" + "\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" + "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4" + "\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@[\\]" + "^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" + "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" + "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8" + "\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc" + "\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" + "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4" + "\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")}, /* Full sequence without a-z */ + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83" + "\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97" + "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + "\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3" + "\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" + "\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb" + "\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83" + "\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97" + "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + "\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3" + "\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" + "\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb" + "\xfc\xfd\xfe\xff")}, /* Full sequence */ + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89" + "\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d" + "\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1" + "\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5" + "\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9" + "\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed" + "\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ab" + "cdefghijklmnopqrstuvwxyz[\\]^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89" + "\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d" + "\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1" + "\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5" + "\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9" + "\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed" + "\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")} /* Full with A/a match */ +}; + +struct two_neq_strs +{ + const struct str_with_len s1; + const struct str_with_len s2; + const size_t dif_pos; +}; + +static const struct two_neq_strs neq_strings[] = { + {D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`"), 27}, + {D_STR_W_LEN(".1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`"), 0}, + {D_STR_W_LEN("Simple string."), D_STR_W_LEN("Simple ctring."), 7}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("simple string"), 13}, + {D_STR_W_LEN("simple strings"), D_STR_W_LEN("Simple String."), 13}, + {D_STR_W_LEN("sImPlE StRiNg."), D_STR_W_LEN("SYMpLe sTrInG."), 1}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("simple string.2"), 14}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz,"), D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz."), 26}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz!"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ?"), 26}, + {D_STR_W_LEN("zyxwvutsrqponwMLKJIHGFEDCBA"), D_STR_W_LEN("ZYXWVUTSRQPON%mlkjihgfedcba"), 13}, + + {D_STR_W_LEN("S\xbdur veulent plus d'\xbdufs."), /* "Sœur veulent plus d'œufs." in ISO-8859-15 */ + D_STR_W_LEN("S\xbcUR VEULENT PLUS D'\xbcUFS."), 1},/* "SŒUR VEULENT PLUS D'ŒUFS." in ISO-8859-15 */ + {D_STR_W_LEN("S\x9cur veulent plus d'\x9cufs."), /* "Sœur veulent plus d'œufs." in CP1252 */ + D_STR_W_LEN("S\x8cUR VEULENT PLUS D'\x8cUFS."), 1},/* "SŒUR VEULENT PLUS D'ŒUFS." in CP1252 */ + {D_STR_W_LEN("S\xc5\x93ur veulent plus d'\xc5\x93ufs."), /* "Sœur veulent plus d'œufs." in UTF-8 */ + D_STR_W_LEN("S\xc5\x92UR VEULENT PLUS D'\xc5\x92UFS."), 2},/* "SŒUR VEULENT PLUS D'ŒUFS." in UTF-8 */ + + {D_STR_W_LEN("Um ein sch\x94nes M\x84" "dchen zu k\x81ssen."), /* "Um ein schönes Mädchen zu küssen." in CP850 */ + D_STR_W_LEN("UM EIN SCH\x99NES M\x8e" "DCHEN ZU K\x9aSSEN."), 10},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in CP850 */ + {D_STR_W_LEN("Um ein sch\xf6nes M\xe4" "dchen zu k\xfcssen."), /* "Um ein schönes Mädchen zu küssen." in ISO-8859-1/ISO-8859-15/CP1250/CP1252 */ + D_STR_W_LEN("UM EIN SCH\xd6NES M\xc4" "DCHEN ZU K\xdcSSEN."), 10},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in ISO-8859-1/ISO-8859-15/CP1250/CP1252 */ + {D_STR_W_LEN("Um ein sch\xc3\xb6nes M\xc3\xa4" "dchen zu k\xc3\xbcssen."), /* "Um ein schönes Mädchen zu küssen." in UTF-8 */ + D_STR_W_LEN("UM EIN SCH\xc3\x96NES M\xc3\x84" "DCHEN ZU K\xc3\x9cSSEN."), 11},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in UTF-8 */ + + {D_STR_W_LEN("\x98stanbul"), /* "İstanbul" in CP857 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in CP857 */ + {D_STR_W_LEN("\xddstanbul"), /* "İstanbul" in ISO-8859-9/CP1254 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in ISO-8859-9/CP1254 */ + {D_STR_W_LEN("\xc4\xb0stanbul"), /* "İstanbul" in UTF-8 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in UTF-8 */ + {D_STR_W_LEN("Diyarbak\x8dr"), /* "Diyarbakır" in CP857 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in CP857 */ + {D_STR_W_LEN("Diyarbak\xfdr"), /* "Diyarbakır" in ISO-8859-9/CP1254 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in ISO-8859-9/CP1254 */ + {D_STR_W_LEN("Diyarbak\xc4\xb1r"), /* "Diyarbakır" in UTF-8 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in UTF-8 */ + + {D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0."), /* "Тестовая Строка." in CP866 */ + D_STR_W_LEN("\x92\x85\x91\x92\x8e\x82\x80\x9f \x91\x92\x90\x8e\x8a\x80."), 1}, /* "ТЕСТОВАЯ СТРОКА." in CP866 */ + {D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0."), /* "Тестовая Строка." in CP1251 */ + D_STR_W_LEN("\xd2\xc5\xd1\xd2\xce\xc2\xc0\xdf \xd1\xd2\xd0\xce\xca\xc0."), 1}, /* "ТЕСТОВАЯ СТРОКА." in CP1251 */ + {D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1."), /* "Тестовая Строка." in KOI8-R */ + D_STR_W_LEN("\xf4\xe5\xf3\xf4\xef\xf7\xe1\xf1 \xf3\xf4\xf2\xef\xeb\xe1."), 1}, /* "ТЕСТОВАЯ СТРОКА." in KOI8-R */ + {D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0."), /* "Тестовая Строка." in ISO-8859-5 */ + D_STR_W_LEN("\xc2\xb5\xc1\xc2\xbe\xb2\xb0\xcf \xc1\xc2\xc0\xbe\xba\xb0."), 1}, /* "ТЕСТОВАЯ СТРОКА." in ISO-8859-5 */ + {D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0."), /* "Тестовая Строка." in UTF-8 */ + D_STR_W_LEN("\xd0\xa2\xd0\x95\xd0\xa1\xd0\xa2\xd0\x9e\xd0\x92\xd0\x90\xd0" + "\xaf \xd0\xa1\xd0\xa2\xd0\xa0\xd0\x9e\xd0\x9a\xd0\x90."), 3} /* "ТЕСТОВАЯ СТРОКА." in UTF-8 */ +}; + + +int check_eq_strings(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(eq_strings) / sizeof(eq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + const struct two_eq_strs * const t = eq_strings + i; + if (c_failed[i]) + continue; /* skip already failed checks */ + if (!MHD_str_equal_caseless_(t->s1.str, t->s2.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned zero, while expected non-zero." + " Locale: %s\n", n_prnt(t->s1.str), n_prnt(t->s2.str), get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_(t->s2.str, t->s1.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned zero, while expected non-zero." + " Locale: %s\n", n_prnt(t->s2.str), n_prnt(t->s1.str), get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n" + " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n", n_prnt(t->s1.str), n_prnt(t->s2.str), + n_prnt(t->s2.str), n_prnt(t->s1.str)); + } + } + return t_failed; +} + +int check_neq_strings(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(neq_strings) / sizeof(neq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + const struct two_neq_strs * const t = neq_strings + i; + if (c_failed[i]) + continue; /* skip already failed checks */ + if (MHD_str_equal_caseless_(t->s1.str, t->s2.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned non-zero, while expected zero." + " Locale: %s\n", n_prnt(t->s1.str), n_prnt(t->s2.str), get_current_locale_str()); + } + else if (MHD_str_equal_caseless_(t->s2.str, t->s1.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned non-zero, while expected zero." + " Locale: %s\n", n_prnt(t->s2.str), n_prnt(t->s1.str), get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n" + " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n", n_prnt(t->s1.str), n_prnt(t->s2.str), + n_prnt(t->s2.str), n_prnt(t->s1.str)); + } + } + return t_failed; +} + +int check_eq_strings_n(void) +{ + size_t t_failed = 0; + size_t i, j, k; + static const size_t n_checks = sizeof(eq_strings) / sizeof(eq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t m_len; + const struct two_eq_strs * const t = eq_strings + i; + m_len = (t->s1.len > t->s2.len) ? t->s1.len : t->s2.len; + for(k = 0; k <= m_len + 1 && !c_failed[i]; k++) + { + if (!MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) m_len + 1); + } + } + return t_failed; +} + +int check_neq_strings_n(void) +{ + size_t t_failed = 0; + size_t i, j, k; + static const size_t n_checks = sizeof(neq_strings) / sizeof(neq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t m_len; + const struct two_neq_strs * const t = neq_strings + i; + m_len = t->s1.len > t->s2.len ? t->s1.len : t->s2.len; + if (t->dif_pos >= m_len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less than " + "s1.len (%u) or s2.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s1.len, (unsigned int) t->s2.len); + return -1; + } + if (t->dif_pos > t->s1.len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less or " + "equal to s1.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s1.len); + return -1; + } + if (t->dif_pos > t->s2.len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less or " + "equal to s2.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s2.len); + return -1; + } + for(k = 0; k <= m_len + 1 && !c_failed[i]; k++) + { + if (k <= t->dif_pos) + { + if (!MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + else + { + if (MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned non-zero," + " while expected zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned non-zero," + " while expected zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + { + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), + (unsigned int) t->dif_pos); + + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) == 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) == 0, where N is %u..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), + (unsigned int) t->dif_pos + 1, (unsigned int) m_len + 1); + } + } + } + return t_failed; +} + +/* + * Run eq/neq strings tests + */ +int run_eq_neq_str_tests(void) +{ + int str_equal_caseless_fails = 0; + int str_equal_caseless_n_fails = 0; + int res; + + res = check_eq_strings(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_eq_strings().\n"); + return 99; + } + str_equal_caseless_fails += res; + fprintf(stderr, "FAILED: testcase check_eq_strings() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_eq_strings() successfully passed.\n\n"); + + res = check_neq_strings(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_neq_strings().\n"); + return 99; + } + str_equal_caseless_fails += res; + fprintf(stderr, "FAILED: testcase check_neq_strings() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_neq_strings() successfully passed.\n\n"); + + if (str_equal_caseless_fails) + fprintf(stderr, "FAILED: function MHD_str_equal_caseless_() failed %d time%s.\n\n", + str_equal_caseless_fails, str_equal_caseless_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_equal_caseless_() successfully passed all checks.\n\n"); + + res = check_eq_strings_n(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_eq_strings_n().\n"); + return 99; + } + str_equal_caseless_n_fails += res; + fprintf(stderr, "FAILED: testcase check_eq_strings_n() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_eq_strings_n() successfully passed.\n\n"); + + res = check_neq_strings_n(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_neq_strings_n().\n"); + return 99; + } + str_equal_caseless_n_fails += res; + fprintf(stderr, "FAILED: testcase check_neq_strings_n() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_neq_strings_n() successfully passed.\n\n"); + + if (str_equal_caseless_n_fails) + fprintf(stderr, "FAILED: function MHD_str_equal_caseless_n_() failed %d time%s.\n\n", + str_equal_caseless_n_fails, str_equal_caseless_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_equal_caseless_n_() successfully passed all checks.\n\n"); + + if (str_equal_caseless_fails || str_equal_caseless_n_fails) + { + if (verbose > 0) + printf("At least one test failed.\n"); + + return 1; + } + + if (verbose > 0) + printf("All tests passed successfully.\n"); + + return 0; +} + +/* + * Digits in string -> value tests + */ + +struct str_with_value { + const struct str_with_len str; + const size_t num_of_digt; + const uint64_t val; +}; + +/* valid string for conversion to unsigned integer value */ +static const struct str_with_value dstrs_w_values[] = { + /* simplest strings */ + {D_STR_W_LEN("1"), 1, 1}, + {D_STR_W_LEN("0"), 1, 0}, + {D_STR_W_LEN("10000"), 5, 10000}, + + /* all digits */ + {D_STR_W_LEN("1234"), 4, 1234}, + {D_STR_W_LEN("4567"), 4, 4567}, + {D_STR_W_LEN("7890"), 4, 7890}, + {D_STR_W_LEN("8021"), 4, 8021}, + {D_STR_W_LEN("9754"), 4, 9754}, + {D_STR_W_LEN("6392"), 4, 6392}, + + /* various prefixes */ + {D_STR_W_LEN("00000000"), 8, 0}, + {D_STR_W_LEN("0755"), 4, 755}, /* not to be interpreted as octal value! */ + {D_STR_W_LEN("002"), 3, 2}, + {D_STR_W_LEN("0001"), 4, 1}, + {D_STR_W_LEN("00000000000000000000000031295483"), 32, 31295483}, + + /* numbers below and above limits */ + {D_STR_W_LEN("127"), 3, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("128"), 3, 128}, /* 0x80, SCHAR_MAX+1 */ + {D_STR_W_LEN("255"), 3, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("256"), 3, 256}, /* 0x100, UCHAR_MAX+1 */ + {D_STR_W_LEN("32767"), 5, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("32768"), 5, 32768}, /* 0x8000, INT16_MAX+1 */ + {D_STR_W_LEN("65535"), 5, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("65536"), 5, 65536}, /* 0x10000, UINT16_MAX+1 */ + {D_STR_W_LEN("2147483647"), 10, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("2147483648"), 10, UINT64_C(2147483648)}, /* 0x80000000, INT32_MAX+1 */ + {D_STR_W_LEN("4294967295"), 10, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("4294967296"), 10, UINT64_C(4294967296)}, /* 0x100000000, UINT32_MAX+1 */ + {D_STR_W_LEN("9223372036854775807"), 19, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("9223372036854775808"), 19, UINT64_C(9223372036854775808)}, /* 0x8000000000000000, INT64_MAX+1 */ + {D_STR_W_LEN("18446744073709551615"), 20, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + + /* random numbers */ + {D_STR_W_LEN("10186753"), 8, 10186753}, + {D_STR_W_LEN("144402566"), 9, 144402566}, + {D_STR_W_LEN("151903144"), 9, 151903144}, + {D_STR_W_LEN("139264621"), 9, 139264621}, + {D_STR_W_LEN("730348"), 6, 730348}, + {D_STR_W_LEN("21584377"), 8, 21584377}, + {D_STR_W_LEN("709"), 3, 709}, + {D_STR_W_LEN("54"), 2, 54}, + {D_STR_W_LEN("8452"), 4, 8452}, + {D_STR_W_LEN("17745098750013624977"), 20, UINT64_C(17745098750013624977)}, + {D_STR_W_LEN("06786878769931678000"), 20, UINT64_C(6786878769931678000)}, + + /* non-digit suffixes */ + {D_STR_W_LEN("1234oa"), 4, 1234}, + {D_STR_W_LEN("20h"), 2, 20}, /* not to be interpreted as hex value! */ + {D_STR_W_LEN("0x1F"), 1, 0}, /* not to be interpreted as hex value! */ + {D_STR_W_LEN("0564`~}"), 4, 564}, + {D_STR_W_LEN("7240146.724"), 7, 7240146}, + {D_STR_W_LEN("2,9"), 1, 2}, + {D_STR_W_LEN("200+1"), 3, 200}, + {D_STR_W_LEN("1a"), 1, 1}, + {D_STR_W_LEN("2E"), 1, 2}, + {D_STR_W_LEN("6c"), 1, 6}, + {D_STR_W_LEN("8F"), 1, 8}, + {D_STR_W_LEN("287416997! And the not too long string."), 9, 287416997} +}; + +/* strings that should overflow uint64_t */ +const struct str_with_len str_ovflw[] = { + D_STR_W_LEN("18446744073709551616"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("18446744073709551620"), + D_STR_W_LEN("18446744083709551615"), + D_STR_W_LEN("19234761020556472143"), + D_STR_W_LEN("184467440737095516150"), + D_STR_W_LEN("1844674407370955161500"), + D_STR_W_LEN("000018446744073709551616"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000"), + D_STR_W_LEN("020000000000000000000"), + D_STR_W_LEN("0020000000000000000000"), + D_STR_W_LEN("100000000000000000000"), + D_STR_W_LEN("434532891232591226417"), + D_STR_W_LEN("99999999999999999999"), + D_STR_W_LEN("18446744073709551616abcd"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000 suffix"), + D_STR_W_LEN("020000000000000000000x") +}; + +/* strings that should not be convertible to numeric value */ +const struct str_with_len str_no_num[] = { + D_STR_W_LEN("zero"), + D_STR_W_LEN("one"), + D_STR_W_LEN("\xb9\xb2\xb3"), /* superscript "123" in ISO-8859-1/CP1252 */ + D_STR_W_LEN("\xc2\xb9\xc2\xb2\xc2\xb3"), /* superscript "123" in UTF-8 */ + D_STR_W_LEN("\xd9\xa1\xd9\xa2\xd9\xa3"), /* Arabic-Indic "١٢٣" in UTF-8 */ + D_STR_W_LEN("\xdb\xb1\xdb\xb2\xdb\xb3"), /* Ext Arabic-Indic "۱۲۳" in UTF-8 */ + D_STR_W_LEN("\xe0\xa5\xa7\xe0\xa5\xa8\xe0\xa5\xa9"), /* Devanagari "१२३" in UTF-8 */ + D_STR_W_LEN("\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89"), /* Chinese "一二三" in UTF-8 */ + D_STR_W_LEN("\xd2\xbb\xb6\xfe\xc8\xfd"), /* Chinese "一二三" in GB2312/CP936 */ + D_STR_W_LEN("\x1B\x24\x29\x41\x0E\x52\x3B\x36\x7E\x48\x7D\x0F") /* Chinese "一二三" in ISO-2022-CN */ +}; + +/* valid hex string for conversion to unsigned integer value */ +static const struct str_with_value xdstrs_w_values[] = { + /* simplest strings */ + {D_STR_W_LEN("1"), 1, 0x1}, + {D_STR_W_LEN("0"), 1, 0x0}, + {D_STR_W_LEN("10000"), 5, 0x10000}, + + /* all digits */ + {D_STR_W_LEN("1234"), 4, 0x1234}, + {D_STR_W_LEN("4567"), 4, 0x4567}, + {D_STR_W_LEN("7890"), 4, 0x7890}, + {D_STR_W_LEN("8021"), 4, 0x8021}, + {D_STR_W_LEN("9754"), 4, 0x9754}, + {D_STR_W_LEN("6392"), 4, 0x6392}, + {D_STR_W_LEN("abcd"), 4, 0xABCD}, + {D_STR_W_LEN("cdef"), 4, 0xCDEF}, + {D_STR_W_LEN("FEAB"), 4, 0xFEAB}, + {D_STR_W_LEN("BCED"), 4, 0xBCED}, + {D_STR_W_LEN("bCeD"), 4, 0xBCED}, + {D_STR_W_LEN("1A5F"), 4, 0x1A5F}, + {D_STR_W_LEN("12AB"), 4, 0x12AB}, + {D_STR_W_LEN("CD34"), 4, 0xCD34}, + {D_STR_W_LEN("56EF"), 4, 0x56EF}, + {D_STR_W_LEN("7a9f"), 4, 0x7A9F}, + + /* various prefixes */ + {D_STR_W_LEN("00000000"), 8, 0x0}, + {D_STR_W_LEN("0755"), 4, 0x755}, /* not to be interpreted as octal value! */ + {D_STR_W_LEN("002"), 3, 0x2}, + {D_STR_W_LEN("0001"), 4, 0x1}, + {D_STR_W_LEN("00a"), 3, 0xA}, + {D_STR_W_LEN("0F"), 2, 0xF}, + {D_STR_W_LEN("0000000000000000000000003A29e4C3"), 32, 0x3A29E4C3}, + + /* numbers below and above limits */ + {D_STR_W_LEN("7F"), 2, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("7f"), 2, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("80"), 2, 128}, /* 0x80, SCHAR_MAX+1 */ + {D_STR_W_LEN("fF"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("Ff"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("FF"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("ff"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("100"), 3, 256}, /* 0x100, UCHAR_MAX+1 */ + {D_STR_W_LEN("7fff"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("7FFF"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("7Fff"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("8000"), 4, 32768}, /* 0x8000, INT16_MAX+1 */ + {D_STR_W_LEN("ffff"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("FFFF"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("FffF"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("10000"), 5, 65536}, /* 0x10000, UINT16_MAX+1 */ + {D_STR_W_LEN("7FFFFFFF"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("7fffffff"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("7FFffFff"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("80000000"), 8, UINT64_C(2147483648)}, /* 0x80000000, INT32_MAX+1 */ + {D_STR_W_LEN("FFFFFFFF"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("ffffffff"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("FfFfFfFf"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("100000000"), 9, UINT64_C(4294967296)}, /* 0x100000000, UINT32_MAX+1 */ + {D_STR_W_LEN("7fffffffffffffff"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("7FFFFFFFFFFFFFFF"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("7FfffFFFFffFFffF"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("8000000000000000"), 16, UINT64_C(9223372036854775808)}, /* 0x8000000000000000, INT64_MAX+1 */ + {D_STR_W_LEN("ffffffffffffffff"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + {D_STR_W_LEN("FFFFFFFFFFFFFFFF"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + {D_STR_W_LEN("FffFffFFffFFfFFF"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + + /* random numbers */ + {D_STR_W_LEN("10186753"), 8, 0x10186753}, + {D_STR_W_LEN("144402566"), 9, 0x144402566}, + {D_STR_W_LEN("151903144"), 9, 0x151903144}, + {D_STR_W_LEN("139264621"), 9, 0x139264621}, + {D_STR_W_LEN("730348"), 6, 0x730348}, + {D_STR_W_LEN("21584377"), 8, 0x21584377}, + {D_STR_W_LEN("709"), 3, 0x709}, + {D_STR_W_LEN("54"), 2, 0x54}, + {D_STR_W_LEN("8452"), 4, 0x8452}, + {D_STR_W_LEN("22353EC6"), 8, 0x22353EC6}, + {D_STR_W_LEN("307F1655"), 8, 0x307F1655}, + {D_STR_W_LEN("1FCB7226"), 8, 0x1FCB7226}, + {D_STR_W_LEN("82480560"), 8, 0x82480560}, + {D_STR_W_LEN("7386D95"), 7, 0x7386D95}, + {D_STR_W_LEN("EC3AB"), 5, 0xEC3AB}, + {D_STR_W_LEN("6DD05"), 5, 0x6DD05}, + {D_STR_W_LEN("C5DF"), 4, 0xC5DF}, + {D_STR_W_LEN("6CE"), 3, 0x6CE}, + {D_STR_W_LEN("CE6"), 3, 0xCE6}, + {D_STR_W_LEN("ce6"), 3, 0xCE6}, + {D_STR_W_LEN("F27"), 3, 0xF27}, + {D_STR_W_LEN("8497D54277D7E1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8497d54277d7e1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8497d54277d7E1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8C8112D0A06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("8c8112d0a06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("8c8112d0A06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("1774509875001362"), 16, UINT64_C(1690064375898968930)}, + {D_STR_W_LEN("0678687876998000"), 16, UINT64_C(466237428027981824)}, + + /* non-digit suffixes */ + {D_STR_W_LEN("1234oa"), 4, 0x1234}, + {D_STR_W_LEN("20h"), 2, 0x20}, + {D_STR_W_LEN("2CH"), 2, 0x2C}, + {D_STR_W_LEN("2ch"), 2, 0x2C}, + {D_STR_W_LEN("0x1F"), 1, 0x0}, /* not to be interpreted as hex prefix! */ + {D_STR_W_LEN("0564`~}"), 4, 0x564}, + {D_STR_W_LEN("0A64`~}"), 4, 0xA64}, + {D_STR_W_LEN("056c`~}"), 4, 0X56C}, + {D_STR_W_LEN("7240146.724"), 7, 0x7240146}, + {D_STR_W_LEN("7E4c1AB.724"), 7, 0X7E4C1AB}, + {D_STR_W_LEN("F24B1B6.724"), 7, 0xF24B1B6}, + {D_STR_W_LEN("2,9"), 1, 0x2}, + {D_STR_W_LEN("a,9"), 1, 0xA}, + {D_STR_W_LEN("200+1"), 3, 0x200}, + {D_STR_W_LEN("2cc+1"), 3, 0x2CC}, + {D_STR_W_LEN("2cC+1"), 3, 0x2CC}, + {D_STR_W_LEN("27416997! And the not too long string."), 8, 0x27416997}, + {D_STR_W_LEN("27555416997! And the not too long string."), 11, 0x27555416997}, + {D_STR_W_LEN("416997And the not too long string."), 7, 0x416997A}, + {D_STR_W_LEN("0F4C3Dabstract addition to make string even longer"), 8, 0xF4C3DAB} +}; + +/* hex strings that should overflow uint64_t */ +const struct str_with_len strx_ovflw[] = { + D_STR_W_LEN("10000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("10000000000000001"), + D_STR_W_LEN("10000000000000002"), + D_STR_W_LEN("1000000000000000A"), + D_STR_W_LEN("11000000000000000"), + D_STR_W_LEN("010000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("000010000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000"), + D_STR_W_LEN("020000000000000000000"), + D_STR_W_LEN("0020000000000000000000"), + D_STR_W_LEN("20000000000000000"), + D_STR_W_LEN("A0000000000000000"), + D_STR_W_LEN("F0000000000000000"), + D_STR_W_LEN("a0000000000000000"), + D_STR_W_LEN("11111111111111111"), + D_STR_W_LEN("CcCcCCccCCccCCccC"), + D_STR_W_LEN("f0000000000000000"), + D_STR_W_LEN("100000000000000000000"), + D_STR_W_LEN("434532891232591226417"), + D_STR_W_LEN("10000000000000000a"), + D_STR_W_LEN("10000000000000000E"), + D_STR_W_LEN("100000000000000000 and nothing"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("100000000000000000xx"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("99999999999999999999"), + D_STR_W_LEN("18446744073709551616abcd"), + D_STR_W_LEN("20000000000000000000 suffix"), + D_STR_W_LEN("020000000000000000000x") +}; + + +int check_str_to_uint64_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(dstrs_w_values) / sizeof(dstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv; + size_t rs; + const struct str_with_value * const t = dstrs_w_values + i; + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: dstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 9435223; /* some random value */ + rs = MHD_str_to_uint64_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") converted string to value %" PRIu64 "," + " while expecting result %" PRIu64 ". Locale: %s\n", n_prnt(t->str.str), rv, rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), rv, rs); + } + } + return t_failed; +} + + +int check_str_to_uint64_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 24941852; + size_t rs; + if (c >= '0' && c <= '9') + continue; /* skip digits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_str_to_uint64_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(test_str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_str_to_uint64_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_ovflw) / sizeof(str_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_ovflw + i; + static const uint64_t rnd_val = 2; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_str_to_uint64_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(dstrs_w_values) / sizeof(dstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv = 1235572; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = dstrs_w_values + i; + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: dstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_str_to_uint64_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " converted string to value %" PRIu64 ", while expecting result %" PRIu64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, rv, rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%" PRIu64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, rv, rs); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 98372558; + size_t rs; + size_t len; + + if (c >= '0' && c <= '9') + continue; /* skip digits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_str_to_uint64_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, test_val, rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_str_to_uint64_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_ovflw) / sizeof(str_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_ovflw + i; + static const uint64_t rnd_val = 3; + size_t len; + + for (len = t->len; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), (uintptr_t)t->len, + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 43255654342; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint32_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint32_t rv; + size_t rs; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->val > UINT32_MAX) + continue; /* number is too high for this function */ + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 1458532; /* some random value */ + rs = MHD_strx_to_uint32_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), (uint64_t)rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") converted string to value 0x%" PRIX64 "," + " while expecting result 0x%" PRIX64 ". Locale: %s\n", n_prnt(t->str.str), (uint64_t)rv, (uint64_t)rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), (uint64_t)rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint32_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint32_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint32_t rnd_val = 234234; + size_t rs; + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||(c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint32_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint32_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(test_str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint32_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks1 = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]) + + sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + static const uint32_t rnd_val = 74218431; + uint32_t test_val; + const char * str; + if (i < n_checks1) + { + const struct str_with_len * const t = strx_ovflw + i; + str = t->str; + } + else + { + const struct str_with_value * const t = xdstrs_w_values + (i - n_checks1); + if (t->val <= UINT32_MAX) + continue; /* check only strings that should overflow uint32_t */ + str = t->str.str; + } + + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_(str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(str)); + } + } + return t_failed; +} + + +int check_strx_to_uint32_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint32_t rnd_val = 74218431; + uint32_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint32_t rv = 2352932; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->val > UINT32_MAX) + continue; /* number is too high for this function */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_strx_to_uint32_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, (uint64_t)rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " converted string to value 0x%" PRIX64 ", while expecting result 0x%" PRIX64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, (uint64_t)rv, (uint64_t)rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->0x%" PRIX64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, (uint64_t)rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint32_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint32_t rnd_val = 98372558; + size_t rs; + size_t len; + + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint32_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint32_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks1 = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]) + + sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + static const uint32_t rnd_val = 4; + size_t len; + const char * str; + size_t min_len, max_len; + if (i < n_checks1) + { + const struct str_with_len * const t = strx_ovflw + i; + str = t->str; + min_len = t->len; + max_len = t->len + 1; + } + else + { + const struct str_with_value * const t = xdstrs_w_values + (i - n_checks1); + if (t->val <= UINT32_MAX) + continue; /* check only strings that should overflow uint32_t */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) (i - n_checks1), (unsigned int) t->num_of_digt, + (unsigned int) t->str.len); + return -1; + } + str = t->str.str; + min_len = t->num_of_digt; + max_len = t->str.len + 1; + } + + for (len = min_len; len <= max_len; len++) + { + uint32_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_n_(str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(str), (uintptr_t)min_len, + (uintptr_t)max_len); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint32_t rnd_val = 3214314212L; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint32_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint64_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv; + size_t rs; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 1458532; /* some random value */ + rs = MHD_strx_to_uint64_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") converted string to value 0x%" PRIX64 "," + " while expecting result 0x%" PRIX64 ". Locale: %s\n", n_prnt(t->str.str), rv, rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint64_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 234234; + size_t rs; + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint64_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(test_str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint64_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = strx_ovflw + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint64_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv = 2352932; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_strx_to_uint64_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " converted string to value 0x%" PRIX64 ", while expecting result 0x%" PRIX64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, rv, rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->0x%" PRIX64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 98372558; + size_t rs; + size_t len; + + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint64_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, test_val, rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = strx_ovflw + i; + static const uint64_t rnd_val = 4; + size_t len; + + for (len = t->len; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), (uintptr_t)t->len, + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 3214314212L; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int run_str_to_X_tests(void) +{ + int str_to_uint64_fails = 0; + int str_to_uint64_n_fails = 0; + int strx_to_uint32_fails = 0; + int strx_to_uint32_n_fails = 0; + int strx_to_uint64_fails = 0; + int strx_to_uint64_n_fails = 0; + int res; + + res = check_str_to_uint64_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_valid().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_valid() successfully passed.\n\n"); + + res = check_str_to_uint64_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_all_chars().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_all_chars() successfully passed.\n\n"); + + res = check_str_to_uint64_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_overflow().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_overflow() successfully passed.\n\n"); + + res = check_str_to_uint64_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_no_val().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_no_val() successfully passed.\n\n"); + + if (str_to_uint64_fails) + fprintf(stderr, "FAILED: function MHD_str_to_uint64_() failed %d time%s.\n\n", + str_to_uint64_fails, str_to_uint64_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_to_uint64_() successfully passed all checks.\n\n"); + + res = check_str_to_uint64_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_valid().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_valid() successfully passed.\n\n"); + + res = check_str_to_uint64_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_all_chars().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_all_chars() successfully passed.\n\n"); + + res = check_str_to_uint64_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_overflow().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_overflow() successfully passed.\n\n"); + + res = check_str_to_uint64_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_no_val().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_no_val() successfully passed.\n\n"); + + if (str_to_uint64_n_fails) + fprintf(stderr, "FAILED: function MHD_str_to_uint64_n_() failed %d time%s.\n\n", + str_to_uint64_n_fails, str_to_uint64_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_to_uint64_n_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint32_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_valid().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_valid() successfully passed.\n\n"); + + res = check_strx_to_uint32_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_all_chars().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint32_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_overflow().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint32_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_no_val().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_no_val() successfully passed.\n\n"); + + if (strx_to_uint32_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint32_() failed %d time%s.\n\n", + strx_to_uint32_fails, strx_to_uint32_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint32_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint32_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_valid().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_valid() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_all_chars().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_overflow().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_no_val().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_no_val() successfully passed.\n\n"); + + if (strx_to_uint32_n_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint32_n_() failed %d time%s.\n\n", + strx_to_uint32_n_fails, strx_to_uint32_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint32_n_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint64_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_valid().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_valid() successfully passed.\n\n"); + + res = check_strx_to_uint64_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_all_chars().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint64_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_overflow().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint64_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_no_val().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_no_val() successfully passed.\n\n"); + + if (strx_to_uint64_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint64_() failed %d time%s.\n\n", + strx_to_uint64_fails, strx_to_uint64_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint64_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint64_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_valid().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_valid() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_all_chars().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_overflow().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_no_val().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_no_val() successfully passed.\n\n"); + + if (strx_to_uint64_n_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint64_n_() failed %d time%s.\n\n", + strx_to_uint64_n_fails, strx_to_uint64_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint64_n_() successfully passed all checks.\n\n"); + + if (str_to_uint64_fails || str_to_uint64_n_fails || + strx_to_uint32_fails || strx_to_uint32_n_fails || + strx_to_uint64_fails || strx_to_uint64_n_fails) + { + if (verbose > 0) + printf("At least one test failed.\n"); + + return 1; + } + + if (verbose > 0) + printf("All tests passed successfully.\n"); + + return 0; +} + + +int main(int argc, char * argv[]) +{ + if (has_param(argc, argv, "-v") || has_param(argc, argv, "--verbose") || has_param(argc, argv, "--verbose1")) + verbose = 1; + if (has_param(argc, argv, "-vv") || has_param(argc, argv, "--verbose2")) + verbose = 2; + if (has_param(argc, argv, "-vvv") || has_param(argc, argv, "--verbose3")) + verbose = 3; + + if (has_in_name(argv[0], "_to_value")) + return run_str_to_X_tests(); + + return run_eq_neq_str_tests(); +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_str_token.c libmicrohttpd-0.9.55/src/microhttpd/test_str_token.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_str_token.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_str_token.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,117 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Karlson2k (Evgeny Grin) + + This test tool is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. + + This test tool is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_str_token.c + * @brief Unit tests for some mhd_str functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include "mhd_str.h" + + +static int +expect_found_n(const char *str, const char *token, size_t token_len) +{ + if (!MHD_str_has_token_caseless_(str, token, token_len)) + { + fprintf(stderr, "MHD_str_has_token_caseless_() FAILED:\n\tMHD_str_has_token_caseless_(%s, %s, %lu) return false\n", + str, token, (unsigned long) token_len); + return 1; + } + return 0; +} + +#define expect_found(s,t) expect_found_n((s),(t),MHD_STATICSTR_LEN_(t)) + +static int +expect_not_found_n(const char *str, const char *token, size_t token_len) +{ + if (MHD_str_has_token_caseless_(str, token, token_len)) + { + fprintf(stderr, "MHD_str_has_token_caseless_() FAILED:\n\tMHD_str_has_token_caseless_(%s, %s, %lu) return true\n", + str, token, (unsigned long) token_len); + return 1; + } + return 0; +} + +#define expect_not_found(s,t) expect_not_found_n((s),(t),MHD_STATICSTR_LEN_(t)) + +int check_match(void) +{ + int errcount = 0; + errcount += expect_found("string", "string"); + errcount += expect_found("String", "string"); + errcount += expect_found("string", "String"); + errcount += expect_found("strinG", "String"); + errcount += expect_found("\t strinG", "String"); + errcount += expect_found("strinG\t ", "String"); + errcount += expect_found(" \t tOkEn ", "toKEN"); + errcount += expect_found("not token\t, tOkEn ", "toKEN"); + errcount += expect_found("not token,\t tOkEn, more token", "toKEN"); + errcount += expect_found("not token,\t tOkEn\t, more token", "toKEN"); + errcount += expect_found(",,,,,,test,,,,", "TESt"); + errcount += expect_found(",,,,,\t,test,,,,", "TESt"); + errcount += expect_found(",,,,,,test, ,,,", "TESt"); + errcount += expect_found(",,,,,, test,,,,", "TESt"); + errcount += expect_found(",,,,,, test not,test,,", "TESt"); + errcount += expect_found(",,,,,, test not,,test,,", "TESt"); + errcount += expect_found(",,,,,, test not ,test,,", "TESt"); + errcount += expect_found(",,,,,, test", "TESt"); + errcount += expect_found(",,,,,, test ", "TESt"); + errcount += expect_found("no test,,,,,, test ", "TESt"); + return errcount; +} + +int check_not_match(void) +{ + int errcount = 0; + errcount += expect_not_found("strin", "string"); + errcount += expect_not_found("Stringer", "string"); + errcount += expect_not_found("sstring", "String"); + errcount += expect_not_found("string", "Strin"); + errcount += expect_not_found("\t( strinG", "String"); + errcount += expect_not_found(")strinG\t ", "String"); + errcount += expect_not_found(" \t tOkEn t ", "toKEN"); + errcount += expect_not_found("not token\t, tOkEner ", "toKEN"); + errcount += expect_not_found("not token,\t tOkEns, more token", "toKEN"); + errcount += expect_not_found("not token,\t tOkEns\t, more token", "toKEN"); + errcount += expect_not_found(",,,,,,testing,,,,", "TESt"); + errcount += expect_not_found(",,,,,\t,test,,,,", "TESting"); + errcount += expect_not_found("tests,,,,,,quest, ,,,", "TESt"); + errcount += expect_not_found(",,,,,, testы,,,,", "TESt"); + errcount += expect_not_found(",,,,,, test not,хtest,,", "TESt"); + errcount += expect_not_found("testing,,,,,, test not,,test2,,", "TESt"); + errcount += expect_not_found(",testi,,,,, test not ,test,,", "TESting"); + errcount += expect_not_found(",,,,,,2 test", "TESt"); + errcount += expect_not_found(",,,,,,test test ", "test"); + errcount += expect_not_found("no test,,,,,, test test", "test"); + return errcount; +} + +int main(int argc, char * argv[]) +{ + int errcount = 0; + errcount += check_match(); + errcount += check_not_match(); + return errcount == 0 ? 0 : 1; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_upgrade.c libmicrohttpd-0.9.55/src/microhttpd/test_upgrade.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/test_upgrade.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microhttpd/test_upgrade.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,1252 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff + + libmicrohttpd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + libmicrohttpd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_upgrade.c + * @brief Testcase for libmicrohttpd upgrading a connection + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include +#include +#include +#include +#include +#ifndef WINDOWS +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#include "mhd_sockets.h" +#ifdef HAVE_NETINET_IP_H +#include +#endif /* HAVE_NETINET_IP_H */ + +#include "platform.h" +#include "microhttpd.h" + +#include "test_helpers.h" + +#ifdef HTTPS_SUPPORT +#include +#include "../testcurl/https/tls_test_keys.h" + +#if defined(HAVE_FORK) && defined(HAVE_WAITPID) +#include +#include +#endif /* HAVE_FORK && HAVE_WAITPID */ +#endif /* HTTPS_SUPPORT */ + +static int verbose = 0; + +enum tls_tool +{ + TLS_CLI_NO_TOOL = 0, + TLS_CLI_GNUTLS, + TLS_CLI_OPENSSL, + TLS_LIB_GNUTLS +}; + +enum tls_tool use_tls_tool; + +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) +/** + * Fork child that connects via GnuTLS-CLI to our @a port. Allows us to + * talk to our port over a socket in @a sp without having to worry + * about TLS. + * + * @param location where the socket is returned + * @return -1 on error, otherwise PID of TLS child process + */ +static pid_t +gnutlscli_connect (int *sock, + uint16_t port) +{ + pid_t chld; + int sp[2]; + char destination[30]; + + if (0 != socketpair (AF_UNIX, + SOCK_STREAM, + 0, + sp)) + return -1; + chld = fork (); + if (0 != chld) + { + *sock = sp[1]; + MHD_socket_close_chk_ (sp[0]); + return chld; + } + MHD_socket_close_chk_ (sp[1]); + (void) close (0); + (void) close (1); + dup2 (sp[0], 0); + dup2 (sp[0], 1); + MHD_socket_close_chk_ (sp[0]); + if (TLS_CLI_GNUTLS == use_tls_tool) + { + snprintf (destination, + sizeof(destination), + "%u", + (unsigned int) port); + execlp ("gnutls-cli", + "gnutls-cli", + "--insecure", + "-p", + destination, + "127.0.0.1", + (char *) NULL); + } + else if (TLS_CLI_OPENSSL == use_tls_tool) + { + snprintf (destination, + sizeof(destination), + "127.0.0.1:%u", + (unsigned int) port); + execlp ("openssl", + "openssl", + "s_client", + "-connect", + destination, + "-verify", + "1", + (char *) NULL); + } + _exit (1); +} +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + + +/** + * Wrapper structure for plain&TLS sockets + */ +struct wr_socket_strc +{ + /** + * Real network socket + */ + MHD_socket fd; + + /** + * Type of this socket + */ + enum wr_type + { + wr_invalid = 0, + wr_plain = 1, + wr_tls = 2 + } t; +#ifdef HTTPS_SUPPORT + /** + * TLS credentials + */ + gnutls_certificate_credentials_t tls_crd; + + /** + * TLS session. + */ + gnutls_session_t tls_s; + + /** + * TLS handshake already succeed? + */ + bool tls_connected; +#endif +}; + + +/** + * Pseudo type for plain&TLS sockets + */ +typedef struct wr_socket_strc* wr_socket; + + +/** + * Invalid value of wr_socket + */ +#define WR_BAD (NULL) + + +/** + * Get underlying real socket. + * @return FD of real socket + */ +#define wr_fd(s) ((s)->fd) + + +/** + * Create wr_socket with plain TCP underlying socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket wr_create_plain_sckt(void) +{ + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + if (WR_BAD == s) + return WR_BAD; + s->t = wr_plain; + s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (MHD_INVALID_SOCKET != s->fd) + return s; + free(s); + return WR_BAD; +} + + +/** + * Create wr_socket with TLS TCP underlying socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket wr_create_tls_sckt(void) +{ +#ifdef HTTPS_SUPPORT + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + if (WR_BAD == s) + return WR_BAD; + s->t = wr_tls; + s->tls_connected = 0; + s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (MHD_INVALID_SOCKET != s->fd) + { + if (GNUTLS_E_SUCCESS == gnutls_init (&(s->tls_s), GNUTLS_CLIENT)) + { + if (GNUTLS_E_SUCCESS == gnutls_set_default_priority (s->tls_s)) + { + if (GNUTLS_E_SUCCESS == gnutls_certificate_allocate_credentials (&(s->tls_crd))) + { + if (GNUTLS_E_SUCCESS == gnutls_credentials_set (s->tls_s, GNUTLS_CRD_CERTIFICATE, s->tls_crd)) + { +#if GNUTLS_VERSION_NUMBER+0 >= 0x030109 + gnutls_transport_set_int (s->tls_s, (int)(s->fd)); +#else /* GnuTLS before 3.1.9 */ + gnutls_transport_set_ptr (s->tls_s, (gnutls_transport_ptr_t)(intptr_t)(s->fd)); +#endif /* GnuTLS before 3.1.9 */ + return s; + } + gnutls_certificate_free_credentials (s->tls_crd); + } + } + gnutls_deinit (s->tls_s); + } + (void)MHD_socket_close_ (s->fd); + } + free(s); +#endif /* HTTPS_SUPPORT */ + return WR_BAD; +} + + +/** + * Create wr_socket with plain TCP underlying socket + * from already created TCP socket. + * @param plain_sk real TCP socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket wr_create_from_plain_sckt(MHD_socket plain_sk) +{ + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + if (WR_BAD == s) + return WR_BAD; + s->t = wr_plain; + s->fd = plain_sk; + return s; +} + + +/** + * Connect socket to specified address. + * @param s socket to use + * @param addr address to connect + * @param length of sturcture pointed by @a addr + * @return zero on success, -1 otherwise. + */ +static int wr_connect(wr_socket s, struct sockaddr * addr, int length) +{ + if (0 != connect(s->fd, addr, length)) + return -1; + if (wr_plain == s->t) + return 0; +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + s->tls_connected = 0; + return 0; + /* Do not try handshake here as + * it require processing on MHD side and + * when testing with "external" polling, + * test will call MHD processing only + * after return from wr_connect(). */ + /* + int res = gnutls_handshake (s->tls_s); + if (GNUTLS_E_SUCCESS == res) + { + s->tls_connected = !0; + return 0; + } + if (GNUTLS_E_AGAIN == res) + return 0; + */ + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + +#ifdef HTTPS_SUPPORT +/* Only to be called from wr_send() and wr_recv() ! */ +static bool wr_handshake(wr_socket s) +{ + int res = gnutls_handshake (s->tls_s); + if (GNUTLS_E_SUCCESS == res) + s->tls_connected = !0; + else if (GNUTLS_E_AGAIN == res) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + return s->tls_connected; +} +#endif /* HTTPS_SUPPORT */ + + +/** + * Send data to remote by socket. + * @param s the socket to use + * @param buf the buffer with data to send + * @param len the length of data in @a buf + * @return number of bytes were sent if succeed, + * -1 if failed. Use #MHD_socket_get_error_() + * to get socket error. + */ +static ssize_t wr_send(wr_socket s, const void *buf, size_t len) +{ + if (wr_plain == s->t) + return MHD_send_(s->fd, buf, len); +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + ssize_t ret; + if (!s->tls_connected && !wr_handshake (s)) + return -1; + + ret = gnutls_record_send (s->tls_s, buf, len); + if (ret > 0) + return ret; + if (GNUTLS_E_AGAIN == ret) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + + +/** + * Receive data from remote by socket. + * @param s the socket to use + * @param buf the buffer to store received data + * @param len the length of @a buf + * @return number of bytes were received if succeed, + * -1 if failed. Use #MHD_socket_get_error_() + * to get socket error. + */ +static ssize_t wr_recv(wr_socket s, void *buf, size_t len) +{ + if (wr_plain == s->t) + return MHD_recv_ (s->fd, buf, len); +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + ssize_t ret; + if (!s->tls_connected && !wr_handshake (s)) + return -1; + + ret = gnutls_record_recv (s->tls_s, buf, len); + if (ret > 0) + return ret; + if (GNUTLS_E_AGAIN == ret) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + + +/** + * Close socket and release allocated resourced + * @param s the socket to close + * @return zero on succeed, -1 otherwise + */ +static int +wr_close(wr_socket s) +{ + int ret = (MHD_socket_close_(s->fd)) ? 0 : -1; +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + gnutls_deinit (s->tls_s); + gnutls_certificate_free_credentials (s->tls_crd); + } +#endif /* HTTPS_SUPPORT */ + free(s); + return ret; +} + + +/** + * Thread we use to run the interaction with the upgraded socket. + */ +static pthread_t pt; + +/** + * Will be set to the upgraded socket. + */ +static wr_socket usock; + +/** + * Thread we use to run the interaction with the upgraded socket. + */ +static pthread_t pt_client; + +/** + * Flag set to 1 once the test is finished. + */ +static volatile bool done; + + +static void +notify_completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) && + (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && + (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) + abort (); + if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) + abort (); + free (*con_cls); + *con_cls = NULL; +} + + +/** + * Logging callback. + * + * @param cls logging closure (NULL) + * @param uri access URI + * @param connection connection handle + * @return #TEST_PTR + */ +static void * +log_cb (void *cls, + const char *uri, + struct MHD_Connection *connection) +{ + pthread_t* ppth; + if (0 != strcmp (uri, + "/")) + abort (); + ppth = (pthread_t*) malloc (sizeof(pthread_t)); + if (NULL == ppth) + abort(); + *ppth = pthread_self (); + return (void *) ppth; +} + + +/** + * Function to check that MHD properly notifies about starting + * and stopping. + * + * @param cls client-defined closure + * @param connection connection handle + * @param socket_context socket-specific pointer where the + * client can associate some state specific + * to the TCP connection; note that this is + * different from the "con_cls" which is per + * HTTP request. The client can initialize + * during #MHD_CONNECTION_NOTIFY_STARTED and + * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED + * and access in the meantime using + * #MHD_CONNECTION_INFO_SOCKET_CONTEXT. + * @param toe reason for connection notification + * @see #MHD_OPTION_NOTIFY_CONNECTION + * @ingroup request + */ +static void +notify_connection_cb (void *cls, + struct MHD_Connection *connection, + void **socket_context, + enum MHD_ConnectionNotificationCode toe) +{ + static int started; + + switch (toe) + { + case MHD_CONNECTION_NOTIFY_STARTED: + if (MHD_NO != started) + abort (); + started = MHD_YES; + *socket_context = &started; + break; + case MHD_CONNECTION_NOTIFY_CLOSED: + if (MHD_YES != started) + abort (); + if (&started != *socket_context) + abort (); + *socket_context = NULL; + started = MHD_NO; + break; + } +} + + +/** + * Change socket to blocking. + * + * @param fd the socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +static void +make_blocking (MHD_socket fd) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (fd, F_GETFL); + if (-1 == flags) + return; + if ((flags & ~O_NONBLOCK) != flags) + if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK)) + abort (); +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + ioctlsocket (fd, FIONBIO, &flags); +#endif /* MHD_WINSOCK_SOCKETS */ + +} + + +static void +send_all (wr_socket sock, + const char *text) +{ + size_t len = strlen (text); + ssize_t ret; + + make_blocking (wr_fd (sock)); + for (size_t off = 0; off < len; off += ret) + { + ret = wr_send (sock, + &text[off], + len - off); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + { + ret = 0; + continue; + } + abort (); + } + } +} + + +/** + * Read character-by-character until we + * get '\r\n\r\n'. + */ +static void +recv_hdr (wr_socket sock) +{ + unsigned int i; + char next; + char c; + ssize_t ret; + + make_blocking (wr_fd (sock)); + next = '\r'; + i = 0; + while (i < 4) + { + ret = wr_recv (sock, + &c, + 1); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + continue; + abort (); + } + if (0 == ret) + continue; + if (c == next) + { + i++; + if (next == '\r') + next = '\n'; + else + next = '\r'; + continue; + } + if (c == '\r') + { + i = 1; + next = '\n'; + continue; + } + i = 0; + next = '\r'; + } +} + + +static void +recv_all (wr_socket sock, + const char *text) +{ + size_t len = strlen (text); + char buf[len]; + ssize_t ret; + + make_blocking (wr_fd (sock)); + for (size_t off = 0; off < len; off += ret) + { + ret = wr_recv (sock, + &buf[off], + len - off); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + { + ret = 0; + continue; + } + abort (); + } + } + if (0 != strncmp (text, buf, len)) + abort(); +} + + +/** + * Main function for the thread that runs the interaction with + * the upgraded socket. + * + * @param cls the handle for the upgrade + */ +static void * +run_usock (void *cls) +{ + struct MHD_UpgradeResponseHandle *urh = cls; + + send_all (usock, + "Hello"); + recv_all (usock, + "World"); + send_all (usock, + "Finished"); + MHD_upgrade_action (urh, + MHD_UPGRADE_ACTION_CLOSE); + return NULL; +} + + +/** + * Main function for the thread that runs the client-side of the + * interaction with the upgraded socket. + * + * @param cls the client socket + */ +static void * +run_usock_client (void *cls) +{ + wr_socket *sock = cls; + + send_all (*sock, + "GET / HTTP/1.1\r\nConnection: Upgrade\r\n\r\n"); + recv_hdr (*sock); + recv_all (*sock, + "Hello"); + send_all (*sock, + "World"); + recv_all (*sock, + "Finished"); + wr_close (*sock); + done = true; + return NULL; +} + + +/** + * Function called after a protocol "upgrade" response was sent + * successfully and the socket should now be controlled by some + * protocol other than HTTP. + * + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Except when in 'thread-per-connection' mode, implementations + * of this function should never block (as it will still be called + * from within the main event loop). + * + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). + * @param connection original HTTP connection handle, + * giving the function a last chance + * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in + * @param sock socket to use for bi-directional communication + * with the client. For HTTPS, this may not be a socket + * that is directly connected to the client and thus certain + * operations (TCP-specific setsockopt(), getsockopt(), etc.) + * may not work as expected (as the socket could be from a + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. + */ +static void +upgrade_cb (void *cls, + struct MHD_Connection *connection, + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh) +{ + usock = wr_create_from_plain_sckt (sock); + if (0 != extra_in_size) + abort (); + if (0 != pthread_create (&pt, + NULL, + &run_usock, + urh)) + abort (); +} + + +/** + * A client has requested the given url using the given method + * (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT, + * #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc). The callback + * must call MHD callbacks to provide content to give back to the + * client and return an HTTP status code (i.e. #MHD_HTTP_OK, + * #MHD_HTTP_NOT_FOUND, etc.). + * + * @param cls argument given together with the function + * pointer when the handler was registered with MHD + * @param url the requested url + * @param method the HTTP method used (#MHD_HTTP_METHOD_GET, + * #MHD_HTTP_METHOD_PUT, etc.) + * @param version the HTTP version string (i.e. + * #MHD_HTTP_VERSION_1_1) + * @param upload_data the data being uploaded (excluding HEADERS, + * for a POST that fits into memory and that is encoded + * with a supported encoding, the POST data will NOT be + * given in upload_data and is instead available as + * part of #MHD_get_connection_values; very large POST + * data *will* be made available incrementally in + * @a upload_data) + * @param upload_data_size set initially to the size of the + * @a upload_data provided; the method must update this + * value to the number of bytes NOT processed; + * @param con_cls pointer that the callback can set to some + * address and that will be preserved by MHD for future + * calls for this request; since the access handler may + * be called many times (i.e., for a PUT/POST operation + * with plenty of upload data) this allows the application + * to easily associate some request-specific state. + * If necessary, this state can be cleaned up in the + * global #MHD_RequestCompletedCallback (which + * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). + * Initially, `*con_cls` will be NULL. + * @return #MHD_YES if the connection was handled successfully, + * #MHD_NO if the socket must be closed due to a serios + * error while handling the request + */ +static int +ahc_upgrade (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + struct MHD_Response *resp; + int ret; + + if (NULL == *con_cls) + abort (); + if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) + abort (); + resp = MHD_create_response_for_upgrade (&upgrade_cb, + NULL); + MHD_add_response_header (resp, + MHD_HTTP_HEADER_UPGRADE, + "Hello World Protocol"); + ret = MHD_queue_response (connection, + MHD_HTTP_SWITCHING_PROTOCOLS, + resp); + MHD_destroy_response (resp); + return ret; +} + + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_select_loop (struct MHD_Daemon *daemon) +{ + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max_fd; + MHD_UNSIGNED_LONG_LONG to; + struct timeval tv; + + while (! done) + { + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + max_fd = -1; + to = 1000; + + if (MHD_YES != + MHD_get_fdset (daemon, + &rs, + &ws, + &es, + &max_fd)) + abort (); + (void) MHD_get_timeout (daemon, + &to); + if (1000 < to) + to = 1000; + tv.tv_sec = to / 1000; + tv.tv_usec = 1000 * (to % 1000); + if (0 > MHD_SYS_select_ (max_fd + 1, + &rs, + &ws, + &es, + &tv)) + abort (); + MHD_run_from_select (daemon, + &rs, + &ws, + &es); + } +} + +#ifdef HAVE_POLL + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_poll_loop (struct MHD_Daemon *daemon) +{ + abort (); /* currently not implementable with existing MHD API */ +} +#endif /* HAVE_POLL */ + + +#ifdef EPOLL_SUPPORT +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_epoll_loop (struct MHD_Daemon *daemon) +{ + const union MHD_DaemonInfo *di; + MHD_socket ep; + fd_set rs; + MHD_UNSIGNED_LONG_LONG to; + struct timeval tv; + + di = MHD_get_daemon_info (daemon, + MHD_DAEMON_INFO_EPOLL_FD); + ep = di->listen_fd; + while (! done) + { + FD_ZERO (&rs); + to = 1000; + + FD_SET (ep, &rs); + (void) MHD_get_timeout (daemon, + &to); + if (1000 < to) + to = 1000; + tv.tv_sec = to / 1000; + tv.tv_usec = 1000 * (to % 1000); + select (ep + 1, + &rs, + NULL, + NULL, + &tv); + MHD_run (daemon); + } +} +#endif /* EPOLL_SUPPORT */ + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_loop (struct MHD_Daemon *daemon, + int flags) +{ + if (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) + run_mhd_select_loop (daemon); +#ifdef HAVE_POLL + else if (0 != (flags & MHD_USE_POLL)) + run_mhd_poll_loop (daemon); +#endif /* HAVE_POLL */ +#if EPOLL_SUPPORT + else if (0 != (flags & MHD_USE_EPOLL)) + run_mhd_epoll_loop (daemon); +#endif + else + abort (); +} + +static bool test_tls; + +/** + * Test upgrading a connection. + * + * @param flags which event loop style should be tested + * @param pool size of the thread pool, 0 to disable + */ +static int +test_upgrade (int flags, + unsigned int pool) +{ + struct MHD_Daemon *d = NULL; + wr_socket sock; + struct sockaddr_in sa; + const union MHD_DaemonInfo *real_flags; +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + pid_t pid = -1; +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + + done = false; + + if (!test_tls) + d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, + 1080, + NULL, NULL, + &ahc_upgrade, NULL, + MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb, NULL, + MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb, NULL, + MHD_OPTION_THREAD_POOL_SIZE, pool, + MHD_OPTION_END); +#ifdef HTTPS_SUPPORT + else + d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS, + 1080, + NULL, NULL, + &ahc_upgrade, NULL, + MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb, NULL, + MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_THREAD_POOL_SIZE, pool, + MHD_OPTION_END); +#endif /* HTTPS_SUPPORT */ + if (NULL == d) + return 2; + real_flags = MHD_get_daemon_info(d, MHD_DAEMON_INFO_FLAGS); + if (NULL == real_flags) + abort (); + if (!test_tls || TLS_LIB_GNUTLS == use_tls_tool) + { + sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); + if (WR_BAD == sock) + abort (); + sa.sin_family = AF_INET; + sa.sin_port = htons (1080); + sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (0 != wr_connect (sock, + (struct sockaddr *) &sa, + sizeof (sa))) + abort (); + } + else + { +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + MHD_socket tls_fork_sock; + if (-1 == (pid = gnutlscli_connect (&tls_fork_sock, 1080))) + { + MHD_stop_daemon (d); + return 4; + } + sock = wr_create_from_plain_sckt (tls_fork_sock); + if (WR_BAD == sock) + abort (); +#else /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */ + abort (); +#endif /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */ + } + + if (0 != pthread_create (&pt_client, + NULL, + &run_usock_client, + &sock)) + abort (); + if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) ) + run_mhd_loop (d, real_flags->flags); + pthread_join (pt_client, + NULL); + pthread_join (pt, + NULL); +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + if (test_tls && TLS_LIB_GNUTLS != use_tls_tool) + waitpid (pid, NULL, 0); +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, + char *const *argv) +{ + int error_count = 0; + int res; + + use_tls_tool = TLS_CLI_NO_TOOL; + test_tls = has_in_name(argv[0], "_tls"); + + if (has_param(argc, argv, "-v") || has_param(argc, argv, "--verbose")) + verbose = 1; + + if (test_tls) + { +#ifdef HTTPS_SUPPORT + if (has_param(argc, argv, "--use-gnutls-cli")) + use_tls_tool = TLS_CLI_GNUTLS; + else if (has_param(argc, argv, "--use-openssl")) + use_tls_tool = TLS_CLI_OPENSSL; + else if (has_param(argc, argv, "--use-gnutls-lib")) + use_tls_tool = TLS_LIB_GNUTLS; +#if defined(HAVE_FORK) && defined(HAVE_WAITPID) + else if (0 == system ("gnutls-cli --version 1> /dev/null")) + use_tls_tool = TLS_CLI_GNUTLS; + else if (0 == system ("openssl version 1> /dev/null")) + use_tls_tool = TLS_CLI_OPENSSL; +#endif /* HAVE_FORK && HAVE_WAITPID */ + else + use_tls_tool = TLS_LIB_GNUTLS; /* Should be available as MHD use it. */ + if (verbose) + { + switch (use_tls_tool) + { + case TLS_CLI_GNUTLS: + printf ("GnuTLS-CLI will be used for testing.\n"); + break; + case TLS_CLI_OPENSSL: + printf ("Command line version of OpenSSL will be used for testing.\n"); + break; + case TLS_LIB_GNUTLS: + printf ("GnuTLS library will be used for testing.\n"); + break; + default: + abort (); + } + } + if ( (TLS_LIB_GNUTLS == use_tls_tool) && + (GNUTLS_E_SUCCESS != gnutls_global_init()) ) + abort (); + +#else /* ! HTTPS_SUPPORT */ + fprintf (stderr, "HTTPS support was disabled by configure.\n"); + return 77; +#endif /* ! HTTPS_SUPPORT */ + } + + /* run tests */ + if (verbose) + printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n", test_tls ? "TLS" : "plain"); + /* try external select */ + res = test_upgrade (0, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external select, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external select.\n"); + + /* Try external auto */ + res = test_upgrade (MHD_USE_AUTO, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external 'auto', return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external 'auto'.\n"); + +#ifdef EPOLL_SUPPORT + res = test_upgrade (MHD_USE_EPOLL, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external select with EPOLL, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external select with EPOLL.\n"); +#endif + + /* Test thread-per-connection */ + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection.\n"); + + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection and 'auto', return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection and 'auto'.\n"); +#ifdef HAVE_POLL + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection and poll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection and poll.\n"); +#endif /* HAVE_POLL */ + + /* Test different event loops, with and without thread pool */ + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal select, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal select.\n"); + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD, + 2); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal select with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal select with thread pool.\n"); + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal 'auto' return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal 'auto'.\n"); + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, + 2); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal 'auto' with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal 'auto' with thread pool.\n"); +#ifdef HAVE_POLL + res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal poll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal poll.\n"); + res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD, + 2); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal poll with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal poll with thread pool.\n"); +#endif +#ifdef EPOLL_SUPPORT + res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD, + 0); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal epoll.\n"); + res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD, + 2); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal epoll.\n"); +#endif + /* report result */ + if (0 != error_count) + fprintf (stderr, + "Error (code: %u)\n", + error_count); +#ifdef HTTPS_SUPPORT + if (test_tls && (TLS_LIB_GNUTLS == use_tls_tool)) + gnutls_global_deinit(); +#endif /* HTTPS_SUPPORT */ + return error_count != 0; /* 0 == pass */ +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/tsearch.c libmicrohttpd-0.9.55/src/microhttpd/tsearch.c --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/tsearch.c 2015-09-06 18:41:01.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/tsearch.c 2017-05-28 22:34:00.000000000 +0200 @@ -12,68 +12,77 @@ #include "tsearch.h" #include -typedef struct node { + +typedef struct node +{ const void *key; - struct node *llink, *rlink; + struct node *llink; + struct node *rlink; } node_t; + /* $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $ */ /* find or insert datum into search tree */ void * -tsearch(const void *vkey, /* key to be located */ - void **vrootp, /* address of tree root */ - int (*compar)(const void *, const void *)) +tsearch (const void *vkey, /* key to be located */ + void **vrootp, /* address of tree root */ + int (*compar)(const void *, const void *)) { - node_t *q; - node_t **rootp = (node_t **)vrootp; - - if (rootp == NULL) - return NULL; + node_t *q; + node_t **rootp = (node_t **)vrootp; - while (*rootp != NULL) { /* Knuth's T1: */ - int r; + if (NULL == rootp) + return NULL; - if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ - return *rootp; /* we found it! */ - - rootp = (r < 0) ? - &(*rootp)->llink : /* T3: follow left branch */ - &(*rootp)->rlink; /* T4: follow right branch */ - } - - q = malloc(sizeof(node_t)); /* T5: key not found */ - if (q) { /* make new node */ - *rootp = q; /* link new node to old */ - q->key = vkey; /* initialize new node */ - q->llink = q->rlink = NULL; - } - return q; + while (*rootp != NULL) + { /* Knuth's T1: */ + int r; + + if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ + return *rootp; /* we found it! */ + + rootp = (r < 0) ? + &(*rootp)->llink : /* T3: follow left branch */ + &(*rootp)->rlink; /* T4: follow right branch */ + } + + q = malloc (sizeof(node_t)); /* T5: key not found */ + if (q) + { /* make new node */ + *rootp = q; /* link new node to old */ + q->key = vkey; /* initialize new node */ + q->llink = q->rlink = NULL; + } + return q; } + /* $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */ /* find a node, or return NULL */ void * -tfind(const void *vkey, /* key to be found */ - void * const *vrootp, /* address of the tree root */ - int (*compar)(const void *, const void *)) +tfind (const void *vkey, /* key to be found */ + void * const *vrootp, /* address of the tree root */ + int (*compar)(const void *, const void *)) { - node_t * const *rootp = (node_t * const*)vrootp; - - if (rootp == NULL) - return NULL; + node_t * const *rootp = (node_t * const*)vrootp; - while (*rootp != NULL) { /* T1: */ - int r; + if (NULL == rootp) + return NULL; - if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ - return *rootp; /* key found */ - rootp = (r < 0) ? - &(*rootp)->llink : /* T3: follow left branch */ - &(*rootp)->rlink; /* T4: follow right branch */ - } - return NULL; + while (*rootp != NULL) + { /* T1: */ + int r; + + if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ + return *rootp; /* key found */ + rootp = (r < 0) ? + &(*rootp)->llink : /* T3: follow left branch */ + &(*rootp)->rlink; /* T4: follow right branch */ + } + return NULL; } + /* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */ /* * delete node with given key @@ -83,42 +92,52 @@ * compar: function to carry out node comparisons */ void * -tdelete(const void * __restrict vkey, void ** __restrict vrootp, - int (*compar)(const void *, const void *)) +tdelete (const void * __restrict vkey, + void ** __restrict vrootp, + int (*compar)(const void *, const void *)) { - node_t **rootp = (node_t **)vrootp; - node_t *p, *q, *r; - int cmp; - - if (rootp == NULL || (p = *rootp) == NULL) - return NULL; - - while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) { - p = *rootp; - rootp = (cmp < 0) ? - &(*rootp)->llink : /* follow llink branch */ - &(*rootp)->rlink; /* follow rlink branch */ - if (*rootp == NULL) - return NULL; /* key not found */ - } - r = (*rootp)->rlink; /* D1: */ - if ((q = (*rootp)->llink) == NULL) /* Left NULL? */ - q = r; - else if (r != NULL) { /* Right link is NULL? */ - if (r->llink == NULL) { /* D2: Find successor */ - r->llink = q; - q = r; - } else { /* D3: Find NULL link */ - for (q = r->llink; q->llink != NULL; q = r->llink) - r = q; - r->llink = q->rlink; - q->llink = (*rootp)->llink; - q->rlink = (*rootp)->rlink; - } - } - free(*rootp); /* D4: Free node */ - *rootp = q; /* link parent to new node */ - return p; + node_t **rootp = (node_t **)vrootp; + node_t *p; + node_t *q; + node_t *r; + int cmp; + + if (rootp == NULL || (p = *rootp) == NULL) + return NULL; + + while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) + { + p = *rootp; + rootp = (cmp < 0) ? + &(*rootp)->llink : /* follow llink branch */ + &(*rootp)->rlink; /* follow rlink branch */ + if (*rootp == NULL) + return NULL; /* key not found */ + } + r = (*rootp)->rlink; /* D1: */ + if ((q = (*rootp)->llink) == NULL) /* Left NULL? */ + { + q = r; + } + else if (r != NULL) + { /* Right link is NULL? */ + if (r->llink == NULL) + { /* D2: Find successor */ + r->llink = q; + q = r; + } + else + { /* D3: Find NULL link */ + for (q = r->llink; q->llink != NULL; q = r->llink) + r = q; + r->llink = q->rlink; + q->llink = (*rootp)->llink; + q->rlink = (*rootp)->rlink; + } + } + free(*rootp); /* D4: Free node */ + *rootp = q; /* link parent to new node */ + return p; } /* end of tsearch.c */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microhttpd/tsearch.h libmicrohttpd-0.9.55/src/microhttpd/tsearch.h --- libmicrohttpd-0.9.44+dfsg/src/microhttpd/tsearch.h 2015-09-06 18:41:01.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microhttpd/tsearch.h 2017-05-28 22:34:00.000000000 +0200 @@ -12,11 +12,25 @@ #if defined(__cplusplus) extern "C" { #endif /* __cplusplus */ -void *tdelete(const void * __restrict, void ** __restrict, - int (*)(const void *, const void *)); -void *tfind(const void *, void * const *, - int (*)(const void *, const void *)); -void *tsearch(const void *, void **, int (*)(const void *, const void *)); + + +void * +tdelete (const void * __restrict, + void ** __restrict, + int (*)(const void *, const void *)); + + +void * +tfind (const void *, + void * const *, + int (*)(const void *, const void *)); + + +void * +tsearch (const void *, + void **, + int (*)(const void *, const void *)); + #if defined(__cplusplus) }; #endif /* __cplusplus */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/alstructures.c libmicrohttpd-0.9.55/src/microspdy/alstructures.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/alstructures.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/alstructures.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file alstructures.c - * @brief structures only for the application layer - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "alstructures.h" -#include "internal.h" - -void -SPDY_destroy_request (struct SPDY_Request *request) -{ - if(NULL == request) - { - SPDYF_DEBUG("request is NULL"); - return; - } - //strings into request struct are just references to strings in - //headers, so no need to free them twice - SPDY_name_value_destroy(request->headers); - free(request); -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/alstructures.h libmicrohttpd-0.9.55/src/microspdy/alstructures.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/alstructures.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/alstructures.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,79 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file alstructures.h - * @brief structures only for the application layer - * @author Andrey Uzunov - */ - -#ifndef ALSTRUCTURES_H -#define ALSTRUCTURES_H - -#include "platform.h" - - -/** - * Represents a SPDY request. - */ -struct SPDY_Request -{ - /** - * SPDY stream in whose context the request was received - */ - struct SPDYF_Stream *stream; - - /** - * Other HTTP headers from the request - */ - struct SPDY_NameValue *headers; - - /** - * HTTP method - */ - char *method; - - /** - * HTTP path - */ - char *path; - - /** - * HTTP version just like in HTTP request/response: - * "HTTP/1.0" or "HTTP/1.1" currently - */ - char *version; - - /** - * called host as in HTTP - */ - char *host; - - /** - * The scheme used ("http" or "https") - */ - char *scheme; - - /** - * Extra field to be used by the user with set/get func for whatever - * purpose he wants. - */ - void *user_cls; -}; - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/applicationlayer.c libmicrohttpd-0.9.55/src/microspdy/applicationlayer.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/applicationlayer.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/applicationlayer.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,748 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file applicationlayer.c - * @brief SPDY application or HTTP layer - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "applicationlayer.h" -#include "alstructures.h" -#include "structures.h" -#include "internal.h" -#include "daemon.h" -#include "session.h" - - -void -spdy_callback_response_done(void *cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)cls; - (void)status; - (void)streamopened; - - SPDY_destroy_request(request); - SPDY_destroy_response(response); -} - - -/** - * Callback called when new stream is created. It extracts the info from - * the stream to create (HTTP) request object and pass it to the client. - * - * @param cls - * @param stream the new SPDY stream - * @return SPDY_YES on success, SPDY_NO on memomry error - */ -static int -spdy_handler_new_stream (void *cls, - struct SPDYF_Stream * stream) -{ - (void)cls; - unsigned int i; - char *method = NULL; - char *path = NULL; - char *version = NULL; - char *host = NULL; - char *scheme = NULL; - struct SPDY_Request * request = NULL; - struct SPDY_NameValue * headers = NULL; - struct SPDY_NameValue * iterator = stream->headers; - struct SPDY_Daemon *daemon; - - daemon = stream->session->daemon; - - //if the user doesn't care, ignore it - if(NULL == daemon->new_request_cb) - return SPDY_YES; - - if(NULL == (headers=SPDY_name_value_create())) - goto free_and_fail; - - if(NULL==(request = malloc(sizeof(struct SPDY_Request)))) - goto free_and_fail; - - memset(request, 0, sizeof(struct SPDY_Request)); - request->stream = stream; - - /* extract the mandatory fields from stream->headers' structure - * to pass them to the client */ - while(iterator != NULL) - { - if(strcmp(":method",iterator->name) == 0) - { - if(1 != iterator->num_values) - break; - method = iterator->value[0]; - } - else if(strcmp(":path",iterator->name) == 0) - { - if(1 != iterator->num_values) - break; - path = iterator->value[0]; - } - else if(strcmp(":version",iterator->name) == 0) - { - if(1 != iterator->num_values) - break; - version = iterator->value[0]; - } - else if(strcmp(":host",iterator->name) == 0) - { - //TODO can it have more values? - if(1 != iterator->num_values) - break; - host = iterator->value[0]; - } - else if(strcmp(":scheme",iterator->name) == 0) - { - if(1 != iterator->num_values) - break; - scheme = iterator->value[0]; - } - else - for(i=0; inum_values; ++i) - if (SPDY_YES != SPDY_name_value_add(headers,iterator->name,iterator->value[i])) - { - SPDY_destroy_request(request); - goto free_and_fail; - } - - iterator = iterator->next; - } - - request->method=method; - request->path=path; - request->version=version; - request->host=host; - request->scheme=scheme; - request->headers=headers; - - //check request validity, all these fields are mandatory for a request - if(NULL == method || strlen(method) == 0 - || NULL == path || strlen(path) == 0 - || NULL == version || strlen(version) == 0 - || NULL == host || strlen(host) == 0 - || NULL == scheme || strlen(scheme) == 0 - ) - { - //TODO HTTP 400 Bad Request must be answered - - SPDYF_DEBUG("Bad request"); - - SPDY_destroy_request(request); - - return SPDY_YES; - } - - //call client's callback function to notify - daemon->new_request_cb(daemon->cls, - request, - stream->priority, - method, - path, - version, - host, - scheme, - headers, - !stream->is_in_closed); - - stream->cls = request; - - return SPDY_YES; - - //for GOTO - free_and_fail: - - SPDY_name_value_destroy(headers); - return SPDY_NO; -} - - -/** - * TODO - */ -static int -spdy_handler_new_data (void * cls, - struct SPDYF_Stream *stream, - const void * buf, - size_t size, - bool more) -{ - return stream->session->daemon->received_data_cb(cls, stream->cls, buf, size, more); -} - - - -/** - * Callback to be called when the response queue object was handled and - * the data was already sent or discarded. - * - * @param cls - * @param response_queue the object which is being handled - * @param status shows if actually the response was sent or it was - * discarded by the lib for any reason (e.g., closing session, - * closing stream, stopping daemon, etc.). It is possible that - * status indicates an error but parts of the response headers - * and/or body (in one - * or several frames) were already sent to the client. - */ -static void -spdy_handler_response_queue_result(void * cls, - struct SPDYF_Response_Queue *response_queue, - enum SPDY_RESPONSE_RESULT status) -{ - int streamopened; - struct SPDY_Request *request = (struct SPDY_Request *)cls; - - SPDYF_ASSERT( ( (NULL == response_queue->data_frame) && - (NULL != response_queue->control_frame) ) || - ( (NULL != response_queue->data_frame) && - (NULL == response_queue->control_frame) ), - "response queue must have either control frame or data frame"); - - streamopened = !response_queue->stream->is_out_closed; - - response_queue->rrcb(response_queue->rrcb_cls, response_queue->response, request, status, streamopened); -} - - -int -(SPDY_init) (enum SPDY_IO_SUBSYSTEM io_subsystem, ...) -{ - SPDYF_ASSERT(SPDYF_BUFFER_SIZE >= SPDY_MAX_SUPPORTED_FRAME_SIZE, - "Buffer size is less than max supported frame size!"); - SPDYF_ASSERT(SPDY_MAX_SUPPORTED_FRAME_SIZE >= 32, - "Max supported frame size must be bigger than the minimal value!"); - SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized, - "SPDY_init must be called only once per program or after SPDY_deinit"); - - if(SPDY_IO_SUBSYSTEM_OPENSSL & io_subsystem) - { - SPDYF_openssl_global_init(); - spdyf_io_initialized |= SPDY_IO_SUBSYSTEM_OPENSSL; - } - else if(SPDY_IO_SUBSYSTEM_RAW & io_subsystem) - { - SPDYF_raw_global_init(); - spdyf_io_initialized |= SPDY_IO_SUBSYSTEM_RAW; - } - - SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized, - "SPDY_init could not find even one IO subsystem"); - - return SPDY_YES; -} - - -void -SPDY_deinit () -{ - SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized, - "SPDY_init has not been called!"); - - if(SPDY_IO_SUBSYSTEM_OPENSSL & spdyf_io_initialized) - SPDYF_openssl_global_deinit(); - else if(SPDY_IO_SUBSYSTEM_RAW & spdyf_io_initialized) - SPDYF_raw_global_deinit(); - - spdyf_io_initialized = SPDY_IO_SUBSYSTEM_NONE; -} - - -void -SPDY_run (struct SPDY_Daemon *daemon) -{ - if(NULL == daemon) - { - SPDYF_DEBUG("daemon is NULL"); - return; - } - - SPDYF_run(daemon); -} - - -int -SPDY_get_timeout (struct SPDY_Daemon *daemon, - unsigned long long *timeout) -{ - if(NULL == daemon) - { - SPDYF_DEBUG("daemon is NULL"); - return SPDY_INPUT_ERROR; - } - - return SPDYF_get_timeout(daemon,timeout); -} - - -int -SPDY_get_fdset (struct SPDY_Daemon *daemon, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *except_fd_set) -{ - if(NULL == daemon - || NULL == read_fd_set - || NULL == write_fd_set - || NULL == except_fd_set) - { - SPDYF_DEBUG("a parameter is NULL"); - return SPDY_INPUT_ERROR; - } - - return SPDYF_get_fdset(daemon, - read_fd_set, - write_fd_set, - except_fd_set, - false); -} - - -struct SPDY_Daemon * -SPDY_start_daemon (uint16_t port, - const char *certfile, - const char *keyfile, - SPDY_NewSessionCallback nscb, - SPDY_SessionClosedCallback sccb, - SPDY_NewRequestCallback nrcb, - SPDY_NewDataCallback npdcb, - void * cls, - ...) -{ - struct SPDY_Daemon *daemon; - va_list valist; - - if(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized) - { - SPDYF_DEBUG("library not initialized"); - return NULL; - } - /* - * for now make this checks in framing layer - if(NULL == certfile) - { - SPDYF_DEBUG("certfile is NULL"); - return NULL; - } - if(NULL == keyfile) - { - SPDYF_DEBUG("keyfile is NULL"); - return NULL; - } - */ - - va_start(valist, cls); - daemon = SPDYF_start_daemon_va ( port, - certfile, - keyfile, - nscb, - sccb, - nrcb, - npdcb, - &spdy_handler_new_stream, - &spdy_handler_new_data, - cls, - NULL, - valist - ); - va_end(valist); - - return daemon; -} - - -void -SPDY_stop_daemon (struct SPDY_Daemon *daemon) -{ - if(NULL == daemon) - { - SPDYF_DEBUG("daemon is NULL"); - return; - } - - SPDYF_stop_daemon(daemon); -} - - -struct SPDY_Response * -SPDY_build_response(int status, - const char * statustext, - const char * version, - struct SPDY_NameValue * headers, - const void * data, - size_t size) -{ - struct SPDY_Response *response = NULL; - struct SPDY_NameValue ** all_headers = NULL; //TODO maybe array in stack is enough - char *fullstatus = NULL; - int ret; - int num_hdr_containers = 1; - - if(NULL == version) - { - SPDYF_DEBUG("version is NULL"); - return NULL; - } - - if(NULL == (response = malloc(sizeof(struct SPDY_Response)))) - goto free_and_fail; - memset(response, 0, sizeof(struct SPDY_Response)); - - if(NULL != headers && !SPDYF_name_value_is_empty(headers)) - num_hdr_containers = 2; - - if(NULL == (all_headers = malloc(num_hdr_containers * sizeof(struct SPDY_NameValue *)))) - goto free_and_fail; - memset(all_headers, 0, num_hdr_containers * sizeof(struct SPDY_NameValue *)); - - if(2 == num_hdr_containers) - all_headers[1] = headers; - - if(NULL == (all_headers[0] = SPDY_name_value_create())) - goto free_and_fail; - - if(NULL == statustext) - ret = asprintf(&fullstatus, "%i", status); - else - ret = asprintf(&fullstatus, "%i %s", status, statustext); - if(-1 == ret) - goto free_and_fail; - - if(SPDY_YES != SPDY_name_value_add(all_headers[0], ":status", fullstatus)) - goto free_and_fail; - - free(fullstatus); - fullstatus = NULL; - - if(SPDY_YES != SPDY_name_value_add(all_headers[0], ":version", version)) - goto free_and_fail; - - if(0 >= (response->headers_size = SPDYF_name_value_to_stream(all_headers, - num_hdr_containers, - &(response->headers)))) - goto free_and_fail; - - SPDY_name_value_destroy(all_headers[0]); - free(all_headers); - all_headers = NULL; - - if(size > 0) - { - //copy the data to the response object - if(NULL == (response->data = malloc(size))) - { - free(response->headers); - goto free_and_fail; - } - memcpy(response->data, data, size); - response->data_size = size; - } - - return response; - - //for GOTO - free_and_fail: - - free(fullstatus); - if(NULL != all_headers) - SPDY_name_value_destroy(all_headers[0]); - free(all_headers); - free(response); - - return NULL; -} - - -struct SPDY_Response * -SPDY_build_response_with_callback(int status, - const char * statustext, - const char * version, - struct SPDY_NameValue * headers, - SPDY_ResponseCallback rcb, - void *rcb_cls, - uint32_t block_size) -{ - struct SPDY_Response *response; - - if(NULL == rcb) - { - SPDYF_DEBUG("rcb is NULL"); - return NULL; - } - if(block_size > SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - SPDYF_DEBUG("block_size is wrong"); - return NULL; - } - - if(0 == block_size) - block_size = SPDY_MAX_SUPPORTED_FRAME_SIZE; - - response = SPDY_build_response(status, - statustext, - version, - headers, - NULL, - 0); - - if(NULL == response) - { - return NULL; - } - - response->rcb = rcb; - response->rcb_cls = rcb_cls; - response->rcb_block_size = block_size; - - return response; -} - - -int -SPDY_queue_response (struct SPDY_Request * request, - struct SPDY_Response *response, - bool closestream, - bool consider_priority, - SPDY_ResponseResultCallback rrcb, - void * rrcb_cls) -{ - struct SPDYF_Response_Queue *headers_to_queue; - struct SPDYF_Response_Queue *body_to_queue; - SPDYF_ResponseQueueResultCallback frqcb = NULL; - void *frqcb_cls = NULL; - int int_consider_priority = consider_priority ? SPDY_YES : SPDY_NO; - - if(NULL == request) - { - SPDYF_DEBUG("request is NULL"); - return SPDY_INPUT_ERROR; - } - if(NULL == response) - { - SPDYF_DEBUG("request is NULL"); - return SPDY_INPUT_ERROR; - } - - if(request->stream->is_out_closed - || SPDY_SESSION_STATUS_CLOSING == request->stream->session->status) - return SPDY_NO; - - if(NULL != rrcb) - { - frqcb_cls = request; - frqcb = &spdy_handler_response_queue_result; - } - - if(response->data_size > 0) - { - //SYN_REPLY and DATA will be queued - - if(NULL == (headers_to_queue = SPDYF_response_queue_create(false, - response->headers, - response->headers_size, - response, - request->stream, - false, - NULL, - NULL, - NULL, - NULL))) - { - return SPDY_NO; - } - - if(NULL == (body_to_queue = SPDYF_response_queue_create(true, - response->data, - response->data_size, - response, - request->stream, - closestream, - frqcb, - frqcb_cls, - rrcb, - rrcb_cls))) - { - SPDYF_response_queue_destroy(headers_to_queue); - return SPDY_NO; - } - - SPDYF_queue_response (headers_to_queue, - request->stream->session, - int_consider_priority); - - SPDYF_queue_response (body_to_queue, - request->stream->session, - int_consider_priority); - } - else if(NULL == response->rcb) - { - //no "body" will be queued, e.g. HTTP 404 without body - - if(NULL == (headers_to_queue = SPDYF_response_queue_create(false, - response->headers, - response->headers_size, - response, - request->stream, - closestream, - frqcb, - frqcb_cls, - rrcb, - rrcb_cls))) - { - return SPDY_NO; - } - - SPDYF_queue_response (headers_to_queue, - request->stream->session, - int_consider_priority); - } - else - { - //response with callbacks - - if(NULL == (headers_to_queue = SPDYF_response_queue_create(false, - response->headers, - response->headers_size, - response, - request->stream, - false, - NULL, - NULL, - NULL, - NULL))) - { - return SPDY_NO; - } - - if(NULL == (body_to_queue = SPDYF_response_queue_create(true, - response->data, - response->data_size, - response, - request->stream, - closestream, - frqcb, - frqcb_cls, - rrcb, - rrcb_cls))) - { - SPDYF_response_queue_destroy(headers_to_queue); - return SPDY_NO; - } - - SPDYF_queue_response (headers_to_queue, - request->stream->session, - int_consider_priority); - - SPDYF_queue_response (body_to_queue, - request->stream->session, - int_consider_priority); - } - - return SPDY_YES; -} - - -socklen_t -SPDY_get_remote_addr(struct SPDY_Session * session, - struct sockaddr ** addr) -{ - if(NULL == session) - { - SPDYF_DEBUG("session is NULL"); - return 0; - } - - *addr = session->addr; - - return session->addr_len; -} - - -struct SPDY_Session * -SPDY_get_session_for_request(const struct SPDY_Request * request) -{ - if(NULL == request) - { - SPDYF_DEBUG("request is NULL"); - return NULL; - } - - return request->stream->session; -} - - -void * -SPDY_get_cls_from_session(struct SPDY_Session * session) -{ - if(NULL == session) - { - SPDYF_DEBUG("session is NULL"); - return NULL; - } - - return session->user_cls; -} - - -void -SPDY_set_cls_to_session(struct SPDY_Session * session, - void * cls) -{ - if(NULL == session) - { - SPDYF_DEBUG("session is NULL"); - return; - } - - session->user_cls = cls; -} - - -void * -SPDY_get_cls_from_request(struct SPDY_Request * request) -{ - if(NULL == request) - { - SPDYF_DEBUG("request is NULL"); - return NULL; - } - - return request->user_cls; -} - - -void -SPDY_set_cls_to_request(struct SPDY_Request * request, - void * cls) -{ - if(NULL == request) - { - SPDYF_DEBUG("request is NULL"); - return; - } - - request->user_cls = cls; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/applicationlayer.h libmicrohttpd-0.9.55/src/microspdy/applicationlayer.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/applicationlayer.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/applicationlayer.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file applicationlayer.h - * @brief SPDY application or HTTP layer - * @author Andrey Uzunov - */ - -#ifndef APPLICATIONLAYER_H -#define APPLICATIONLAYER_H - -#include "platform.h" - - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/compression.c libmicrohttpd-0.9.55/src/microspdy/compression.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/compression.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/compression.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,441 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file compression.c - * @brief zlib handling functions - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "compression.h" - -/* spdy ver 3 specific dictionary used by zlib */ -static const unsigned char -spdyf_zlib_dictionary[] = { - 0x00, 0x00, 0x00, 0x07, 0x6f, 0x70, 0x74, 0x69, // - - - - o p t i - 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x04, 0x68, // o n s - - - - h - 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x04, 0x70, // e a d - - - - p - 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x03, 0x70, // o s t - - - - p - 0x75, 0x74, 0x00, 0x00, 0x00, 0x06, 0x64, 0x65, // u t - - - - d e - 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x00, 0x05, // l e t e - - - - - 0x74, 0x72, 0x61, 0x63, 0x65, 0x00, 0x00, 0x00, // t r a c e - - - - 0x06, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x00, // - a c c e p t - - 0x00, 0x00, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, // - - - a c c e p - 0x74, 0x2d, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // t - c h a r s e - 0x74, 0x00, 0x00, 0x00, 0x0f, 0x61, 0x63, 0x63, // t - - - - a c c - 0x65, 0x70, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // e p t - e n c o - 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x0f, // d i n g - - - - - 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x6c, // a c c e p t - l - 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x00, // a n g u a g e - - 0x00, 0x00, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x70, // - - - a c c e p - 0x74, 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, // t - r a n g e s - 0x00, 0x00, 0x00, 0x03, 0x61, 0x67, 0x65, 0x00, // - - - - a g e - - 0x00, 0x00, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, // - - - a l l o w - 0x00, 0x00, 0x00, 0x0d, 0x61, 0x75, 0x74, 0x68, // - - - - a u t h - 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, // o r i z a t i o - 0x6e, 0x00, 0x00, 0x00, 0x0d, 0x63, 0x61, 0x63, // n - - - - c a c - 0x68, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, // h e - c o n t r - 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, // o l - - - - c o - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, // n n e c t i o n - 0x00, 0x00, 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, // - - - - c o n t - 0x65, 0x6e, 0x74, 0x2d, 0x62, 0x61, 0x73, 0x65, // e n t - b a s e - 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, 0x6e, 0x74, // - - - - c o n t - 0x65, 0x6e, 0x74, 0x2d, 0x65, 0x6e, 0x63, 0x6f, // e n t - e n c o - 0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, // d i n g - - - - - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, // c o n t e n t - - 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, // l a n g u a g e - 0x00, 0x00, 0x00, 0x0e, 0x63, 0x6f, 0x6e, 0x74, // - - - - c o n t - 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x65, 0x6e, 0x67, // e n t - l e n g - 0x74, 0x68, 0x00, 0x00, 0x00, 0x10, 0x63, 0x6f, // t h - - - - c o - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x6c, 0x6f, // n t e n t - l o - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // c a t i o n - - - 0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // - - c o n t e n - 0x74, 0x2d, 0x6d, 0x64, 0x35, 0x00, 0x00, 0x00, // t - m d 5 - - - - 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, // - c o n t e n t - 0x2d, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, // - r a n g e - - - 0x00, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, // - - c o n t e n - 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // t - t y p e - - - 0x00, 0x04, 0x64, 0x61, 0x74, 0x65, 0x00, 0x00, // - - d a t e - - - 0x00, 0x04, 0x65, 0x74, 0x61, 0x67, 0x00, 0x00, // - - e t a g - - - 0x00, 0x06, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, // - - e x p e c t - 0x00, 0x00, 0x00, 0x07, 0x65, 0x78, 0x70, 0x69, // - - - - e x p i - 0x72, 0x65, 0x73, 0x00, 0x00, 0x00, 0x04, 0x66, // r e s - - - - f - 0x72, 0x6f, 0x6d, 0x00, 0x00, 0x00, 0x04, 0x68, // r o m - - - - h - 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x08, 0x69, // o s t - - - - i - 0x66, 0x2d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, // f - m a t c h - - 0x00, 0x00, 0x11, 0x69, 0x66, 0x2d, 0x6d, 0x6f, // - - - i f - m o - 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2d, 0x73, // d i f i e d - s - 0x69, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x0d, // i n c e - - - - - 0x69, 0x66, 0x2d, 0x6e, 0x6f, 0x6e, 0x65, 0x2d, // i f - n o n e - - 0x6d, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, // m a t c h - - - - 0x08, 0x69, 0x66, 0x2d, 0x72, 0x61, 0x6e, 0x67, // - i f - r a n g - 0x65, 0x00, 0x00, 0x00, 0x13, 0x69, 0x66, 0x2d, // e - - - - i f - - 0x75, 0x6e, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, // u n m o d i f i - 0x65, 0x64, 0x2d, 0x73, 0x69, 0x6e, 0x63, 0x65, // e d - s i n c e - 0x00, 0x00, 0x00, 0x0d, 0x6c, 0x61, 0x73, 0x74, // - - - - l a s t - 0x2d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, // - m o d i f i e - 0x64, 0x00, 0x00, 0x00, 0x08, 0x6c, 0x6f, 0x63, // d - - - - l o c - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // a t i o n - - - - 0x0c, 0x6d, 0x61, 0x78, 0x2d, 0x66, 0x6f, 0x72, // - m a x - f o r - 0x77, 0x61, 0x72, 0x64, 0x73, 0x00, 0x00, 0x00, // w a r d s - - - - 0x06, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x00, // - p r a g m a - - 0x00, 0x00, 0x12, 0x70, 0x72, 0x6f, 0x78, 0x79, // - - - p r o x y - 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, // - a u t h e n t - 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, // i c a t e - - - - 0x13, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, // - p r o x y - a - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, // u t h o r i z a - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // t i o n - - - - - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x00, 0x00, 0x00, // r a n g e - - - - 0x07, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x72, // - r e f e r e r - 0x00, 0x00, 0x00, 0x0b, 0x72, 0x65, 0x74, 0x72, // - - - - r e t r - 0x79, 0x2d, 0x61, 0x66, 0x74, 0x65, 0x72, 0x00, // y - a f t e r - - 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, // - - - s e r v e - 0x72, 0x00, 0x00, 0x00, 0x02, 0x74, 0x65, 0x00, // r - - - - t e - - 0x00, 0x00, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, // - - - t r a i l - 0x65, 0x72, 0x00, 0x00, 0x00, 0x11, 0x74, 0x72, // e r - - - - t r - 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, 0x65, // a n s f e r - e - 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x00, // n c o d i n g - - 0x00, 0x00, 0x07, 0x75, 0x70, 0x67, 0x72, 0x61, // - - - u p g r a - 0x64, 0x65, 0x00, 0x00, 0x00, 0x0a, 0x75, 0x73, // d e - - - - u s - 0x65, 0x72, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74, // e r - a g e n t - 0x00, 0x00, 0x00, 0x04, 0x76, 0x61, 0x72, 0x79, // - - - - v a r y - 0x00, 0x00, 0x00, 0x03, 0x76, 0x69, 0x61, 0x00, // - - - - v i a - - 0x00, 0x00, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, // - - - w a r n i - 0x6e, 0x67, 0x00, 0x00, 0x00, 0x10, 0x77, 0x77, // n g - - - - w w - 0x77, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, // w - a u t h e n - 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x00, 0x00, // t i c a t e - - - 0x00, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, // - - m e t h o d - 0x00, 0x00, 0x00, 0x03, 0x67, 0x65, 0x74, 0x00, // - - - - g e t - - 0x00, 0x00, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, // - - - s t a t u - 0x73, 0x00, 0x00, 0x00, 0x06, 0x32, 0x30, 0x30, // s - - - - 2 0 0 - 0x20, 0x4f, 0x4b, 0x00, 0x00, 0x00, 0x07, 0x76, // - O K - - - - v - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, // e r s i o n - - - 0x00, 0x08, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, // - - H T T P - 1 - 0x2e, 0x31, 0x00, 0x00, 0x00, 0x03, 0x75, 0x72, // - 1 - - - - u r - 0x6c, 0x00, 0x00, 0x00, 0x06, 0x70, 0x75, 0x62, // l - - - - p u b - 0x6c, 0x69, 0x63, 0x00, 0x00, 0x00, 0x0a, 0x73, // l i c - - - - s - 0x65, 0x74, 0x2d, 0x63, 0x6f, 0x6f, 0x6b, 0x69, // e t - c o o k i - 0x65, 0x00, 0x00, 0x00, 0x0a, 0x6b, 0x65, 0x65, // e - - - - k e e - 0x70, 0x2d, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x00, // p - a l i v e - - 0x00, 0x00, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, // - - - o r i g i - 0x6e, 0x31, 0x30, 0x30, 0x31, 0x30, 0x31, 0x32, // n 1 0 0 1 0 1 2 - 0x30, 0x31, 0x32, 0x30, 0x32, 0x32, 0x30, 0x35, // 0 1 2 0 2 2 0 5 - 0x32, 0x30, 0x36, 0x33, 0x30, 0x30, 0x33, 0x30, // 2 0 6 3 0 0 3 0 - 0x32, 0x33, 0x30, 0x33, 0x33, 0x30, 0x34, 0x33, // 2 3 0 3 3 0 4 3 - 0x30, 0x35, 0x33, 0x30, 0x36, 0x33, 0x30, 0x37, // 0 5 3 0 6 3 0 7 - 0x34, 0x30, 0x32, 0x34, 0x30, 0x35, 0x34, 0x30, // 4 0 2 4 0 5 4 0 - 0x36, 0x34, 0x30, 0x37, 0x34, 0x30, 0x38, 0x34, // 6 4 0 7 4 0 8 4 - 0x30, 0x39, 0x34, 0x31, 0x30, 0x34, 0x31, 0x31, // 0 9 4 1 0 4 1 1 - 0x34, 0x31, 0x32, 0x34, 0x31, 0x33, 0x34, 0x31, // 4 1 2 4 1 3 4 1 - 0x34, 0x34, 0x31, 0x35, 0x34, 0x31, 0x36, 0x34, // 4 4 1 5 4 1 6 4 - 0x31, 0x37, 0x35, 0x30, 0x32, 0x35, 0x30, 0x34, // 1 7 5 0 2 5 0 4 - 0x35, 0x30, 0x35, 0x32, 0x30, 0x33, 0x20, 0x4e, // 5 0 5 2 0 3 - N - 0x6f, 0x6e, 0x2d, 0x41, 0x75, 0x74, 0x68, 0x6f, // o n - A u t h o - 0x72, 0x69, 0x74, 0x61, 0x74, 0x69, 0x76, 0x65, // r i t a t i v e - 0x20, 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, // - I n f o r m a - 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x30, 0x34, 0x20, // t i o n 2 0 4 - - 0x4e, 0x6f, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x65, // N o - C o n t e - 0x6e, 0x74, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, // n t 3 0 1 - M o - 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, // v e d - P e r m - 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x34, // a n e n t l y 4 - 0x30, 0x30, 0x20, 0x42, 0x61, 0x64, 0x20, 0x52, // 0 0 - B a d - R - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x34, 0x30, // e q u e s t 4 0 - 0x31, 0x20, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, // 1 - U n a u t h - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x34, 0x30, // o r i z e d 4 0 - 0x33, 0x20, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, // 3 - F o r b i d - 0x64, 0x65, 0x6e, 0x34, 0x30, 0x34, 0x20, 0x4e, // d e n 4 0 4 - N - 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, // o t - F o u n d - 0x35, 0x30, 0x30, 0x20, 0x49, 0x6e, 0x74, 0x65, // 5 0 0 - I n t e - 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72, // r n a l - S e r - 0x76, 0x65, 0x72, 0x20, 0x45, 0x72, 0x72, 0x6f, // v e r - E r r o - 0x72, 0x35, 0x30, 0x31, 0x20, 0x4e, 0x6f, 0x74, // r 5 0 1 - N o t - 0x20, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, // - I m p l e m e - 0x6e, 0x74, 0x65, 0x64, 0x35, 0x30, 0x33, 0x20, // n t e d 5 0 3 - - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, // S e r v i c e - - 0x55, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, // U n a v a i l a - 0x62, 0x6c, 0x65, 0x4a, 0x61, 0x6e, 0x20, 0x46, // b l e J a n - F - 0x65, 0x62, 0x20, 0x4d, 0x61, 0x72, 0x20, 0x41, // e b - M a r - A - 0x70, 0x72, 0x20, 0x4d, 0x61, 0x79, 0x20, 0x4a, // p r - M a y - J - 0x75, 0x6e, 0x20, 0x4a, 0x75, 0x6c, 0x20, 0x41, // u n - J u l - A - 0x75, 0x67, 0x20, 0x53, 0x65, 0x70, 0x74, 0x20, // u g - S e p t - - 0x4f, 0x63, 0x74, 0x20, 0x4e, 0x6f, 0x76, 0x20, // O c t - N o v - - 0x44, 0x65, 0x63, 0x20, 0x30, 0x30, 0x3a, 0x30, // D e c - 0 0 - 0 - 0x30, 0x3a, 0x30, 0x30, 0x20, 0x4d, 0x6f, 0x6e, // 0 - 0 0 - M o n - 0x2c, 0x20, 0x54, 0x75, 0x65, 0x2c, 0x20, 0x57, // - - T u e - - W - 0x65, 0x64, 0x2c, 0x20, 0x54, 0x68, 0x75, 0x2c, // e d - - T h u - - 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x53, 0x61, // - F r i - - S a - 0x74, 0x2c, 0x20, 0x53, 0x75, 0x6e, 0x2c, 0x20, // t - - S u n - - - 0x47, 0x4d, 0x54, 0x63, 0x68, 0x75, 0x6e, 0x6b, // G M T c h u n k - 0x65, 0x64, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, // e d - t e x t - - 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x69, 0x6d, 0x61, // h t m l - i m a - 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x2c, 0x69, // g e - p n g - i - 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x6a, 0x70, 0x67, // m a g e - j p g - 0x2c, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, // - i m a g e - g - 0x69, 0x66, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // i f - a p p l i - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // c a t i o n - x - 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, // m l - a p p l i - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, // c a t i o n - x - 0x68, 0x74, 0x6d, 0x6c, 0x2b, 0x78, 0x6d, 0x6c, // h t m l - x m l - 0x2c, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x70, 0x6c, // - t e x t - p l - 0x61, 0x69, 0x6e, 0x2c, 0x74, 0x65, 0x78, 0x74, // a i n - t e x t - 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, // - j a v a s c r - 0x69, 0x70, 0x74, 0x2c, 0x70, 0x75, 0x62, 0x6c, // i p t - p u b l - 0x69, 0x63, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, // i c p r i v a t - 0x65, 0x6d, 0x61, 0x78, 0x2d, 0x61, 0x67, 0x65, // e m a x - a g e - 0x3d, 0x67, 0x7a, 0x69, 0x70, 0x2c, 0x64, 0x65, // - g z i p - d e - 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, // f l a t e - s d - 0x63, 0x68, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, // c h c h a r s e - 0x74, 0x3d, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x63, // t - u t f - 8 c - 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x69, // h a r s e t - i - 0x73, 0x6f, 0x2d, 0x38, 0x38, 0x35, 0x39, 0x2d, // s o - 8 8 5 9 - - 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x2c, 0x2a, // 1 - u t f - - - - 0x2c, 0x65, 0x6e, 0x71, 0x3d, 0x30, 0x2e // - e n q - 0 - -}; - - -int -SPDYF_zlib_deflate_init(z_stream *strm) -{ - int ret; - - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - //the second argument is "level of compression" - //use 0 for no compression; 9 for best compression - ret = deflateInit(strm, Z_DEFAULT_COMPRESSION); - if(ret != Z_OK) - { - SPDYF_DEBUG("deflate init"); - return SPDY_NO; - } - ret = deflateSetDictionary(strm, - spdyf_zlib_dictionary, - sizeof(spdyf_zlib_dictionary)); - if(ret != Z_OK) - { - SPDYF_DEBUG("deflate set dict"); - deflateEnd(strm); - return SPDY_NO; - } - return SPDY_YES; -} - - -void -SPDYF_zlib_deflate_end(z_stream *strm) -{ - deflateEnd(strm); -} - -int -SPDYF_zlib_deflate(z_stream *strm, - const void *src, - size_t src_size, - size_t *data_used, - void **dest, - size_t *dest_size) -{ - int ret; - int flush; - unsigned int have; - Bytef out[SPDYF_ZLIB_CHUNK]; - - *dest = NULL; - *dest_size = 0; - - do - { - /* check for big data bigger than the buffer used */ - if(src_size > SPDYF_ZLIB_CHUNK) - { - strm->avail_in = SPDYF_ZLIB_CHUNK; - src_size -= SPDYF_ZLIB_CHUNK; - /* flush is used for the loop to detect if we still - * need to supply additional - * data to the stream via avail_in and next_in. */ - flush = Z_NO_FLUSH; - } - else - { - strm->avail_in = src_size; - flush = Z_SYNC_FLUSH; - } - *data_used += strm->avail_in; - - strm->next_in = (Bytef *)src; - - /* Loop while output data is available */ - do - { - strm->avail_out = SPDYF_ZLIB_CHUNK; - strm->next_out = out; - - /* No need to check return value of deflate. - * (See zlib documentation at http://www.zlib.net/zlib_how.html */ - ret = deflate(strm, flush); - have = SPDYF_ZLIB_CHUNK - strm->avail_out; - - /* (Re)allocate memory for dest and keep track of it's size. */ - *dest_size += have; - *dest = realloc(*dest, *dest_size); - if(!*dest) - { - SPDYF_DEBUG("realloc data for result"); - deflateEnd(strm); - return SPDY_NO; - } - memcpy((*dest) + ((*dest_size) - have), out, have); - } - while(strm->avail_out == 0); - /* At this point, all of the input data should already - * have been used. */ - SPDYF_ASSERT(strm->avail_in == 0,"compressing bug"); - } - while(flush != Z_SYNC_FLUSH); - - return Z_OK == ret ? SPDY_YES : SPDY_NO; -} - - -int -SPDYF_zlib_inflate_init(z_stream *strm) -{ - int ret; - - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - strm->avail_in = 0; - strm->next_in = Z_NULL; - //change 15 to lower value for performance and benchmark - //"The windowBits parameter is the base two logarithm of the - // maximum window size (the size of the history buffer)." - ret = inflateInit2(strm, 15); - if(ret != Z_OK) - { - SPDYF_DEBUG("Cannot inflateInit2 the stream"); - return SPDY_NO; - } - return SPDY_YES; -} - - -void -SPDYF_zlib_inflate_end(z_stream *strm) -{ - inflateEnd(strm); -} - - -int -SPDYF_zlib_inflate(z_stream *strm, - const void *src, - size_t src_size, - void **dest, - size_t *dest_size) -{ - int ret = Z_OK; - uint32_t have; - Bytef out[SPDYF_ZLIB_CHUNK]; - - *dest = NULL; - *dest_size = 0; - - /* decompress until deflate stream ends or end of file */ - do - { - if(src_size > SPDYF_ZLIB_CHUNK) - { - strm->avail_in = SPDYF_ZLIB_CHUNK; - src_size -= SPDYF_ZLIB_CHUNK; - } - else - { - strm->avail_in = src_size; - src_size = 0; - } - - if(strm->avail_in == 0){ - //the loop breaks always here as the stream never ends - break; - } - - strm->next_in = (Bytef *) src; - /* run inflate() on input until output buffer not full */ - do { - strm->avail_out = SPDYF_ZLIB_CHUNK; - strm->next_out = out; - ret = inflate(strm, Z_SYNC_FLUSH); - - switch (ret) - { - case Z_STREAM_ERROR: - SPDYF_DEBUG("Error on inflate"); - //no inflateEnd here, same in zlib example - return SPDY_NO; - - case Z_NEED_DICT: - ret = inflateSetDictionary(strm, - spdyf_zlib_dictionary, - sizeof(spdyf_zlib_dictionary)); - if(ret != Z_OK) - { - SPDYF_DEBUG("Error on inflateSetDictionary"); - inflateEnd(strm); - return SPDY_NO; - } - ret = inflate(strm, Z_SYNC_FLUSH); - if(Z_STREAM_ERROR == ret) - { - SPDYF_DEBUG("Error on inflate"); - return SPDY_NO; - } - break; - - case Z_DATA_ERROR: - SPDYF_DEBUG("Z_DATA_ERROR"); - inflateEnd(strm); - return SPDY_NO; - - case Z_MEM_ERROR: - SPDYF_DEBUG("Z_MEM_ERROR"); - inflateEnd(strm); - return SPDY_NO; - } - have = SPDYF_ZLIB_CHUNK - strm->avail_out; - *dest_size += have; - /* (re)alloc memory for the output buffer */ - *dest = realloc(*dest, *dest_size); - if(!*dest) - { - SPDYF_DEBUG("Cannot realloc memory"); - inflateEnd(strm); - return SPDY_NO; - } - memcpy((*dest) + ((*dest_size) - have), out, have); - } - while (0 == strm->avail_out); - } - while (Z_STREAM_END != ret); - - return Z_OK == ret || Z_STREAM_END == ret ? SPDY_YES : SPDY_NO; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/compression.h libmicrohttpd-0.9.55/src/microspdy/compression.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/compression.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/compression.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,117 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file compression.h - * @brief zlib handling functions - * @author Andrey Uzunov - */ - -#ifndef COMPRESSION_H -#define COMPRESSION_H - -#include "platform.h" - -/* size of buffers used by zlib on (de)compressing */ -#define SPDYF_ZLIB_CHUNK 16384 - - -/** - * Initializes the zlib stream for compression. Must be called once - * for a session on initialization. - * - * @param strm Zlib stream on which we work - * @return SPDY_NO if zlib failed. SPDY_YES otherwise - */ -int -SPDYF_zlib_deflate_init(z_stream *strm); - - -/** - * Deinitializes the zlib stream for compression. Should be called once - * for a session on cleaning up. - * - * @param strm Zlib stream on which we work - */ -void -SPDYF_zlib_deflate_end(z_stream *strm); - - -/** - * Compressing stream with zlib. - * - * @param strm Zlib stream on which we work - * @param src stream of the data to be compressed - * @param src_size size of the data - * @param data_used the number of bytes from src_stream that were used - * TODO do we need - * @param dest the resulting compressed stream. Should be NULL. Must be - * freed later manually. - * @param dest_size size of the data after compression - * @return SPDY_NO if malloc or zlib failed. SPDY_YES otherwise - */ -int -SPDYF_zlib_deflate(z_stream *strm, - const void *src, - size_t src_size, - size_t *data_used, - void **dest, - size_t *dest_size); - - -/** - * Initializes the zlib stream for decompression. Must be called once - * for a session. - * - * @param strm Zlib stream on which we work - * @return SPDY_NO if zlib failed. SPDY_YES otherwise - */ -int -SPDYF_zlib_inflate_init(z_stream *strm); - - -/** - * Deinitializes the zlib stream for decompression. Should be called once - * for a session on cleaning up. - * - * @param strm Zlib stream on which we work - */ -void -SPDYF_zlib_inflate_end(z_stream *strm); - - -/** - * Decompressing stream with zlib. - * - * @param strm Zlib stream on which we work - * @param src stream of the data to be decompressed - * @param src_size size of the data - * @param dest the resulting decompressed stream. Should be NULL. Must - * be freed manually. - * @param dest_size size of the data after decompression - * @return SPDY_NO if malloc or zlib failed. SPDY_YES otherwise. If the - * function fails, the SPDY session must be closed - */ -int -SPDYF_zlib_inflate(z_stream *strm, - const void *src, - size_t src_size, - void **dest, - size_t *dest_size); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/daemon.c libmicrohttpd-0.9.55/src/microspdy/daemon.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/daemon.c 2015-08-02 19:05:53.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microspdy/daemon.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,544 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file microspdy/daemon.c - * @brief daemon functionality - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "session.h" -#include "io.h" - - -/** - * Default implementation of the panic function, - * prints an error message and aborts. - * - * @param cls unused - * @param file name of the file with the problem - * @param line line number with the problem - * @param reason error message with details - */ -static void -spdyf_panic_std (void *cls, - const char *file, - unsigned int line, - const char *reason) -{ - (void)cls; - fprintf (stdout, "Fatal error in libmicrospdy %s:%u: %s\n", - file, line, reason); - //raise(SIGINT); //used for gdb - abort (); -} - - -/** - * Global handler for fatal errors. - */ -SPDY_PanicCallback spdyf_panic = &spdyf_panic_std; - - -/** - * Global closure argument for "spdyf_panic". - */ -void *spdyf_panic_cls; - - -/** - * Free resources associated with all closed connections. - * (destroy responses, free buffers, etc.). - * - * @param daemon daemon to clean up - */ -static void -spdyf_cleanup_sessions (struct SPDY_Daemon *daemon) -{ - struct SPDY_Session *session; - - while (NULL != (session = daemon->cleanup_head)) - { - DLL_remove (daemon->cleanup_head, - daemon->cleanup_tail, - session); - - SPDYF_session_destroy(session); - } -} - - -/** - * Closing of all connections handled by the daemon. - * - * @param daemon SPDY daemon - */ -static void -spdyf_close_all_sessions (struct SPDY_Daemon *daemon) -{ - struct SPDY_Session *session; - - while (NULL != (session = daemon->sessions_head)) - { - //prepare GOAWAY frame - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_OK, true); - //try to send the frame (it is best effort, so it will maybe sent) - SPDYF_session_write(session,true); - SPDYF_session_close(session); - } - - spdyf_cleanup_sessions(daemon); -} - - -/** - * Parse a list of options given as varargs. - * - * @param daemon the daemon to initialize - * @param valist the options - * @return SPDY_YES on success, SPDY_NO on error - */ -static int -spdyf_parse_options_va (struct SPDY_Daemon *daemon, - va_list valist) -{ - enum SPDY_DAEMON_OPTION opt; - - while (SPDY_DAEMON_OPTION_END != (opt = (enum SPDY_DAEMON_OPTION) va_arg (valist, int))) - { - if(opt & daemon->options) - { - SPDYF_DEBUG("Daemon option %i used twice",opt); - return SPDY_NO; - } - daemon->options |= opt; - - switch (opt) - { - case SPDY_DAEMON_OPTION_SESSION_TIMEOUT: - daemon->session_timeout = va_arg (valist, unsigned int) * 1000; - break; - case SPDY_DAEMON_OPTION_SOCK_ADDR: - daemon->address = va_arg (valist, struct sockaddr *); - break; - case SPDY_DAEMON_OPTION_FLAGS: - daemon->flags = va_arg (valist, enum SPDY_DAEMON_FLAG); - break; - case SPDY_DAEMON_OPTION_IO_SUBSYSTEM: - daemon->io_subsystem = va_arg (valist, enum SPDY_IO_SUBSYSTEM); - break; - case SPDY_DAEMON_OPTION_MAX_NUM_FRAMES: - daemon->max_num_frames = va_arg (valist, uint32_t); - break; - default: - SPDYF_DEBUG("Wrong option for the daemon %i",opt); - return SPDY_NO; - } - } - return SPDY_YES; -} - - -void -SPDY_set_panic_func (SPDY_PanicCallback cb, - void *cls) -{ - spdyf_panic = cb; - spdyf_panic_cls = cls; -} - - -struct SPDY_Daemon * -SPDYF_start_daemon_va (uint16_t port, - const char *certfile, - const char *keyfile, - SPDY_NewSessionCallback nscb, - SPDY_SessionClosedCallback sccb, - SPDY_NewRequestCallback nrcb, - SPDY_NewDataCallback npdcb, - SPDYF_NewStreamCallback fnscb, - SPDYF_NewDataCallback fndcb, - void * cls, - void * fcls, - va_list valist) -{ - struct SPDY_Daemon *daemon = NULL; - int afamily; - int option_on = 1; - int ret; - struct sockaddr_in* servaddr4 = NULL; -#if HAVE_INET6 - struct sockaddr_in6* servaddr6 = NULL; -#endif - socklen_t addrlen; - - if (NULL == (daemon = malloc (sizeof (struct SPDY_Daemon)))) - { - SPDYF_DEBUG("malloc"); - return NULL; - } - memset (daemon, 0, sizeof (struct SPDY_Daemon)); - daemon->socket_fd = -1; - daemon->port = port; - - if(SPDY_YES != spdyf_parse_options_va (daemon, valist)) - { - SPDYF_DEBUG("parse"); - goto free_and_fail; - } - - if(0 == daemon->max_num_frames) - daemon->max_num_frames = SPDYF_NUM_SENT_FRAMES_AT_ONCE; - - if(!port && NULL == daemon->address) - { - SPDYF_DEBUG("Port is 0"); - goto free_and_fail; - } - if(0 == daemon->io_subsystem) - daemon->io_subsystem = SPDY_IO_SUBSYSTEM_OPENSSL; - - if(SPDY_YES != SPDYF_io_set_daemon(daemon, daemon->io_subsystem)) - goto free_and_fail; - - if(SPDY_IO_SUBSYSTEM_RAW != daemon->io_subsystem) - { - if (NULL == certfile - || NULL == (daemon->certfile = strdup (certfile))) - { - SPDYF_DEBUG("strdup (certfile)"); - goto free_and_fail; - } - if (NULL == keyfile - || NULL == (daemon->keyfile = strdup (keyfile))) - { - SPDYF_DEBUG("strdup (keyfile)"); - goto free_and_fail; - } - } - - daemon->new_session_cb = nscb; - daemon->session_closed_cb = sccb; - daemon->new_request_cb = nrcb; - daemon->received_data_cb = npdcb; - daemon->cls = cls; - daemon->fcls = fcls; - daemon->fnew_stream_cb = fnscb; - daemon->freceived_data_cb = fndcb; - -#if HAVE_INET6 - //handling IPv6 - if((daemon->flags & SPDY_DAEMON_FLAG_ONLY_IPV6) - && NULL != daemon->address && AF_INET6 != daemon->address->sa_family) - { - SPDYF_DEBUG("SPDY_DAEMON_FLAG_ONLY_IPV6 set but IPv4 address provided"); - goto free_and_fail; - } - - addrlen = sizeof (struct sockaddr_in6); - - if(NULL == daemon->address) - { - if (NULL == (servaddr6 = malloc (addrlen))) - { - SPDYF_DEBUG("malloc"); - goto free_and_fail; - } - memset (servaddr6, 0, addrlen); - servaddr6->sin6_family = AF_INET6; - servaddr6->sin6_addr = in6addr_any; - servaddr6->sin6_port = htons (port); - daemon->address = (struct sockaddr *) servaddr6; - } - - if(AF_INET6 == daemon->address->sa_family) - { - afamily = PF_INET6; - } - else - { - afamily = PF_INET; - } -#else - //handling IPv4 - if(daemon->flags & SPDY_DAEMON_FLAG_ONLY_IPV6) - { - SPDYF_DEBUG("SPDY_DAEMON_FLAG_ONLY_IPV6 set but no support"); - goto free_and_fail; - } - - addrlen = sizeof (struct sockaddr_in); - - if(NULL == daemon->address) - { - if (NULL == (servaddr4 = malloc (addrlen))) - { - SPDYF_DEBUG("malloc"); - goto free_and_fail; - } - memset (servaddr4, 0, addrlen); - servaddr4->sin_family = AF_INET; - servaddr4->sin_addr = INADDR_ANY; - servaddr4->sin_port = htons (port); - daemon->address = (struct sockaddr *) servaddr4; - } - - afamily = PF_INET; -#endif - - daemon->socket_fd = socket (afamily, SOCK_STREAM, 0); - if (-1 == daemon->socket_fd) - { - SPDYF_DEBUG("sock"); - goto free_and_fail; - } - - //setting option for the socket to reuse address - ret = setsockopt(daemon->socket_fd, SOL_SOCKET, SO_REUSEADDR, &option_on, sizeof(option_on)); - if(ret) - { - SPDYF_DEBUG("WARNING: SO_REUSEADDR was not set for the server"); - } - -#if HAVE_INET6 - if(daemon->flags & SPDY_DAEMON_FLAG_ONLY_IPV6) - { - ret = setsockopt(daemon->socket_fd, IPPROTO_IPV6, IPV6_V6ONLY, &option_on, sizeof(option_on)); - if(ret) - { - SPDYF_DEBUG("setsockopt with IPPROTO_IPV6 failed"); - goto free_and_fail; - } - } -#endif - - if (-1 == bind (daemon->socket_fd, daemon->address, addrlen)) - { - SPDYF_DEBUG("bind %i",errno); - goto free_and_fail; - } - - if (listen (daemon->socket_fd, 20) < 0) - { - SPDYF_DEBUG("listen %i",errno); - goto free_and_fail; - } - - if(SPDY_YES != daemon->fio_init(daemon)) - { - SPDYF_DEBUG("tls"); - goto free_and_fail; - } - - return daemon; - - //for GOTO - free_and_fail: - if(daemon->socket_fd > 0) - (void)MHD_socket_close_ (daemon->socket_fd); - - free(servaddr4); -#if HAVE_INET6 - free(servaddr6); -#endif - if(NULL != daemon->certfile) - free(daemon->certfile); - if(NULL != daemon->keyfile) - free(daemon->keyfile); - free (daemon); - - return NULL; -} - - -void -SPDYF_stop_daemon (struct SPDY_Daemon *daemon) -{ - daemon->fio_deinit(daemon); - - shutdown (daemon->socket_fd, SHUT_RDWR); - spdyf_close_all_sessions (daemon); - (void)MHD_socket_close_ (daemon->socket_fd); - - if(!(SPDY_DAEMON_OPTION_SOCK_ADDR & daemon->options)) - free(daemon->address); - - free(daemon->certfile); - free(daemon->keyfile); - - free(daemon); -} - - -int -SPDYF_get_timeout (struct SPDY_Daemon *daemon, - unsigned long long *timeout) -{ - unsigned long long earliest_deadline = 0; - unsigned long long now; - struct SPDY_Session *pos; - bool have_timeout; - - if(0 == daemon->session_timeout) - return SPDY_NO; - - now = SPDYF_monotonic_time(); - have_timeout = false; - for (pos = daemon->sessions_head; NULL != pos; pos = pos->next) - { - if ( (! have_timeout) || - (earliest_deadline > pos->last_activity + daemon->session_timeout) ) - earliest_deadline = pos->last_activity + daemon->session_timeout; - - have_timeout = true; - - if (SPDY_YES == pos->fio_is_pending(pos)) - { - earliest_deadline = 0; - break; - } - } - - if (!have_timeout) - return SPDY_NO; - if (earliest_deadline <= now) - *timeout = 0; - else - *timeout = earliest_deadline - now; - - return SPDY_YES; -} - - -int -SPDYF_get_fdset (struct SPDY_Daemon *daemon, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *except_fd_set, - bool all) -{ - (void)except_fd_set; - struct SPDY_Session *pos; - int fd; - int max_fd = -1; - - fd = daemon->socket_fd; - if (-1 != fd) - { - FD_SET (fd, read_fd_set); - /* update max file descriptor */ - max_fd = fd; - } - - for (pos = daemon->sessions_head; NULL != pos; pos = pos->next) - { - fd = pos->socket_fd; - FD_SET(fd, read_fd_set); - if (all - || (NULL != pos->response_queue_head) //frames pending - || (NULL != pos->write_buffer) //part of last frame pending - || (SPDY_SESSION_STATUS_CLOSING == pos->status) //the session is about to be closed - || (daemon->session_timeout //timeout passed for the session - && (pos->last_activity + daemon->session_timeout < SPDYF_monotonic_time())) - || (SPDY_YES == pos->fio_is_pending(pos)) //data in TLS' read buffer pending - || ((pos->read_buffer_offset - pos->read_buffer_beginning) > 0) // data in lib's read buffer pending - ) - FD_SET(fd, write_fd_set); - if(fd > max_fd) - max_fd = fd; - } - - return max_fd; -} - - -void -SPDYF_run (struct SPDY_Daemon *daemon) -{ - struct SPDY_Session *pos; - struct SPDY_Session *next; - int num_ready; - fd_set rs; - fd_set ws; - fd_set es; - int max; - struct timeval timeout; - int ds; - - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO (&rs); - FD_ZERO (&ws); - FD_ZERO (&es); - //here we need really all descriptors to see later which are ready - max = SPDYF_get_fdset(daemon,&rs,&ws,&es, true); - - num_ready = select (max + 1, &rs, &ws, &es, &timeout); - - if(num_ready < 1) - return; - - if ( (-1 != (ds = daemon->socket_fd)) && - (FD_ISSET (ds, &rs)) ){ - SPDYF_session_accept(daemon); - } - - next = daemon->sessions_head; - while (NULL != (pos = next)) - { - next = pos->next; - ds = pos->socket_fd; - if (ds != -1) - { - //fill the read buffer - if (FD_ISSET (ds, &rs) || pos->fio_is_pending(pos)){ - SPDYF_session_read(pos); - } - - //do something with the data in read buffer - if(SPDY_NO == SPDYF_session_idle(pos)) - { - //the session was closed, cannot write anymore - //continue; - } - - //write whatever has been put to the response queue - //during read or idle operation, something might be put - //on the response queue, thus call write operation - if (FD_ISSET (ds, &ws)){ - if(SPDY_NO == SPDYF_session_write(pos, false)) - { - //SPDYF_session_close(pos); - //continue; - } - } - - /* the response queue has been flushed for half closed - * connections, so let close them */ - /*if(pos->read_closed) - { - SPDYF_session_close(pos); - }*/ - } - } - - spdyf_cleanup_sessions(daemon); -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/daemon.h libmicrohttpd-0.9.55/src/microspdy/daemon.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/daemon.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/daemon.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,130 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file daemon.h - * @brief daemon functionality - * @author Andrey Uzunov - */ - -#ifndef DAEMON_H -#define DAEMON_H - -#include "platform.h" - - -/** - * Global flags containing the initialized IO subsystems. - */ -enum SPDY_IO_SUBSYSTEM spdyf_io_initialized; - - -/** - * Start a SPDDY webserver on the given port. - * - * @param port port to bind to - * @param certfile path to the certificate that will be used by server - * @param keyfile path to the keyfile for the certificate - * @param nscb callback called when a new SPDY session is - * established by a client - * @param sccb callback called when a client closes the session - * @param nrcb callback called when a client sends request - * @param npdcb callback called when HTTP POST params are received - * after request - * @param fnscb callback called when new stream is opened by a client - * @param fndcb callback called when new data -- within a data frame -- - * is received by the server - * @param cls extra argument to all of the callbacks without those - * specific only for the framing layer - * @param fcls extra argument to all of the callbacks, specific only for - * the framing layer (those vars starting with 'f'). - * @param valist va_list of options (type-value pairs, - * terminated with SPDY_DAEMON_OPTION_END). - * @return NULL on error, handle to daemon on success - */ -struct SPDY_Daemon * -SPDYF_start_daemon_va (uint16_t port, - const char *certfile, - const char *keyfile, - SPDY_NewSessionCallback nscb, - SPDY_SessionClosedCallback sccb, - SPDY_NewRequestCallback nrcb, - SPDY_NewDataCallback npdcb, - SPDYF_NewStreamCallback fnscb, - SPDYF_NewDataCallback fndcb, - void * cls, - void * fcls, - va_list valist); - - -/** - * Run webserver operations (without blocking unless - * in client callbacks). This method must be called in the client event - * loop. - * - * @param daemon daemon to run - */ -void -SPDYF_run (struct SPDY_Daemon *daemon); - - -/** - * Obtain timeout value for select for this daemon. The returned value - * is how long select - * should at most block, not the timeout value set for connections. - * - * @param daemon daemon to query for timeout - * @param timeout set to the timeout (in milliseconds) - * @return SPDY_YES on success, SPDY_NO if no connections exist that - * would necessiate the use of a timeout right now - */ -int -SPDYF_get_timeout (struct SPDY_Daemon *daemon, - unsigned long long *timeout); - - -/** - * Obtain the select sets for this daemon. The idea of SPDYF_get_fdset - * is to return such descriptors that the select in the application can - * return and SPDY_run can be called only when this is really needed. - * That means not all sockets will be added to write_fd_set. - * - * @param daemon daemon to get sets from - * @param read_fd_set read set - * @param write_fd_set write set - * @param except_fd_set except set - * @param all add all session's descriptors to write_fd_set or not - * @return largest FD added - */ -int -SPDYF_get_fdset (struct SPDY_Daemon *daemon, - fd_set *read_fd_set, - fd_set *write_fd_set, - fd_set *except_fd_set, - bool all); - - -/** - * Shutdown the daemon. - * - * @param daemon daemon to stop - */ -void -SPDYF_stop_daemon (struct SPDY_Daemon *daemon); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/internal.c libmicrohttpd-0.9.55/src/microspdy/internal.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/internal.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/internal.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file microspdy/internal.c - * @brief internal functions and macros for the framing layer - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" - - -unsigned long long -SPDYF_monotonic_time (void) -{ -#ifdef HAVE_CLOCK_GETTIME -#ifdef CLOCK_MONOTONIC - struct timespec ts; - if (0 == clock_gettime (CLOCK_MONOTONIC, &ts)) - return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; -#endif -#endif - return time (NULL) * 1000; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/internal.h libmicrohttpd-0.9.55/src/microspdy/internal.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/internal.h 2015-08-02 19:09:46.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microspdy/internal.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,199 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file microspdy/internal.h - * @brief internal functions and macros for the framing layer - * @author Andrey Uzunov - */ - -#ifndef INTERNAL_H_H -#define INTERNAL_H_H - -#include "platform.h" -#include "platform_interface.h" -#include "microspdy.h" - -/** - * size of read buffers for each connection - * must be at least the size of SPDY_MAX_SUPPORTED_FRAME_SIZE - */ -#define SPDYF_BUFFER_SIZE 8192 - -/** - * initial size of window for each stream (this is for the data - * within data frames that can be handled) - */ -#define SPDYF_INITIAL_WINDOW_SIZE 65536 - -/** - * number of frames written to the socket at once. After X frames - * everything should be run again. In this way the application can - * response to more important requests while a big file is still - * being transmitted to the client - */ -#define SPDYF_NUM_SENT_FRAMES_AT_ONCE 10 - - -/** - * Handler for fatal errors. - */ -extern SPDY_PanicCallback spdyf_panic; - - -/** - * Closure argument for "mhd_panic". - */ -extern void *spdyf_panic_cls; - - -/** - * Trigger 'panic' action based on fatal errors. - * - * @param msg error message (const char *) - */ -#define SPDYF_PANIC(msg) \ - spdyf_panic (spdyf_panic_cls, __FILE__, __LINE__, msg) - - -/** - * Asserts the validity of an expression. - * - * @param expr (bool) - * @param msg message to print on error (const char *) - */ -#define SPDYF_ASSERT(expr, msg) \ - if(!(expr)){\ - SPDYF_PANIC(msg);\ - abort();\ - } - - -/** - * Convert 24 bit integer from host byte order to network byte order. - * - * @param n input value (int32_t) - * @return converted value (uint32_t) - */ -#if HAVE_BIG_ENDIAN -#define HTON24(n) n -#else -#define HTON24(n) (((((uint32_t)(n) & 0xFF)) << 16)\ - | (((uint32_t)(n) & 0xFF00))\ - | ((((uint32_t)(n) & 0xFF0000)) >> 16)) -#endif - - -/** - * Convert 24 bit integer from network byte order to host byte order. - * - * @param n input value (int32_t) - * @return converted value (uint32_t) - */ -#if HAVE_BIG_ENDIAN -#define NTOH24(n) n -#else -#define NTOH24(n) (((((uint32_t)(n) & 0xFF)) << 16)\ - | (((uint32_t)(n) & 0xFF00))\ - | ((((uint32_t)(n) & 0xFF0000)) >> 16)) -#endif - - -/** - * Convert 31 bit integer from network byte order to host byte order. - * - * @param n input value (int32_t) - * @return converted value (uint32_t) - */ -#if HAVE_BIG_ENDIAN -#define NTOH31(n) n -#else -#define NTOH31(n) (((((uint32_t)(n) & 0x7F)) << 24) | \ - ((((uint32_t)(n) & 0xFF00)) << 8) | \ - ((((uint32_t)(n) & 0xFF0000)) >> 8) | \ - ((((uint32_t)(n) & 0xFF000000)) >> 24)) -#endif - - -/** - * Convert 31 bit integer from host byte order to network byte order. - * - * @param n input value (int32_t) - * @return converted value (uint32_t) - */ -#if HAVE_BIG_ENDIAN -#define HTON31(n) n -#else -#define HTON31(n) (((((uint32_t)(n) & 0xFF)) << 24) | \ - ((((uint32_t)(n) & 0xFF00)) << 8) | \ - ((((uint32_t)(n) & 0xFF0000)) >> 8) | \ - ((((uint32_t)(n) & 0x7F000000)) >> 24)) -#endif - - -/** - * Print formatted debug value. - * - * @param fmt format (const char *) - * @param ... args for format - */ -#define SPDYF_DEBUG(fmt, ...) do { \ - fprintf (stdout, "%s\n%u: ",__FILE__, __LINE__);\ - fprintf(stdout,fmt,##__VA_ARGS__);\ - fprintf(stdout,"\n");\ - fflush(stdout); } while (0) - - -/** - * Print stream for debuging. - * - * @param strm (void *) - * @param size (int) - */ -#define SPDYF_PRINT_STREAM(strm, size) do { \ - int ___i;\ - for(___i=0;___i. -*/ - -/** - * @file io.c - * @brief Generic functions for IO. - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "io.h" - - -int -SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, - enum SPDY_IO_SUBSYSTEM io_subsystem) -{ - switch(io_subsystem) - { - case SPDY_IO_SUBSYSTEM_OPENSSL: - daemon->fio_init = &SPDYF_openssl_init; - daemon->fio_deinit = &SPDYF_openssl_deinit; - break; - - case SPDY_IO_SUBSYSTEM_RAW: - daemon->fio_init = &SPDYF_raw_init; - daemon->fio_deinit = &SPDYF_raw_deinit; - break; - - case SPDY_IO_SUBSYSTEM_NONE: - default: - SPDYF_DEBUG("Unsupported subsystem"); - return SPDY_NO; - } - - return SPDY_YES; -} - - -int -SPDYF_io_set_session(struct SPDY_Session *session, - enum SPDY_IO_SUBSYSTEM io_subsystem) -{ - switch(io_subsystem) - { - case SPDY_IO_SUBSYSTEM_OPENSSL: - session->fio_new_session = &SPDYF_openssl_new_session; - session->fio_close_session = &SPDYF_openssl_close_session; - session->fio_is_pending = &SPDYF_openssl_is_pending; - session->fio_recv = &SPDYF_openssl_recv; - session->fio_send = &SPDYF_openssl_send; - session->fio_before_write = &SPDYF_openssl_before_write; - session->fio_after_write = &SPDYF_openssl_after_write; - break; - - case SPDY_IO_SUBSYSTEM_RAW: - session->fio_new_session = &SPDYF_raw_new_session; - session->fio_close_session = &SPDYF_raw_close_session; - session->fio_is_pending = &SPDYF_raw_is_pending; - session->fio_recv = &SPDYF_raw_recv; - session->fio_send = &SPDYF_raw_send; - session->fio_before_write = &SPDYF_raw_before_write; - session->fio_after_write = &SPDYF_raw_after_write; - break; - - case SPDY_IO_SUBSYSTEM_NONE: - default: - SPDYF_DEBUG("Unsupported subsystem"); - return SPDY_NO; - } - - return SPDY_YES; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/io.h libmicrohttpd-0.9.55/src/microspdy/io.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/io.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/io.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,216 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file io.h - * @brief Signatures for IO functions. - * @author Andrey Uzunov - */ - -#ifndef IO_H -#define IO_H - -#include "platform.h" -#include "io_openssl.h" -#include "io_raw.h" - - -/** - * Used for return code when reading and writing to the TLS socket. - */ -enum SPDY_IO_ERROR -{ - /** - * The connection was closed by the other party. - */ - SPDY_IO_ERROR_CLOSED = 0, - - /** - * Any kind of error ocurred. The session has to be closed. - */ - SPDY_IO_ERROR_ERROR = -2, - - /** - * The function had to return without processing any data. The whole - * cycle of events has to be called again (SPDY_run) as something - * either has to be written or read or the the syscall was - * interrupted by a signal. - */ - SPDY_IO_ERROR_AGAIN = -3, -}; - - -/** - * Global initializing. Must be called only once in the program. - * - */ -typedef void -(*SPDYF_IOGlobalInit) (); - - -/** - * Global deinitializing for the whole program. Should be called - * at the end of the program. - * - */ -typedef void -(*SPDYF_IOGlobalDeinit) (); - - -/** - * Initializing of io context for a specific daemon. - * Must be called when the daemon starts. - * - * @param daemon SPDY_Daemon for which io will be used. Daemon's - * certificate and key file are used for tls. - * @return SPDY_YES on success or SPDY_NO on error - */ -typedef int -(*SPDYF_IOInit) (struct SPDY_Daemon *daemon); - - -/** - * Deinitializing io context for a daemon. Should be called - * when the deamon is stopped. - * - * @param daemon SPDY_Daemon which is being stopped - */ -typedef void -(*SPDYF_IODeinit) (struct SPDY_Daemon *daemon); - - -/** - * Initializing io for a specific connection. Must be called - * after the connection has been accepted. - * - * @param session SPDY_Session whose socket will be used - * @return SPDY_NO if some funcs inside fail. SPDY_YES otherwise - */ -typedef int -(*SPDYF_IONewSession) (struct SPDY_Session *session); - - -/** - * Deinitializing io for a specific connection. Should be called - * closing session's socket. - * - * @param session SPDY_Session whose socket is used - */ -typedef void -(*SPDYF_IOCloseSession) (struct SPDY_Session *session); - - -/** - * Reading from session's socket. Reads available data and put it to the - * buffer. - * - * @param session for which data is received - * @param buffer where data from the socket will be written to - * @param size of the buffer - * @return number of bytes (at most size) read from the connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -typedef int -(*SPDYF_IORecv) (struct SPDY_Session *session, - void * buffer, - size_t size); - - -/** - * Writing to session's socket. Writes the data given into the buffer to the - * socket. - * - * @param session whose context is used - * @param buffer from where data will be written to the socket - * @param size number of bytes to be taken from the buffer - * @return number of bytes (at most size) from the buffer that has been - * written to the connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -typedef int -(*SPDYF_IOSend) (struct SPDY_Session *session, - const void * buffer, - size_t size); - - -/** - * Checks if there is data staying in the buffers of the underlying - * system that waits to be read. In case of TLS, this will call - * something like SSL_pending(). - * - * @param session which is checked - * @return SPDY_YES if data is pending or SPDY_NO otherwise - */ -typedef int -(*SPDYF_IOIsPending) (struct SPDY_Session *session); - - -/** - * Called just before frames are about to be processed and written - * to the socket. - * - * @param session - * @return SPDY_NO if writing must not happen in the call; - * SPDY_YES otherwise - */ -typedef int -(*SPDYF_IOBeforeWrite) (struct SPDY_Session *session); - - -/** - * Called just after frames have been processed and written - * to the socket. - * - * @param session - * @param was_written has the same value as the write function for the - * session will return - * @return returned value will be used by the write function to return - */ -typedef int -(*SPDYF_IOAfterWrite) (struct SPDY_Session *session, - int was_written); - - -/** - * Sets callbacks for the daemon with regard to the IO subsystem. - * - * @param daemon - * @param io_subsystem the IO subsystem that will - * be initialized and used by daemon. - * @return SPDY_YES on success or SPDY_NO otherwise - */ -int -SPDYF_io_set_daemon(struct SPDY_Daemon *daemon, - enum SPDY_IO_SUBSYSTEM io_subsystem); - - -/** - * Sets callbacks for the session with regard to the IO subsystem. - * - * @param session - * @param io_subsystem the IO subsystem that will - * be initialized and used by session. - * @return SPDY_YES on success or SPDY_NO otherwise - */ -int -SPDYF_io_set_session(struct SPDY_Session *session, - enum SPDY_IO_SUBSYSTEM io_subsystem); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/io_openssl.c libmicrohttpd-0.9.55/src/microspdy/io_openssl.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/io_openssl.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/io_openssl.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,280 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file io_openssl.c - * @brief TLS handling using libssl. The current code assumes that - * blocking I/O is in use. - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "internal.h" -#include "session.h" -#include "io_openssl.h" - - -/** - * Callback to advertise spdy ver. 3 in Next Protocol Negotiation - * - * @param ssl openssl context for a connection - * @param out must be set to the raw data that is advertised in NPN - * @param outlen must be set to size of out - * @param arg - * @return SSL_TLSEXT_ERR_OK to do advertising - */ -static int -spdyf_next_protos_advertised_cb (SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg) -{ - (void)ssl; - (void)arg; - static unsigned char npn_spdy3[] = {0x06, // length of "spdy/3" - 0x73,0x70,0x64,0x79,0x2f,0x33};// spdy/3 - - *out = npn_spdy3; - *outlen = 7; // total length of npn_spdy3 - return SSL_TLSEXT_ERR_OK; -} - - -void -SPDYF_openssl_global_init() -{ - //error strings are now not used by the lib - //SSL_load_error_strings(); - //init libssl - SSL_library_init(); //always returns 1 - //the table for looking up algos is not used now by the lib - //OpenSSL_add_all_algorithms(); -} - - -void -SPDYF_openssl_global_deinit() -{ - //if SSL_load_error_strings was called - //ERR_free_strings(); - //if OpenSSL_add_all_algorithms was called - //EVP_cleanup(); -} - - -int -SPDYF_openssl_init(struct SPDY_Daemon *daemon) -{ - int options; - //create ssl context. TLSv1 used - if(NULL == (daemon->io_context = SSL_CTX_new(TLSv1_server_method()))) - { - SPDYF_DEBUG("Couldn't create ssl context"); - return SPDY_NO; - } - //set options for tls - //TODO DH is not enabled for easier debugging - //SSL_CTX_set_options(daemon->io_context, SSL_OP_SINGLE_DH_USE); - - //TODO here session tickets are disabled for easier debuging with - //wireshark when using Chrome - // SSL_OP_NO_COMPRESSION disables TLS compression to avoid CRIME attack - options = SSL_OP_NO_TICKET; -#ifdef SSL_OP_NO_COMPRESSION - options |= SSL_OP_NO_COMPRESSION; -#elif OPENSSL_VERSION_NUMBER >= 0x00908000L /* workaround for OpenSSL 0.9.8 */ - sk_SSL_COMP_zero(SSL_COMP_get_compression_methods()); -#endif - - SSL_CTX_set_options(daemon->io_context, options); - if(1 != SSL_CTX_use_certificate_file(daemon->io_context, daemon->certfile , SSL_FILETYPE_PEM)) - { - SPDYF_DEBUG("Couldn't load the cert file"); - SSL_CTX_free(daemon->io_context); - return SPDY_NO; - } - if(1 != SSL_CTX_use_PrivateKey_file(daemon->io_context, daemon->keyfile, SSL_FILETYPE_PEM)) - { - SPDYF_DEBUG("Couldn't load the name file"); - SSL_CTX_free(daemon->io_context); - return SPDY_NO; - } - SSL_CTX_set_next_protos_advertised_cb(daemon->io_context, &spdyf_next_protos_advertised_cb, NULL); - if (1 != SSL_CTX_set_cipher_list(daemon->io_context, "HIGH")) - { - SPDYF_DEBUG("Couldn't set the desired cipher list"); - SSL_CTX_free(daemon->io_context); - return SPDY_NO; - } - - return SPDY_YES; -} - - -void -SPDYF_openssl_deinit(struct SPDY_Daemon *daemon) -{ - SSL_CTX_free(daemon->io_context); -} - - -int -SPDYF_openssl_new_session(struct SPDY_Session *session) -{ - int ret; - - if(NULL == (session->io_context = SSL_new(session->daemon->io_context))) - { - SPDYF_DEBUG("Couldn't create ssl structure"); - return SPDY_NO; - } - if(1 != (ret = SSL_set_fd(session->io_context, session->socket_fd))) - { - SPDYF_DEBUG("SSL_set_fd %i",ret); - SSL_free(session->io_context); - session->io_context = NULL; - return SPDY_NO; - } - - //for non-blocking I/O SSL_accept may return -1 - //and this function won't work - if(1 != (ret = SSL_accept(session->io_context))) - { - SPDYF_DEBUG("SSL_accept %i",ret); - SSL_free(session->io_context); - session->io_context = NULL; - return SPDY_NO; - } - /* alternatively - SSL_set_accept_state(session->io_context); - * may be called and then the negotiation will be done on reading - */ - - return SPDY_YES; -} - - -void -SPDYF_openssl_close_session(struct SPDY_Session *session) -{ - //SSL_shutdown sends TLS "close notify" as in TLS standard. - //The function may fail as it waits for the other party to also close - //the TLS session. The lib just sends it and will close the socket - //after that because the browsers don't seem to care much about - //"close notify" - SSL_shutdown(session->io_context); - - SSL_free(session->io_context); -} - - -int -SPDYF_openssl_recv(struct SPDY_Session *session, - void * buffer, - size_t size) -{ - int ret; - int n = SSL_read(session->io_context, - buffer, - size); - //if(n > 0) SPDYF_DEBUG("recvd: %i",n); - if (n <= 0) - { - ret = SSL_get_error(session->io_context, n); - switch(ret) - { - case SSL_ERROR_ZERO_RETURN: - return 0; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return SPDY_IO_ERROR_AGAIN; - - case SSL_ERROR_SYSCALL: - if(EINTR == errno) - return SPDY_IO_ERROR_AGAIN; - return SPDY_IO_ERROR_ERROR; - default: - return SPDY_IO_ERROR_ERROR; - } - } - - return n; -} - - -int -SPDYF_openssl_send(struct SPDY_Session *session, - const void * buffer, - size_t size) -{ - int ret; - - int n = SSL_write(session->io_context, - buffer, - size); - //if(n > 0) SPDYF_DEBUG("sent: %i",n); - if (n <= 0) - { - ret = SSL_get_error(session->io_context, n); - switch(ret) - { - case SSL_ERROR_ZERO_RETURN: - return 0; - - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return SPDY_IO_ERROR_AGAIN; - - case SSL_ERROR_SYSCALL: - if(EINTR == errno) - return SPDY_IO_ERROR_AGAIN; - return SPDY_IO_ERROR_ERROR; - default: - return SPDY_IO_ERROR_ERROR; - } - } - - return n; -} - - -int -SPDYF_openssl_is_pending(struct SPDY_Session *session) -{ - /* From openssl docs: - * BUGS -SSL_pending() takes into account only bytes from the TLS/SSL record that is currently being processed (if any). If the SSL object's read_ahead flag is set, additional protocol bytes may have been read containing more TLS/SSL records; these are ignored by SSL_pending(). - */ - return SSL_pending(session->io_context) > 0 ? SPDY_YES : SPDY_NO; -} - - -int -SPDYF_openssl_before_write(struct SPDY_Session *session) -{ - (void)session; - - return SPDY_YES; -} - - -int -SPDYF_openssl_after_write(struct SPDY_Session *session, int was_written) -{ - (void)session; - - return was_written; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/io_openssl.h libmicrohttpd-0.9.55/src/microspdy/io_openssl.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/io_openssl.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/io_openssl.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,166 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file io_openssl.h - * @brief TLS handling. openssl with NPN is used, but as long as the - * functions conform to this interface file, other libraries - * can be used. - * @author Andrey Uzunov - */ - -#ifndef IO_OPENSSL_H -#define IO_OPENSSL_H - -#include "platform.h" -#include "io.h" -#include -#include -#include - - -/** - * Global initializing of openssl. Must be called only once in the program. - * - */ -void -SPDYF_openssl_global_init(); - - -/** - * Global deinitializing of openssl for the whole program. Should be called - * at the end of the program. - * - */ -void -SPDYF_openssl_global_deinit(); - - -/** - * Initializing of openssl for a specific daemon. - * Must be called when the daemon starts. - * - * @param daemon SPDY_Daemon for which openssl will be used. Daemon's - * certificate and key file are used. - * @return SPDY_YES on success or SPDY_NO on error - */ -int -SPDYF_openssl_init(struct SPDY_Daemon *daemon); - - -/** - * Deinitializing openssl for a daemon. Should be called - * when the deamon is stopped. - * - * @param daemon SPDY_Daemon which is being stopped - */ -void -SPDYF_openssl_deinit(struct SPDY_Daemon *daemon); - - -/** - * Initializing openssl for a specific connection. Must be called - * after the connection has been accepted. - * - * @param session SPDY_Session whose socket will be used by openssl - * @return SPDY_NO if some openssl funcs fail. SPDY_YES otherwise - */ -int -SPDYF_openssl_new_session(struct SPDY_Session *session); - - -/** - * Deinitializing openssl for a specific connection. Should be called - * closing session's socket. - * - * @param session SPDY_Session whose socket is used by openssl - */ -void -SPDYF_openssl_close_session(struct SPDY_Session *session); - - -/** - * Reading from a TLS socket. Reads available data and put it to the - * buffer. - * - * @param session for which data is received - * @param buffer where data from the socket will be written to - * @param size of the buffer - * @return number of bytes (at most size) read from the TLS connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -int -SPDYF_openssl_recv(struct SPDY_Session *session, - void * buffer, - size_t size); - - -/** - * Writing to a TLS socket. Writes the data given into the buffer to the - * TLS socket. - * - * @param session whose context is used - * @param buffer from where data will be written to the socket - * @param size number of bytes to be taken from the buffer - * @return number of bytes (at most size) from the buffer that has been - * written to the TLS connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -int -SPDYF_openssl_send(struct SPDY_Session *session, - const void * buffer, - size_t size); - - -/** - * Checks if there is data staying in the buffers of the underlying - * system that waits to be read. - * - * @param session which is checked - * @return SPDY_YES if data is pending or SPDY_NO otherwise - */ -int -SPDYF_openssl_is_pending(struct SPDY_Session *session); - - -/** - * Nothing. - * - * @param session - * @return SPDY_NO if writing must not happen in the call; - * SPDY_YES otherwise - */ -int -SPDYF_openssl_before_write(struct SPDY_Session *session); - - -/** - * Nothing. - * - * @param session - * @param was_written has the same value as the write function for the - * session will return - * @return returned value will be used by the write function to return - */ -int -SPDYF_openssl_after_write(struct SPDY_Session *session, int was_written); - - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/io_raw.c libmicrohttpd-0.9.55/src/microspdy/io_raw.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/io_raw.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/io_raw.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,194 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file io_raw.c - * @brief IO for SPDY without TLS. - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "internal.h" -#include "session.h" -#include "io_raw.h" -//TODO put in in the right place -#include - - -void -SPDYF_raw_global_init() -{ -} - - -void -SPDYF_raw_global_deinit() -{ -} - - -int -SPDYF_raw_init(struct SPDY_Daemon *daemon) -{ - (void)daemon; - - return SPDY_YES; -} - - -void -SPDYF_raw_deinit(struct SPDY_Daemon *daemon) -{ - (void)daemon; -} - - -int -SPDYF_raw_new_session(struct SPDY_Session *session) -{ - int fd_flags; - int val = 1; - int ret; - - //setting the socket to be non-blocking - fd_flags = fcntl (session->socket_fd, F_GETFL); - if ( -1 == fd_flags - || 0 != fcntl (session->socket_fd, F_SETFL, fd_flags | O_NONBLOCK)) - SPDYF_DEBUG("WARNING: Couldn't set the new connection to be non-blocking"); - - if(SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags) - { - ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(-1 == ret) - SPDYF_DEBUG("WARNING: Couldn't set the new connection to TCP_NODELAY"); - } - - return SPDY_YES; -} - - -void -SPDYF_raw_close_session(struct SPDY_Session *session) -{ - (void)session; -} - - -int -SPDYF_raw_recv(struct SPDY_Session *session, - void * buffer, - size_t size) -{ - int n = read(session->socket_fd, - buffer, - size); - //if(n > 0) SPDYF_DEBUG("recvd: %i",n); - if (n < 0) - { - switch(errno) - { - case EAGAIN: -#if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: -#endif - case EINTR: - return SPDY_IO_ERROR_AGAIN; - - default: - return SPDY_IO_ERROR_ERROR; - } - } - - return n; -} - - -int -SPDYF_raw_send(struct SPDY_Session *session, - const void * buffer, - size_t size) -{ - int n = write(session->socket_fd, - buffer, - size); - //if(n > 0) SPDYF_DEBUG("sent: %i",n); - if (n < 0) - { - switch(errno) - { - case EAGAIN: -#if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: -#endif - case EINTR: - return SPDY_IO_ERROR_AGAIN; - - default: - return SPDY_IO_ERROR_ERROR; - } - } - - return n; -} - - -int -SPDYF_raw_is_pending(struct SPDY_Session *session) -{ - (void)session; - - return SPDY_NO; -} - - -int -SPDYF_raw_before_write(struct SPDY_Session *session) -{ -#if HAVE_DECL_TCP_CORK - if(0 == (SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags)) - { - int val = 1; - int ret; - - ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val)); - if(-1 == ret) - SPDYF_DEBUG("WARNING: Couldn't set the new connection to TCP_CORK"); - } -#endif - - return SPDY_YES; -} - - -int -SPDYF_raw_after_write(struct SPDY_Session *session, int was_written) -{ -#if HAVE_DECL_TCP_CORK - if(SPDY_YES == was_written && 0 == (SPDY_DAEMON_FLAG_NO_DELAY & session->daemon->flags)) - { - int val = 0; - int ret; - - ret = setsockopt(session->socket_fd, IPPROTO_TCP, TCP_CORK, &val, (socklen_t)sizeof(val)); - if(-1 == ret) - SPDYF_DEBUG("WARNING: Couldn't unset the new connection to TCP_CORK"); - } - -#endif - return was_written; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/io_raw.h libmicrohttpd-0.9.55/src/microspdy/io_raw.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/io_raw.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/io_raw.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,158 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file io_raw.h - * @brief IO for SPDY without TLS. - * @author Andrey Uzunov - */ - -#ifndef IO_RAW_H -#define IO_RAW_H - -#include "platform.h" - - -/** - * Must be called only once in the program. - * - */ -void -SPDYF_raw_global_init(); - - -/** - * Should be called - * at the end of the program. - * - */ -void -SPDYF_raw_global_deinit(); - - -/** - * Must be called when the daemon starts. - * - * @param daemon SPDY_Daemon - * @return SPDY_YES on success or SPDY_NO on error - */ -int -SPDYF_raw_init(struct SPDY_Daemon *daemon); - - -/** - * Should be called - * when the deamon is stopped. - * - * @param daemon SPDY_Daemon which is being stopped - */ -void -SPDYF_raw_deinit(struct SPDY_Daemon *daemon); - - -/** - * Must be called - * after the connection has been accepted. - * - * @param session SPDY_Session whose socket will be used - * @return SPDY_NO if some funcs fail. SPDY_YES otherwise - */ -int -SPDYF_raw_new_session(struct SPDY_Session *session); - - -/** - * Should be called - * closing session's socket. - * - * @param session SPDY_Session whose socket is used - */ -void -SPDYF_raw_close_session(struct SPDY_Session *session); - - -/** - * Reading from socket. Reads available data and put it to the - * buffer. - * - * @param session for which data is received - * @param buffer where data from the socket will be written to - * @param size of the buffer - * @return number of bytes (at most size) read from the connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -int -SPDYF_raw_recv(struct SPDY_Session *session, - void * buffer, - size_t size); - - -/** - * Writing to socket. Writes the data given into the buffer to the - * socket. - * - * @param session whose context is used - * @param buffer from where data will be written to the socket - * @param size number of bytes to be taken from the buffer - * @return number of bytes (at most size) from the buffer that has been - * written to the connection - * 0 if the other party has closed the connection - * SPDY_IO_ERROR code on error - */ -int -SPDYF_raw_send(struct SPDY_Session *session, - const void * buffer, - size_t size); - - -/** - * Checks if there is data staying in the buffers of the underlying - * system that waits to be read. Always returns SPDY_NO, as we do not - * use a subsystem here. - * - * @param session which is checked - * @return SPDY_YES if data is pending or SPDY_NO otherwise - */ -int -SPDYF_raw_is_pending(struct SPDY_Session *session); - - -/** - * Sets TCP_CORK. - * - * @param session - * @return SPDY_NO if writing must not happen in the call; - * SPDY_YES otherwise - */ -int -SPDYF_raw_before_write(struct SPDY_Session *session); - - -/** - * Unsets TCP_CORK. - * - * @param session - * @param was_written has the same value as the write function for the - * session will return - * @return returned value will be used by the write function to return - */ -int -SPDYF_raw_after_write(struct SPDY_Session *session, int was_written); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/Makefile.am libmicrohttpd-0.9.55/src/microspdy/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/microspdy/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -# This Makefile.am is in the public domain -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/microspdy - -AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) - - -lib_LTLIBRARIES = \ - libmicrospdy.la - -libmicrospdy_la_SOURCES = \ - io.h io.c \ - io_openssl.h io_openssl.c \ - io_raw.h io_raw.c \ - structures.h structures.c \ - internal.h internal.c \ - daemon.h daemon.c \ - stream.h stream.c \ - compression.h compression.c \ - session.h session.c \ - applicationlayer.c applicationlayer.h \ - alstructures.c alstructures.h -libmicrospdy_la_LIBADD = \ - $(SPDY_LIBDEPS) - -libmicrospdy_la_LDFLAGS = \ - $(SPDY_LIB_LDFLAGS) - -libmicrospdy_la_CPPFLAGS = \ - $(AM_CPPFLAGS) $(SPDY_LIB_CPPFLAGS) \ - -DBUILDING_MHD_LIB=1 - -libmicrospdy_la_CFLAGS = -Wextra \ - $(AM_CFLAGS) $(SPDY_LIB_CFLAGS) - - -if USE_COVERAGE - AM_CFLAGS += --coverage -endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/Makefile.in libmicrohttpd-0.9.55/src/microspdy/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/microspdy/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microspdy/Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,831 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@USE_COVERAGE_TRUE@am__append_1 = --coverage -subdir = src/microspdy -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ - $(top_srcdir)/m4/ax_append_flag.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ - $(top_srcdir)/m4/ax_count_cpus.m4 \ - $(top_srcdir)/m4/ax_have_epoll.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/ax_require_defined.m4 \ - $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/MHD_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -libmicrospdy_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libmicrospdy_la_OBJECTS = libmicrospdy_la-io.lo \ - libmicrospdy_la-io_openssl.lo libmicrospdy_la-io_raw.lo \ - libmicrospdy_la-structures.lo libmicrospdy_la-internal.lo \ - libmicrospdy_la-daemon.lo libmicrospdy_la-stream.lo \ - libmicrospdy_la-compression.lo libmicrospdy_la-session.lo \ - libmicrospdy_la-applicationlayer.lo \ - libmicrospdy_la-alstructures.lo -libmicrospdy_la_OBJECTS = $(am_libmicrospdy_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libmicrospdy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libmicrospdy_la_CFLAGS) $(CFLAGS) $(libmicrospdy_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libmicrospdy_la_SOURCES) -DIST_SOURCES = $(libmicrospdy_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPU_COUNT = @CPU_COUNT@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ -GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ -HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ -HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL = @LIBCURL@ -LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ -LIBTOOL = @LIBTOOL@ -LIB_VERSION_AGE = @LIB_VERSION_AGE@ -LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ -LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MHD_LIBDEPS = @MHD_LIBDEPS@ -MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ -MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ -MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ -MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ -MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ -MKDIR_P = @MKDIR_P@ -MS_LIB_TOOL = @MS_LIB_TOOL@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ -PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ -PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -_libcurl_config = @_libcurl_config@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -have_socat = @have_socat@ -have_zzuf = @have_zzuf@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_cv_objdir = @lt_cv_objdir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# This Makefile.am is in the public domain -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/microspdy - -AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) $(am__append_1) -lib_LTLIBRARIES = \ - libmicrospdy.la - -libmicrospdy_la_SOURCES = \ - io.h io.c \ - io_openssl.h io_openssl.c \ - io_raw.h io_raw.c \ - structures.h structures.c \ - internal.h internal.c \ - daemon.h daemon.c \ - stream.h stream.c \ - compression.h compression.c \ - session.h session.c \ - applicationlayer.c applicationlayer.h \ - alstructures.c alstructures.h - -libmicrospdy_la_LIBADD = \ - $(SPDY_LIBDEPS) - -libmicrospdy_la_LDFLAGS = \ - $(SPDY_LIB_LDFLAGS) - -libmicrospdy_la_CPPFLAGS = \ - $(AM_CPPFLAGS) $(SPDY_LIB_CPPFLAGS) \ - -DBUILDING_MHD_LIB=1 - -libmicrospdy_la_CFLAGS = -Wextra \ - $(AM_CFLAGS) $(SPDY_LIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/microspdy/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/microspdy/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libmicrospdy.la: $(libmicrospdy_la_OBJECTS) $(libmicrospdy_la_DEPENDENCIES) $(EXTRA_libmicrospdy_la_DEPENDENCIES) - $(AM_V_CCLD)$(libmicrospdy_la_LINK) -rpath $(libdir) $(libmicrospdy_la_OBJECTS) $(libmicrospdy_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-alstructures.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-applicationlayer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-compression.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-daemon.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-internal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-io_openssl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-io_raw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrospdy_la-structures.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -libmicrospdy_la-io.lo: io.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-io.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-io.Tpo -c -o libmicrospdy_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-io.Tpo $(DEPDIR)/libmicrospdy_la-io.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='io.c' object='libmicrospdy_la-io.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-io.lo `test -f 'io.c' || echo '$(srcdir)/'`io.c - -libmicrospdy_la-io_openssl.lo: io_openssl.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-io_openssl.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-io_openssl.Tpo -c -o libmicrospdy_la-io_openssl.lo `test -f 'io_openssl.c' || echo '$(srcdir)/'`io_openssl.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-io_openssl.Tpo $(DEPDIR)/libmicrospdy_la-io_openssl.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='io_openssl.c' object='libmicrospdy_la-io_openssl.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-io_openssl.lo `test -f 'io_openssl.c' || echo '$(srcdir)/'`io_openssl.c - -libmicrospdy_la-io_raw.lo: io_raw.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-io_raw.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-io_raw.Tpo -c -o libmicrospdy_la-io_raw.lo `test -f 'io_raw.c' || echo '$(srcdir)/'`io_raw.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-io_raw.Tpo $(DEPDIR)/libmicrospdy_la-io_raw.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='io_raw.c' object='libmicrospdy_la-io_raw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-io_raw.lo `test -f 'io_raw.c' || echo '$(srcdir)/'`io_raw.c - -libmicrospdy_la-structures.lo: structures.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-structures.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-structures.Tpo -c -o libmicrospdy_la-structures.lo `test -f 'structures.c' || echo '$(srcdir)/'`structures.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-structures.Tpo $(DEPDIR)/libmicrospdy_la-structures.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='structures.c' object='libmicrospdy_la-structures.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-structures.lo `test -f 'structures.c' || echo '$(srcdir)/'`structures.c - -libmicrospdy_la-internal.lo: internal.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-internal.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-internal.Tpo -c -o libmicrospdy_la-internal.lo `test -f 'internal.c' || echo '$(srcdir)/'`internal.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-internal.Tpo $(DEPDIR)/libmicrospdy_la-internal.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='internal.c' object='libmicrospdy_la-internal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-internal.lo `test -f 'internal.c' || echo '$(srcdir)/'`internal.c - -libmicrospdy_la-daemon.lo: daemon.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-daemon.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-daemon.Tpo -c -o libmicrospdy_la-daemon.lo `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-daemon.Tpo $(DEPDIR)/libmicrospdy_la-daemon.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='daemon.c' object='libmicrospdy_la-daemon.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-daemon.lo `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c - -libmicrospdy_la-stream.lo: stream.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-stream.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-stream.Tpo -c -o libmicrospdy_la-stream.lo `test -f 'stream.c' || echo '$(srcdir)/'`stream.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-stream.Tpo $(DEPDIR)/libmicrospdy_la-stream.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stream.c' object='libmicrospdy_la-stream.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-stream.lo `test -f 'stream.c' || echo '$(srcdir)/'`stream.c - -libmicrospdy_la-compression.lo: compression.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-compression.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-compression.Tpo -c -o libmicrospdy_la-compression.lo `test -f 'compression.c' || echo '$(srcdir)/'`compression.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-compression.Tpo $(DEPDIR)/libmicrospdy_la-compression.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compression.c' object='libmicrospdy_la-compression.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-compression.lo `test -f 'compression.c' || echo '$(srcdir)/'`compression.c - -libmicrospdy_la-session.lo: session.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-session.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-session.Tpo -c -o libmicrospdy_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-session.Tpo $(DEPDIR)/libmicrospdy_la-session.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='session.c' object='libmicrospdy_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmicrospdy_la-applicationlayer.lo: applicationlayer.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-applicationlayer.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-applicationlayer.Tpo -c -o libmicrospdy_la-applicationlayer.lo `test -f 'applicationlayer.c' || echo '$(srcdir)/'`applicationlayer.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-applicationlayer.Tpo $(DEPDIR)/libmicrospdy_la-applicationlayer.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='applicationlayer.c' object='libmicrospdy_la-applicationlayer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-applicationlayer.lo `test -f 'applicationlayer.c' || echo '$(srcdir)/'`applicationlayer.c - -libmicrospdy_la-alstructures.lo: alstructures.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -MT libmicrospdy_la-alstructures.lo -MD -MP -MF $(DEPDIR)/libmicrospdy_la-alstructures.Tpo -c -o libmicrospdy_la-alstructures.lo `test -f 'alstructures.c' || echo '$(srcdir)/'`alstructures.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrospdy_la-alstructures.Tpo $(DEPDIR)/libmicrospdy_la-alstructures.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='alstructures.c' object='libmicrospdy_la-alstructures.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrospdy_la_CPPFLAGS) $(CPPFLAGS) $(libmicrospdy_la_CFLAGS) $(CFLAGS) -c -o libmicrospdy_la-alstructures.lo `test -f 'alstructures.c' || echo '$(srcdir)/'`alstructures.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(libdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-libLTLIBRARIES - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-libLTLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/session.c libmicrohttpd-0.9.55/src/microspdy/session.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/session.c 2015-08-02 19:05:34.000000000 +0200 +++ libmicrohttpd-0.9.55/src/microspdy/session.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1769 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file session.c - * @brief TCP connection/SPDY session handling. So far most of the - * functions for handling SPDY framing layer are here. - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "session.h" -#include "compression.h" -#include "stream.h" -#include "io.h" - - -/** - * Handler for reading the full SYN_STREAM frame after we know that - * the frame is such. - * The function waits for the full frame and then changes status - * of the session. New stream is created. - * - * @param session SPDY_Session whose read buffer is used. - */ -static void -spdyf_handler_read_syn_stream (struct SPDY_Session *session) -{ - size_t name_value_strm_size = 0; - unsigned int compressed_data_size; - int ret; - void *name_value_strm = NULL; - struct SPDYF_Control_Frame *frame; - struct SPDY_NameValue *headers; - - SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status - || SPDY_SESSION_STATUS_WAIT_FOR_BODY == session->status, - "the function is called wrong"); - - frame = (struct SPDYF_Control_Frame *)session->frame_handler_cls; - - //handle subheaders - if(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status) - { - if(0 == frame->length) - { - //protocol error: incomplete frame - //we just ignore it since there is no stream id for which to - //send RST_STREAM - //TODO maybe GOAWAY and closing session is appropriate - SPDYF_DEBUG("zero long SYN_STREAM received"); - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); - return; - } - - if(SPDY_YES != SPDYF_stream_new(session)) - { - /* waiting for some more fields to create new stream - or something went wrong, SPDYF_stream_new has handled the - situation */ - return; - } - - session->current_stream_id = session->streams_head->stream_id; - if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - //TODO no need to create stream if this happens - session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; - return; - } - else - session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; - } - - //handle body - - //start reading the compressed name/value pairs (http headers) - compressed_data_size = frame->length //everything after length field - - 10;//4B stream id, 4B assoc strem id, 2B priority, unused and slot - - if(session->read_buffer_offset - session->read_buffer_beginning < compressed_data_size) - { - // the full frame is not yet here, try later - return; - } - - if ( (compressed_data_size > 0) && - (SPDY_YES != - SPDYF_zlib_inflate(&session->zlib_recv_stream, - session->read_buffer + session->read_buffer_beginning, - compressed_data_size, - &name_value_strm, - &name_value_strm_size)) ) - { - /* something went wrong on inflating, - * the state of the stream for decompression is unknown - * and we may not be able to read anything more received on - * this session, - * so it is better to close the session */ - free(name_value_strm); - free(frame); - - /* mark the session for closing and close it, when - * everything on the output queue is already written */ - session->status = SPDY_SESSION_STATUS_FLUSHING; - - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_INTERNAL_ERROR, false); - - return; - } - - if(0 == name_value_strm_size || 0 == compressed_data_size) - { - //Protocol error: send RST_STREAM - if(SPDY_YES != SPDYF_prepare_rst_stream(session, session->streams_head, - SPDY_RST_STREAM_STATUS_PROTOCOL_ERROR)) - { - //no memory, try later to send RST - free(name_value_strm); - return; - } - } - else - { - ret = SPDYF_name_value_from_stream(name_value_strm, name_value_strm_size, &headers); - if(SPDY_NO == ret) - { - //memory error, try later - free(name_value_strm); - return; - } - - session->streams_head->headers = headers; - //inform the application layer for the new stream received - if(SPDY_YES != session->daemon->fnew_stream_cb(session->daemon->fcls, session->streams_head)) - { - //memory error, try later - free(name_value_strm); - return; - } - - session->read_buffer_beginning += compressed_data_size; - } - - //SPDYF_DEBUG("syn_stream received: id %i", session->current_stream_id); - - //change state to wait for new frame - free(name_value_strm); - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); -} - - -/** - * Handler for reading the GOAWAY frame after we know that - * the frame is such. - * The function waits for the full frame and then changes status - * of the session. - * - * @param session SPDY_Session whose read buffer is used. - */ -static void -spdyf_handler_read_goaway (struct SPDY_Session *session) -{ - struct SPDYF_Control_Frame *frame; - uint32_t last_good_stream_id; - uint32_t status_int; - enum SPDY_GOAWAY_STATUS status; - - SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status, - "the function is called wrong"); - - frame = (struct SPDYF_Control_Frame *)session->frame_handler_cls; - - if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - //this is a protocol error/attack - session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; - return; - } - - if(0 != frame->flags || 8 != frame->length) - { - //this is a protocol error - SPDYF_DEBUG("wrong GOAWAY received"); - //anyway, it will be handled - } - - if((session->read_buffer_offset - session->read_buffer_beginning) < frame->length) - { - //not all fields are received - //try later - return; - } - - //mark that the session is almost closed - session->is_goaway_received = true; - - if(8 == frame->length) - { - memcpy(&last_good_stream_id, session->read_buffer + session->read_buffer_beginning, 4); - last_good_stream_id = NTOH31(last_good_stream_id); - session->read_buffer_beginning += 4; - - memcpy(&status_int, session->read_buffer + session->read_buffer_beginning, 4); - status = ntohl(status_int); - session->read_buffer_beginning += 4; - - //TODO do something with last_good - - //SPDYF_DEBUG("Received GOAWAY; status=%i; lastgood=%i",status,last_good_stream_id); - - //do something according to the status - //TODO - switch(status) - { - case SPDY_GOAWAY_STATUS_OK: - break; - case SPDY_GOAWAY_STATUS_PROTOCOL_ERROR: - break; - case SPDY_GOAWAY_STATUS_INTERNAL_ERROR: - break; - } - - //SPDYF_DEBUG("goaway received: status %i", status); - } - - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); -} - - -/** - * Handler for reading RST_STREAM frames. After receiving the frame - * the stream moves into closed state and status - * of the session is changed. Frames, belonging to this stream, which - * are still at the output queue, will be ignored later. - * - * @param session SPDY_Session whose read buffer is used. - */ -static void -spdyf_handler_read_rst_stream (struct SPDY_Session *session) -{ - struct SPDYF_Control_Frame *frame; - uint32_t stream_id; - int32_t status_int; - //enum SPDY_RST_STREAM_STATUS status; //for debug - struct SPDYF_Stream *stream; - - SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status, - "the function is called wrong"); - - frame = (struct SPDYF_Control_Frame *)session->frame_handler_cls; - - if(0 != frame->flags || 8 != frame->length) - { - //this is a protocol error - SPDYF_DEBUG("wrong RST_STREAM received"); - //ignore as a large frame - session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; - return; - } - - if((session->read_buffer_offset - session->read_buffer_beginning) < frame->length) - { - //not all fields are received - //try later - return; - } - - memcpy(&stream_id, session->read_buffer + session->read_buffer_beginning, 4); - stream_id = NTOH31(stream_id); - session->read_buffer_beginning += 4; - - memcpy(&status_int, session->read_buffer + session->read_buffer_beginning, 4); - //status = ntohl(status_int); //for debug - session->read_buffer_beginning += 4; - - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); - - //mark the stream as closed - stream = session->streams_head; - while(NULL != stream) - { - if(stream_id == stream->stream_id) - { - stream->is_in_closed = true; - stream->is_out_closed = true; - break; - } - stream = stream->next; - } - - //SPDYF_DEBUG("Received RST_STREAM; status=%i; id=%i",status,stream_id); - - //do something according to the status - //TODO - /*switch(status) - { - case SPDY_RST_STREAM_STATUS_PROTOCOL_ERROR: - break; - }*/ -} - - -/** - * Handler for reading DATA frames. In requests they are used for POST - * arguments. - * - * @param session SPDY_Session whose read buffer is used. - */ -static void -spdyf_handler_read_data (struct SPDY_Session *session) -{ - int ret; - struct SPDYF_Data_Frame * frame; - struct SPDYF_Stream * stream; - - SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status - || SPDY_SESSION_STATUS_WAIT_FOR_BODY == session->status, - "the function is called wrong"); - - //SPDYF_DEBUG("DATA frame received (POST?). Ignoring"); - - //SPDYF_SIGINT(""); - - frame = (struct SPDYF_Data_Frame *)session->frame_handler_cls; - - //handle subheaders - if(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status) - { - if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; - return; - } - else - session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; - } - - //handle body - - if(session->read_buffer_offset - session->read_buffer_beginning - >= frame->length) - { - stream = SPDYF_stream_find(frame->stream_id, session); - - if(NULL == stream || stream->is_in_closed || NULL == session->daemon->received_data_cb) - { - if(NULL == session->daemon->received_data_cb) - SPDYF_DEBUG("No callback for DATA frame set; Ignoring DATA frame!"); - - //TODO send error? - - //TODO for now ignore frame - session->read_buffer_beginning += frame->length; - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); - return; - } - - ret = session->daemon->freceived_data_cb(session->daemon->cls, - stream, - session->read_buffer + session->read_buffer_beginning, - frame->length, - 0 == (SPDY_DATA_FLAG_FIN & frame->flags)); - - session->read_buffer_beginning += frame->length; - - stream->window_size -= frame->length; - - //TODO close in and send rst maybe - SPDYF_ASSERT(SPDY_YES == ret, "Cancel POST data is not yet implemented"); - - if(SPDY_DATA_FLAG_FIN & frame->flags) - { - stream->is_in_closed = true; - } - else if(stream->window_size < SPDYF_INITIAL_WINDOW_SIZE / 2) - { - //very simple implementation of flow control - //when the window's size is under the half of the initial value, - //increase it again up to the initial value - - //prepare WINDOW_UPDATE - if(SPDY_YES == SPDYF_prepare_window_update(session, stream, - SPDYF_INITIAL_WINDOW_SIZE - stream->window_size)) - { - stream->window_size = SPDYF_INITIAL_WINDOW_SIZE; - } - //else: do it later - } - - //SPDYF_DEBUG("data received: id %i", frame->stream_id); - - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); - } -} - - -int -SPDYF_handler_write_syn_reply (struct SPDY_Session *session) -{ - struct SPDYF_Response_Queue *response_queue = session->response_queue_head; - struct SPDYF_Stream *stream = response_queue->stream; - struct SPDYF_Control_Frame control_frame; - void *compressed_headers = NULL; - size_t compressed_headers_size=0; - size_t used_data=0; - size_t total_size; - uint32_t stream_id_nbo; - - SPDYF_ASSERT(NULL == session->write_buffer, "the function is called not in the correct moment"); - - memcpy(&control_frame, response_queue->control_frame, sizeof(control_frame)); - - if(SPDY_YES != SPDYF_zlib_deflate(&session->zlib_send_stream, - response_queue->data, - response_queue->data_size, - &used_data, - &compressed_headers, - &compressed_headers_size)) - { - /* something went wrong on compressing, - * the state of the stream for compression is unknown - * and we may not be able to send anything more on - * this session, - * so it is better to close the session right now */ - session->status = SPDY_SESSION_STATUS_CLOSING; - - free(compressed_headers); - - return SPDY_NO; - } - - //TODO do we need this used_Data - SPDYF_ASSERT(used_data == response_queue->data_size, "not everything was used by zlib"); - - total_size = sizeof(struct SPDYF_Control_Frame) //SPDY header - + 4 // stream id as "subheader" - + compressed_headers_size; - - if(NULL == (session->write_buffer = malloc(total_size))) - { - /* no memory - * since we do not save the compressed data anywhere and - * the sending zlib stream is already in new state, we must - * close the session */ - session->status = SPDY_SESSION_STATUS_CLOSING; - - free(compressed_headers); - - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - control_frame.length = compressed_headers_size + 4; // compressed data + stream_id - SPDYF_CONTROL_FRAME_HTON(&control_frame); - - //put frame headers to write buffer - memcpy(session->write_buffer + session->write_buffer_offset,&control_frame,sizeof(struct SPDYF_Control_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Control_Frame); - - //put stream id to write buffer - stream_id_nbo = HTON31(stream->stream_id); - memcpy(session->write_buffer + session->write_buffer_offset, &stream_id_nbo, 4); - session->write_buffer_offset += 4; - - //put compressed name/value pairs to write buffer - memcpy(session->write_buffer + session->write_buffer_offset, compressed_headers, compressed_headers_size); - session->write_buffer_offset += compressed_headers_size; - - SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); - SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); - - //DEBUG CODE, break compression state to see what happens -/* SPDYF_zlib_deflate(&session->zlib_send_stream, - "1234567890", - 10, - &used_data, - &compressed_headers, - &compressed_headers_size); -*/ - free(compressed_headers); - - session->last_replied_to_stream_id = stream->stream_id; - - //SPDYF_DEBUG("syn_reply sent: id %i", stream->stream_id); - - return SPDY_YES; -} - - -int -SPDYF_handler_write_goaway (struct SPDY_Session *session) -{ - struct SPDYF_Response_Queue *response_queue = session->response_queue_head; - struct SPDYF_Control_Frame control_frame; - size_t total_size; - int last_good_stream_id; - - SPDYF_ASSERT(NULL == session->write_buffer, "the function is called not in the correct moment"); - - memcpy(&control_frame, response_queue->control_frame, sizeof(control_frame)); - - session->is_goaway_sent = true; - - total_size = sizeof(struct SPDYF_Control_Frame) //SPDY header - + 4 // last good stream id as "subheader" - + 4; // status code as "subheader" - - if(NULL == (session->write_buffer = malloc(total_size))) - { - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - control_frame.length = 8; // always for GOAWAY - SPDYF_CONTROL_FRAME_HTON(&control_frame); - - //put frame headers to write buffer - memcpy(session->write_buffer + session->write_buffer_offset,&control_frame,sizeof(struct SPDYF_Control_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Control_Frame); - - //put last good stream id to write buffer - last_good_stream_id = HTON31(session->last_replied_to_stream_id); - memcpy(session->write_buffer + session->write_buffer_offset, &last_good_stream_id, 4); - session->write_buffer_offset += 4; - - //put "data" to write buffer. This is the status - memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, 4); - session->write_buffer_offset += 4; - //data is not freed by the destroy function so: - //free(response_queue->data); - - //SPDYF_DEBUG("goaway sent: status %i", NTOH31(*(uint32_t*)(response_queue->data))); - - SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); - SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); - - return SPDY_YES; -} - - -int -SPDYF_handler_write_data (struct SPDY_Session *session) -{ - struct SPDYF_Response_Queue *response_queue = session->response_queue_head; - struct SPDYF_Response_Queue *new_response_queue; - size_t total_size; - struct SPDYF_Data_Frame data_frame; - ssize_t ret; - bool more; - - SPDYF_ASSERT(NULL == session->write_buffer, "the function is called not in the correct moment"); - - memcpy(&data_frame, response_queue->data_frame, sizeof(data_frame)); - - if(NULL == response_queue->response->rcb) - { - //standard response with data into the struct - SPDYF_ASSERT(NULL != response_queue->data, "no data for the response"); - - total_size = sizeof(struct SPDYF_Data_Frame) //SPDY header - + response_queue->data_size; - - if(NULL == (session->write_buffer = malloc(total_size))) - { - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - data_frame.length = response_queue->data_size; - SPDYF_DATA_FRAME_HTON(&data_frame); - - //put SPDY headers to the writing buffer - memcpy(session->write_buffer + session->write_buffer_offset,&data_frame,sizeof(struct SPDYF_Data_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Data_Frame); - - //put data to the writing buffer - memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, response_queue->data_size); - session->write_buffer_offset += response_queue->data_size; - } - else - { - /* response with callbacks. The lib will produce more than 1 - * data frames - */ - - total_size = sizeof(struct SPDYF_Data_Frame) //SPDY header - + SPDY_MAX_SUPPORTED_FRAME_SIZE; //max possible size - - if(NULL == (session->write_buffer = malloc(total_size))) - { - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - ret = response_queue->response->rcb(response_queue->response->rcb_cls, - session->write_buffer + sizeof(struct SPDYF_Data_Frame), - response_queue->response->rcb_block_size, - &more); - - if(ret < 0 || ret > response_queue->response->rcb_block_size) - { - free(session->write_buffer); - session->write_buffer = NULL; - - //send RST_STREAM - if(SPDY_YES == (ret = SPDYF_prepare_rst_stream(session, - response_queue->stream, - SPDY_RST_STREAM_STATUS_INTERNAL_ERROR))) - { - return SPDY_NO; - } - - //else no memory - //for now close session - //TODO what? - session->status = SPDY_SESSION_STATUS_CLOSING; - - return SPDY_NO; - } - if(0 == ret && more) - { - //the app couldn't write anything to buf but later will - free(session->write_buffer); - session->write_buffer = NULL; - session->write_buffer_size = 0; - - if(NULL != response_queue->next) - { - //put the frame at the end of the queue - //otherwise - head of line blocking - session->response_queue_head = response_queue->next; - session->response_queue_head->prev = NULL; - session->response_queue_tail->next = response_queue; - response_queue->prev = session->response_queue_tail; - response_queue->next = NULL; - session->response_queue_tail = response_queue; - } - - return SPDY_YES; - } - - if(more) - { - //create another response queue object to call the user cb again - if(NULL == (new_response_queue = SPDYF_response_queue_create(true, - NULL, - 0, - response_queue->response, - response_queue->stream, - false, - response_queue->frqcb, - response_queue->frqcb_cls, - response_queue->rrcb, - response_queue->rrcb_cls))) - { - //TODO send RST_STREAM - //for now close session - session->status = SPDY_SESSION_STATUS_CLOSING; - - free(session->write_buffer); - session->write_buffer = NULL; - return SPDY_NO; - } - - //put it at second position on the queue - new_response_queue->prev = response_queue; - new_response_queue->next = response_queue->next; - if(NULL == response_queue->next) - { - session->response_queue_tail = new_response_queue; - } - else - { - response_queue->next->prev = new_response_queue; - } - response_queue->next = new_response_queue; - - response_queue->frqcb = NULL; - response_queue->frqcb_cls = NULL; - response_queue->rrcb = NULL; - response_queue->rrcb_cls = NULL; - } - else - { - data_frame.flags |= SPDY_DATA_FLAG_FIN; - } - - data_frame.length = ret; - SPDYF_DATA_FRAME_HTON(&data_frame); - - //put SPDY headers to the writing buffer - memcpy(session->write_buffer + session->write_buffer_offset, - &data_frame, - sizeof(struct SPDYF_Data_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Data_Frame); - session->write_buffer_offset += ret; - session->write_buffer_size = session->write_buffer_offset; - } - - //SPDYF_DEBUG("data sent: id %i", NTOH31(data_frame.stream_id)); - - SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); - SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); - - return SPDY_YES; -} - - -int -SPDYF_handler_write_rst_stream (struct SPDY_Session *session) -{ - struct SPDYF_Response_Queue *response_queue = session->response_queue_head; - struct SPDYF_Control_Frame control_frame; - size_t total_size; - - SPDYF_ASSERT(NULL == session->write_buffer, "the function is called not in the correct moment"); - - memcpy(&control_frame, response_queue->control_frame, sizeof(control_frame)); - - total_size = sizeof(struct SPDYF_Control_Frame) //SPDY header - + 4 // stream id as "subheader" - + 4; // status code as "subheader" - - if(NULL == (session->write_buffer = malloc(total_size))) - { - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - control_frame.length = 8; // always for RST_STREAM - SPDYF_CONTROL_FRAME_HTON(&control_frame); - - //put frame headers to write buffer - memcpy(session->write_buffer + session->write_buffer_offset,&control_frame,sizeof(struct SPDYF_Control_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Control_Frame); - - //put stream id to write buffer. This is the status - memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, 8); - session->write_buffer_offset += 8; - //data is not freed by the destroy function so: - //free(response_queue->data); - - //SPDYF_DEBUG("rst_stream sent: id %i", NTOH31((((uint64_t)response_queue->data) & 0xFFFF0000) >> 32)); - - SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); - SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); - - return SPDY_YES; -} - - -int -SPDYF_handler_write_window_update (struct SPDY_Session *session) -{ - struct SPDYF_Response_Queue *response_queue = session->response_queue_head; - struct SPDYF_Control_Frame control_frame; - size_t total_size; - - SPDYF_ASSERT(NULL == session->write_buffer, "the function is called not in the correct moment"); - - memcpy(&control_frame, response_queue->control_frame, sizeof(control_frame)); - - total_size = sizeof(struct SPDYF_Control_Frame) //SPDY header - + 4 // stream id as "subheader" - + 4; // delta-window-size as "subheader" - - if(NULL == (session->write_buffer = malloc(total_size))) - { - return SPDY_NO; - } - session->write_buffer_beginning = 0; - session->write_buffer_offset = 0; - session->write_buffer_size = total_size; - - control_frame.length = 8; // always for WINDOW_UPDATE - SPDYF_CONTROL_FRAME_HTON(&control_frame); - - //put frame headers to write buffer - memcpy(session->write_buffer + session->write_buffer_offset,&control_frame,sizeof(struct SPDYF_Control_Frame)); - session->write_buffer_offset += sizeof(struct SPDYF_Control_Frame); - - //put stream id and delta-window-size to write buffer - memcpy(session->write_buffer + session->write_buffer_offset, response_queue->data, 8); - session->write_buffer_offset += 8; - - //SPDYF_DEBUG("window_update sent: id %i", NTOH31((((uint64_t)response_queue->data) & 0xFFFF0000) >> 32)); - - SPDYF_ASSERT(0 == session->write_buffer_beginning, "bug1"); - SPDYF_ASSERT(session->write_buffer_offset == session->write_buffer_size, "bug2"); - - return SPDY_YES; -} - - -void -SPDYF_handler_ignore_frame (struct SPDY_Session *session) -{ - struct SPDYF_Control_Frame *frame; - - SPDYF_ASSERT(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status - || SPDY_SESSION_STATUS_WAIT_FOR_BODY == session->status, - "the function is called wrong"); - - - frame = (struct SPDYF_Control_Frame *)session->frame_handler_cls; - - //handle subheaders - if(SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER == session->status) - { - if(frame->length > SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - session->status = SPDY_SESSION_STATUS_IGNORE_BYTES; - return; - } - else - session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; - } - - //handle body - - if(session->read_buffer_offset - session->read_buffer_beginning - >= frame->length) - { - session->read_buffer_beginning += frame->length; - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - free(frame); - } -} - - -int -SPDYF_session_read (struct SPDY_Session *session) -{ - int bytes_read; - bool reallocate; - size_t actual_buf_size; - - if(SPDY_SESSION_STATUS_CLOSING == session->status - || SPDY_SESSION_STATUS_FLUSHING == session->status) - return SPDY_NO; - - //if the read buffer is full to the end, we need to reallocate space - if (session->read_buffer_size == session->read_buffer_offset) - { - //but only if the state of the session requires it - //i.e. no further proceeding is possible without reallocation - reallocate = false; - actual_buf_size = session->read_buffer_offset - - session->read_buffer_beginning; - switch(session->status) - { - case SPDY_SESSION_STATUS_WAIT_FOR_HEADER: - - case SPDY_SESSION_STATUS_IGNORE_BYTES: - //we need space for a whole control frame header - if(actual_buf_size < sizeof(struct SPDYF_Control_Frame)) - reallocate = true; - break; - - case SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER: - - case SPDY_SESSION_STATUS_WAIT_FOR_BODY: - //we need as many bytes as set in length field of the - //header - SPDYF_ASSERT(NULL != session->frame_handler_cls, - "no frame for session"); - if(session->frame_handler != &spdyf_handler_read_data) - { - if(actual_buf_size - < ((struct SPDYF_Control_Frame *)session->frame_handler_cls)->length) - reallocate = true; - } - else - { - if(actual_buf_size - < ((struct SPDYF_Data_Frame *)session->frame_handler_cls)->length) - reallocate = true; - } - break; - - case SPDY_SESSION_STATUS_CLOSING: - case SPDY_SESSION_STATUS_FLUSHING: - //nothing needed - break; - } - - if(reallocate) - { - //reuse the space in the buffer that was already read by the lib - memmove(session->read_buffer, - session->read_buffer + session->read_buffer_beginning, - session->read_buffer_offset - session->read_buffer_beginning); - - session->read_buffer_offset -= session->read_buffer_beginning; - session->read_buffer_beginning = 0; - } - else - { - //will read next time - //TODO optimize it, memmove more often? - return SPDY_NO; - } - } - - session->last_activity = SPDYF_monotonic_time(); - - //actual read from the TLS socket - bytes_read = session->fio_recv(session, - session->read_buffer + session->read_buffer_offset, - session->read_buffer_size - session->read_buffer_offset); - - switch(bytes_read) - { - case SPDY_IO_ERROR_CLOSED: - //The TLS connection was closed by the other party, clean - //or not - shutdown (session->socket_fd, SHUT_RD); - session->read_closed = true; - session->status = SPDY_SESSION_STATUS_CLOSING; - return SPDY_YES; - - case SPDY_IO_ERROR_ERROR: - //any kind of error in the TLS subsystem - //try to prepare GOAWAY frame - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_INTERNAL_ERROR, false); - //try to flush the queue when write is called - session->status = SPDY_SESSION_STATUS_FLUSHING; - return SPDY_YES; - - case SPDY_IO_ERROR_AGAIN: - //read or write should be called again; leave it for the - //next time - return SPDY_NO; - - //default: - //something was really read from the TLS subsystem - //just continue - } - - session->read_buffer_offset += bytes_read; - - return SPDY_YES; -} - - -int -SPDYF_session_write (struct SPDY_Session *session, - bool only_one_frame) -{ - unsigned int i; - int bytes_written; - struct SPDYF_Response_Queue *queue_head; - struct SPDYF_Response_Queue *response_queue; - - if(SPDY_SESSION_STATUS_CLOSING == session->status) - return SPDY_NO; - - if(SPDY_NO == session->fio_before_write(session)) - return SPDY_NO; - - for(i=0; - only_one_frame - ? i < 1 - : i < session->max_num_frames; - ++i) - { - //if the buffer is not null, part of the last frame is still - //pending to be sent - if(NULL == session->write_buffer) - { - //discard frames on closed streams - response_queue = session->response_queue_head; - - while(NULL != response_queue) - { - //if stream is closed, remove not yet sent frames - //associated with it - //GOAWAY frames are not associated to streams - //and still need to be sent - if(NULL == response_queue->stream - || !response_queue->stream->is_out_closed) - break; - - DLL_remove(session->response_queue_head,session->response_queue_tail,response_queue); - - if(NULL != response_queue->frqcb) - { - response_queue->frqcb(response_queue->frqcb_cls, response_queue, SPDY_RESPONSE_RESULT_STREAM_CLOSED); - } - - SPDYF_response_queue_destroy(response_queue); - response_queue = session->response_queue_head; - } - - if(NULL == session->response_queue_head) - break;//nothing on the queue - - //get next data from queue and put it to the write buffer - // to send it - if(SPDY_NO == session->response_queue_head->process_response_handler(session)) - { - //error occured and the handler changed or not the - //session's status appropriately - if(SPDY_SESSION_STATUS_CLOSING == session->status) - { - //try to send GOAWAY first if the current frame is different - if(session->response_queue_head->is_data - || SPDY_CONTROL_FRAME_TYPES_GOAWAY - != session->response_queue_head->control_frame->type) - { - session->status = SPDY_SESSION_STATUS_FLUSHING; - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_INTERNAL_ERROR, true); - SPDYF_session_write(session,true); - session->status = SPDY_SESSION_STATUS_CLOSING; - } - return SPDY_YES; - } - - //just return from the loop to return from this function - ++i; - break; - } - - //check if something was prepared for writing - //on respones with callbacks it is possible that their is no - //data available - if(0 == session->write_buffer_size)//nothing to write - { - if(response_queue != session->response_queue_head) - { - //the handler modified the queue - continue; - } - else - { - //no need to try the same frame again - ++i; - break; - } - } - } - - session->last_activity = SPDYF_monotonic_time(); - - //actual write to the IO - bytes_written = session->fio_send(session, - session->write_buffer + session->write_buffer_beginning, - session->write_buffer_offset - session->write_buffer_beginning); - - switch(bytes_written) - { - case SPDY_IO_ERROR_CLOSED: - //The TLS connection was closed by the other party, clean - //or not - shutdown (session->socket_fd, SHUT_RD); - session->read_closed = true; - session->status = SPDY_SESSION_STATUS_CLOSING; - return SPDY_YES; - - case SPDY_IO_ERROR_ERROR: - //any kind of error in the TLS subsystem - //forbid more writing - session->status = SPDY_SESSION_STATUS_CLOSING; - return SPDY_YES; - - case SPDY_IO_ERROR_AGAIN: - //read or write should be called again; leave it for the - //next time; return from the function as we do not now - //whether reading or writing is needed - return i>0 ? SPDY_YES : SPDY_NO; - - //default: - //something was really read from the TLS subsystem - //just continue - } - - session->write_buffer_beginning += bytes_written; - - //check if the full buffer was written - if(session->write_buffer_beginning == session->write_buffer_size) - { - //that response is handled, remove it from queue - free(session->write_buffer); - session->write_buffer = NULL; - session->write_buffer_size = 0; - queue_head = session->response_queue_head; - if(NULL == queue_head->next) - { - session->response_queue_head = NULL; - session->response_queue_tail = NULL; - } - else - { - session->response_queue_head = queue_head->next; - session->response_queue_head->prev = NULL; - } - - //set stream to closed if the frame's fin flag is set - SPDYF_stream_set_flags_on_write(queue_head); - - if(NULL != queue_head->frqcb) - { - //application layer callback to notify sending of the response - queue_head->frqcb(queue_head->frqcb_cls, queue_head, SPDY_RESPONSE_RESULT_SUCCESS); - } - - SPDYF_response_queue_destroy(queue_head); - } - } - - if(SPDY_SESSION_STATUS_FLUSHING == session->status - && NULL == session->response_queue_head) - session->status = SPDY_SESSION_STATUS_CLOSING; - - //return i>0 ? SPDY_YES : SPDY_NO; - return session->fio_after_write(session, i>0 ? SPDY_YES : SPDY_NO); -} - - -int -SPDYF_session_idle (struct SPDY_Session *session) -{ - size_t read_buffer_beginning; - size_t frame_length; - struct SPDYF_Control_Frame* control_frame; - struct SPDYF_Data_Frame *data_frame; - - //prepare session for closing if timeout is used and already passed - if(SPDY_SESSION_STATUS_CLOSING != session->status - && session->daemon->session_timeout - && (session->last_activity + session->daemon->session_timeout < SPDYF_monotonic_time())) - { - session->status = SPDY_SESSION_STATUS_CLOSING; - //best effort for sending GOAWAY - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_OK, true); - SPDYF_session_write(session,true); - } - - switch(session->status) - { - //expect new frame to arrive - case SPDY_SESSION_STATUS_WAIT_FOR_HEADER: - session->current_stream_id = 0; - //check if the whole frame header is already here - //both frame types have the same length - if(session->read_buffer_offset - session->read_buffer_beginning - < sizeof(struct SPDYF_Control_Frame)) - return SPDY_NO; - - /* check the first bit to see if it is data or control frame - * and also if the version is supported */ - if(0x80 == *(uint8_t *)(session->read_buffer + session->read_buffer_beginning) - && SPDY_VERSION == *((uint8_t *)session->read_buffer + session->read_buffer_beginning + 1)) - { - //control frame - if(NULL == (control_frame = malloc(sizeof(struct SPDYF_Control_Frame)))) - { - SPDYF_DEBUG("No memory"); - return SPDY_NO; - } - - //get frame headers - memcpy(control_frame, - session->read_buffer + session->read_buffer_beginning, - sizeof(struct SPDYF_Control_Frame)); - session->read_buffer_beginning += sizeof(struct SPDYF_Control_Frame); - SPDYF_CONTROL_FRAME_NTOH(control_frame); - - session->status = SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER; - //assign different frame handler according to frame type - switch(control_frame->type){ - case SPDY_CONTROL_FRAME_TYPES_SYN_STREAM: - session->frame_handler = &spdyf_handler_read_syn_stream; - break; - case SPDY_CONTROL_FRAME_TYPES_GOAWAY: - session->frame_handler = &spdyf_handler_read_goaway; - break; - case SPDY_CONTROL_FRAME_TYPES_RST_STREAM: - session->frame_handler = &spdyf_handler_read_rst_stream; - break; - default: - session->frame_handler = &SPDYF_handler_ignore_frame; - } - session->frame_handler_cls = control_frame; - //DO NOT break the outer case - } - else if(0 == *(uint8_t *)(session->read_buffer + session->read_buffer_beginning)) - { - //needed for POST - //data frame - if(NULL == (data_frame = malloc(sizeof(struct SPDYF_Data_Frame)))) - { - SPDYF_DEBUG("No memory"); - return SPDY_NO; - } - - //get frame headers - memcpy(data_frame, - session->read_buffer + session->read_buffer_beginning, - sizeof(struct SPDYF_Data_Frame)); - session->read_buffer_beginning += sizeof(struct SPDYF_Data_Frame); - SPDYF_DATA_FRAME_NTOH(data_frame); - - session->status = SPDY_SESSION_STATUS_WAIT_FOR_BODY; - session->frame_handler = &spdyf_handler_read_data; - session->frame_handler_cls = data_frame; - //DO NOT brake the outer case - } - else - { - SPDYF_DEBUG("another protocol or version received!"); - - /* According to the draft the lib should send here - * RST_STREAM with status UNSUPPORTED_VERSION. I don't - * see any sense of keeping the session open since - * we don't know how many bytes is the bogus "frame". - * And the latter normally will be HTTP request. - * - */ - - //shutdown(session->socket_fd, SHUT_RD); - session->status = SPDY_SESSION_STATUS_FLUSHING; - SPDYF_prepare_goaway(session, SPDY_GOAWAY_STATUS_PROTOCOL_ERROR,false); - //SPDYF_session_write(session,false); - /* close connection since the client expects another - protocol from us */ - //SPDYF_session_close(session); - return SPDY_YES; - } - - //expect specific header fields after the standard header - case SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER: - if(NULL!=session->frame_handler) - { - read_buffer_beginning = session->read_buffer_beginning; - //if everything is ok, the "body" will also be processed - //by the handler - session->frame_handler(session); - - if(SPDY_SESSION_STATUS_IGNORE_BYTES == session->status) - { - //check for larger than max supported frame - if(session->frame_handler != &spdyf_handler_read_data) - { - frame_length = ((struct SPDYF_Control_Frame *)session->frame_handler_cls)->length; - } - else - { - frame_length = ((struct SPDYF_Data_Frame *)session->frame_handler_cls)->length; - } - - //if(SPDY_MAX_SUPPORTED_FRAME_SIZE < frame_length) - { - SPDYF_DEBUG("received frame with unsupported size: %zu", frame_length); - //the data being received must be ignored and - //RST_STREAM sent - - //ignore bytes that will arive later - session->read_ignore_bytes = frame_length - + read_buffer_beginning - - session->read_buffer_offset; - //ignore what is already in read buffer - session->read_buffer_beginning = session->read_buffer_offset; - - SPDYF_prepare_rst_stream(session, - session->current_stream_id > 0 ? session->streams_head : NULL, //may be 0 here which is not good - SPDY_RST_STREAM_STATUS_FRAME_TOO_LARGE); - - //actually the read buffer can be bigger than the - //max supported size - session->status = session->read_ignore_bytes - ? SPDY_SESSION_STATUS_IGNORE_BYTES - : SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - - free(session->frame_handler_cls); - } - } - } - - if(SPDY_SESSION_STATUS_IGNORE_BYTES != session->status) - { - break; - } - - //ignoring data in read buffer - case SPDY_SESSION_STATUS_IGNORE_BYTES: - SPDYF_ASSERT(session->read_ignore_bytes > 0, - "Session is in wrong state"); - if(session->read_ignore_bytes - > session->read_buffer_offset - session->read_buffer_beginning) - { - session->read_ignore_bytes -= - session->read_buffer_offset - session->read_buffer_beginning; - session->read_buffer_beginning = session->read_buffer_offset; - } - else - { - session->read_buffer_beginning += session->read_ignore_bytes; - session->read_ignore_bytes = 0; - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - } - break; - - //expect frame body (name/value pairs) - case SPDY_SESSION_STATUS_WAIT_FOR_BODY: - if(NULL!=session->frame_handler) - session->frame_handler(session); - break; - - case SPDY_SESSION_STATUS_FLUSHING: - - return SPDY_NO; - - //because of error the session needs to be closed - case SPDY_SESSION_STATUS_CLOSING: - //error should be already sent to the client - SPDYF_session_close(session); - return SPDY_YES; - } - - return SPDY_YES; -} - - -void -SPDYF_session_close (struct SPDY_Session *session) -{ - struct SPDY_Daemon *daemon = session->daemon; - int by_client = session->read_closed ? SPDY_YES : SPDY_NO; - - //shutdown the tls and deinit the tls context - session->fio_close_session(session); - shutdown (session->socket_fd, - session->read_closed ? SHUT_WR : SHUT_RDWR); - session->read_closed = true; - - //remove session from the list - DLL_remove (daemon->sessions_head, - daemon->sessions_tail, - session); - //add the session for the list for cleaning up - DLL_insert (daemon->cleanup_head, - daemon->cleanup_tail, - session); - - //call callback for closed session - if(NULL != daemon->session_closed_cb) - { - daemon->session_closed_cb(daemon->cls, session, by_client); - } -} - - -int -SPDYF_session_accept(struct SPDY_Daemon *daemon) -{ - int new_socket_fd; - int ret; - struct SPDY_Session *session = NULL; - socklen_t addr_len; - struct sockaddr *addr; - -#if HAVE_INET6 - struct sockaddr_in6 addr6; - - addr = (struct sockaddr *)&addr6; - addr_len = sizeof(addr6); -#else - struct sockaddr_in addr4; - - addr = (struct sockaddr *)&addr4; - addr_len = sizeof(addr6); -#endif - - new_socket_fd = accept (daemon->socket_fd, addr, &addr_len); - - if(new_socket_fd < 1) - return SPDY_NO; - - if (NULL == (session = malloc (sizeof (struct SPDY_Session)))) - { - goto free_and_fail; - } - memset (session, 0, sizeof (struct SPDY_Session)); - - session->daemon = daemon; - session->socket_fd = new_socket_fd; - session->max_num_frames = daemon->max_num_frames; - - ret = SPDYF_io_set_session(session, daemon->io_subsystem); - SPDYF_ASSERT(SPDY_YES == ret, "Somehow daemon->io_subsystem iswrong here"); - - //init TLS context, handshake will be done - if(SPDY_YES != session->fio_new_session(session)) - { - goto free_and_fail; - } - - //read buffer - session->read_buffer_size = SPDYF_BUFFER_SIZE; - if (NULL == (session->read_buffer = malloc (session->read_buffer_size))) - { - session->fio_close_session(session); - goto free_and_fail; - } - - //address of the client - if (NULL == (session->addr = malloc (addr_len))) - { - session->fio_close_session(session); - goto free_and_fail; - } - memcpy (session->addr, addr, addr_len); - - session->addr_len = addr_len; - session->status = SPDY_SESSION_STATUS_WAIT_FOR_HEADER; - - //init zlib context for the whole session - if(SPDY_YES != SPDYF_zlib_deflate_init(&session->zlib_send_stream)) - { - session->fio_close_session(session); - goto free_and_fail; - } - if(SPDY_YES != SPDYF_zlib_inflate_init(&session->zlib_recv_stream)) - { - session->fio_close_session(session); - SPDYF_zlib_deflate_end(&session->zlib_send_stream); - goto free_and_fail; - } - - //add it to daemon's list - DLL_insert(daemon->sessions_head,daemon->sessions_tail,session); - - session->last_activity = SPDYF_monotonic_time(); - - if(NULL != daemon->new_session_cb) - daemon->new_session_cb(daemon->cls, session); - - return SPDY_YES; - - //for GOTO - free_and_fail: - /* something failed, so shutdown, close and free memory */ - shutdown (new_socket_fd, SHUT_RDWR); - (void)MHD_socket_close_ (new_socket_fd); - - if(NULL != session) - { - if(NULL != session->addr) - free (session->addr); - if(NULL != session->read_buffer) - free (session->read_buffer); - free (session); - } - return SPDY_NO; -} - - -void -SPDYF_queue_response (struct SPDYF_Response_Queue *response_to_queue, - struct SPDY_Session *session, - int consider_priority) -{ - struct SPDYF_Response_Queue *pos; - struct SPDYF_Response_Queue *last; - uint8_t priority; - - SPDYF_ASSERT(SPDY_YES != consider_priority || NULL != response_to_queue->stream, - "called with consider_priority but no stream provided"); - - last = response_to_queue; - while(NULL != last->next) - { - last = last->next; - } - - if(SPDY_NO == consider_priority) - { - //put it at the end of the queue - response_to_queue->prev = session->response_queue_tail; - if (NULL == session->response_queue_head) - session->response_queue_head = response_to_queue; - else - session->response_queue_tail->next = response_to_queue; - session->response_queue_tail = last; - return; - } - else if(-1 == consider_priority) - { - //put it at the head of the queue - last->next = session->response_queue_head; - if (NULL == session->response_queue_tail) - session->response_queue_tail = last; - else - session->response_queue_head->prev = response_to_queue; - session->response_queue_head = response_to_queue; - return; - } - - if(NULL == session->response_queue_tail) - { - session->response_queue_head = response_to_queue; - session->response_queue_tail = last; - return; - } - - //search for the right position to put it - pos = session->response_queue_tail; - priority = response_to_queue->stream->priority; - while(NULL != pos - && pos->stream->priority > priority) - { - pos = pos->prev; - } - - if(NULL == pos) - { - //put it on the head - session->response_queue_head->prev = last; - last->next = session->response_queue_head; - session->response_queue_head = response_to_queue; - } - else if(NULL == pos->next) - { - //put it at the end - response_to_queue->prev = pos; - pos->next = response_to_queue; - session->response_queue_tail = last; - } - else - { - response_to_queue->prev = pos; - last->next = pos->next; - pos->next = response_to_queue; - last->next->prev = last; - } -} - - -void -SPDYF_session_destroy(struct SPDY_Session *session) -{ - struct SPDYF_Stream *stream; - struct SPDYF_Response_Queue *response_queue; - - (void)MHD_socket_close_ (session->socket_fd); - SPDYF_zlib_deflate_end(&session->zlib_send_stream); - SPDYF_zlib_inflate_end(&session->zlib_recv_stream); - - //clean up unsent data in the output queue - while (NULL != (response_queue = session->response_queue_head)) - { - DLL_remove (session->response_queue_head, - session->response_queue_tail, - response_queue); - - if(NULL != response_queue->frqcb) - { - response_queue->frqcb(response_queue->frqcb_cls, response_queue, SPDY_RESPONSE_RESULT_SESSION_CLOSED); - } - - SPDYF_response_queue_destroy(response_queue); - } - - //clean up the streams belonging to this session - while (NULL != (stream = session->streams_head)) - { - DLL_remove (session->streams_head, - session->streams_tail, - stream); - - SPDYF_stream_destroy(stream); - } - - free(session->addr); - free(session->read_buffer); - free(session->write_buffer); - free(session); -} - - -int -SPDYF_prepare_goaway (struct SPDY_Session *session, - enum SPDY_GOAWAY_STATUS status, - bool in_front) -{ - struct SPDYF_Response_Queue *response_to_queue; - struct SPDYF_Control_Frame *control_frame; - uint32_t *data; - - if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) - { - return SPDY_NO; - } - memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); - - if(NULL == (control_frame = malloc(sizeof(struct SPDYF_Control_Frame)))) - { - free(response_to_queue); - return SPDY_NO; - } - memset(control_frame, 0, sizeof(struct SPDYF_Control_Frame)); - - if(NULL == (data = malloc(4))) - { - free(control_frame); - free(response_to_queue); - return SPDY_NO; - } - *(data) = htonl(status); - - control_frame->control_bit = 1; - control_frame->version = SPDY_VERSION; - control_frame->type = SPDY_CONTROL_FRAME_TYPES_GOAWAY; - control_frame->flags = 0; - - response_to_queue->control_frame = control_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_goaway; - response_to_queue->data = data; - response_to_queue->data_size = 4; - - SPDYF_queue_response (response_to_queue, - session, - in_front ? -1 : SPDY_NO); - - return SPDY_YES; -} - - -int -SPDYF_prepare_rst_stream (struct SPDY_Session *session, - struct SPDYF_Stream * stream, - enum SPDY_RST_STREAM_STATUS status) -{ - struct SPDYF_Response_Queue *response_to_queue; - struct SPDYF_Control_Frame *control_frame; - uint32_t *data; - uint32_t stream_id; - - if(NULL == stream) - stream_id = 0; - else - stream_id = stream->stream_id; - - if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) - { - return SPDY_NO; - } - memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); - - if(NULL == (control_frame = malloc(sizeof(struct SPDYF_Control_Frame)))) - { - free(response_to_queue); - return SPDY_NO; - } - memset(control_frame, 0, sizeof(struct SPDYF_Control_Frame)); - - if(NULL == (data = malloc(8))) - { - free(control_frame); - free(response_to_queue); - return SPDY_NO; - } - *(data) = HTON31(stream_id); - *(data + 1) = htonl(status); - - control_frame->control_bit = 1; - control_frame->version = SPDY_VERSION; - control_frame->type = SPDY_CONTROL_FRAME_TYPES_RST_STREAM; - control_frame->flags = 0; - - response_to_queue->control_frame = control_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_rst_stream; - response_to_queue->data = data; - response_to_queue->data_size = 8; - response_to_queue->stream = stream; - - SPDYF_queue_response (response_to_queue, - session, - -1); - - return SPDY_YES; -} - - -int -SPDYF_prepare_window_update (struct SPDY_Session *session, - struct SPDYF_Stream * stream, - int32_t delta_window_size) -{ - struct SPDYF_Response_Queue *response_to_queue; - struct SPDYF_Control_Frame *control_frame; - uint32_t *data; - - SPDYF_ASSERT(NULL != stream, "stream cannot be NULL"); - - if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) - { - return SPDY_NO; - } - memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); - - if(NULL == (control_frame = malloc(sizeof(struct SPDYF_Control_Frame)))) - { - free(response_to_queue); - return SPDY_NO; - } - memset(control_frame, 0, sizeof(struct SPDYF_Control_Frame)); - - if(NULL == (data = malloc(8))) - { - free(control_frame); - free(response_to_queue); - return SPDY_NO; - } - *(data) = HTON31(stream->stream_id); - *(data + 1) = HTON31(delta_window_size); - - control_frame->control_bit = 1; - control_frame->version = SPDY_VERSION; - control_frame->type = SPDY_CONTROL_FRAME_TYPES_WINDOW_UPDATE; - control_frame->flags = 0; - - response_to_queue->control_frame = control_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_window_update; - response_to_queue->data = data; - response_to_queue->data_size = 8; - response_to_queue->stream = stream; - - SPDYF_queue_response (response_to_queue, - session, - -1); - - return SPDY_YES; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/session.h libmicrohttpd-0.9.55/src/microspdy/session.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/session.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/session.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,281 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file session.h - * @brief TCP connection/SPDY session handling - * @author Andrey Uzunov - */ - -#ifndef SESSION_H -#define SESSION_H - -#include "platform.h" -#include "structures.h" - -/** - * Called by the daemon when the socket for the session has available - * data to be read. Reads data from the TLS socket and puts it to the - * session's read buffer. The latte - * - * @param session SPDY_Session for which data will be read. - * @return SPDY_YES if something was read or session's status was - * changed. It is possible that error occurred but was handled - * and the status was therefore changed. - * SPDY_NO if nothing happened, e.g. the subsystem wants read/ - * write to be called again. - */ -int -SPDYF_session_read (struct SPDY_Session *session); - - -/** - * Called by the daemon when the socket for the session is ready for some - * data to be written to it. For one or more objects on the response - * queue tries to fill in the write buffer, based on the frame on the - * queue, and to write data to the TLS socket. - * - * @param session SPDY_Session for which data will be written. - * @param only_one_frame when true, the function will write at most one - * SPDY frame to the underlying IO subsystem; - * when false, the function will write up to - * session->max_num_frames SPDY frames - * @return SPDY_YES if the session's internal writing state has changed: - * something was written and/or session's status was - * changed and/or response callback was called but did not provide - * data. It is possible that error occurred but was handled - * and the status was therefore changed. - * SPDY_NO if nothing happened. However, it is possible that some - * frames were discarded within the call, e.g. frames belonging - * to a closed stream. - */ -int -SPDYF_session_write (struct SPDY_Session *session, - bool only_one_frame); - - -/** - * Called by the daemon on SPDY_run to handle the data in the read and write - * buffer of a session. Based on the state and the content of the read - * buffer new frames are received and interpreted, appropriate user - * callbacks are called and maybe something is put on the response queue - * ready to be handled by session_write. - * - * @param session SPDY_Session which will be handled. - * @return SPDY_YES if something from the read buffers was processed, - * session's status was changed and/or the session was closed. - * SPDY_NO if nothing happened, e.g. the session is in a state, - * not allowing processing read buffers. - */ -int -SPDYF_session_idle (struct SPDY_Session *session); - - -/** - * This function shutdowns the socket, moves the session structure to - * daemon's queue for sessions to be cleaned up. - * - * @param session SPDY_Session which will be handled. - */ -void -SPDYF_session_close (struct SPDY_Session *session); - - -/** - * Called to accept new TCP connection and create SPDY session. - * - * @param daemon SPDY_Daemon whose listening socket is used. - * @return SPDY_NO on any kind of error while accepting new TCP connection - * and initializing new SPDY_Session. - * SPDY_YES otherwise. - */ -int -SPDYF_session_accept(struct SPDY_Daemon *daemon); - - -/** - * Puts SPDYF_Response_Queue object on the queue to be sent to the - * client later. - * - * @param response_to_queue linked list of objects containing SPDY - * frame and data to be added to the queue - * @param session SPDY session for which the response is sent - * @param consider_priority if SPDY_NO, the list will be added to the - * end of the queue. - * If SPDY_YES, the response will be added after - * the last previously added response with priority of the - * request grater or equal to that of the current one. - * If -1, the object will be put at the head of the queue. - */ -void -SPDYF_queue_response (struct SPDYF_Response_Queue *response_to_queue, - struct SPDY_Session *session, - int consider_priority); - - -/** - * Cleans up the TSL context for the session, closes the TCP connection, - * cleans up any data pointed by members of the session structure - * (buffers, queue of responses, etc.) and frees the memory allocated by - * the session itself. - */ -void -SPDYF_session_destroy(struct SPDY_Session *session); - - -/** - * Prepares GOAWAY frame to tell the client to stop creating new streams. - * The session should be closed soon after this call. - * - * @param session SPDY session - * @param status code for the GOAWAY frame - * @param in_front whether or not to put the frame in front of everything - * on the response queue - * @return SPDY_NO on error (not enough memory) or - * SPDY_YES on success - */ -int -SPDYF_prepare_goaway (struct SPDY_Session *session, - enum SPDY_GOAWAY_STATUS status, - bool in_front); - - -/** - * Prepares RST_STREAM frame to terminate a stream. This frame may or - * not indicate an error. The frame will be put at the head of the queue. - * This means that frames for this stream which are still in the queue - * will be discarded soon. - * - * @param session SPDY session - * @param stream stream to terminate - * @param status code for the RST_STREAM frame - * @return SPDY_NO on memory error or - * SPDY_YES on success - */ -int -SPDYF_prepare_rst_stream (struct SPDY_Session *session, - struct SPDYF_Stream * stream, - enum SPDY_RST_STREAM_STATUS status); - - -/** - * Prepares WINDOW_UPDATE frame to tell the other party that more - * data can be sent on the stream. The frame will be put at the head of - * the queue. - * - * @param session SPDY session - * @param stream stream to which the changed window will apply - * @param delta_window_size how much the window grows - * @return SPDY_NO on memory error or - * SPDY_YES on success - */ -int -SPDYF_prepare_window_update (struct SPDY_Session *session, - struct SPDYF_Stream * stream, - int32_t delta_window_size); - - -/** - * Handler called by session_write to fill the write buffer according to - * the data frame waiting in the response queue. - * When response data is given by user callback, the lib does not know - * how many frames are needed. In such case this call produces - * another ResponseQueue object and puts it on the queue while the the - * user callback says that there will be more data. - * - * @return SPDY_NO on error (not enough memory or the user calback for - * providing response data did something wrong). If - * the error is unrecoverable the handler changes session's - * status. - * SPDY_YES on success - */ -int -SPDYF_handler_write_data (struct SPDY_Session *session); - - -/** - * Handler called by session_write to fill the write buffer based on the - * control frame (SYN_REPLY) waiting in the response queue. - * - * @param session SPDY session - * @return SPDY_NO on error (zlib state is broken; the session MUST be - * closed). If - * the error is unrecoverable the handler changes session's - * status. - * SPDY_YES on success - */ -int -SPDYF_handler_write_syn_reply (struct SPDY_Session *session); - - -/** - * Handler called by session_write to fill the write buffer based on the - * control frame (GOAWAY) waiting in the response queue. - * - * @param session SPDY session - * @return SPDY_NO on error (not enough memory; by specification the - * session must be closed - * soon, thus there is no need to handle the error) or - * SPDY_YES on success - */ -int -SPDYF_handler_write_goaway (struct SPDY_Session *session); - - -/** - * Handler called by session_write to fill the write buffer based on the - * control frame (RST_STREAM) waiting in the response queue. - * - * @param session SPDY session - * @return SPDY_NO on error (not enough memory). If - * the error is unrecoverable the handler changes session's - * status. - * SPDY_YES on success - */ -int -SPDYF_handler_write_rst_stream (struct SPDY_Session *session); - - -/** - * Handler called by session_write to fill the write buffer based on the - * control frame (WINDOW_UPDATE) waiting in the response queue. - * - * @param session SPDY session - * @return SPDY_NO on error (not enough memory). If - * the error is unrecoverable the handler changes session's - * status. - * SPDY_YES on success - */ -int -SPDYF_handler_write_window_update (struct SPDY_Session *session); - - -/** - * Carefully ignore the full size of frames which are not yet supported - * by the lib. - * TODO Ignoring frames containing compressed bodies means that the - * compress state will be corrupted on next received frame. According to - * the draft the lib SHOULD try to decompress data also in corrupted - * frames just to keep right compression state. - * - * @param session SPDY_Session whose read buffer is used. - */ -void -SPDYF_handler_ignore_frame (struct SPDY_Session *session); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/stream.c libmicrohttpd-0.9.55/src/microspdy/stream.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/stream.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/stream.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,169 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file stream.c - * @brief SPDY streams handling - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "session.h" - - -int -SPDYF_stream_new (struct SPDY_Session *session) -{ - uint32_t stream_id; - uint32_t assoc_stream_id; - uint8_t priority; - uint8_t slot; - size_t buffer_pos = session->read_buffer_beginning; - struct SPDYF_Stream *stream; - struct SPDYF_Control_Frame *frame; - - if((session->read_buffer_offset - session->read_buffer_beginning) < 10) - { - //not all fields are received to create new stream - return SPDY_NO; - } - - frame = (struct SPDYF_Control_Frame *)session->frame_handler_cls; - - //get stream id of the new stream - memcpy(&stream_id, session->read_buffer + session->read_buffer_beginning, 4); - stream_id = NTOH31(stream_id); - session->read_buffer_beginning += 4; - if(stream_id <= session->last_in_stream_id || 0==(stream_id % 2)) - { - //wrong stream id sent by client - //GOAWAY with PROTOCOL_ERROR MUST be sent - //TODO - - //ignore frame - session->frame_handler = &SPDYF_handler_ignore_frame; - return SPDY_NO; - } - else if(session->is_goaway_sent) - { - //the client is not allowed to create new streams anymore - //we MUST ignore the frame - session->frame_handler = &SPDYF_handler_ignore_frame; - return SPDY_NO; - } - - //set highest stream id for session - session->last_in_stream_id = stream_id; - - //get assoc stream id of the new stream - //this value is used with SPDY PUSH, thus nothing to do with it here - memcpy(&assoc_stream_id, session->read_buffer + session->read_buffer_beginning, 4); - assoc_stream_id = NTOH31(assoc_stream_id); - session->read_buffer_beginning += 4; - - //get stream priority (3 bits) - //after it there are 5 bits that are not used - priority = *(uint8_t *)(session->read_buffer + session->read_buffer_beginning) >> 5; - session->read_buffer_beginning++; - - //get slot (see SPDY draft) - slot = *(uint8_t *)(session->read_buffer + session->read_buffer_beginning); - session->read_buffer_beginning++; - - if(NULL == (stream = malloc(sizeof(struct SPDYF_Stream)))) - { - SPDYF_DEBUG("No memory"); - //revert buffer state - session->read_buffer_beginning = buffer_pos; - return SPDY_NO; - } - memset(stream,0, sizeof(struct SPDYF_Stream)); - stream->session = session; - stream->stream_id = stream_id; - stream->assoc_stream_id = assoc_stream_id; - stream->priority = priority; - stream->slot = slot; - stream->is_in_closed = (frame->flags & SPDY_SYN_STREAM_FLAG_FIN) != 0; - stream->flag_unidirectional = (frame->flags & SPDY_SYN_STREAM_FLAG_UNIDIRECTIONAL) != 0; - stream->is_out_closed = stream->flag_unidirectional; - stream->is_server_initiator = false; - stream->window_size = SPDYF_INITIAL_WINDOW_SIZE; - - //put the stream to the list of streams for the session - DLL_insert(session->streams_head, session->streams_tail, stream); - - return SPDY_YES; -} - - -void -SPDYF_stream_destroy(struct SPDYF_Stream *stream) -{ - SPDY_name_value_destroy(stream->headers); - free(stream); - stream = NULL; -} - - -void -SPDYF_stream_set_flags_on_write(struct SPDYF_Response_Queue *response_queue) -{ - struct SPDYF_Stream * stream = response_queue->stream; - - if(NULL != response_queue->data_frame) - { - stream->is_out_closed = (bool)(response_queue->data_frame->flags & SPDY_DATA_FLAG_FIN); - } - else if(NULL != response_queue->control_frame) - { - switch(response_queue->control_frame->type) - { - case SPDY_CONTROL_FRAME_TYPES_SYN_REPLY: - stream->is_out_closed = (bool)(response_queue->control_frame->flags & SPDY_SYN_REPLY_FLAG_FIN); - break; - - case SPDY_CONTROL_FRAME_TYPES_RST_STREAM: - if(NULL != stream) - { - stream->is_out_closed = true; - stream->is_in_closed = true; - } - break; - - } - } -} - - -//TODO add function *on_read - - -struct SPDYF_Stream * -SPDYF_stream_find(uint32_t stream_id, struct SPDY_Session * session) -{ - struct SPDYF_Stream * stream = session->streams_head; - - while(NULL != stream && stream_id != stream->stream_id) - { - stream = stream->next; - } - - return stream; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/stream.h libmicrohttpd-0.9.55/src/microspdy/stream.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/stream.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/stream.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file stream.h - * @brief SPDY streams handling - * @author Andrey Uzunov - */ - -#ifndef STREAM_H -#define STREAM_H - -#include "platform.h" - - -/** - * Reads data from session's read buffer and tries to create a new SPDY - * stream. This function is called after control frame's header has been - * read from the buffer (after the length field). If bogus frame is - * received the function changes the read handler of the session and - * fails, i.e. there is no need of further error handling by the caller. - * - * @param session SPDY_Session whose read buffer is being read - * @return SPDY_YES if a new SPDY stream request was correctly received - * and handled. SPDY_NO if the whole SPDY frame was not yet - * received or memory error occurred. - */ -int -SPDYF_stream_new (struct SPDY_Session *session); - - -/** - * Destroys stream structure and whatever is in it. - * - * @param stream SPDY_Stream to destroy - */ -void -SPDYF_stream_destroy(struct SPDYF_Stream *stream); - - -/** - * Set stream flags if needed based on the type of the frame that was - * just sent (e.g., close stream if it was RST_STREAM). - * - * @param response_queue sent for this stream - */ -void -SPDYF_stream_set_flags_on_write(struct SPDYF_Response_Queue *response_queue); - - -/** - * Find and return a session's stream, based on stream's ID. - * - * @param stream_id to search for - * @param session whose streams are considered - * @return SPDY_Stream with the desired ID. Can be NULL. - */ -struct SPDYF_Stream * -SPDYF_stream_find(uint32_t stream_id, struct SPDY_Session * session); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/structures.c libmicrohttpd-0.9.55/src/microspdy/structures.c --- libmicrohttpd-0.9.44+dfsg/src/microspdy/structures.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/structures.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,638 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file structures.c - * @brief Functions for handling most of the structures in defined - * in structures.h - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "structures.h" -#include "internal.h" -#include "session.h" -//TODO not for here? -#include - - -int -SPDYF_name_value_is_empty(struct SPDY_NameValue *container) -{ - SPDYF_ASSERT(NULL != container, "NULL is not an empty container!"); - return (NULL == container->name && NULL == container->value) ? SPDY_YES : SPDY_NO; -} - -struct SPDY_NameValue * -SPDY_name_value_create () -{ - struct SPDY_NameValue *pair; - - if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) - return NULL; - - memset (pair, 0, sizeof (struct SPDY_NameValue)); - - return pair; -} - - -int -SPDY_name_value_add (struct SPDY_NameValue *container, - const char *name, - const char *value) -{ - unsigned int i; - unsigned int len; - struct SPDY_NameValue *pair; - struct SPDY_NameValue *temp; - char **temp_value; - char *temp_string; - - if(NULL == container || NULL == name || NULL == value || 0 == (len = strlen(name))) - return SPDY_INPUT_ERROR; - //TODO there is old code handling value==NULL - //update it to handle strlen(value)==0 - - for(i=0; iname = strdup (name))) - { - return SPDY_NO; - } - if (NULL == (container->value = malloc(sizeof(char *)))) - { - free(container->name); - return SPDY_NO; - } - /*if(NULL == value) - container->value[0] = NULL; - else */if (NULL == (container->value[0] = strdup (value))) - { - free(container->value); - free(container->name); - return SPDY_NO; - } - container->num_values = 1; - return SPDY_YES; - } - - pair = container; - while(NULL != pair) - { - if(0 == strcmp(pair->name, name)) - { - //the value will be added to this pair - break; - } - pair = pair->next; - } - - if(NULL == pair) - { - //the name doesn't exist in container, add new pair - if(NULL == (pair = malloc(sizeof(struct SPDY_NameValue)))) - return SPDY_NO; - - memset(pair, 0, sizeof(struct SPDY_NameValue)); - - if (NULL == (pair->name = strdup (name))) - { - free(pair); - return SPDY_NO; - } - if (NULL == (pair->value = malloc(sizeof(char *)))) - { - free(pair->name); - free(pair); - return SPDY_NO; - } - /*if(NULL == value) - pair->value[0] = NULL; - else */if (NULL == (pair->value[0] = strdup (value))) - { - free(pair->value); - free(pair->name); - free(pair); - return SPDY_NO; - } - pair->num_values = 1; - - temp = container; - while(NULL != temp->next) - temp = temp->next; - temp->next = pair; - pair->prev = temp; - - return SPDY_YES; - } - - //check for duplication (case sensitive) - for(i=0; inum_values; ++i) - if(0 == strcmp(pair->value[i], value)) - return SPDY_NO; - - if(strlen(pair->value[0]) > 0) - { - //the value will be appended to the others for this name - if (NULL == (temp_value = malloc((pair->num_values + 1) * sizeof(char *)))) - { - return SPDY_NO; - } - memcpy(temp_value, pair->value, pair->num_values * sizeof(char *)); - if (NULL == (temp_value[pair->num_values] = strdup (value))) - { - free(temp_value); - return SPDY_NO; - } - free(pair->value); - pair->value = temp_value; - ++pair->num_values; - return SPDY_YES; - } - - //just replace the empty value - - if (NULL == (temp_string = strdup (value))) - { - return SPDY_NO; - } - free(pair->value[0]); - pair->value[0] = temp_string; - - return SPDY_YES; -} - - -const char * const * -SPDY_name_value_lookup (struct SPDY_NameValue *container, - const char *name, - int *num_values) -{ - struct SPDY_NameValue *temp = container; - - if(NULL == container || NULL == name || NULL == num_values) - return NULL; - if(SPDYF_name_value_is_empty(container)) - return NULL; - - do - { - if(strcmp(name, temp->name) == 0) - { - *num_values = temp->num_values; - return (const char * const *)temp->value; - } - - temp = temp->next; - } - while(NULL != temp); - - return NULL; -} - - -void -SPDY_name_value_destroy (struct SPDY_NameValue *container) -{ - unsigned int i; - struct SPDY_NameValue *temp = container; - - while(NULL != temp) - { - container = container->next; - free(temp->name); - for(i=0; inum_values; ++i) - free(temp->value[i]); - free(temp->value); - free(temp); - temp=container; - } -} - - -int -SPDY_name_value_iterate (struct SPDY_NameValue *container, - SPDY_NameValueIterator iterator, - void *iterator_cls) -{ - int count; - int ret; - struct SPDY_NameValue *temp = container; - - if(NULL == container) - return SPDY_INPUT_ERROR; - - //check if container is an empty struct - if(SPDYF_name_value_is_empty(container)) - return 0; - - count = 0; - - if(NULL == iterator) - { - do - { - ++count; - temp=temp->next; - } - while(NULL != temp); - - return count; - } - - //code duplication for avoiding if here - do - { - ++count; - ret = iterator(iterator_cls, temp->name, (const char * const *)temp->value, temp->num_values); - temp=temp->next; - } - while(NULL != temp && SPDY_YES == ret); - - return count; -} - -void -SPDY_destroy_response(struct SPDY_Response *response) -{ - if(NULL == response) - return; - free(response->data); - free(response->headers); - free(response); -} - - -struct SPDYF_Response_Queue * -SPDYF_response_queue_create(bool is_data, - void *data, - size_t data_size, - struct SPDY_Response *response, - struct SPDYF_Stream *stream, - bool closestream, - SPDYF_ResponseQueueResultCallback frqcb, - void *frqcb_cls, - SPDY_ResponseResultCallback rrcb, - void *rrcb_cls) -{ - struct SPDYF_Response_Queue *head = NULL; - struct SPDYF_Response_Queue *prev; - struct SPDYF_Response_Queue *response_to_queue; - struct SPDYF_Control_Frame *control_frame; - struct SPDYF_Data_Frame *data_frame; - unsigned int i; - bool is_last; - - SPDYF_ASSERT((! is_data) - || ((0 == data_size) && (NULL != response->rcb)) - || ((0 < data_size) && (NULL == response->rcb)), - "either data or request->rcb must not be null"); - - if (is_data && (data_size > SPDY_MAX_SUPPORTED_FRAME_SIZE)) - { - //separate the data in more frames and add them to the queue - - prev=NULL; - for(i = 0; i < data_size; i += SPDY_MAX_SUPPORTED_FRAME_SIZE) - { - is_last = (i + SPDY_MAX_SUPPORTED_FRAME_SIZE) >= data_size; - - if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) - goto free_and_fail; - - memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); - if(0 == i) - head = response_to_queue; - - if(NULL == (data_frame = malloc(sizeof(struct SPDYF_Data_Frame)))) - { - free(response_to_queue); - goto free_and_fail; - } - memset(data_frame, 0, sizeof(struct SPDYF_Data_Frame)); - data_frame->control_bit = 0; - data_frame->stream_id = stream->stream_id; - if(is_last && closestream) - data_frame->flags |= SPDY_DATA_FLAG_FIN; - - response_to_queue->data_frame = data_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_data; - response_to_queue->is_data = is_data; - response_to_queue->stream = stream; - if(is_last) - { - response_to_queue->frqcb = frqcb; - response_to_queue->frqcb_cls = frqcb_cls; - response_to_queue->rrcb = rrcb; - response_to_queue->rrcb_cls = rrcb_cls; - } - response_to_queue->data = data + i; - response_to_queue->data_size = is_last - ? (data_size - 1) % SPDY_MAX_SUPPORTED_FRAME_SIZE + 1 - : SPDY_MAX_SUPPORTED_FRAME_SIZE; - response_to_queue->response = response; - - response_to_queue->prev = prev; - if(NULL != prev) - prev->next = response_to_queue; - prev = response_to_queue; - } - - return head; - - //for GOTO - free_and_fail: - while(NULL != head) - { - response_to_queue = head; - head = head->next; - free(response_to_queue->data_frame); - free(response_to_queue); - } - return NULL; - } - - //create only one frame for data, data with callback or control frame - - if(NULL == (response_to_queue = malloc(sizeof(struct SPDYF_Response_Queue)))) - { - return NULL; - } - memset(response_to_queue, 0, sizeof(struct SPDYF_Response_Queue)); - - if(is_data) - { - if(NULL == (data_frame = malloc(sizeof(struct SPDYF_Data_Frame)))) - { - free(response_to_queue); - return NULL; - } - memset(data_frame, 0, sizeof(struct SPDYF_Data_Frame)); - data_frame->control_bit = 0; - data_frame->stream_id = stream->stream_id; - if(closestream && NULL == response->rcb) - data_frame->flags |= SPDY_DATA_FLAG_FIN; - - response_to_queue->data_frame = data_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_data; - } - else - { - if(NULL == (control_frame = malloc(sizeof(struct SPDYF_Control_Frame)))) - { - free(response_to_queue); - return NULL; - } - memset(control_frame, 0, sizeof(struct SPDYF_Control_Frame)); - control_frame->control_bit = 1; - control_frame->version = SPDY_VERSION; - control_frame->type = SPDY_CONTROL_FRAME_TYPES_SYN_REPLY; - if(closestream) - control_frame->flags |= SPDY_SYN_REPLY_FLAG_FIN; - - response_to_queue->control_frame = control_frame; - response_to_queue->process_response_handler = &SPDYF_handler_write_syn_reply; - } - - response_to_queue->is_data = is_data; - response_to_queue->stream = stream; - response_to_queue->frqcb = frqcb; - response_to_queue->frqcb_cls = frqcb_cls; - response_to_queue->rrcb = rrcb; - response_to_queue->rrcb_cls = rrcb_cls; - response_to_queue->data = data; - response_to_queue->data_size = data_size; - response_to_queue->response = response; - - return response_to_queue; -} - - -void -SPDYF_response_queue_destroy(struct SPDYF_Response_Queue *response_queue) -{ - //data is not copied to the struct but only linked - //but this is not valid for GOAWAY and RST_STREAM - if(!response_queue->is_data - && (SPDY_CONTROL_FRAME_TYPES_RST_STREAM == response_queue->control_frame->type - || SPDY_CONTROL_FRAME_TYPES_GOAWAY == response_queue->control_frame->type)) - { - free(response_queue->data); - } - if(response_queue->is_data) - free(response_queue->data_frame); - else - free(response_queue->control_frame); - - free(response_queue); -} - - -/* Needed by testcase to be extern -- should this be - in the header? */ -_MHD_EXTERN ssize_t -SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], - int num_containers, - void **stream) -{ - size_t size; - int32_t num_pairs = 0; - int32_t value_size; - int32_t name_size; - int32_t temp; - unsigned int i; - unsigned int offset; - unsigned int value_offset; - struct SPDY_NameValue * iterator; - int j; - - size = 4; //for num pairs - - for(j=0; jname); //length + string - - SPDYF_ASSERT(iterator->num_values>0, "num_values is 0"); - - size += 4; //value length - - for(i=0; inum_values; ++i) - { - //if(NULL == iterator->value[i]) - // continue; - size += strlen(iterator->value[i]); // string - if(i/* || !strlen(iterator->value[i])*/) ++size; //NULL separator - } - - iterator = iterator->next; - } - } - - if(NULL == (*stream = malloc(size))) - { - return -1; - } - - //put num_pairs to the stream - num_pairs = htonl(num_pairs); - memcpy(*stream, &num_pairs, 4); - offset = 4; - - //put all other headers to the stream - for(j=0; jname); - temp = htonl(name_size); - memcpy(*stream + offset, &temp, 4); - offset += 4; - strncpy(*stream + offset, iterator->name, name_size); - offset += name_size; - - value_offset = offset; - offset += 4; - for(i=0; inum_values; ++i) - { - if(i /*|| !strlen(iterator->value[0])*/) - { - memset(*stream + offset, 0, 1); - ++offset; - //if(!i) continue; - } - //else if(NULL != iterator->value[i]) - //{ - strncpy(*stream + offset, iterator->value[i], strlen(iterator->value[i])); - offset += strlen(iterator->value[i]); - //} - } - value_size = offset - value_offset - 4; - value_size = htonl(value_size); - memcpy(*stream + value_offset, &value_size, 4); - - iterator = iterator->next; - } - } - - SPDYF_ASSERT(offset == size,"offset is wrong"); - - return size; -} - - -/* Needed by testcase to be extern -- should this be - in the header? */ -_MHD_EXTERN int -SPDYF_name_value_from_stream(void *stream, - size_t size, - struct SPDY_NameValue ** container) -{ - int32_t num_pairs; - int32_t value_size; - int32_t name_size; - int i; - unsigned int offset = 0; - unsigned int value_end_offset; - char *name; - char *value; - - if(NULL == (*container = SPDY_name_value_create ())) - { - return SPDY_NO; - } - - //get number of pairs - memcpy(&num_pairs, stream, 4); - offset = 4; - num_pairs = ntohl(num_pairs); - - if(num_pairs > 0) - { - for(i = 0; i < num_pairs; ++i) - { - //get name size - memcpy(&name_size, stream + offset, 4); - offset += 4; - name_size = ntohl(name_size); - //get name - if(NULL == (name = strndup(stream + offset, name_size))) - { - SPDY_name_value_destroy(*container); - return SPDY_NO; - } - offset+=name_size; - - //get value size - memcpy(&value_size, stream + offset, 4); - offset += 4; - value_size = ntohl(value_size); - value_end_offset = offset + value_size; - //get value - do - { - if(NULL == (value = strndup(stream + offset, value_size))) - { - free(name); - SPDY_name_value_destroy(*container); - return SPDY_NO; - } - offset += strlen(value); - if(offset < value_end_offset) - ++offset; //NULL separator - - //add name/value to the struct - if(SPDY_YES != SPDY_name_value_add(*container, name, value)) - { - free(name); - free(value); - SPDY_name_value_destroy(*container); - return SPDY_NO; - } - free(value); - } - while(offset < value_end_offset); - - free(name); - - if(offset != value_end_offset) - { - SPDY_name_value_destroy(*container); - return SPDY_INPUT_ERROR; - } - } - } - - if(offset == size) - return SPDY_YES; - - SPDY_name_value_destroy(*container); - return SPDY_INPUT_ERROR; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/microspdy/structures.h libmicrohttpd-0.9.55/src/microspdy/structures.h --- libmicrohttpd-0.9.44+dfsg/src/microspdy/structures.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/microspdy/structures.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,1246 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file structures.h - * @brief internal and public structures -- most of the structs used by - * the library are defined here - * @author Andrey Uzunov - */ - -#ifndef STRUCTURES_H -#define STRUCTURES_H - -#include "platform.h" -#include "microspdy.h" -#include "io.h" - - -/** - * All possible SPDY control frame types. The number is used in the header - * of the control frame. - */ -enum SPDY_CONTROL_FRAME_TYPES -{ - /** - * The SYN_STREAM control frame allows the sender to asynchronously - * create a stream between the endpoints. - */ - SPDY_CONTROL_FRAME_TYPES_SYN_STREAM = 1, - - /** - * SYN_REPLY indicates the acceptance of a stream creation by - * the recipient of a SYN_STREAM frame. - */ - SPDY_CONTROL_FRAME_TYPES_SYN_REPLY = 2, - - /** - * The RST_STREAM frame allows for abnormal termination of a stream. - * When sent by the creator of a stream, it indicates the creator - * wishes to cancel the stream. When sent by the recipient of a - * stream, it indicates an error or that the recipient did not want - * to accept the stream, so the stream should be closed. - */ - SPDY_CONTROL_FRAME_TYPES_RST_STREAM = 3, - - /** - * A SETTINGS frame contains a set of id/value pairs for - * communicating configuration data about how the two endpoints may - * communicate. SETTINGS frames can be sent at any time by either - * endpoint, are optionally sent, and are fully asynchronous. When - * the server is the sender, the sender can request that - * configuration data be persisted by the client across SPDY - * sessions and returned to the server in future communications. - */ - SPDY_CONTROL_FRAME_TYPES_SETTINGS = 4, - - /** - * The PING control frame is a mechanism for measuring a minimal - * round-trip time from the sender. It can be sent from the client - * or the server. Recipients of a PING frame should send an - * identical frame to the sender as soon as possible (if there is - * other pending data waiting to be sent, PING should take highest - * priority). Each ping sent by a sender should use a unique ID. - */ - SPDY_CONTROL_FRAME_TYPES_PING = 6, - - /** - * The GOAWAY control frame is a mechanism to tell the remote side - * of the connection to stop creating streams on this session. It - * can be sent from the client or the server. - */ - SPDY_CONTROL_FRAME_TYPES_GOAWAY = 7, - - /** - * The HEADERS frame augments a stream with additional headers. It - * may be optionally sent on an existing stream at any time. - * Specific application of the headers in this frame is - * application-dependent. The name/value header block within this - * frame is compressed. - */ - SPDY_CONTROL_FRAME_TYPES_HEADERS = 8, - - /** - * The WINDOW_UPDATE control frame is used to implement per stream - * flow control in SPDY. Flow control in SPDY is per hop, that is, - * only between the two endpoints of a SPDY connection. If there are - * one or more intermediaries between the client and the origin - * server, flow control signals are not explicitly forwarded by the - * intermediaries. - */ - SPDY_CONTROL_FRAME_TYPES_WINDOW_UPDATE = 9, - - /** - * The CREDENTIAL control frame is used by the client to send - * additional client certificates to the server. A SPDY client may - * decide to send requests for resources from different origins on - * the same SPDY session if it decides that that server handles both - * origins. For example if the IP address associated with both - * hostnames matches and the SSL server certificate presented in the - * initial handshake is valid for both hostnames. However, because - * the SSL connection can contain at most one client certificate, - * the client needs a mechanism to send additional client - * certificates to the server. - */ - SPDY_CONTROL_FRAME_TYPES_CREDENTIAL = 11 -}; - - -/** - * SPDY_SESSION_STATUS is used to show the current receiving state - * of each session, i.e. what is expected to come now, and how it should - * be handled. - */ -enum SPDY_SESSION_STATUS -{ - /** - * The session is in closing state, do not read read anything from - * it. Do not write anything to it. - */ - SPDY_SESSION_STATUS_CLOSING = 0, - - /** - * Wait for new SPDY frame to come. - */ - SPDY_SESSION_STATUS_WAIT_FOR_HEADER = 1, - - /** - * The standard 8 byte header of the SPDY frame was received and - * handled. Wait for the specific (sub)headers according to the - * frame type. - */ - SPDY_SESSION_STATUS_WAIT_FOR_SUBHEADER = 2, - - /** - * The specific (sub)headers were received and handled. Wait for the - * "body", i.e. wait for the name/value pairs compressed by zlib. - */ - SPDY_SESSION_STATUS_WAIT_FOR_BODY = 3, - - /** - * Ignore all the bytes read from the socket, e.g. larger frames. - */ - SPDY_SESSION_STATUS_IGNORE_BYTES= 4, - - /** - * The session is in pre-closing state, do not read read anything - * from it. In this state the output queue will be written to the - * socket. - */ - SPDY_SESSION_STATUS_FLUSHING = 5, -}; - - -/** - * Specific flags for the SYN_STREAM control frame. - */ -enum SPDY_SYN_STREAM_FLAG -{ - /** - * The sender won't send any more frames on this stream. - */ - SPDY_SYN_STREAM_FLAG_FIN = 1, - - /** - * The sender creates this stream as unidirectional. - */ - SPDY_SYN_STREAM_FLAG_UNIDIRECTIONAL = 2 -}; - - -/** - * Specific flags for the SYN_REPLY control frame. - */ -enum SPDY_SYN_REPLY_FLAG -{ - /** - * The sender won't send any more frames on this stream. - */ - SPDY_SYN_REPLY_FLAG_FIN = 1 -}; - - -/** - * Specific flags for the data frame. - */ -enum SPDY_DATA_FLAG -{ - /** - * The sender won't send any more frames on this stream. - */ - SPDY_DATA_FLAG_FIN = 1, - - /** - * The data in the frame is compressed. - * This flag appears only in the draft on ietf.org but not on - * chromium.org. - */ - SPDY_DATA_FLAG_COMPRESS = 2 -}; - -/** - * Status code within RST_STREAM control frame. - */ -enum SPDY_RST_STREAM_STATUS -{ - /** - * This is a generic error, and should only be used if a more - * specific error is not available. - */ - SPDY_RST_STREAM_STATUS_PROTOCOL_ERROR = 1, - - /** - * This is returned when a frame is received for a stream which is - * not active. - */ - SPDY_RST_STREAM_STATUS_INVALID_STREAM = 2, - - /** - * Indicates that the stream was refused before any processing has - * been done on the stream. - */ - SPDY_RST_STREAM_STATUS_REFUSED_STREAM = 3, - - /** - * Indicates that the recipient of a stream does not support the - * SPDY version requested. - */ - SPDY_RST_STREAM_STATUS_UNSUPPORTED_VERSION = 4, - - /** - * Used by the creator of a stream to indicate that the stream is - * no longer needed. - */ - SPDY_RST_STREAM_STATUS_CANCEL = 5, - - /** - * This is a generic error which can be used when the implementation - * has internally failed, not due to anything in the protocol. - */ - SPDY_RST_STREAM_STATUS_INTERNAL_ERROR = 6, - - /** - * The endpoint detected that its peer violated the flow control - * protocol. - */ - SPDY_RST_STREAM_STATUS_FLOW_CONTROL_ERROR = 7, - - /** - * The endpoint received a SYN_REPLY for a stream already open. - */ - SPDY_RST_STREAM_STATUS_STREAM_IN_USE = 8, - - /** - * The endpoint received a data or SYN_REPLY frame for a stream - * which is half closed. - */ - SPDY_RST_STREAM_STATUS_STREAM_ALREADY_CLOSED = 9, - - /** - * The server received a request for a resource whose origin does - * not have valid credentials in the client certificate vector. - */ - SPDY_RST_STREAM_STATUS_INVALID_CREDENTIALS = 10, - - /** - * The endpoint received a frame which this implementation could not - * support. If FRAME_TOO_LARGE is sent for a SYN_STREAM, HEADERS, - * or SYN_REPLY frame without fully processing the compressed - * portion of those frames, then the compression state will be - * out-of-sync with the other endpoint. In this case, senders of - * FRAME_TOO_LARGE MUST close the session. - */ - SPDY_RST_STREAM_STATUS_FRAME_TOO_LARGE = 11 -}; - - -/** - * Status code within GOAWAY control frame. - */ -enum SPDY_GOAWAY_STATUS -{ - /** - * This is a normal session teardown. - */ - SPDY_GOAWAY_STATUS_OK = 0, - - /** - * This is a generic error, and should only be used if a more - * specific error is not available. - */ - SPDY_GOAWAY_STATUS_PROTOCOL_ERROR = 1, - - /** - * This is a generic error which can be used when the implementation - * has internally failed, not due to anything in the protocol. - */ - SPDY_GOAWAY_STATUS_INTERNAL_ERROR = 11 -}; - - -struct SPDYF_Stream; - -struct SPDYF_Response_Queue; - - -/** - * Callback for received new data chunk. - * - * @param cls client-defined closure - * @param stream handler - * @param buf data chunk from the data - * @param size the size of the data chunk 'buf' in bytes - * @param more false if this is the last frame received on this stream. Note: - * true does not mean that more data will come, exceptional - * situation is possible - * @return SPDY_YES to continue calling the function, - * SPDY_NO to stop calling the function for this stream - */ -typedef int -(*SPDYF_NewDataCallback) (void * cls, - struct SPDYF_Stream *stream, - const void * buf, - size_t size, - bool more); - - -/** - * Callback for new stream. To be used in the application layer of the - * lib. - * - * @param cls - * @param stream the new stream - * @return SPDY_YES on success, - * SPDY_NO if error occurs - */ -typedef int -(*SPDYF_NewStreamCallback) (void *cls, - struct SPDYF_Stream * stream); - - -/** - * Callback to be called when the response queue object was handled and - * the data was already sent. - * - * @param cls - * @param response_queue the SPDYF_Response_Queue structure which will - * be cleaned very soon - * @param status shows if actually the response was sent or it was - * discarded by the lib for any reason (e.g., closing session, - * closing stream, stopping daemon, etc.). It is possible that - * status indicates an error but part of the response (in one - * or several frames) was sent to the client. - */ -typedef void -(*SPDYF_ResponseQueueResultCallback) (void * cls, - struct SPDYF_Response_Queue *response_queue, - enum SPDY_RESPONSE_RESULT status); - - -/** - * Representation of the control frame's headers, which are common for - * all types. - */ -struct __attribute__((__packed__)) SPDYF_Control_Frame -{ - uint16_t version : 15; - uint16_t control_bit : 1; /* always 1 for control frames */ - uint16_t type; - uint32_t flags : 8; - uint32_t length : 24; -}; - - -/** - * Representation of the data frame's headers. - */ -struct __attribute__((__packed__)) SPDYF_Data_Frame -{ - uint32_t stream_id : 31; - uint32_t control_bit : 1; /* always 0 for data frames */ - uint32_t flags : 8; - uint32_t length : 24; -}; - - -/** - * Queue of the responses, to be handled (e.g. compressed) and sent later. - */ -struct SPDYF_Response_Queue -{ - /** - * This is a doubly-linked list. - */ - struct SPDYF_Response_Queue *next; - - /** - * This is a doubly-linked list. - */ - struct SPDYF_Response_Queue *prev; - - /** - * Stream (Request) for which is the response. - */ - struct SPDYF_Stream *stream; - - /** - * Response structure with all the data (uncompressed headers) to be sent. - */ - struct SPDY_Response *response; - - /** - * Control frame. The length field should be set after compressing - * the headers! - */ - struct SPDYF_Control_Frame *control_frame; - - /** - * Data frame. The length field should be set after compressing - * the body! - */ - struct SPDYF_Data_Frame *data_frame; - - /** - * Data to be sent: name/value pairs in control frames or body in data frames. - */ - void *data; - - /** - * Specific handler for different frame types. - */ - int (* process_response_handler)(struct SPDY_Session *session); - - /** - * Callback to be called when the last bytes from the response was sent - * to the client. - */ - SPDYF_ResponseQueueResultCallback frqcb; - - /** - * Closure for frqcb. - */ - void *frqcb_cls; - - /** - * Callback to be used by the application layer. - */ - SPDY_ResponseResultCallback rrcb; - - /** - * Closure for rcb. - */ - void *rrcb_cls; - - /** - * Data size. - */ - size_t data_size; - - /** - * True if data frame should be sent. False if control frame should - * be sent. - */ - bool is_data; -}; - - - -/** - * Collection of HTTP headers used in requests and responses. - */ -struct SPDY_NameValue -{ - /** - * This is a doubly-linked list. - */ - struct SPDY_NameValue *next; - - /** - * This is a doubly-linked list. - */ - struct SPDY_NameValue *prev; - - /** - * Null terminated string for name. - */ - char *name; - - /** - * Array of Null terminated strings for value. num_values is the - * length of the array. - */ - char **value; - - /** - * Number of values, this is >= 0. - */ - unsigned int num_values; -}; - - -/** - * Represents a SPDY stream - */ -struct SPDYF_Stream -{ - /** - * This is a doubly-linked list. - */ - struct SPDYF_Stream *next; - - /** - * This is a doubly-linked list. - */ - struct SPDYF_Stream *prev; - - /** - * Reference to the SPDY_Session struct. - */ - struct SPDY_Session *session; - - /** - * Name value pairs, sent within the frame which created the stream. - */ - struct SPDY_NameValue *headers; - - /** - * Any object to be used by the application layer. - */ - void *cls; - - /** - * This stream's ID. - */ - uint32_t stream_id; - - /** - * Stream to which this one is associated. - */ - uint32_t assoc_stream_id; - - /** - * The window of the data within data frames. - */ - uint32_t window_size; - - /** - * Stream priority. 0 is the highest, 7 is the lowest. - */ - uint8_t priority; - - /** - * Integer specifying the index in the server's CREDENTIAL vector of - * the client certificate to be used for this request The value 0 - * means no client certificate should be associated with this stream. - */ - uint8_t slot; - - /** - * If initially the stream was created as unidirectional. - */ - bool flag_unidirectional; - - /** - * If the stream won't be used for receiving frames anymore. The - * client has sent FLAG_FIN or the stream was terminated with - * RST_STREAM. - */ - bool is_in_closed; - - /** - * If the stream won't be used for sending out frames anymore. The - * server has sent FLAG_FIN or the stream was terminated with - * RST_STREAM. - */ - bool is_out_closed; - - /** - * Which entity (server/client) has created the stream. - */ - bool is_server_initiator; -}; - - -/** - * Represents a SPDY session which is just a TCP connection - */ -struct SPDY_Session -{ - /** - * zlib stream for decompressing all the name/pair values from the - * received frames. All the received compressed data must be - * decompressed within one context: this stream. Thus, it should be - * unique for the session and initialized at its creation. - */ - z_stream zlib_recv_stream; - - /** - * zlib stream for compressing all the name/pair values from the - * frames to be sent. All the sent compressed data must be - * compressed within one context: this stream. Thus, it should be - * unique for the session and initialized at its creation. - */ - z_stream zlib_send_stream; - - /** - * This is a doubly-linked list. - */ - struct SPDY_Session *next; - - /** - * This is a doubly-linked list. - */ - struct SPDY_Session *prev; - - /** - * Reference to the SPDY_Daemon struct. - */ - struct SPDY_Daemon *daemon; - - /** - * Foreign address (of length addr_len). - */ - struct sockaddr *addr; - - /** - * Head of doubly-linked list of the SPDY streams belonging to the - * session. - */ - struct SPDYF_Stream *streams_head; - - /** - * Tail of doubly-linked list of the streams. - */ - struct SPDYF_Stream *streams_tail; - - /** - * Unique IO context for the session. Initialized on each creation - * (actually when the TCP connection is established). - */ - void *io_context; - - /** - * Head of doubly-linked list of the responses. - */ - struct SPDYF_Response_Queue *response_queue_head; - - /** - * Tail of doubly-linked list of the responses. - */ - struct SPDYF_Response_Queue *response_queue_tail; - - /** - * Buffer for reading requests. - */ - void *read_buffer; - - /** - * Buffer for writing responses. - */ - void *write_buffer; - - /** - * Specific handler for the frame that is currently being received. - */ - void (*frame_handler) (struct SPDY_Session * session); - - /** - * Closure for frame_handler. - */ - void *frame_handler_cls; - - /** - * Extra field to be used by the user with set/get func for whatever - * purpose he wants. - */ - void *user_cls; - - /** - * Function to initialize the IO context for a new session. - */ - SPDYF_IONewSession fio_new_session; - - /** - * Function to deinitialize the IO context for a session. - */ - SPDYF_IOCloseSession fio_close_session; - - /** - * Function to read data from socket. - */ - SPDYF_IORecv fio_recv; - - /** - * Function to write data to socket. - */ - SPDYF_IOSend fio_send; - - /** - * Function to check for pending data in IO buffers. - */ - SPDYF_IOIsPending fio_is_pending; - - /** - * Function to call before writing set of frames. - */ - SPDYF_IOBeforeWrite fio_before_write; - - /** - * Function to call after writing set of frames. - */ - SPDYF_IOAfterWrite fio_after_write; - - /** - * Number of bytes that the lib must ignore immediately after they - * are read from the TLS socket without adding them to the read buf. - * This is needed, for instance, when receiving frame bigger than - * the buffer to avoid deadlock situations. - */ - size_t read_ignore_bytes; - - /** - * Size of read_buffer (in bytes). This value indicates - * how many bytes we're willing to read into the buffer; - * the real buffer is one byte longer to allow for - * adding zero-termination (when needed). - */ - size_t read_buffer_size; - - /** - * Position where we currently append data in - * read_buffer (last valid position). - */ - size_t read_buffer_offset; - - /** - * Position until where everything was already read - */ - size_t read_buffer_beginning; - - /** - * Size of write_buffer (in bytes). This value indicates - * how many bytes we're willing to prepare for writing. - */ - size_t write_buffer_size; - - /** - * Position where we currently append data in - * write_buffer (last valid position). - */ - size_t write_buffer_offset; - - /** - * Position until where everything was already written to the socket - */ - size_t write_buffer_beginning; - - /** - * Last time this connection had any activity - * (reading or writing). In milliseconds. - */ - unsigned long long last_activity; - - /** - * Socket for this connection. Set to -1 if - * this connection has died (daemon should clean - * up in that case). - */ - int socket_fd; - - /** - * Length of the foreign address. - */ - socklen_t addr_len; - - /** - * The biggest stream ID for this session for streams initiated - * by the client. - */ - uint32_t last_in_stream_id; - - /** - * The biggest stream ID for this session for streams initiated - * by the server. - */ - uint32_t last_out_stream_id; - - /** - * This value is updated whenever SYN_REPLY or RST_STREAM are sent - * and is used later in GOAWAY frame. - * TODO it is not clear in the draft what happens when streams are - * not answered in the order of their IDs. Moreover, why should we - * send GOAWAY with the ID of received bogus SYN_STREAM with huge ID? - */ - uint32_t last_replied_to_stream_id; - - /** - * Shows the stream id of the currently handled frame. This value is - * to be used when sending RST_STREAM in answer to a problematic - * frame, e.g. larger than supported. - */ - uint32_t current_stream_id; - - /** - * Maximum number of frames to be written to the socket at once. The - * library tries to send max_num_frames in a single call to SPDY_run - * for a single session. This means no requests can be received nor - * other sessions can send data as long the current one has enough - * frames to send and there is no error on writing. - */ - uint32_t max_num_frames; - - /** - * Shows the current receiving state the session, i.e. what is - * expected to come now, and how it shold be handled. - */ - enum SPDY_SESSION_STATUS status; - - /** - * Has this socket been closed for reading (i.e. - * other side closed the connection)? If so, - * we must completely close the connection once - * we are done sending our response (and stop - * trying to read from this socket). - */ - bool read_closed; - - /** - * If the server sends GOAWAY, it must ignore all SYN_STREAMS for - * this session. Normally the server will soon close the TCP session. - */ - bool is_goaway_sent; - - /** - * If the server receives GOAWAY, it must not send new SYN_STREAMS - * on this session. Normally the client will soon close the TCP - * session. - */ - bool is_goaway_received; -}; - - -/** - * State and settings kept for each SPDY daemon. - */ -struct SPDY_Daemon -{ - - /** - * Tail of doubly-linked list of our current, active sessions. - */ - struct SPDY_Session *sessions_head; - - /** - * Tail of doubly-linked list of our current, active sessions. - */ - struct SPDY_Session *sessions_tail; - - /** - * Tail of doubly-linked list of connections to clean up. - */ - struct SPDY_Session *cleanup_head; - - /** - * Tail of doubly-linked list of connections to clean up. - */ - struct SPDY_Session *cleanup_tail; - - /** - * Unique IO context for the daemon. Initialized on daemon start. - */ - void *io_context; - - /** - * Certificate file of the server. File path is kept here. - */ - char *certfile; - - /** - * Key file for the certificate of the server. File path is - * kept here. - */ - char *keyfile; - - - /** - * The address to which the listening socket is bound. - */ - struct sockaddr *address; - - /** - * Callback called when a new SPDY session is - * established by a client - */ - SPDY_NewSessionCallback new_session_cb; - - /** - * Callback called when a client closes the session - */ - SPDY_SessionClosedCallback session_closed_cb; - - /** - * Callback called when a client sends request - */ - SPDY_NewRequestCallback new_request_cb; - - /** - * Callback called when HTTP POST params are received - * after request. To be used by the application layer - */ - SPDY_NewDataCallback received_data_cb; - - /** - * Callback called when DATA frame is received. - */ - SPDYF_NewDataCallback freceived_data_cb; - - /** - * Closure argument for all the callbacks that can be used by the client. - */ - void *cls; - - /** - * Callback called when new stream is created. - */ - SPDYF_NewStreamCallback fnew_stream_cb; - - /** - * Closure argument for all the callbacks defined in the framing layer. - */ - void *fcls; - - /** - * Function to initialize the IO context for the daemon. - */ - SPDYF_IOInit fio_init; - - /** - * Function to deinitialize the IO context for the daemon. - */ - SPDYF_IODeinit fio_deinit; - - /** - * After how many milliseconds of inactivity should - * connections time out? Zero for no timeout. - */ - unsigned long long session_timeout; - - /** - * Listen socket. - */ - int socket_fd; - - /** - * This value is inherited by all sessions of the daemon. - * Maximum number of frames to be written to the socket at once. The - * library tries to send max_num_frames in a single call to SPDY_run - * for a single session. This means no requests can be received nor - * other sessions can send data as long the current one has enough - * frames to send and there is no error on writing. - */ - uint32_t max_num_frames; - - /** - * Daemon's options. - */ - enum SPDY_DAEMON_OPTION options; - - /** - * Daemon's flags. - */ - enum SPDY_DAEMON_FLAG flags; - - /** - * IO subsystem type used by daemon and all its sessions. - */ - enum SPDY_IO_SUBSYSTEM io_subsystem; - - /** - * Listen port. - */ - uint16_t port; -}; - - -/** - * Represents a SPDY response. - */ -struct SPDY_Response -{ - /** - * Raw uncompressed stream of the name/value pairs in SPDY frame - * used for the HTTP headers. - */ - void *headers; - - /** - * Raw stream of the data to be sent. Equivalent to the body in HTTP - * response. - */ - void *data; - - /** - * Callback function to be used when the response data is provided - * with callbacks. In this case data must be NULL and data_size must - * be 0. - */ - SPDY_ResponseCallback rcb; - - /** - * Extra argument to rcb. - */ - void *rcb_cls; - - /** - * Length of headers. - */ - size_t headers_size; - - /** - * Length of data. - */ - size_t data_size; - - /** - * The callback func will be called to get that amount of bytes to - * put them into a DATA frame. It is either user preffered or - * the maximum supported by the lib value. - */ - uint32_t rcb_block_size; -}; - - -/* Macros for handling data and structures */ - - -/** - * Insert an element at the head of a DLL. Assumes that head, tail and - * element are structs with prev and next fields. - * - * @param head pointer to the head of the DLL (struct ? *) - * @param tail pointer to the tail of the DLL (struct ? *) - * @param element element to insert (struct ? *) - */ -#define DLL_insert(head,tail,element) do { \ - (element)->next = (head); \ - (element)->prev = NULL; \ - if ((tail) == NULL) \ - (tail) = element; \ - else \ - (head)->prev = element; \ - (head) = (element); } while (0) - - -/** - * Remove an element from a DLL. Assumes - * that head, tail and element are structs - * with prev and next fields. - * - * @param head pointer to the head of the DLL (struct ? *) - * @param tail pointer to the tail of the DLL (struct ? *) - * @param element element to remove (struct ? *) - */ -#define DLL_remove(head,tail,element) do { \ - if ((element)->prev == NULL) \ - (head) = (element)->next; \ - else \ - (element)->prev->next = (element)->next; \ - if ((element)->next == NULL) \ - (tail) = (element)->prev; \ - else \ - (element)->next->prev = (element)->prev; \ - (element)->next = NULL; \ - (element)->prev = NULL; } while (0) - - -/** - * Convert all integers in a SPDY control frame headers structure from - * host byte order to network byte order. - * - * @param frame input and output structure (struct SPDY_Control_Frame *) - */ -#if HAVE_BIG_ENDIAN -#define SPDYF_CONTROL_FRAME_HTON(frame) -#else -#define SPDYF_CONTROL_FRAME_HTON(frame) do { \ - (*((uint16_t *) frame )) = (*((uint8_t *) (frame) +1 )) | ((*((uint8_t *) frame ))<<8);\ - (frame)->type = htons((frame)->type); \ - (frame)->length = HTON24((frame)->length); \ - } while (0) -#endif - - -/** - * Convert all integers in a SPDY control frame headers structure from - * network byte order to host byte order. - * - * @param frame input and output structure (struct SPDY_Control_Frame *) - */ -#if HAVE_BIG_ENDIAN -#define SPDYF_CONTROL_FRAME_NTOH(frame) -#else -#define SPDYF_CONTROL_FRAME_NTOH(frame) do { \ - (*((uint16_t *) frame )) = (*((uint8_t *) (frame) +1 )) | ((*((uint8_t *) frame ))<<8);\ - (frame)->type = ntohs((frame)->type); \ - (frame)->length = NTOH24((frame)->length); \ - } while (0) -#endif - - -/** - * Convert all integers in a SPDY data frame headers structure from - * host byte order to network byte order. - * - * @param frame input and output structure (struct SPDY_Data_Frame *) - */ -#if HAVE_BIG_ENDIAN -#define SPDYF_DATA_FRAME_HTON(frame) -#else -#define SPDYF_DATA_FRAME_HTON(frame) do { \ - *((uint32_t *) frame ) = htonl(*((uint32_t *) frame ));\ - (frame)->length = HTON24((frame)->length); \ - } while (0) -#endif - - -/** - * Convert all integers in a SPDY data frame headers structure from - * network byte order to host byte order. - * - * @param frame input and output structure (struct SPDY_Data_Frame *) - */ -#if HAVE_BIG_ENDIAN -#define SPDYF_DATA_FRAME_NTOH(frame) -#else -#define SPDYF_DATA_FRAME_NTOH(frame) do { \ - *((uint32_t *) frame ) = ntohl(*((uint32_t *) frame ));\ - (frame)->length = NTOH24((frame)->length); \ - } while (0) -#endif - - -/** - * Creates one or more new SPDYF_Response_Queue object to be put on the - * response queue. - * - * @param is_data whether new data frame or new control frame will be - * crerated - * @param data the row stream which will be used as the body of the frame - * @param data_size length of data - * @param response object, part of which is the frame - * @param stream on which data is to be sent - * @param closestream TRUE if the frame must close the stream (with flag) - * @param frqcb callback to notify application layer when the frame - * has been sent or discarded - * @param frqcb_cls closure for frqcb - * @param rrcb callback used by the application layer to notify the - * application when the frame has been sent or discarded. - * frqcb will call it - * @param rrcb_cls closure for rrcb - * @return double linked list of SPDYF_Response_Queue structures: one or - * more frames are returned based on the size of the data - */ -struct SPDYF_Response_Queue * -SPDYF_response_queue_create(bool is_data, - void *data, - size_t data_size, - struct SPDY_Response *response, - struct SPDYF_Stream *stream, - bool closestream, - SPDYF_ResponseQueueResultCallback frqcb, - void *frqcb_cls, - SPDY_ResponseResultCallback rrcb, - void *rrcb_cls); - - -/** - * Destroys SPDYF_Response_Queue structure and whatever is in it. - * - * @param response_queue to destroy - */ -void -SPDYF_response_queue_destroy(struct SPDYF_Response_Queue *response_queue); - - -/** - * Checks if the container is empty, i.e. created but no values were - * added to it. - * - * @param container - * @return SPDY_YES if empty - * SPDY_NO if not - */ -int -SPDYF_name_value_is_empty(struct SPDY_NameValue *container); - - -/** - * Transforms raw binary decomressed stream of headers - * into SPDY_NameValue, containing all of the headers and values. - * - * @param stream that is to be transformed - * @param size length of the stream - * @param container will contain the newly created SPDY_NameValue - * container. Should point to NULL. - * @return SPDY_YES on success - * SPDY_NO on memory error - * SPDY_INPUT_ERROR if the provided stream is not valid - */ -int -SPDYF_name_value_from_stream(void *stream, - size_t size, - struct SPDY_NameValue ** container); - - -/** - * Transforms array of objects of name/values tuples, containing HTTP - * headers, into raw binary stream. The resulting stream is ready to - * be compressed and sent. - * - * @param container one or more SPDY_NameValue objects. Each object - * contains multiple number of name/value tuples. - * @param num_containers length of the array - * @param stream will contain the resulting stream. Should point to NULL. - * @return length of stream or value less than 0 indicating error - */ -ssize_t -SPDYF_name_value_to_stream(struct SPDY_NameValue * container[], - int num_containers, - void **stream); - -#endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/platform/Makefile.am libmicrohttpd-0.9.55/src/platform/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/platform/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/platform/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -# This Makefile.am is in the public domain -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/include - -AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) - -if USE_COVERAGE - AM_CFLAGS += --coverage -endif - -if HAVE_W32 -noinst_LTLIBRARIES = \ - libplatform_interface.la -libplatform_interface_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -DBUILDING_MHD_LIB=1 -libplatform_interface_la_SOURCES = \ - w32functions.c -endif - diff -Nru libmicrohttpd-0.9.44+dfsg/src/platform/Makefile.in libmicrohttpd-0.9.55/src/platform/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/platform/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/platform/Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,669 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@USE_COVERAGE_TRUE@am__append_1 = --coverage -subdir = src/platform -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ - $(top_srcdir)/m4/ax_append_flag.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ - $(top_srcdir)/m4/ax_count_cpus.m4 \ - $(top_srcdir)/m4/ax_have_epoll.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/ax_require_defined.m4 \ - $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/MHD_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libplatform_interface_la_LIBADD = -am__libplatform_interface_la_SOURCES_DIST = w32functions.c -@HAVE_W32_TRUE@am_libplatform_interface_la_OBJECTS = \ -@HAVE_W32_TRUE@ libplatform_interface_la-w32functions.lo -libplatform_interface_la_OBJECTS = \ - $(am_libplatform_interface_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -@HAVE_W32_TRUE@am_libplatform_interface_la_rpath = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libplatform_interface_la_SOURCES) -DIST_SOURCES = $(am__libplatform_interface_la_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPU_COUNT = @CPU_COUNT@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ -GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ -HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ -HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL = @LIBCURL@ -LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ -LIBTOOL = @LIBTOOL@ -LIB_VERSION_AGE = @LIB_VERSION_AGE@ -LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ -LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MHD_LIBDEPS = @MHD_LIBDEPS@ -MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ -MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ -MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ -MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ -MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ -MKDIR_P = @MKDIR_P@ -MS_LIB_TOOL = @MS_LIB_TOOL@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ -PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ -PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -_libcurl_config = @_libcurl_config@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -have_socat = @have_socat@ -have_zzuf = @have_zzuf@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_cv_objdir = @lt_cv_objdir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# This Makefile.am is in the public domain -AM_CPPFLAGS = \ - -I$(top_srcdir)/src/include - -AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) $(am__append_1) -@HAVE_W32_TRUE@noinst_LTLIBRARIES = \ -@HAVE_W32_TRUE@ libplatform_interface.la - -@HAVE_W32_TRUE@libplatform_interface_la_CPPFLAGS = \ -@HAVE_W32_TRUE@ $(AM_CPPFLAGS) \ -@HAVE_W32_TRUE@ -DBUILDING_MHD_LIB=1 - -@HAVE_W32_TRUE@libplatform_interface_la_SOURCES = \ -@HAVE_W32_TRUE@ w32functions.c - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/platform/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/platform/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libplatform_interface.la: $(libplatform_interface_la_OBJECTS) $(libplatform_interface_la_DEPENDENCIES) $(EXTRA_libplatform_interface_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(am_libplatform_interface_la_rpath) $(libplatform_interface_la_OBJECTS) $(libplatform_interface_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libplatform_interface_la-w32functions.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -libplatform_interface_la-w32functions.lo: w32functions.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libplatform_interface_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libplatform_interface_la-w32functions.lo -MD -MP -MF $(DEPDIR)/libplatform_interface_la-w32functions.Tpo -c -o libplatform_interface_la-w32functions.lo `test -f 'w32functions.c' || echo '$(srcdir)/'`w32functions.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libplatform_interface_la-w32functions.Tpo $(DEPDIR)/libplatform_interface_la-w32functions.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='w32functions.c' object='libplatform_interface_la-w32functions.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libplatform_interface_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libplatform_interface_la-w32functions.lo `test -f 'w32functions.c' || echo '$(srcdir)/'`w32functions.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/src/platform/w32functions.c libmicrohttpd-0.9.55/src/platform/w32functions.c --- libmicrohttpd-0.9.44+dfsg/src/platform/w32functions.c 2015-09-06 18:41:01.000000000 +0200 +++ libmicrohttpd-0.9.55/src/platform/w32functions.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,704 +0,0 @@ -/* - This file is part of libmicrohttpd - Copyright (C) 2014 Karlson2k (Evgeny Grin) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. - If not, see . -*/ - -/** - * @file platform/w32functions.h - * @brief internal functions for W32 systems - * @author Karlson2k (Evgeny Grin) - */ - -#include "w32functions.h" -#include -#include -#include -#include -#include -#include -#include - - -/** - * Return errno equivalent of last winsock error - * @return errno equivalent of last winsock error - */ -int MHD_W32_errno_from_winsock_(void) -{ - switch(WSAGetLastError()) - { - case 0: return 0; - case WSA_INVALID_HANDLE: return EBADF; - case WSA_NOT_ENOUGH_MEMORY: return ENOMEM; - case WSA_INVALID_PARAMETER: return EINVAL; - case WSAEINTR: return EINTR; - case WSAEWOULDBLOCK: return EWOULDBLOCK; - case WSAEINPROGRESS: return EINPROGRESS; - case WSAEALREADY: return EALREADY; - case WSAENOTSOCK: return ENOTSOCK; - case WSAEDESTADDRREQ: return EDESTADDRREQ; - case WSAEMSGSIZE: return EMSGSIZE; - case WSAEPROTOTYPE: return EPROTOTYPE; - case WSAENOPROTOOPT: return ENOPROTOOPT; - case WSAEPROTONOSUPPORT: return EPROTONOSUPPORT; - case WSAESOCKTNOSUPPORT: return ESOCKTNOSUPPORT; - case WSAEOPNOTSUPP: return EOPNOTSUPP; - case WSAEPFNOSUPPORT: return EPFNOSUPPORT; - case WSAEAFNOSUPPORT: return EAFNOSUPPORT; - case WSAEADDRINUSE: return EADDRINUSE; - case WSAEADDRNOTAVAIL: return EADDRNOTAVAIL; - case WSAENETDOWN: return ENETDOWN; - case WSAENETUNREACH: return ENETUNREACH; - case WSAENETRESET: return ENETRESET; - case WSAECONNABORTED: return ECONNABORTED; - case WSAECONNRESET: return ECONNRESET; - case WSAENOBUFS: return ENOBUFS; - case WSAEISCONN: return EISCONN; - case WSAENOTCONN: return ENOTCONN; - case WSAESHUTDOWN: return ESHUTDOWN; - case WSAETOOMANYREFS: return ETOOMANYREFS; - case WSAETIMEDOUT: return ETIMEDOUT; - case WSAECONNREFUSED: return ECONNREFUSED; - case WSAELOOP: return ELOOP; - case WSAENAMETOOLONG: return ENAMETOOLONG; - case WSAEHOSTDOWN: return EHOSTDOWN; - case WSAEHOSTUNREACH: return EHOSTUNREACH; - case WSAENOTEMPTY: return ENOTEMPTY; - case WSAEPROCLIM: return EPROCLIM; - case WSAEUSERS: return EUSERS; - case WSAEDQUOT: return EDQUOT; - case WSAESTALE: return ESTALE; - case WSAEREMOTE: return EREMOTE; - case WSAEINVAL: return EINVAL; - case WSAEFAULT: return EFAULT; - case WSANO_DATA: return ENODATA; - /* Rough equivalents */ - case WSAEDISCON: return ECONNRESET; - case WSAEINVALIDPROCTABLE: return EFAULT; - case WSASYSNOTREADY: - case WSANOTINITIALISED: - case WSASYSCALLFAILURE: return ENOBUFS; - case WSAVERNOTSUPPORTED: return EOPNOTSUPP; - case WSAEREFUSED: return EIO; - } - return EINVAL; -} - -/** - * Return pointer to string description of errnum error - * Works fine with both standard errno errnums - * and errnums from MHD_W32_errno_from_winsock_ - * @param errnum the errno or value from MHD_W32_errno_from_winsock_() - * @return pointer to string description of error - */ -const char* MHD_W32_strerror_(int errnum) -{ - switch(errnum) - { - case 0: - return "No error"; - case EWOULDBLOCK: - return "Operation would block"; - case EINPROGRESS: - return "Connection already in progress"; - case EALREADY: - return "Socket already connected"; - case ENOTSOCK: - return "Socket operation on non-socket"; - case EDESTADDRREQ: - return "Destination address required"; - case EMSGSIZE: - return "Message too long"; - case EPROTOTYPE: - return "Protocol wrong type for socket"; - case ENOPROTOOPT: - return "Protocol not available"; - case EPROTONOSUPPORT: - return "Unknown protocol"; - case ESOCKTNOSUPPORT: - return "Socket type not supported"; - case EOPNOTSUPP: - return "Operation not supported on socket"; - case EPFNOSUPPORT: - return "Protocol family not supported"; - case EAFNOSUPPORT: - return "Address family not supported by protocol family"; - case EADDRINUSE: - return "Address already in use"; - case EADDRNOTAVAIL: - return "Cannot assign requested address"; - case ENETDOWN: - return "Network is down"; - case ENETUNREACH: - return "Network is unreachable"; - case ENETRESET: - return "Network dropped connection on reset"; - case ECONNABORTED: - return "Software caused connection abort"; - case ECONNRESET: - return "Connection reset by peer"; - case ENOBUFS: - return "No system resources available"; - case EISCONN: - return "Socket is already connected"; - case ENOTCONN: - return "Socket is not connected"; - case ESHUTDOWN: - return "Can't send after socket shutdown"; - case ETOOMANYREFS: - return "Too many references: cannot splice"; - case ETIMEDOUT: - return "Connection timed out"; - case ECONNREFUSED: - return "Connection refused"; - case ELOOP: - return "Cannot translate name"; - case EHOSTDOWN: - return "Host is down"; - case EHOSTUNREACH: - return "Host is unreachable"; - case EPROCLIM: - return "Too many processes"; - case EUSERS: - return "Too many users"; - case EDQUOT: - return "Disk quota exceeded"; - case ESTALE: - return "Stale file handle reference"; - case EREMOTE: - return "Resource is remote"; - case ENODATA: - return "No data available"; - } - return strerror(errnum); -} - -/** - * Return pointer to string description of last winsock error - * @return pointer to string description of last winsock error - */ -const char* MHD_W32_strerror_last_winsock_(void) -{ - switch (WSAGetLastError()) - { - case 0: - return "No error"; - case WSA_INVALID_HANDLE: - return "Specified event object handle is invalid"; - case WSA_NOT_ENOUGH_MEMORY: - return "Insufficient memory available"; - case WSA_INVALID_PARAMETER: - return "One or more parameters are invalid"; - case WSA_OPERATION_ABORTED: - return "Overlapped operation aborted"; - case WSA_IO_INCOMPLETE: - return "Overlapped I/O event object not in signaled state"; - case WSA_IO_PENDING: - return "Overlapped operations will complete later"; - case WSAEINTR: - return "Interrupted function call"; - case WSAEBADF: - return "File handle is not valid"; - case WSAEACCES: - return "Permission denied"; - case WSAEFAULT: - return "Bad address"; - case WSAEINVAL: - return "Invalid argument"; - case WSAEMFILE: - return "Too many open files"; - case WSAEWOULDBLOCK: - return "Resource temporarily unavailable"; - case WSAEINPROGRESS: - return "Operation now in progress"; - case WSAEALREADY: - return "Operation already in progress"; - case WSAENOTSOCK: - return "Socket operation on nonsocket"; - case WSAEDESTADDRREQ: - return "Destination address required"; - case WSAEMSGSIZE: - return "Message too long"; - case WSAEPROTOTYPE: - return "Protocol wrong type for socket"; - case WSAENOPROTOOPT: - return "Bad protocol option"; - case WSAEPROTONOSUPPORT: - return "Protocol not supported"; - case WSAESOCKTNOSUPPORT: - return "Socket type not supported"; - case WSAEOPNOTSUPP: - return "Operation not supported"; - case WSAEPFNOSUPPORT: - return "Protocol family not supported"; - case WSAEAFNOSUPPORT: - return "Address family not supported by protocol family"; - case WSAEADDRINUSE: - return "Address already in use"; - case WSAEADDRNOTAVAIL: - return "Cannot assign requested address"; - case WSAENETDOWN: - return "Network is down"; - case WSAENETUNREACH: - return "Network is unreachable"; - case WSAENETRESET: - return "Network dropped connection on reset"; - case WSAECONNABORTED: - return "Software caused connection abort"; - case WSAECONNRESET: - return "Connection reset by peer"; - case WSAENOBUFS: - return "No buffer space available"; - case WSAEISCONN: - return "Socket is already connected"; - case WSAENOTCONN: - return "Socket is not connected"; - case WSAESHUTDOWN: - return "Cannot send after socket shutdown"; - case WSAETOOMANYREFS: - return "Too many references"; - case WSAETIMEDOUT: - return "Connection timed out"; - case WSAECONNREFUSED: - return "Connection refused"; - case WSAELOOP: - return "Cannot translate name"; - case WSAENAMETOOLONG: - return "Name too long"; - case WSAEHOSTDOWN: - return "Host is down"; - case WSAEHOSTUNREACH: - return "No route to host"; - case WSAENOTEMPTY: - return "Directory not empty"; - case WSAEPROCLIM: - return "Too many processes"; - case WSAEUSERS: - return "User quota exceeded"; - case WSAEDQUOT: - return "Disk quota exceeded"; - case WSAESTALE: - return "Stale file handle reference"; - case WSAEREMOTE: - return "Item is remote"; - case WSASYSNOTREADY: - return "Network subsystem is unavailable"; - case WSAVERNOTSUPPORTED: - return "Winsock.dll version out of range"; - case WSANOTINITIALISED: - return "Successful WSAStartup not yet performed"; - case WSAEDISCON: - return "Graceful shutdown in progress"; - case WSAENOMORE: - return "No more results"; - case WSAECANCELLED: - return "Call has been canceled"; - case WSAEINVALIDPROCTABLE: - return "Procedure call table is invalid"; - case WSAEINVALIDPROVIDER: - return "Service provider is invalid"; - case WSAEPROVIDERFAILEDINIT: - return "Service provider failed to initialize"; - case WSASYSCALLFAILURE: - return "System call failure"; - case WSASERVICE_NOT_FOUND: - return "Service not found"; - case WSATYPE_NOT_FOUND: - return "Class type not found"; - case WSA_E_NO_MORE: - return "No more results"; - case WSA_E_CANCELLED: - return "Call was canceled"; - case WSAEREFUSED: - return "Database query was refused"; - case WSAHOST_NOT_FOUND: - return "Host not found"; - case WSATRY_AGAIN: - return "Nonauthoritative host not found"; - case WSANO_RECOVERY: - return "This is a nonrecoverable error"; - case WSANO_DATA: - return "Valid name, no data record of requested type"; - case WSA_QOS_RECEIVERS: - return "QoS receivers"; - case WSA_QOS_SENDERS: - return "QoS senders"; - case WSA_QOS_NO_SENDERS: - return "No QoS senders"; - case WSA_QOS_NO_RECEIVERS: - return "QoS no receivers"; - case WSA_QOS_REQUEST_CONFIRMED: - return "QoS request confirmed"; - case WSA_QOS_ADMISSION_FAILURE: - return "QoS admission error"; - case WSA_QOS_POLICY_FAILURE: - return "QoS policy failure"; - case WSA_QOS_BAD_STYLE: - return "QoS bad style"; - case WSA_QOS_BAD_OBJECT: - return "QoS bad object"; - case WSA_QOS_TRAFFIC_CTRL_ERROR: - return "QoS traffic control error"; - case WSA_QOS_GENERIC_ERROR: - return "QoS generic error"; - case WSA_QOS_ESERVICETYPE: - return "QoS service type error"; - case WSA_QOS_EFLOWSPEC: - return "QoS flowspec error"; - case WSA_QOS_EPROVSPECBUF: - return "Invalid QoS provider buffer"; - case WSA_QOS_EFILTERSTYLE: - return "Invalid QoS filter style"; - case WSA_QOS_EFILTERTYPE: - return "Invalid QoS filter type"; - case WSA_QOS_EFILTERCOUNT: - return "Incorrect QoS filter count"; - case WSA_QOS_EOBJLENGTH: - return "Invalid QoS object length"; - case WSA_QOS_EFLOWCOUNT: - return "Incorrect QoS flow count"; - case WSA_QOS_EUNKOWNPSOBJ: - return "Unrecognized QoS object"; - case WSA_QOS_EPOLICYOBJ: - return "Invalid QoS policy object"; - case WSA_QOS_EFLOWDESC: - return "Invalid QoS flow descriptor"; - case WSA_QOS_EPSFLOWSPEC: - return "Invalid QoS provider-specific flowspec"; - case WSA_QOS_EPSFILTERSPEC: - return "Invalid QoS provider-specific filterspec"; - case WSA_QOS_ESDMODEOBJ: - return "Invalid QoS shape discard mode object"; - case WSA_QOS_ESHAPERATEOBJ: - return "Invalid QoS shaping rate object"; - case WSA_QOS_RESERVED_PETYPE: - return "Reserved policy QoS element type"; - } - return "Unknown winsock error"; -} - -/** - * Set last winsock error to equivalent of given errno value - * @param errnum the errno value to set - */ -void MHD_W32_set_last_winsock_error_(int errnum) -{ - switch (errnum) - { - case 0: - WSASetLastError(0); - break; - case EBADF: - WSASetLastError(WSA_INVALID_HANDLE); - break; - case ENOMEM: - WSASetLastError(WSA_NOT_ENOUGH_MEMORY); - break; - case EINVAL: - WSASetLastError(WSA_INVALID_PARAMETER); - break; - case EINTR: - WSASetLastError(WSAEINTR); - break; - case EWOULDBLOCK: - WSASetLastError(WSAEWOULDBLOCK); - break; - case EINPROGRESS: - WSASetLastError(WSAEINPROGRESS); - break; - case EALREADY: - WSASetLastError(WSAEALREADY); - break; - case ENOTSOCK: - WSASetLastError(WSAENOTSOCK); - break; - case EDESTADDRREQ: - WSASetLastError(WSAEDESTADDRREQ); - break; - case EMSGSIZE: - WSASetLastError(WSAEMSGSIZE); - break; - case EPROTOTYPE: - WSASetLastError(WSAEPROTOTYPE); - break; - case ENOPROTOOPT: - WSASetLastError(WSAENOPROTOOPT); - break; - case EPROTONOSUPPORT: - WSASetLastError(WSAEPROTONOSUPPORT); - break; - case ESOCKTNOSUPPORT: - WSASetLastError(WSAESOCKTNOSUPPORT); - break; - case EOPNOTSUPP: - WSASetLastError(WSAEOPNOTSUPP); - break; - case EPFNOSUPPORT: - WSASetLastError(WSAEPFNOSUPPORT); - break; - case EAFNOSUPPORT: - WSASetLastError(WSAEAFNOSUPPORT); - break; - case EADDRINUSE: - WSASetLastError(WSAEADDRINUSE); - break; - case EADDRNOTAVAIL: - WSASetLastError(WSAEADDRNOTAVAIL); - break; - case ENETDOWN: - WSASetLastError(WSAENETDOWN); - break; - case ENETUNREACH: - WSASetLastError(WSAENETUNREACH); - break; - case ENETRESET: - WSASetLastError(WSAENETRESET); - break; - case ECONNABORTED: - WSASetLastError(WSAECONNABORTED); - break; - case ECONNRESET: - WSASetLastError(WSAECONNRESET); - break; - case ENOBUFS: - WSASetLastError(WSAENOBUFS); - break; - case EISCONN: - WSASetLastError(WSAEISCONN); - break; - case ENOTCONN: - WSASetLastError(WSAENOTCONN); - break; - case ESHUTDOWN: - WSASetLastError(WSAESHUTDOWN); - break; - case ETOOMANYREFS: - WSASetLastError(WSAETOOMANYREFS); - break; - case ETIMEDOUT: - WSASetLastError(WSAETIMEDOUT); - break; - case ECONNREFUSED: - WSASetLastError(WSAECONNREFUSED); - break; - case ELOOP: - WSASetLastError(WSAELOOP); - break; - case ENAMETOOLONG: - WSASetLastError(WSAENAMETOOLONG); - break; - case EHOSTDOWN: - WSASetLastError(WSAEHOSTDOWN); - break; - case EHOSTUNREACH: - WSASetLastError(WSAEHOSTUNREACH); - break; - case ENOTEMPTY: - WSASetLastError(WSAENOTEMPTY); - break; - case EPROCLIM: - WSASetLastError(WSAEPROCLIM); - break; - case EUSERS: - WSASetLastError(WSAEUSERS); - break; - case EDQUOT: - WSASetLastError(WSAEDQUOT); - break; - case ESTALE: - WSASetLastError(WSAESTALE); - break; - case EREMOTE: - WSASetLastError(WSAEREMOTE); - break; - case EFAULT: - WSASetLastError(WSAEFAULT); - break; - case ENODATA: - WSASetLastError(WSANO_DATA); - break; -#if EAGAIN != EWOULDBLOCK - case EAGAIN: - WSASetLastError(WSAEWOULDBLOCK); - break; -#endif - /* Rough equivalent */ - case EIO: - WSASetLastError(WSAEREFUSED); - break; - - default: /* Unmapped errors */ - WSASetLastError(WSAENOBUFS); - break; - } -} - -/** - * Create pair of mutually connected TCP/IP sockets on loopback address - * @param sockets_pair array to receive resulted sockets - * @return zero on success, -1 otherwise - */ -int MHD_W32_pair_of_sockets_(SOCKET sockets_pair[2]) -{ - int i; - if (!sockets_pair) - { - errno = EINVAL; - return -1; - } - -#define PAIRMAXTRYIES 800 - for (i = 0; i < PAIRMAXTRYIES; i++) - { - struct sockaddr_in listen_addr; - SOCKET listen_s; - static const int c_addinlen = sizeof(struct sockaddr_in); /* help compiler to optimize */ - int addr_len = c_addinlen; - int opt = 1; - - listen_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (INVALID_SOCKET == listen_s) - break; /* can't create even single socket */ - - listen_addr.sin_family = AF_INET; - listen_addr.sin_port = htons(0); - listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - if (0 == bind(listen_s, (struct sockaddr*) &listen_addr, c_addinlen) - && 0 == listen(listen_s, 1) - && 0 == getsockname(listen_s, (struct sockaddr*) &listen_addr, - &addr_len)) - { - SOCKET client_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (INVALID_SOCKET != client_s) - { - if (0 == ioctlsocket(client_s, FIONBIO, (u_long*) &opt) - && (0 == connect(client_s, (struct sockaddr*) &listen_addr, c_addinlen) - || WSAGetLastError() == WSAEWOULDBLOCK)) - { - struct sockaddr_in accepted_from_addr; - addr_len = c_addinlen; - SOCKET server_s = accept(listen_s, - (struct sockaddr*) &accepted_from_addr, &addr_len); - if (INVALID_SOCKET != server_s) - { - struct sockaddr_in client_addr; - addr_len = c_addinlen; - opt = 0; - if (0 == getsockname(client_s, (struct sockaddr*) &client_addr, &addr_len) - && accepted_from_addr.sin_family == client_addr.sin_family - && accepted_from_addr.sin_port == client_addr.sin_port - && accepted_from_addr.sin_addr.s_addr == client_addr.sin_addr.s_addr - && 0 == ioctlsocket(client_s, FIONBIO, (u_long*) &opt) - && 0 == ioctlsocket(server_s, FIONBIO, (u_long*) &opt)) - { - closesocket(listen_s); - sockets_pair[0] = client_s; - sockets_pair[1] = server_s; - return 0; - } - closesocket(server_s); - } - } - closesocket(client_s); - } - } - closesocket(listen_s); - } - - sockets_pair[0] = INVALID_SOCKET; - sockets_pair[1] = INVALID_SOCKET; - return -1; -} - -/** - * Static variable used by pseudo random number generator - */ -static int32_t rnd_val = 0; -/** - * Generate 31-bit pseudo random number. - * Function initialize itself at first call to current time. - * @return 31-bit pseudo random number. - */ -int MHD_W32_random_(void) -{ - if (0 == rnd_val) - rnd_val = (int32_t)time(NULL); - /* stolen from winsup\cygwin\random.cc */ - rnd_val = (16807 * (rnd_val % 127773) - 2836 * (rnd_val / 127773)) - & 0x7fffffff; - return (int)rnd_val; -} - -/* Emulate snprintf function on W32 */ -int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...) -{ - int ret; - va_list args; - if (0 != n && NULL != s ) - { - va_start(args, format); - ret = _vsnprintf(s, n, format, args); - va_end(args); - if ((int)n == ret) - s[n - 1] = 0; - if (ret >= 0) - return ret; - } - va_start(args, format); - ret = _vscprintf(format, args); - va_end(args); - if (0 <= ret && 0 != n && NULL == s) - return -1; - - return ret; -} - -#ifdef _MSC_FULL_VER -/** - * Set thread name - * @param thread_id ID of thread, -1 for current thread - * @param thread_name name to set - */ -void W32_SetThreadName(const DWORD thread_id, const char *thread_name) -{ - static const DWORD VC_SETNAME_EXC = 0x406D1388; -#pragma pack(push,8) - struct thread_info_struct - { - DWORD type; /* Must be 0x1000. */ - LPCSTR name; /* Pointer to name (in user address space). */ - DWORD ID; /* Thread ID (-1=caller thread). */ - DWORD flags; /* Reserved for future use, must be zero. */ - } thread_info; -#pragma pack(pop) - - if (NULL == thread_name) - return; - - thread_info.type = 0x1000; - thread_info.name = thread_name; - thread_info.ID = thread_id; - thread_info.flags = 0; - - __try - { /* This exception is intercepted by debugger */ - RaiseException(VC_SETNAME_EXC, 0, sizeof(thread_info) / sizeof(ULONG_PTR), (ULONG_PTR*)&thread_info); - } - __except (EXCEPTION_EXECUTE_HANDLER) - {} -} -#endif /* _MSC_FULL_VER */ diff -Nru libmicrohttpd-0.9.44+dfsg/src/spdy2http/Makefile.am libmicrohttpd-0.9.55/src/spdy2http/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/spdy2http/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/spdy2http/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,29 +0,0 @@ -# This Makefile.am is in the public domain -SUBDIRS = . - -AM_CFLAGS = - -if USE_COVERAGE - AM_CFLAGS += -fprofile-arcs -ftest-coverage -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/applicationlayer \ - -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" \ - $(LIBCURL_CPPFLAGS) - -if !HAVE_W32 -PERF_GET_CONCURRENT=perf_get_concurrent -endif - -bin_PROGRAMS = \ - microspdy2http - -microspdy2http_SOURCES = \ - proxy.c -microspdy2http_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz \ - $(LIBCURL) diff -Nru libmicrohttpd-0.9.44+dfsg/src/spdy2http/Makefile.in libmicrohttpd-0.9.55/src/spdy2http/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/spdy2http/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/spdy2http/Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,824 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@USE_COVERAGE_TRUE@am__append_1 = -fprofile-arcs -ftest-coverage -bin_PROGRAMS = microspdy2http$(EXEEXT) -subdir = src/spdy2http -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ - $(top_srcdir)/m4/ax_append_flag.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ - $(top_srcdir)/m4/ax_count_cpus.m4 \ - $(top_srcdir)/m4/ax_have_epoll.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/ax_require_defined.m4 \ - $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/MHD_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am_microspdy2http_OBJECTS = proxy.$(OBJEXT) -microspdy2http_OBJECTS = $(am_microspdy2http_OBJECTS) -am__DEPENDENCIES_1 = -microspdy2http_DEPENDENCIES = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - $(am__DEPENDENCIES_1) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(microspdy2http_SOURCES) -DIST_SOURCES = $(microspdy2http_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPU_COUNT = @CPU_COUNT@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ -GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ -HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ -HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL = @LIBCURL@ -LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ -LIBTOOL = @LIBTOOL@ -LIB_VERSION_AGE = @LIB_VERSION_AGE@ -LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ -LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MHD_LIBDEPS = @MHD_LIBDEPS@ -MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ -MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ -MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ -MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ -MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ -MKDIR_P = @MKDIR_P@ -MS_LIB_TOOL = @MS_LIB_TOOL@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ -PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ -PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -_libcurl_config = @_libcurl_config@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -have_socat = @have_socat@ -have_zzuf = @have_zzuf@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_cv_objdir = @lt_cv_objdir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# This Makefile.am is in the public domain -SUBDIRS = . -AM_CFLAGS = $(am__append_1) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/applicationlayer \ - -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" \ - $(LIBCURL_CPPFLAGS) - -@HAVE_W32_FALSE@PERF_GET_CONCURRENT = perf_get_concurrent -microspdy2http_SOURCES = \ - proxy.c - -microspdy2http_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz \ - $(LIBCURL) - -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/spdy2http/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/spdy2http/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -microspdy2http$(EXEEXT): $(microspdy2http_OBJECTS) $(microspdy2http_DEPENDENCIES) $(EXTRA_microspdy2http_DEPENDENCIES) - @rm -f microspdy2http$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(microspdy2http_OBJECTS) $(microspdy2http_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(PROGRAMS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: $(am__recursive_targets) install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-binPROGRAMS clean-generic clean-libtool \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-binPROGRAMS - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/src/spdy2http/proxy.c libmicrohttpd-0.9.55/src/spdy2http/proxy.c --- libmicrohttpd-0.9.44+dfsg/src/spdy2http/proxy.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/spdy2http/proxy.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1411 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file proxy.c - * @brief Translates incoming SPDY requests to http server on localhost. - * Uses libcurl. - * No error handling for curl requests. - * TODO: - * - test all options! - * - don't abort on lack of memory - * - Correct recapitalizetion of header names before giving the headers - * to curl. - * - curl does not close sockets when connection is closed and no - * new sockets are opened (they stay in CLOSE_WAIT) - * - add '/' when a user requests http://example.com . Now this is a bad - * request - * - curl returns 0 or 1 ms for timeout even when nothing will be done; - * thus the loop uses CPU for nothing - * @author Andrey Uzunov - */ - -#include "platform.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "microspdy.h" -#include -#include -#include -#include - -#define ERROR_RESPONSE "502 Bad Gateway" - - -struct global_options -{ - char *http_backend; - char *cert; - char *cert_key; - char *listen_host; - unsigned int timeout; - uint16_t listen_port; - bool verbose; - bool curl_verbose; - bool transparent; - bool http10; - bool notls; - bool nodelay; - bool ipv4; - bool ipv6; -} glob_opt; - - -struct URI -{ - char * full_uri; - char * scheme; - char * host_and_port; - //char * host_and_port_for_connecting; - char * host; - char * path; - char * path_and_more; - char * query; - char * fragment; - uint16_t port; -}; - - -#define PRINT_INFO(msg) do{\ - fprintf(stdout, "%i:%s\n", __LINE__, msg);\ - fflush(stdout);\ - }\ - while(0) - - -#define PRINT_INFO2(fmt, ...) do{\ - fprintf(stdout, "%i\n", __LINE__);\ - fprintf(stdout, fmt,##__VA_ARGS__);\ - fprintf(stdout, "\n");\ - fflush(stdout);\ - }\ - while(0) - - -#define PRINT_VERBOSE(msg) do{\ - if(glob_opt.verbose){\ - fprintf(stdout, "%i:%s\n", __LINE__, msg);\ - fflush(stdout);\ - }\ - }\ - while(0) - - -#define PRINT_VERBOSE2(fmt, ...) do{\ - if(glob_opt.verbose){\ - fprintf(stdout, "%i\n", __LINE__);\ - fprintf(stdout, fmt,##__VA_ARGS__);\ - fprintf(stdout, "\n");\ - fflush(stdout);\ - }\ - }\ - while(0) - - -#define CURL_SETOPT(handle, opt, val) do{\ - int ret; \ - if(CURLE_OK != (ret = curl_easy_setopt(handle, opt, val))) \ - { \ - PRINT_INFO2("curl_easy_setopt failed (%i = %i)", opt, ret); \ - abort(); \ - } \ - }\ - while(0) - - -#define DIE(msg) do{\ - printf("FATAL ERROR (line %i): %s\n", __LINE__, msg);\ - fflush(stdout);\ - exit(EXIT_FAILURE);\ - }\ - while(0) - - -static int loop = 1; - -static CURLM *multi_handle; - -static int still_running = 0; /* keep number of running handles */ - -static regex_t uri_preg; - -static bool call_spdy_run; -static bool call_curl_run; - -int debug_num_curls; - - -struct Proxy -{ - char *url; - struct SPDY_Request *request; - struct SPDY_Response *response; - CURL *curl_handle; - struct curl_slist *curl_headers; - struct SPDY_NameValue *headers; - char *version; - char *status_msg; - void *http_body; - void *received_body; - bool *session_alive; - size_t http_body_size; - size_t received_body_size; - //ssize_t length; - int status; - //bool done; - bool receiving_done; - bool is_curl_read_paused; - bool is_with_body_data; - //bool error; - bool curl_done; - bool curl_error; - bool spdy_done; - bool spdy_error; -}; - - -static void -free_uri(struct URI * uri) -{ - if(NULL != uri) - { - free(uri->full_uri); - free(uri->scheme); - free(uri->host_and_port); - //free(uri->host_and_port_for_connecting); - free(uri->host); - free(uri->path); - free(uri->path_and_more); - free(uri->query); - free(uri->fragment); - uri->port = 0; - free(uri); - } -} - - -static int -init_parse_uri(regex_t * preg) -{ - // RFC 2396 - // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? - /* - scheme = $2 - authority = $4 - path = $5 - query = $7 - fragment = $9 - */ - - return regcomp(preg, "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", REG_EXTENDED); -} - - -static void -deinit_parse_uri(regex_t * preg) -{ - regfree(preg); -} - - -static int -parse_uri(regex_t * preg, const char * full_uri, struct URI ** uri) -{ - //TODO memeory checks - int ret; - char *colon; - long long port; - size_t nmatch = 10; - regmatch_t pmatch[10]; - - if (0 != (ret = regexec(preg, full_uri, nmatch, pmatch, 0))) - return ret; - - *uri = malloc(sizeof(struct URI)); - if(NULL == *uri) - return -200; - - (*uri)->full_uri = strdup(full_uri); - - asprintf(&((*uri)->scheme), - "%.*s", - (int) (pmatch[2].rm_eo - pmatch[2].rm_so), - &full_uri[pmatch[2].rm_so]); - asprintf(&((*uri)->host_and_port), "%.*s", - (int) (pmatch[4].rm_eo - pmatch[4].rm_so), - &full_uri[pmatch[4].rm_so]); - asprintf(&((*uri)->path), - "%.*s", - (int) (pmatch[5].rm_eo - pmatch[5].rm_so), - &full_uri[pmatch[5].rm_so]); - asprintf(&((*uri)->path_and_more), - "%.*s", - (int) (pmatch[9].rm_eo - pmatch[5].rm_so), - &full_uri[pmatch[5].rm_so]); - asprintf(&((*uri)->query), - "%.*s", - (int) (pmatch[7].rm_eo - pmatch[7].rm_so), - &full_uri[pmatch[7].rm_so]); - asprintf(&((*uri)->fragment), - "%.*s", - (int) (pmatch[9].rm_eo - pmatch[9].rm_so), - &full_uri[pmatch[9].rm_so]); - - colon = strrchr((*uri)->host_and_port, ':'); - if(NULL == colon) - { - (*uri)->host = strdup((*uri)->host_and_port); - /*if(0 == strcasecmp("http", uri->scheme)) - { - uri->port = 80; - asprintf(&(uri->host_and_port_for_connecting), "%s:80", uri->host_and_port); - } - else if(0 == strcasecmp("https", uri->scheme)) - { - uri->port = 443; - asprintf(&(uri->host_and_port_for_connecting), "%s:443", uri->host_and_port); - } - else - { - PRINT_INFO("no standard scheme!"); - */(*uri)->port = 0; - /*uri->host_and_port_for_connecting = strdup(uri->host_and_port); - }*/ - return 0; - } - - port = atoi(colon + 1); - if(port<1 || port >= 256 * 256) - { - free_uri(*uri); - return -100; - } - (*uri)->port = port; - asprintf(&((*uri)->host), "%.*s", (int)(colon - (*uri)->host_and_port), (*uri)->host_and_port); - - return 0; -} - - -static bool -store_in_buffer(const void *src, size_t src_size, void **dst, size_t *dst_size) -{ - if(0 == src_size) - return true; - - if(NULL == *dst) - *dst = malloc(src_size); - else - *dst = realloc(*dst, src_size + *dst_size); - if(NULL == *dst) - return false; - - memcpy(*dst + *dst_size, src, src_size); - *dst_size += src_size; - - return true; -} - - -static ssize_t -get_from_buffer(void **src, size_t *src_size, void *dst, size_t max_size) -{ - size_t ret; - void *newbody; - - if(max_size >= *src_size) - { - ret = *src_size; - newbody = NULL; - } - else - { - ret = max_size; - if(NULL == (newbody = malloc(*src_size - max_size))) - return -1; - memcpy(newbody, *src + ret, *src_size - ret); - } - memcpy(dst, *src, ret); - free(*src); - *src = newbody; - *src_size -= ret; - - return ret; -} - - -static void -catch_signal(int signal) -{ - (void)signal; - - loop = 0; -} - -static void -new_session_cb (void * cls, - struct SPDY_Session * session) -{ - (void)cls; - - bool *session_alive; - - PRINT_VERBOSE("new session"); - //TODO clean this memory - if(NULL == (session_alive = malloc(sizeof(bool)))) - { - DIE("no memory"); - } - *session_alive = true; - SPDY_set_cls_to_session(session, - session_alive); -} - -static void -session_closed_cb (void * cls, - struct SPDY_Session * session, - int by_client) -{ - (void)cls; - - bool *session_alive; - - PRINT_VERBOSE2("session closed; by client: %i", by_client); - - session_alive = SPDY_get_cls_from_session(session); - assert(NULL != session_alive); - - *session_alive = false; -} - - -static int -spdy_post_data_cb (void * cls, - struct SPDY_Request *request, - const void * buf, - size_t size, - bool more) -{ - (void)cls; - int ret; - struct Proxy *proxy = (struct Proxy *)SPDY_get_cls_from_request(request); - - if(!store_in_buffer(buf, size, &proxy->received_body, &proxy->received_body_size)) - { - PRINT_INFO("not enough memory (malloc/realloc returned NULL)"); - return 0; - } - - proxy->receiving_done = !more; - - PRINT_VERBOSE2("POST bytes from SPDY: %zu", size); - - call_curl_run = true; - - if(proxy->is_curl_read_paused) - { - if(CURLE_OK != (ret = curl_easy_pause(proxy->curl_handle, CURLPAUSE_CONT))) - { - PRINT_INFO2("curl_easy_pause returned %i", ret); - abort(); - } - PRINT_VERBOSE("curl_read_cb pause resumed"); - } - - return SPDY_YES; -} - - -ssize_t -response_callback (void *cls, - void *buffer, - size_t max, - bool *more) -{ - ssize_t ret; - struct Proxy *proxy = (struct Proxy *)cls; - - *more = true; - - assert(!proxy->spdy_error); - - if(proxy->curl_error) - { - PRINT_VERBOSE("tell spdy about the error"); - return -1; - } - - if(!proxy->http_body_size)//nothing to write now - { - PRINT_VERBOSE("nothing to write now"); - if(proxy->curl_done || proxy->curl_error) *more = false; - return 0; - } - - ret = get_from_buffer(&(proxy->http_body), &(proxy->http_body_size), buffer, max); - if(ret < 0) - { - PRINT_INFO("no memory"); - //TODO error? - return -1; - } - - if((proxy->curl_done || proxy->curl_error) && 0 == proxy->http_body_size) *more = false; - - PRINT_VERBOSE2("given bytes to microspdy: %zd", ret); - - return ret; -} - - -static void -cleanup(struct Proxy *proxy) -{ - int ret; - - //fprintf(stderr, "free proxy for %s\n", proxy->url); - - if(CURLM_OK != (ret = curl_multi_remove_handle(multi_handle, proxy->curl_handle))) - { - PRINT_INFO2("curl_multi_remove_handle failed (%i)", ret); - DIE("bug in cleanup"); - } - debug_num_curls--; - //TODO bug on ku6.com or amazon.cn - // after curl_multi_remove_handle returned CURLM_BAD_EASY_HANDLE - curl_slist_free_all(proxy->curl_headers); - curl_easy_cleanup(proxy->curl_handle); - - free(proxy->url); - free(proxy); -} - - -static void -response_done_callback(void *cls, - struct SPDY_Response *response, - struct SPDY_Request *request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)streamopened; - struct Proxy *proxy = (struct Proxy *)cls; - - if(SPDY_RESPONSE_RESULT_SUCCESS != status) - { - free(proxy->http_body); - proxy->http_body = NULL; - proxy->spdy_error = true; - } - cleanup(proxy); - SPDY_destroy_request(request); - SPDY_destroy_response(response); -} - - -static size_t -curl_header_cb(void *ptr, size_t size, size_t nmemb, void *userp) -{ - size_t realsize = size * nmemb; - struct Proxy *proxy = (struct Proxy *)userp; - char *line = (char *)ptr; - char *name; - char *value; - char *status; - unsigned int i; - unsigned int pos; - int ret; - int num_values; - const char * const * values; - bool abort_it; - - //printf("curl_header_cb %s\n", line); - if(!*(proxy->session_alive)) - { - PRINT_VERBOSE("headers received, but session is dead"); - proxy->spdy_error = true; - proxy->curl_error = true; - return 0; - } - - //trailer - if(NULL != proxy->response) return 0; - - if('\r' == line[0] || '\n' == line[0]) - { - //all headers were already handled; prepare spdy frames - if(NULL == (proxy->response = SPDY_build_response_with_callback(proxy->status, - proxy->status_msg, - proxy->version, - proxy->headers, - &response_callback, - proxy, - 0))) - //256))) - DIE("no response"); - - SPDY_name_value_destroy(proxy->headers); - proxy->headers = NULL; - free(proxy->status_msg); - proxy->status_msg = NULL; - free(proxy->version); - proxy->version = NULL; - - if(SPDY_YES != SPDY_queue_response(proxy->request, - proxy->response, - true, - false, - &response_done_callback, - proxy)) - { - //DIE("no queue"); - //TODO right? - proxy->spdy_error = true; - proxy->curl_error = true; - PRINT_VERBOSE2("no queue in curl_header_cb for %s", proxy->url); - SPDY_destroy_response(proxy->response); - proxy->response = NULL; - return 0; - } - - call_spdy_run = true; - - return realsize; - } - - pos = 0; - if(NULL == proxy->version) - { - //first line from headers - //version - for(i=pos; iversion = strndup(line, i - pos))) - DIE("No memory"); - pos = i+1; - - //status (number) - for(i=pos; istatus = atoi(status); - free(status); - if(istatus_msg = strndup(&(line[pos]), i - pos))) - DIE("No memory"); - } - PRINT_VERBOSE2("Header line received '%s' '%i' '%s' ", proxy->version, proxy->status, proxy->status_msg); - return realsize; - } - - //other lines - //header name - for(i=pos; iheaders, name, "")) - DIE("SPDY_name_value_add failed"); - return realsize; - } - - //header value - pos = i+1; - while(posheaders, name, value))) - { - abort_it=true; - if(NULL != (values = SPDY_name_value_lookup(proxy->headers, name, &num_values))) - for(i=0; i<(unsigned int)num_values; ++i) - if(0 == strcasecmp(value, values[i])) - { - abort_it=false; - PRINT_VERBOSE2("header appears more than once with same value '%s: %s'", name, value); - break; - } - - if(abort_it) - { - PRINT_INFO2("SPDY_name_value_add failed (%i) for '%s'", ret, name); - abort(); - } - } - free(name); - free(value); - - return realsize; -} - - -static size_t -curl_write_cb(void *contents, size_t size, size_t nmemb, void *userp) -{ - size_t realsize = size * nmemb; - struct Proxy *proxy = (struct Proxy *)userp; - - //printf("curl_write_cb %i\n", realsize); - if(!*(proxy->session_alive)) - { - PRINT_VERBOSE("data received, but session is dead"); - proxy->spdy_error = true; - proxy->curl_error = true; - return 0; - } - - if(!store_in_buffer(contents, realsize, &proxy->http_body, &proxy->http_body_size)) - { - PRINT_INFO("not enough memory (malloc/realloc returned NULL)"); - proxy->curl_error = true; - return 0; - } - /* - if(NULL == proxy->http_body) - proxy->http_body = malloc(realsize); - else - proxy->http_body = realloc(proxy->http_body, proxy->http_body_size + realsize); - if(NULL == proxy->http_body) - { - PRINT_INFO("not enough memory (realloc returned NULL)"); - return 0; - } - - memcpy(proxy->http_body + proxy->http_body_size, contents, realsize); - proxy->http_body_size += realsize; - */ - - PRINT_VERBOSE2("received bytes from curl: %zu", realsize); - - call_spdy_run = true; - - return realsize; -} - - -static size_t -curl_read_cb(void *ptr, size_t size, size_t nmemb, void *userp) -{ - ssize_t ret; - size_t max = size * nmemb; - struct Proxy *proxy = (struct Proxy *)userp; - //void *newbody; - - - if((proxy->receiving_done && !proxy->received_body_size) || !proxy->is_with_body_data || max < 1) - { - PRINT_VERBOSE("curl_read_cb last call"); - return 0; - } - - if(!*(proxy->session_alive)) - { - PRINT_VERBOSE("POST is still being sent, but session is dead"); - return CURL_READFUNC_ABORT; - } - - if(!proxy->received_body_size)//nothing to write now - { - PRINT_VERBOSE("curl_read_cb called paused"); - proxy->is_curl_read_paused = true; - return CURL_READFUNC_PAUSE;//TODO curl pause should be used - } - - ret = get_from_buffer(&(proxy->received_body), &(proxy->received_body_size), ptr, max); - if(ret < 0) - { - PRINT_INFO("no memory"); - return CURL_READFUNC_ABORT; - } - - /* - if(max >= proxy->received_body_size) - { - ret = proxy->received_body_size; - newbody = NULL; - } - else - { - ret = max; - if(NULL == (newbody = malloc(proxy->received_body_size - max))) - { - PRINT_INFO("no memory"); - return CURL_READFUNC_ABORT; - } - memcpy(newbody, proxy->received_body + max, proxy->received_body_size - max); - } - memcpy(ptr, proxy->received_body, ret); - free(proxy->received_body); - proxy->received_body = newbody; - proxy->received_body_size -= ret; - * */ - - PRINT_VERBOSE2("given POST bytes to curl: %zd", ret); - - return ret; -} - - -static int -iterate_cb (void *cls, const char *name, const char * const * value, int num_values) -{ - struct Proxy *proxy = (struct Proxy *)cls; - struct curl_slist **curl_headers = (&(proxy->curl_headers)); - char *line; - int line_len = strlen(name) + 3; //+ ": \0" - int i; - - for(i=0; isession_alive = SPDY_get_cls_from_session(session); - assert(NULL != proxy->session_alive); - - SPDY_set_cls_to_request(request, proxy); - - proxy->request = request; - proxy->is_with_body_data = more; - if(NULL == (proxy->headers = SPDY_name_value_create())) - DIE("No memory"); - - if(glob_opt.transparent) - { - if(NULL != glob_opt.http_backend) //use always same host - ret = asprintf(&(proxy->url),"%s://%s%s", scheme, glob_opt.http_backend, path); - else //use host header - ret = asprintf(&(proxy->url),"%s://%s%s", scheme, host, path); - if(-1 == ret) - DIE("No memory"); - - ret = parse_uri(&uri_preg, proxy->url, &uri); - if(ret != 0) - DIE("parsing built uri failed"); - } - else - { - ret = parse_uri(&uri_preg, path, &uri); - PRINT_INFO2("path %s '%s' '%s'", path, uri->scheme, uri->host); - if(ret != 0 || !strlen(uri->scheme) || !strlen(uri->host)) - DIE("parsing received uri failed"); - - if(NULL != glob_opt.http_backend) //use backend host - { - ret = asprintf(&(proxy->url),"%s://%s%s", uri->scheme, glob_opt.http_backend, uri->path_and_more); - if(-1 == ret) - DIE("No memory"); - } - else //use request path - if(NULL == (proxy->url = strdup(path))) - DIE("No memory"); - } - - free_uri(uri); - - PRINT_VERBOSE2("curl will request '%s'", proxy->url); - - SPDY_name_value_iterate(headers, &iterate_cb, proxy); - - if(NULL == (proxy->curl_handle = curl_easy_init())) - { - PRINT_INFO("curl_easy_init failed"); - abort(); - } - - if(glob_opt.curl_verbose) - CURL_SETOPT(proxy->curl_handle, CURLOPT_VERBOSE, 1); - - if(0 == strcmp(SPDY_HTTP_METHOD_POST,method)) - { - if(NULL == (proxy->curl_headers = curl_slist_append(proxy->curl_headers, "Expect:"))) - DIE("curl_slist_append failed"); - CURL_SETOPT(proxy->curl_handle, CURLOPT_POST, 1); - CURL_SETOPT(proxy->curl_handle, CURLOPT_READFUNCTION, curl_read_cb); - CURL_SETOPT(proxy->curl_handle, CURLOPT_READDATA, proxy); - } - - if(glob_opt.timeout) - CURL_SETOPT(proxy->curl_handle, CURLOPT_TIMEOUT, glob_opt.timeout); - CURL_SETOPT(proxy->curl_handle, CURLOPT_URL, proxy->url); - if(glob_opt.http10) - CURL_SETOPT(proxy->curl_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); - CURL_SETOPT(proxy->curl_handle, CURLOPT_WRITEFUNCTION, curl_write_cb); - CURL_SETOPT(proxy->curl_handle, CURLOPT_WRITEDATA, proxy); - CURL_SETOPT(proxy->curl_handle, CURLOPT_HEADERFUNCTION, curl_header_cb); - CURL_SETOPT(proxy->curl_handle, CURLOPT_HEADERDATA, proxy); - CURL_SETOPT(proxy->curl_handle, CURLOPT_PRIVATE, proxy); - CURL_SETOPT(proxy->curl_handle, CURLOPT_HTTPHEADER, proxy->curl_headers); - CURL_SETOPT(proxy->curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);//TODO - CURL_SETOPT(proxy->curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); - if(glob_opt.ipv4 && !glob_opt.ipv6) - CURL_SETOPT(proxy->curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); - else if(glob_opt.ipv6 && !glob_opt.ipv4) - CURL_SETOPT(proxy->curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); - - if(CURLM_OK != (ret = curl_multi_add_handle(multi_handle, proxy->curl_handle))) - { - PRINT_INFO2("curl_multi_add_handle failed (%i)", ret); - abort(); - } - debug_num_curls++; - - //~5ms additional latency for calling this - if(CURLM_OK != (ret = curl_multi_perform(multi_handle, &still_running)) - && CURLM_CALL_MULTI_PERFORM != ret) - { - PRINT_INFO2("curl_multi_perform failed (%i)", ret); - abort(); - } - - call_curl_run = true; -} - - -static int -run () -{ - unsigned long long timeoutlong = 0; - unsigned long long timeout_spdy = 0; - long timeout_curl = -1; - struct timeval timeout; - int ret; - int ret_curl; - int ret_spdy; - fd_set rs; - fd_set ws; - fd_set es; - int maxfd = -1; - int maxfd_curl = -1; - struct SPDY_Daemon *daemon; - CURLMsg *msg; - int msgs_left; - struct Proxy *proxy; - struct sockaddr_in *addr; - struct addrinfo hints; - char service[NI_MAXSERV]; - struct addrinfo *gai; - enum SPDY_IO_SUBSYSTEM io = glob_opt.notls ? SPDY_IO_SUBSYSTEM_RAW : SPDY_IO_SUBSYSTEM_OPENSSL; - enum SPDY_DAEMON_FLAG flags = SPDY_DAEMON_FLAG_NO; - //struct SPDY_Response *error_response; - char *curl_private; - - signal(SIGPIPE, SIG_IGN); - - if (signal(SIGINT, catch_signal) == SIG_ERR) - PRINT_VERBOSE("signal failed"); - - srand(time(NULL)); - if(init_parse_uri(&uri_preg)) - DIE("Regexp compilation failed"); - - SPDY_init(); - - if(glob_opt.nodelay) - flags |= SPDY_DAEMON_FLAG_NO_DELAY; - - if(NULL == glob_opt.listen_host) - { - daemon = SPDY_start_daemon(glob_opt.listen_port, - glob_opt.cert, - glob_opt.cert_key, - &new_session_cb, - &session_closed_cb, - &standard_request_handler, - &spdy_post_data_cb, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_IO_SUBSYSTEM, - io, - SPDY_DAEMON_OPTION_FLAGS, - flags, - SPDY_DAEMON_OPTION_END); - } - else - { - snprintf (service, sizeof(service), "%u", glob_opt.listen_port); - memset (&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_STREAM; - - ret = getaddrinfo(glob_opt.listen_host, service, &hints, &gai); - if(ret != 0) - DIE("problem with specified host"); - - addr = (struct sockaddr_in *) gai->ai_addr; - - daemon = SPDY_start_daemon(0, - glob_opt.cert, - glob_opt.cert_key, - &new_session_cb, - &session_closed_cb, - &standard_request_handler, - &spdy_post_data_cb, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_IO_SUBSYSTEM, - io, - SPDY_DAEMON_OPTION_FLAGS, - flags, - SPDY_DAEMON_OPTION_SOCK_ADDR, - addr, - //SPDY_DAEMON_OPTION_MAX_NUM_FRAMES, - //1, - SPDY_DAEMON_OPTION_END); - } - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - multi_handle = curl_multi_init(); - if(NULL==multi_handle) - DIE("no multi_handle"); - - timeout.tv_usec = 0; - - do - { - FD_ZERO(&rs); - FD_ZERO(&ws); - FD_ZERO(&es); - - PRINT_VERBOSE2("num curls %i", debug_num_curls); - - ret_spdy = SPDY_get_timeout(daemon, &timeout_spdy); - if(SPDY_NO == ret_spdy || timeout_spdy > 5000) - timeoutlong = 5000; - else - timeoutlong = timeout_spdy; - PRINT_VERBOSE2("SPDY timeout %lld; %i", timeout_spdy, ret_spdy); - - if(CURLM_OK != (ret_curl = curl_multi_timeout(multi_handle, &timeout_curl))) - { - PRINT_VERBOSE2("curl_multi_timeout failed (%i)", ret_curl); - //curl_timeo = timeoutlong; - } - else if(timeout_curl >= 0 && timeoutlong > (unsigned long)timeout_curl) - timeoutlong = (unsigned long)timeout_curl; - - PRINT_VERBOSE2("curl timeout %ld", timeout_curl); - - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - - maxfd = SPDY_get_fdset (daemon, - &rs, - &ws, - &es); - assert(-1 != maxfd); - - if(CURLM_OK != (ret = curl_multi_fdset(multi_handle, &rs, - &ws, - &es, &maxfd_curl))) - { - PRINT_INFO2("curl_multi_fdset failed (%i)", ret); - abort(); - } - - if(maxfd_curl > maxfd) - maxfd = maxfd_curl; - - PRINT_VERBOSE2("timeout before %lld %lld", (unsigned long long)timeout.tv_sec, (unsigned long long)timeout.tv_usec); - ret = select(maxfd+1, &rs, &ws, &es, &timeout); - PRINT_VERBOSE2("timeout after %lld %lld; ret is %i", (unsigned long long)timeout.tv_sec, (unsigned long long)timeout.tv_usec, ret); - - /*switch(ret) { - case -1: - PRINT_INFO2("select error: %i", errno); - break; - case 0: - break; - default:*/ - - //the second part should not happen with current implementation - if(ret > 0 || (SPDY_YES == ret_spdy && 0 == timeout_spdy)) - { - PRINT_VERBOSE("run spdy"); - SPDY_run(daemon); - call_spdy_run = false; - } - - //if(ret > 0 || (CURLM_OK == ret_curl && 0 == timeout_curl) || call_curl_run) - { - PRINT_VERBOSE("run curl"); - if(CURLM_OK != (ret = curl_multi_perform(multi_handle, &still_running)) - && CURLM_CALL_MULTI_PERFORM != ret) - { - PRINT_INFO2("curl_multi_perform failed (%i)", ret); - abort(); - } - call_curl_run = false; - } - /*break; - }*/ - - while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { - PRINT_VERBOSE("A curl handler is done"); - if(CURLE_OK != (ret = curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &curl_private))) - { - PRINT_INFO2("err %i",ret); - abort(); - } - assert(NULL != curl_private); - proxy = (struct Proxy *)curl_private; - if(CURLE_OK == msg->data.result) - { - proxy->curl_done = true; - call_spdy_run = true; - //TODO what happens with proxy when the client resets a stream - //and response_done is not yet set for the last frame? is it - //possible? - } - else - { - PRINT_VERBOSE2("bad curl result (%i) for '%s'", msg->data.result, proxy->url); - if(proxy->spdy_done || proxy->spdy_error || (NULL == proxy->response && !*(proxy->session_alive))) - { - PRINT_VERBOSE("cleaning"); - SPDY_name_value_destroy(proxy->headers); - SPDY_destroy_request(proxy->request); - SPDY_destroy_response(proxy->response); - cleanup(proxy); - } - else if(NULL == proxy->response && *(proxy->session_alive)) - { - //generate error for the client - PRINT_VERBOSE("will send Bad Gateway"); - SPDY_name_value_destroy(proxy->headers); - proxy->headers = NULL; - if(NULL == (proxy->response = SPDY_build_response(SPDY_HTTP_BAD_GATEWAY, - NULL, - SPDY_HTTP_VERSION_1_1, - NULL, - ERROR_RESPONSE, - strlen(ERROR_RESPONSE)))) - DIE("no response"); - if(SPDY_YES != SPDY_queue_response(proxy->request, - proxy->response, - true, - false, - &response_done_callback, - proxy)) - { - //clean and forget - PRINT_VERBOSE("cleaning"); - SPDY_destroy_request(proxy->request); - SPDY_destroy_response(proxy->response); - cleanup(proxy); - } - } - else - { - proxy->curl_error = true; - } - call_spdy_run = true; - //TODO spdy should be notified to send RST_STREAM - } - } - else PRINT_INFO("shouldn't happen"); - } - - if(call_spdy_run) - { - PRINT_VERBOSE("second call to SPDY_run"); - SPDY_run(daemon); - call_spdy_run = false; - } - - if(glob_opt.verbose) - { - -#ifdef HAVE_CLOCK_GETTIME -#ifdef CLOCK_MONOTONIC - struct timespec ts; - - if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) - PRINT_VERBOSE2 ("time now %lld %lld", - (unsigned long long) ts.tv_sec, - (unsigned long long) ts.tv_nsec); -#endif -#endif - } - - } - while(loop); - - SPDY_stop_daemon(daemon); - - curl_multi_cleanup(multi_handle); - - SPDY_deinit(); - - deinit_parse_uri(&uri_preg); - - return 0; -} - - -static void -display_usage() -{ - printf( - "Usage: microspdy2http -p [-c ] [-k ]\n" - " [-rvh0DtT] [-b ] [-l ]\n\n" - "OPTIONS:\n" - " -p, --port Listening port.\n" - " -l, --host Listening host. If not set, will listen on [::]\n" - " -c, --certificate Path to a certificate file. Requiered if\n" - " --no-tls is not set.\n" - " -k, --certificate-key Path to a key file for the certificate.\n" - " Requiered if --no-tls is not set.\n" - " -b, --backend-server If set, the proxy will connect always to it.\n" - " Otherwise the proxy will connect to the URL\n" - " which is specified in the path or 'Host:'.\n" - " -v, --verbose Print debug information.\n" - " -r, --no-tls Do not use TLS. Client must use SPDY/3.\n" - " -h, --curl-verbose Print debug information for curl.\n" - " -0, --http10 Prefer HTTP/1.0 connections to the next hop.\n" - " -D, --no-delay This makes sense only if --no-tls is used.\n" - " TCP_NODELAY will be used for all sessions' sockets.\n" - " -4, --curl-ipv4 Curl may use IPv4 to connect to the final destination.\n" - " -6, --curl-ipv6 Curl may use IPv6 to connect to the final destination.\n" - " If neither --curl-ipv4 nor --curl-ipv6 is set,\n" - " both will be used by default.\n" - " -T, --timeout Maximum time in seconds for each HTTP transfer.\n" - " Use 0 for no timeout; this is the default value.\n" - " -t, --transparent If set, the proxy will fetch an URL which\n" - " is based on 'Host:' header and requested path.\n" - " Otherwise, full URL in the requested path is required.\n\n" - - ); -} - - -int -main (int argc, char *const *argv) -{ - - int getopt_ret; - int option_index; - struct option long_options[] = { - {"port", required_argument, 0, 'p'}, - {"certificate", required_argument, 0, 'c'}, - {"certificate-key", required_argument, 0, 'k'}, - {"backend-server", required_argument, 0, 'b'}, - {"no-tls", no_argument, 0, 'r'}, - {"verbose", no_argument, 0, 'v'}, - {"curl-verbose", no_argument, 0, 'h'}, - {"http10", no_argument, 0, '0'}, - {"no-delay", no_argument, 0, 'D'}, - {"transparent", no_argument, 0, 't'}, - {"curl-ipv4", no_argument, 0, '4'}, - {"curl-ipv6", no_argument, 0, '6'}, - {"timeout", required_argument, 0, 'T'}, - {0, 0, 0, 0} - }; - - while (1) - { - getopt_ret = getopt_long( argc, argv, "p:l:c:k:b:rv0Dth46T:", long_options, &option_index); - if (getopt_ret == -1) - break; - - switch(getopt_ret) - { - case 'p': - glob_opt.listen_port = atoi(optarg); - break; - - case 'l': - glob_opt.listen_host= strdup(optarg); - if(NULL == glob_opt.listen_host) - return 1; - break; - - case 'c': - glob_opt.cert = strdup(optarg); - break; - - case 'k': - glob_opt.cert_key = strdup(optarg); - break; - - case 'b': - glob_opt.http_backend = strdup(optarg); - if(NULL == glob_opt.http_backend) - return 1; - break; - - case 'r': - glob_opt.notls = true; - break; - - case 'v': - glob_opt.verbose = true; - break; - - case 'h': - glob_opt.curl_verbose = true; - break; - - case '0': - glob_opt.http10 = true; - break; - - case 'D': - glob_opt.nodelay = true; - break; - - case 't': - glob_opt.transparent = true; - break; - - case '4': - glob_opt.ipv4 = true; - break; - - case '6': - glob_opt.ipv6 = true; - break; - - case 'T': - glob_opt.timeout = atoi(optarg); - break; - - case 0: - PRINT_INFO("0 from getopt"); - break; - - case '?': - display_usage(); - return 1; - - default: - DIE("default from getopt"); - } - } - - if( - 0 == glob_opt.listen_port - || (!glob_opt.notls && (NULL == glob_opt.cert || NULL == glob_opt.cert_key)) - //|| !glob_opt.transparent && NULL != glob_opt.http_backend - ) - { - display_usage(); - return 1; - } - - return run(); -} - diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/curl_version_check.c libmicrohttpd-0.9.55/src/testcurl/curl_version_check.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/curl_version_check.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/curl_version_check.c 2017-05-28 22:34:00.000000000 +0200 @@ -67,13 +67,13 @@ return s; } -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT int curl_uses_nss_ssl() { return (strstr(curl_version(), " NSS/") != NULL) ? 0 : -1; } -#endif +#endif /* HTTPS_SUPPORT */ /* * check local libcurl version matches required version @@ -83,16 +83,16 @@ { const char *ver; const char *curl_ver; -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT const char *ssl_ver; const char *req_ssl_ver; -#endif +#endif /* HTTPS_SUPPORT */ int loc_major, loc_minor, loc_micro; int rq_major, rq_minor, rq_micro; ver = curl_version (); -#if HAVE_MESSAGES +#ifdef HAVE_MESSAGES fprintf (stderr, "curl version: %s\n", ver); #endif /* @@ -127,7 +127,7 @@ * enforce required gnutls/openssl version. * TODO use curl version string to assert use of gnutls */ -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT ssl_ver = strchr (curl_ver, ' '); if (ssl_ver == NULL) return -1; @@ -171,6 +171,6 @@ req_ssl_ver); return -1; } -#endif +#endif /* HTTPS_SUPPORT */ return 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/Makefile.in libmicrohttpd-0.9.55/src/testcurl/https/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -104,7 +104,6 @@ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -112,8 +111,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -573,8 +575,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -582,6 +586,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -597,9 +602,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -607,6 +609,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -621,9 +624,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -645,13 +645,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -659,6 +656,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -703,6 +701,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_empty_response.c libmicrohttpd-0.9.55/src/testcurl/https/test_empty_response.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_empty_response.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_empty_response.c 2017-05-28 22:34:00.000000000 +0200 @@ -70,7 +70,7 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + int maxposixs; /* Max socket number unused on W32 */ int running; struct CURLMsg *msg; time_t start; @@ -80,8 +80,8 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | MHD_USE_SELECT_INTERNALLY, - 1082, NULL, NULL, &ahc_echo, "GET", + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | MHD_USE_INTERNAL_POLLING_THREAD, + 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -134,11 +134,11 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -149,7 +149,16 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 != maxposixs) + { + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) +#endif /* MHD_POSIX_SOCKETS */ + abort (); + } + } curl_multi_perform (multi, &running); if (running == 0) { @@ -192,10 +201,16 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + return 99; + } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; } if (0 != (errorCount = testInternalSelectGet ())) - fprintf (stderr, "Fail: %d\n", errorCount); + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); curl_global_cleanup (); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_get.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_get.c 2017-05-28 22:34:00.000000000 +0200 @@ -43,11 +43,11 @@ const char *cipher_suite, int proto_version) { - int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, 4233, + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, 4233, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, @@ -75,8 +75,8 @@ int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, 4233, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, 4233, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, @@ -109,7 +109,13 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + return 99; + } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; } if (curl_uses_nss_ssl() == 0) @@ -126,5 +132,5 @@ curl_global_cleanup (); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_parallel.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_parallel.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_parallel.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_parallel.c 2017-05-28 22:34:00.000000000 +0200 @@ -142,16 +142,21 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + return 99; } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + return 77; + } if (curl_uses_nss_ssl() == 0) - aes256_sha = "rsa_aes_256_sha"; -#if EPOLL_SUPPORT + aes256_sha = "rsa_aes_256_sha"; +#ifdef EPOLL_SUPPORT errorCount += test_wrap ("single threaded daemon, single client, epoll", &test_single_client, NULL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -159,15 +164,15 @@ errorCount += test_wrap ("single threaded daemon, single client", &test_single_client, NULL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); -#if EPOLL_SUPPORT +#ifdef EPOLL_SUPPORT errorCount += test_wrap ("single threaded daemon, parallel clients, epoll", &test_parallel_clients, NULL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -175,11 +180,13 @@ errorCount += test_wrap ("single threaded daemon, parallel clients", &test_parallel_clients, NULL, - MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); curl_global_cleanup (); - return errorCount != 0; + if (errorCount != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_parallel_threads.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_parallel_threads.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_parallel_threads.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_parallel_threads.c 2017-05-28 22:34:00.000000000 +0200 @@ -144,21 +144,23 @@ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif srand (iseed); + if (0 != curl_global_init (CURL_GLOBAL_ALL)) + { + fprintf (stderr, "Error: %s\n", strerror (errno)); + return 99; + } ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; if (NULL == ssl_version) - { - fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); - return 0; - } + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } if (0 != strncmp (ssl_version, "GnuTLS", 6)) - { - fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); - return 0; - } - if (0 != curl_global_init (CURL_GLOBAL_ALL)) { - fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); + curl_global_cleanup (); + return 77; } char *aes256_sha = "AES256-SHA"; @@ -170,7 +172,7 @@ errorCount += test_wrap ("multi threaded daemon, single client", &test_single_client, NULL, - MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION, + MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -178,14 +180,14 @@ errorCount += test_wrap ("multi threaded daemon, parallel client", &test_parallel_clients, NULL, - MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_THREAD_PER_CONNECTION, + MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); if (errorCount != 0) - fprintf (stderr, "Failed test: %s.\n", argv[0]); + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); curl_global_cleanup (); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_select.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_select.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_get_select.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_get_select.c 2017-05-28 22:34:00.000000000 +0200 @@ -84,7 +84,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -95,8 +100,8 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | flags, - 1082, NULL, NULL, &ahc_echo, "GET", + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | flags, + 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END); @@ -104,7 +109,7 @@ return 256; if (curl_uses_nss_ssl() == 0) - aes256_sha = "rsa_aes_256_sha"; + aes256_sha = "rsa_aes_256_sha"; c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world"); @@ -146,11 +151,12 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -159,7 +165,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -169,7 +175,16 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 != maxposixs) + { + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) +#endif /* MHD_POSIX_SOCKETS */ + abort (); + } + } curl_multi_perform (multi, &running); if (running == 0) { @@ -215,14 +230,21 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + return 99; } -#if EPOLL_SUPPORT - if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL_LINUX_ONLY))) - fprintf (stderr, "Fail: %d\n", errorCount); + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + +#ifdef EPOLL_SUPPORT + errorCount += testExternalGet (MHD_USE_EPOLL); #endif - if (0 != (errorCount = testExternalGet (0))) - fprintf (stderr, "Fail: %d\n", errorCount); + errorCount += testExternalGet (0); curl_global_cleanup (); - return errorCount != 0; + if (errorCount != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_multi_daemon.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_multi_daemon.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_multi_daemon.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_multi_daemon.c 2017-05-28 22:34:00.000000000 +0200 @@ -50,8 +50,8 @@ struct MHD_Daemon *d1; struct MHD_Daemon *d2; - d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, DEAMON_TEST_PORT, + d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, @@ -63,8 +63,8 @@ return -1; } - d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, DEAMON_TEST_PORT + 1, + d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, DEAMON_TEST_PORT + 1, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, @@ -96,6 +96,7 @@ { unsigned int errorCount = 0; FILE *cert; + const char *aes256_sha = "AES256-SHA"; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); #ifdef GCRYCTL_INITIALIZATION_FINISHED @@ -105,20 +106,26 @@ { fprintf (stderr, "Error (code: %u). l:%d f:%s\n", errorCount, __LINE__, __FUNCTION__); - return -1; + return 99; + } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; } if ((cert = setup_ca_cert ()) == NULL) { fprintf (stderr, MHD_E_TEST_FILE_CREAT); - return -1; + curl_global_cleanup (); + return 99; } - const char *aes256_sha = "AES256-SHA"; if (curl_uses_nss_ssl() == 0) { aes256_sha = "rsa_aes_256_sha"; } - + errorCount += test_concurent_daemon_pair (NULL, aes256_sha, CURL_SSLVERSION_TLSv1); @@ -130,5 +137,5 @@ fprintf (stderr, "Failed to remove `%s'\n", ca_cert_file_name); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_session_info.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_session_info.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_session_info.c 2015-07-15 19:40:38.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_session_info.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007 Christian Grothoff + Copyright (C) 2007, 2016 Christian Grothoff libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -107,8 +107,8 @@ gen_test_file_url (url, DEAMON_TEST_PORT); /* setup test */ - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, DEAMON_TEST_PORT, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, NULL, NULL, &query_session_ahc, NULL, MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, @@ -116,7 +116,10 @@ MHD_OPTION_END); if (d == NULL) - return 2; + { + free (cbc.buf); + return 2; + } const char *aes256_sha = "AES256-SHA"; if (curl_uses_nss_ssl() == 0) @@ -168,6 +171,7 @@ main (int argc, char *const *argv) { unsigned int errorCount = 0; + const char *ssl_version; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); #ifdef GCRYCTL_INITIALIZATION_FINISHED @@ -176,14 +180,26 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error (code: %u)\n", errorCount); - return -1; + return 99; } + + ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + if (0 != strncmp (ssl_version, "GnuTLS", 6)) + { + fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); + curl_global_cleanup (); + return 77; + } #if LIBCURL_VERSION_NUM >= 0x072200 errorCount += test_query_session (); #endif print_test_result (errorCount, argv[0]); curl_global_cleanup (); - if (errorCount > 0) - fprintf (stderr, "Error (code: %u)\n", errorCount); - return errorCount; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_sni.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_sni.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_sni.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_sni.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2013 Christian Grothoff + Copyright (C) 2013, 2016 Christian Grothoff libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -256,11 +256,18 @@ if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return -1; + return 99; + } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; } + load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key"); load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key"); - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, 4233, NULL, NULL, &http_ahc, NULL, @@ -271,12 +278,16 @@ fprintf (stderr, MHD_E_SERVER_INIT); return -1; } - error_count += do_get ("https://host1:4233/"); - error_count += do_get ("https://host2:4233/"); + if (0 != do_get ("https://host1:4233/")) + error_count++; + if (0 != do_get ("https://host2:4233/")) + error_count++; MHD_stop_daemon (d); curl_global_cleanup (); - return error_count != 0; + if (error_count != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], error_count); + return (0 != error_count) ? 1 : 0; } @@ -286,6 +297,6 @@ { fprintf (stderr, "SNI not supported by GnuTLS < 3.0\n"); - return 0; + return 77; } #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_time_out.c libmicrohttpd-0.9.55/src/testcurl/https/test_https_time_out.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_https_time_out.c 2015-08-02 19:07:19.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_https_time_out.c 2017-05-28 22:34:00.000000000 +0200 @@ -27,9 +27,10 @@ #include "platform.h" #include "microhttpd.h" -#include "internal.h" #include "tls_test_common.h" #include +#include "mhd_sockets.h" /* only macros used */ + #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN @@ -69,7 +70,7 @@ if (ret < 0) { fprintf (stderr, "Error: %s\n", MHD_E_FAILED_TO_CONNECT); - MHD_socket_close_ (sd); + MHD_socket_close_chk_ (sd); return -1; } @@ -77,7 +78,7 @@ if (ret < 0) { fprintf (stderr, "Handshake failed\n"); - MHD_socket_close_ (sd); + MHD_socket_close_chk_ (sd); return -1; } @@ -88,11 +89,11 @@ if (send (sd, "", 1, 0) == 0) { fprintf (stderr, "Connection failed to time-out\n"); - MHD_socket_close_ (sd); + MHD_socket_close_chk_ (sd); return -1; } - MHD_socket_close_ (sd); + MHD_socket_close_chk_ (sd); return 0; } @@ -115,8 +116,8 @@ gnutls_global_init (); gnutls_global_set_log_level (11); - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, DEAMON_TEST_PORT, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, NULL, NULL, &http_dummy_ahc, NULL, MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, @@ -142,5 +143,5 @@ MHD_stop_daemon (d); gnutls_global_deinit (); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_tls_authentication.c libmicrohttpd-0.9.55/src/testcurl/https/test_tls_authentication.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_tls_authentication.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_tls_authentication.c 2017-05-28 22:34:00.000000000 +0200 @@ -49,8 +49,8 @@ int ret; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, DEAMON_TEST_PORT, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, NULL, NULL, &http_ahc, NULL, MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, @@ -73,24 +73,31 @@ main (int argc, char *const *argv) { unsigned int errorCount = 0; + char *aes256_sha = "AES256-SHA"; gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); #ifdef GCRYCTL_INITIALIZATION_FINISHED gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); #endif - if (setup_ca_cert () == NULL) + if (0 != curl_global_init (CURL_GLOBAL_ALL)) { - fprintf (stderr, MHD_E_TEST_FILE_CREAT); - return -1; + fprintf (stderr, "Error (code: %u)\n", errorCount); + return 99; + } + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; } - if (0 != curl_global_init (CURL_GLOBAL_ALL)) + if (setup_ca_cert () == NULL) { - fprintf (stderr, "Error (code: %u)\n", errorCount); - return -1; + fprintf (stderr, MHD_E_TEST_FILE_CREAT); + curl_global_cleanup (); + return 99; } - char *aes256_sha = "AES256-SHA"; if (curl_uses_nss_ssl() == 0) { aes256_sha = "rsa_aes_256_sha"; @@ -106,5 +113,5 @@ fprintf (stderr, "Failed to remove `%s'\n", ca_cert_file_name); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_tls_options.c libmicrohttpd-0.9.55/src/testcurl/https/test_tls_options.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/test_tls_options.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/test_tls_options.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,17 +1,17 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007, 2010 Christian Grothoff - + Copyright (C) 2007, 2010, 2016 Christian Grothoff + libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + libmicrohttpd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with libmicrohttpd; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -83,7 +83,7 @@ unsigned int errorCount = 0; const char *ssl_version; int daemon_flags = - MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | MHD_USE_DEBUG; + MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG; gcry_control (GCRYCTL_DISABLE_SECMEM, 0); gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); @@ -92,24 +92,24 @@ #endif if (curl_check_version (MHD_REQ_CURL_VERSION)) { - return 0; + return 77; } ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; if (NULL == ssl_version) { fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); - return 0; + return 77; } if (0 != strncmp (ssl_version, "GnuTLS", 6)) { fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); - return 0; + return 77; } if (0 != curl_global_init (CURL_GLOBAL_ALL)) { fprintf (stderr, "Error: %s\n", strerror (errno)); - return 0; + return 99; } const char *aes128_sha = "AES128-SHA"; @@ -119,9 +119,9 @@ aes128_sha = "rsa_aes_128_sha"; aes256_sha = "rsa_aes_256_sha"; } - - if (0 != + + if (0 != test_wrap ("TLS1.0-AES-SHA1", &test_https_transfer, NULL, daemon_flags, aes128_sha, @@ -151,5 +151,5 @@ } curl_global_cleanup (); - return errorCount != 0; + return errorCount != 0 ? 1 : 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/https/tls_test_common.c libmicrohttpd-0.9.55/src/testcurl/https/tls_test_common.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/https/tls_test_common.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/https/tls_test_common.c 2017-05-28 22:34:00.000000000 +0200 @@ -104,7 +104,8 @@ /* perform peer authentication */ /* TODO merge into send_curl_req */ curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, ver_peer); - curl_easy_setopt (c, CURLOPT_CAINFO, ca_cert_file_name); + if (ver_peer) + curl_easy_setopt (c, CURLOPT_CAINFO, ca_cert_file_name); curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -138,9 +139,9 @@ void print_test_result (int test_outcome, char *test_name) { -#if 0 if (test_outcome != 0) - fprintf (stderr, "running test: %s [fail]\n", test_name); + fprintf (stderr, "running test: %s [fail: %u]\n", test_name, (unsigned int)test_outcome); +#if 0 else fprintf (stdout, "running test: %s [pass]\n", test_name); #endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/Makefile.am libmicrohttpd-0.9.55/src/testcurl/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/testcurl/Makefile.am 2015-04-29 00:45:08.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/Makefile.am 2017-05-28 22:34:00.000000000 +0200 @@ -16,22 +16,14 @@ -I$(top_srcdir)/src/include \ $(LIBCURL_CPPFLAGS) -if !HAVE_W32 -PERF_GET_CONCURRENT=perf_get_concurrent -TEST_CONCURRENT_STOP=test_concurrent_stop -if HAVE_CURL_BINARY -CURL_FORK_TEST = test_get_response_cleanup -endif -endif - if HAVE_CURL check_PROGRAMS = \ test_start_stop \ test_get \ test_get_sendfile \ test_urlparse \ + test_delete \ test_put \ - $(TEST_CONCURRENT_STOP) \ test_process_headers \ test_process_arguments \ test_parse_cookies \ @@ -40,6 +32,7 @@ test_get_sendfile11 \ test_put11 \ test_large_put11 \ + test_large_put_inc11 \ test_long_header \ test_long_header11 \ test_get_chunked \ @@ -48,12 +41,23 @@ test_termination \ test_timeout \ test_callback \ - $(CURL_FORK_TEST) \ - perf_get $(PERF_GET_CONCURRENT) + perf_get + +if HAVE_FORK_WAITPID +if HAVE_CURL_BINARY +check_PROGRAMS += test_get_response_cleanup +endif +endif if HAVE_POSIX_THREADS check_PROGRAMS += \ - test_quiesce + test_quiesce \ + test_concurrent_stop \ + perf_get_concurrent + +if HAVE_CURL_BINARY +check_PROGRAMS += test_quiesce_stream +endif endif if HAVE_POSTPROCESSOR @@ -89,9 +93,11 @@ test_concurrent_stop_SOURCES = \ test_concurrent_stop.c +test_concurrent_stop_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) test_concurrent_stop_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + $(PTHREAD_LIBS) @LIBCURL@ test_options_SOURCES = \ test_options.c @@ -112,6 +118,14 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) @LIBCURL@ +test_quiesce_stream_SOURCES = \ + test_quiesce_stream.c +test_quiesce_stream_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_quiesce_stream_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + test_callback_SOURCES = \ test_callback.c test_callback_LDADD = \ @@ -128,9 +142,11 @@ perf_get_concurrent_SOURCES = \ perf_get_concurrent.c \ gauger.h +perf_get_concurrent_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) perf_get_concurrent_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + $(PTHREAD_LIBS) @LIBCURL@ test_digestauth_SOURCES = \ test_digestauth.c @@ -149,14 +165,6 @@ test_get_sendfile_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ -test_get_sendfile_DEPENDENCIES = - -if HAVE_W32 -test_get_sendfile_LDADD += \ - $(top_builddir)/src/platform/libplatform_interface.la -test_get_sendfile_DEPENDENCIES += \ - $(top_builddir)/src/platform/libplatform_interface.la -endif test_urlparse_SOURCES = \ test_urlparse.c @@ -211,6 +219,12 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ +test_delete_SOURCES = \ + test_delete.c +test_delete_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_put_SOURCES = \ test_put.c test_put_LDADD = \ @@ -234,14 +248,6 @@ test_get_sendfile11_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ -test_get_sendfile11_DEPENDENCIES = - -if HAVE_W32 -test_get_sendfile11_LDADD += \ - $(top_builddir)/src/platform/libplatform_interface.la -test_get_sendfile11_DEPENDENCIES += \ - $(top_builddir)/src/platform/libplatform_interface.la -endif test_post11_SOURCES = \ test_post.c @@ -279,6 +285,12 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ +test_large_put_inc11_SOURCES = \ + test_large_put.c +test_large_put_inc11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_long_header_SOURCES = \ test_long_header.c test_long_header_LDADD = \ diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/Makefile.in libmicrohttpd-0.9.55/src/testcurl/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/testcurl/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/Makefile.in 2017-05-28 22:34:00.000000000 +0200 @@ -92,13 +92,15 @@ @ENABLE_HTTPS_TRUE@am__append_1 = https @HAVE_CURL_TRUE@check_PROGRAMS = test_start_stop$(EXEEXT) \ @HAVE_CURL_TRUE@ test_get$(EXEEXT) test_get_sendfile$(EXEEXT) \ -@HAVE_CURL_TRUE@ test_urlparse$(EXEEXT) test_put$(EXEEXT) \ -@HAVE_CURL_TRUE@ $(am__EXEEXT_1) test_process_headers$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_urlparse$(EXEEXT) test_delete$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_put$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_process_headers$(EXEEXT) \ @HAVE_CURL_TRUE@ test_process_arguments$(EXEEXT) \ @HAVE_CURL_TRUE@ test_parse_cookies$(EXEEXT) \ @HAVE_CURL_TRUE@ test_large_put$(EXEEXT) test_get11$(EXEEXT) \ @HAVE_CURL_TRUE@ test_get_sendfile11$(EXEEXT) \ @HAVE_CURL_TRUE@ test_put11$(EXEEXT) test_large_put11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_large_put_inc11$(EXEEXT) \ @HAVE_CURL_TRUE@ test_long_header$(EXEEXT) \ @HAVE_CURL_TRUE@ test_long_header11$(EXEEXT) \ @HAVE_CURL_TRUE@ test_get_chunked$(EXEEXT) \ @@ -106,13 +108,17 @@ @HAVE_CURL_TRUE@ test_iplimit11$(EXEEXT) \ @HAVE_CURL_TRUE@ test_termination$(EXEEXT) \ @HAVE_CURL_TRUE@ test_timeout$(EXEEXT) test_callback$(EXEEXT) \ -@HAVE_CURL_TRUE@ $(am__EXEEXT_2) perf_get$(EXEEXT) \ -@HAVE_CURL_TRUE@ $(am__EXEEXT_3) $(am__EXEEXT_4) \ -@HAVE_CURL_TRUE@ $(am__EXEEXT_5) $(am__EXEEXT_6) -@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_2 = \ -@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_quiesce +@HAVE_CURL_TRUE@ perf_get$(EXEEXT) $(am__EXEEXT_1) \ +@HAVE_CURL_TRUE@ $(am__EXEEXT_2) $(am__EXEEXT_3) \ +@HAVE_CURL_TRUE@ $(am__EXEEXT_4) $(am__EXEEXT_5) +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_FORK_WAITPID_TRUE@am__append_2 = test_get_response_cleanup +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_3 = \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_quiesce \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_concurrent_stop \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ perf_get_concurrent -@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_3 = \ +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_4 = test_quiesce_stream +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_5 = \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop \ @@ -121,28 +127,15 @@ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop11 @HAVE_CURL_TRUE@noinst_PROGRAMS = test_options$(EXEEXT) -@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__append_4 = \ +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__append_6 = \ @ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth test_digestauth_with_arguments -@HAVE_W32_TRUE@am__append_5 = \ -@HAVE_W32_TRUE@ $(top_builddir)/src/platform/libplatform_interface.la - -@HAVE_W32_TRUE@am__append_6 = \ -@HAVE_W32_TRUE@ $(top_builddir)/src/platform/libplatform_interface.la - -@HAVE_W32_TRUE@am__append_7 = \ -@HAVE_W32_TRUE@ $(top_builddir)/src/platform/libplatform_interface.la - -@HAVE_W32_TRUE@am__append_8 = \ -@HAVE_W32_TRUE@ $(top_builddir)/src/platform/libplatform_interface.la - subdir = src/testcurl ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ $(top_srcdir)/m4/ax_count_cpus.m4 \ $(top_srcdir)/m4/ax_have_epoll.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ @@ -150,8 +143,11 @@ $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -170,18 +166,19 @@ am_libcurl_version_check_a_OBJECTS = curl_version_check.$(OBJEXT) libcurl_version_check_a_OBJECTS = \ $(am_libcurl_version_check_a_OBJECTS) -@HAVE_W32_FALSE@am__EXEEXT_1 = test_concurrent_stop$(EXEEXT) -@HAVE_CURL_BINARY_TRUE@@HAVE_W32_FALSE@am__EXEEXT_2 = test_get_response_cleanup$(EXEEXT) -@HAVE_W32_FALSE@am__EXEEXT_3 = perf_get_concurrent$(EXEEXT) -@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_4 = test_quiesce$(EXEEXT) -@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_5 = \ +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_FORK_WAITPID_TRUE@am__EXEEXT_1 = test_get_response_cleanup$(EXEEXT) +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_2 = test_quiesce$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_concurrent_stop$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ perf_get_concurrent$(EXEEXT) +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_3 = test_quiesce_stream$(EXEEXT) +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_4 = \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post$(EXEEXT) \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform$(EXEEXT) \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop$(EXEEXT) \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post11$(EXEEXT) \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform11$(EXEEXT) \ @HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop11$(EXEEXT) -@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__EXEEXT_6 = \ +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__EXEEXT_5 = \ @ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth$(EXEEXT) \ @ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth_with_arguments$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) @@ -193,17 +190,34 @@ am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -am_perf_get_concurrent_OBJECTS = perf_get_concurrent.$(OBJEXT) +am_perf_get_concurrent_OBJECTS = \ + perf_get_concurrent-perf_get_concurrent.$(OBJEXT) perf_get_concurrent_OBJECTS = $(am_perf_get_concurrent_OBJECTS) +am__DEPENDENCIES_1 = perf_get_concurrent_DEPENDENCIES = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +perf_get_concurrent_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(perf_get_concurrent_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_test_callback_OBJECTS = test_callback.$(OBJEXT) test_callback_OBJECTS = $(am_test_callback_OBJECTS) test_callback_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la -am_test_concurrent_stop_OBJECTS = test_concurrent_stop.$(OBJEXT) +am_test_concurrent_stop_OBJECTS = \ + test_concurrent_stop-test_concurrent_stop.$(OBJEXT) test_concurrent_stop_OBJECTS = $(am_test_concurrent_stop_OBJECTS) test_concurrent_stop_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_concurrent_stop_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_concurrent_stop_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_delete_OBJECTS = test_delete.$(OBJEXT) +test_delete_OBJECTS = $(am_test_delete_OBJECTS) +test_delete_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_digestauth_OBJECTS = test_digestauth.$(OBJEXT) test_digestauth_OBJECTS = $(am_test_digestauth_OBJECTS) @@ -235,8 +249,12 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_get_sendfile_OBJECTS = test_get_sendfile.$(OBJEXT) test_get_sendfile_OBJECTS = $(am_test_get_sendfile_OBJECTS) +test_get_sendfile_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_get_sendfile11_OBJECTS = test_get_sendfile.$(OBJEXT) test_get_sendfile11_OBJECTS = $(am_test_get_sendfile11_OBJECTS) +test_get_sendfile11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_iplimit11_OBJECTS = test_iplimit.$(OBJEXT) test_iplimit11_OBJECTS = $(am_test_iplimit11_OBJECTS) test_iplimit11_DEPENDENCIES = \ @@ -249,6 +267,10 @@ test_large_put11_OBJECTS = $(am_test_large_put11_OBJECTS) test_large_put11_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_large_put_inc11_OBJECTS = test_large_put.$(OBJEXT) +test_large_put_inc11_OBJECTS = $(am_test_large_put_inc11_OBJECTS) +test_large_put_inc11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_long_header_OBJECTS = test_long_header.$(OBJEXT) test_long_header_OBJECTS = $(am_test_long_header_OBJECTS) test_long_header_DEPENDENCIES = \ @@ -311,13 +333,22 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la am_test_quiesce_OBJECTS = test_quiesce-test_quiesce.$(OBJEXT) test_quiesce_OBJECTS = $(am_test_quiesce_OBJECTS) -am__DEPENDENCIES_1 = test_quiesce_DEPENDENCIES = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(am__DEPENDENCIES_1) test_quiesce_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_quiesce_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_quiesce_stream_OBJECTS = \ + test_quiesce_stream-test_quiesce_stream.$(OBJEXT) +test_quiesce_stream_OBJECTS = $(am_test_quiesce_stream_OBJECTS) +test_quiesce_stream_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_quiesce_stream_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_quiesce_stream_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_test_start_stop_OBJECTS = test_start_stop.$(OBJEXT) test_start_stop_OBJECTS = $(am_test_start_stop_OBJECTS) test_start_stop_DEPENDENCIES = \ @@ -370,42 +401,46 @@ am__v_CCLD_1 = SOURCES = $(libcurl_version_check_a_SOURCES) $(perf_get_SOURCES) \ $(perf_get_concurrent_SOURCES) $(test_callback_SOURCES) \ - $(test_concurrent_stop_SOURCES) $(test_digestauth_SOURCES) \ + $(test_concurrent_stop_SOURCES) $(test_delete_SOURCES) \ + $(test_digestauth_SOURCES) \ $(test_digestauth_with_arguments_SOURCES) $(test_get_SOURCES) \ $(test_get11_SOURCES) $(test_get_chunked_SOURCES) \ $(test_get_response_cleanup_SOURCES) \ $(test_get_sendfile_SOURCES) $(test_get_sendfile11_SOURCES) \ $(test_iplimit11_SOURCES) $(test_large_put_SOURCES) \ - $(test_large_put11_SOURCES) $(test_long_header_SOURCES) \ - $(test_long_header11_SOURCES) $(test_options_SOURCES) \ - $(test_parse_cookies_SOURCES) $(test_post_SOURCES) \ - $(test_post11_SOURCES) $(test_post_loop_SOURCES) \ - $(test_post_loop11_SOURCES) $(test_postform_SOURCES) \ - $(test_postform11_SOURCES) $(test_process_arguments_SOURCES) \ + $(test_large_put11_SOURCES) $(test_large_put_inc11_SOURCES) \ + $(test_long_header_SOURCES) $(test_long_header11_SOURCES) \ + $(test_options_SOURCES) $(test_parse_cookies_SOURCES) \ + $(test_post_SOURCES) $(test_post11_SOURCES) \ + $(test_post_loop_SOURCES) $(test_post_loop11_SOURCES) \ + $(test_postform_SOURCES) $(test_postform11_SOURCES) \ + $(test_process_arguments_SOURCES) \ $(test_process_headers_SOURCES) $(test_put_SOURCES) \ $(test_put11_SOURCES) $(test_put_chunked_SOURCES) \ - $(test_quiesce_SOURCES) $(test_start_stop_SOURCES) \ - $(test_termination_SOURCES) $(test_timeout_SOURCES) \ - $(test_urlparse_SOURCES) + $(test_quiesce_SOURCES) $(test_quiesce_stream_SOURCES) \ + $(test_start_stop_SOURCES) $(test_termination_SOURCES) \ + $(test_timeout_SOURCES) $(test_urlparse_SOURCES) DIST_SOURCES = $(libcurl_version_check_a_SOURCES) $(perf_get_SOURCES) \ $(perf_get_concurrent_SOURCES) $(test_callback_SOURCES) \ - $(test_concurrent_stop_SOURCES) $(test_digestauth_SOURCES) \ + $(test_concurrent_stop_SOURCES) $(test_delete_SOURCES) \ + $(test_digestauth_SOURCES) \ $(test_digestauth_with_arguments_SOURCES) $(test_get_SOURCES) \ $(test_get11_SOURCES) $(test_get_chunked_SOURCES) \ $(test_get_response_cleanup_SOURCES) \ $(test_get_sendfile_SOURCES) $(test_get_sendfile11_SOURCES) \ $(test_iplimit11_SOURCES) $(test_large_put_SOURCES) \ - $(test_large_put11_SOURCES) $(test_long_header_SOURCES) \ - $(test_long_header11_SOURCES) $(test_options_SOURCES) \ - $(test_parse_cookies_SOURCES) $(test_post_SOURCES) \ - $(test_post11_SOURCES) $(test_post_loop_SOURCES) \ - $(test_post_loop11_SOURCES) $(test_postform_SOURCES) \ - $(test_postform11_SOURCES) $(test_process_arguments_SOURCES) \ + $(test_large_put11_SOURCES) $(test_large_put_inc11_SOURCES) \ + $(test_long_header_SOURCES) $(test_long_header11_SOURCES) \ + $(test_options_SOURCES) $(test_parse_cookies_SOURCES) \ + $(test_post_SOURCES) $(test_post11_SOURCES) \ + $(test_post_loop_SOURCES) $(test_post_loop11_SOURCES) \ + $(test_postform_SOURCES) $(test_postform11_SOURCES) \ + $(test_process_arguments_SOURCES) \ $(test_process_headers_SOURCES) $(test_put_SOURCES) \ $(test_put11_SOURCES) $(test_put_chunked_SOURCES) \ - $(test_quiesce_SOURCES) $(test_start_stop_SOURCES) \ - $(test_termination_SOURCES) $(test_timeout_SOURCES) \ - $(test_urlparse_SOURCES) + $(test_quiesce_SOURCES) $(test_quiesce_stream_SOURCES) \ + $(test_start_stop_SOURCES) $(test_termination_SOURCES) \ + $(test_timeout_SOURCES) $(test_urlparse_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ @@ -703,8 +738,10 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ @@ -712,6 +749,7 @@ GREP = @GREP@ HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -727,9 +765,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ LIBTOOL = @LIBTOOL@ LIB_VERSION_AGE = @LIB_VERSION_AGE@ LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ @@ -737,6 +772,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MHD_LIBDEPS = @MHD_LIBDEPS@ @@ -751,9 +787,6 @@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -775,13 +808,10 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ _libcurl_config = @_libcurl_config@ @@ -789,6 +819,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -833,6 +864,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -852,9 +884,6 @@ -I$(top_srcdir)/src/include \ $(LIBCURL_CPPFLAGS) -@HAVE_W32_FALSE@PERF_GET_CONCURRENT = perf_get_concurrent -@HAVE_W32_FALSE@TEST_CONCURRENT_STOP = test_concurrent_stop -@HAVE_CURL_BINARY_TRUE@@HAVE_W32_FALSE@CURL_FORK_TEST = test_get_response_cleanup @HAVE_CURL_TRUE@TESTS = $(check_PROGRAMS) @HAVE_CURL_TRUE@noinst_LIBRARIES = libcurl_version_check.a libcurl_version_check_a_SOURCES = \ @@ -869,9 +898,12 @@ test_concurrent_stop_SOURCES = \ test_concurrent_stop.c +test_concurrent_stop_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + test_concurrent_stop_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + $(PTHREAD_LIBS) @LIBCURL@ test_options_SOURCES = \ test_options.c @@ -896,6 +928,16 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ $(PTHREAD_LIBS) @LIBCURL@ +test_quiesce_stream_SOURCES = \ + test_quiesce_stream.c + +test_quiesce_stream_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_quiesce_stream_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + test_callback_SOURCES = \ test_callback.c @@ -915,9 +957,12 @@ perf_get_concurrent.c \ gauger.h +perf_get_concurrent_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + perf_get_concurrent_LDADD = \ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ - @LIBCURL@ + $(PTHREAD_LIBS) @LIBCURL@ test_digestauth_SOURCES = \ test_digestauth.c @@ -936,10 +981,10 @@ test_get_sendfile_SOURCES = \ test_get_sendfile.c -test_get_sendfile_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la @LIBCURL@ \ - $(am__append_5) -test_get_sendfile_DEPENDENCIES = $(am__append_6) +test_get_sendfile_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_urlparse_SOURCES = \ test_urlparse.c @@ -1002,6 +1047,13 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ +test_delete_SOURCES = \ + test_delete.c + +test_delete_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_put_SOURCES = \ test_put.c @@ -1026,10 +1078,10 @@ test_get_sendfile11_SOURCES = \ test_get_sendfile.c -test_get_sendfile11_LDADD = \ - $(top_builddir)/src/microhttpd/libmicrohttpd.la @LIBCURL@ \ - $(am__append_7) -test_get_sendfile11_DEPENDENCIES = $(am__append_8) +test_get_sendfile11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_post11_SOURCES = \ test_post.c @@ -1072,6 +1124,13 @@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ @LIBCURL@ +test_large_put_inc11_SOURCES = \ + test_large_put.c + +test_large_put_inc11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + test_long_header_SOURCES = \ test_long_header.c @@ -1173,7 +1232,7 @@ perf_get_concurrent$(EXEEXT): $(perf_get_concurrent_OBJECTS) $(perf_get_concurrent_DEPENDENCIES) $(EXTRA_perf_get_concurrent_DEPENDENCIES) @rm -f perf_get_concurrent$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(perf_get_concurrent_OBJECTS) $(perf_get_concurrent_LDADD) $(LIBS) + $(AM_V_CCLD)$(perf_get_concurrent_LINK) $(perf_get_concurrent_OBJECTS) $(perf_get_concurrent_LDADD) $(LIBS) test_callback$(EXEEXT): $(test_callback_OBJECTS) $(test_callback_DEPENDENCIES) $(EXTRA_test_callback_DEPENDENCIES) @rm -f test_callback$(EXEEXT) @@ -1181,7 +1240,11 @@ test_concurrent_stop$(EXEEXT): $(test_concurrent_stop_OBJECTS) $(test_concurrent_stop_DEPENDENCIES) $(EXTRA_test_concurrent_stop_DEPENDENCIES) @rm -f test_concurrent_stop$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_concurrent_stop_OBJECTS) $(test_concurrent_stop_LDADD) $(LIBS) + $(AM_V_CCLD)$(test_concurrent_stop_LINK) $(test_concurrent_stop_OBJECTS) $(test_concurrent_stop_LDADD) $(LIBS) + +test_delete$(EXEEXT): $(test_delete_OBJECTS) $(test_delete_DEPENDENCIES) $(EXTRA_test_delete_DEPENDENCIES) + @rm -f test_delete$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_delete_OBJECTS) $(test_delete_LDADD) $(LIBS) test_digestauth$(EXEEXT): $(test_digestauth_OBJECTS) $(test_digestauth_DEPENDENCIES) $(EXTRA_test_digestauth_DEPENDENCIES) @rm -f test_digestauth$(EXEEXT) @@ -1227,6 +1290,10 @@ @rm -f test_large_put11$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_large_put11_OBJECTS) $(test_large_put11_LDADD) $(LIBS) +test_large_put_inc11$(EXEEXT): $(test_large_put_inc11_OBJECTS) $(test_large_put_inc11_DEPENDENCIES) $(EXTRA_test_large_put_inc11_DEPENDENCIES) + @rm -f test_large_put_inc11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_large_put_inc11_OBJECTS) $(test_large_put_inc11_LDADD) $(LIBS) + test_long_header$(EXEEXT): $(test_long_header_OBJECTS) $(test_long_header_DEPENDENCIES) $(EXTRA_test_long_header_DEPENDENCIES) @rm -f test_long_header$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_long_header_OBJECTS) $(test_long_header_LDADD) $(LIBS) @@ -1291,6 +1358,10 @@ @rm -f test_quiesce$(EXEEXT) $(AM_V_CCLD)$(test_quiesce_LINK) $(test_quiesce_OBJECTS) $(test_quiesce_LDADD) $(LIBS) +test_quiesce_stream$(EXEEXT): $(test_quiesce_stream_OBJECTS) $(test_quiesce_stream_DEPENDENCIES) $(EXTRA_test_quiesce_stream_DEPENDENCIES) + @rm -f test_quiesce_stream$(EXEEXT) + $(AM_V_CCLD)$(test_quiesce_stream_LINK) $(test_quiesce_stream_OBJECTS) $(test_quiesce_stream_LDADD) $(LIBS) + test_start_stop$(EXEEXT): $(test_start_stop_OBJECTS) $(test_start_stop_DEPENDENCIES) $(EXTRA_test_start_stop_DEPENDENCIES) @rm -f test_start_stop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_start_stop_OBJECTS) $(test_start_stop_LDADD) $(LIBS) @@ -1315,9 +1386,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_version_check.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_get.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_get_concurrent.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_callback.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_concurrent_stop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_delete.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_digestauth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_digestauth_with_arguments.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get.Po@am__quote@ @@ -1337,6 +1409,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put_chunked.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quiesce-test_quiesce.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_start_stop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_termination.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_timeout.Po@am__quote@ @@ -1366,6 +1439,34 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +perf_get_concurrent-perf_get_concurrent.o: perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -MT perf_get_concurrent-perf_get_concurrent.o -MD -MP -MF $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo -c -o perf_get_concurrent-perf_get_concurrent.o `test -f 'perf_get_concurrent.c' || echo '$(srcdir)/'`perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='perf_get_concurrent.c' object='perf_get_concurrent-perf_get_concurrent.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -c -o perf_get_concurrent-perf_get_concurrent.o `test -f 'perf_get_concurrent.c' || echo '$(srcdir)/'`perf_get_concurrent.c + +perf_get_concurrent-perf_get_concurrent.obj: perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -MT perf_get_concurrent-perf_get_concurrent.obj -MD -MP -MF $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo -c -o perf_get_concurrent-perf_get_concurrent.obj `if test -f 'perf_get_concurrent.c'; then $(CYGPATH_W) 'perf_get_concurrent.c'; else $(CYGPATH_W) '$(srcdir)/perf_get_concurrent.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='perf_get_concurrent.c' object='perf_get_concurrent-perf_get_concurrent.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -c -o perf_get_concurrent-perf_get_concurrent.obj `if test -f 'perf_get_concurrent.c'; then $(CYGPATH_W) 'perf_get_concurrent.c'; else $(CYGPATH_W) '$(srcdir)/perf_get_concurrent.c'; fi` + +test_concurrent_stop-test_concurrent_stop.o: test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -MT test_concurrent_stop-test_concurrent_stop.o -MD -MP -MF $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo -c -o test_concurrent_stop-test_concurrent_stop.o `test -f 'test_concurrent_stop.c' || echo '$(srcdir)/'`test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_concurrent_stop.c' object='test_concurrent_stop-test_concurrent_stop.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -c -o test_concurrent_stop-test_concurrent_stop.o `test -f 'test_concurrent_stop.c' || echo '$(srcdir)/'`test_concurrent_stop.c + +test_concurrent_stop-test_concurrent_stop.obj: test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -MT test_concurrent_stop-test_concurrent_stop.obj -MD -MP -MF $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo -c -o test_concurrent_stop-test_concurrent_stop.obj `if test -f 'test_concurrent_stop.c'; then $(CYGPATH_W) 'test_concurrent_stop.c'; else $(CYGPATH_W) '$(srcdir)/test_concurrent_stop.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_concurrent_stop.c' object='test_concurrent_stop-test_concurrent_stop.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -c -o test_concurrent_stop-test_concurrent_stop.obj `if test -f 'test_concurrent_stop.c'; then $(CYGPATH_W) 'test_concurrent_stop.c'; else $(CYGPATH_W) '$(srcdir)/test_concurrent_stop.c'; fi` + test_quiesce-test_quiesce.o: test_quiesce.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -MT test_quiesce-test_quiesce.o -MD -MP -MF $(DEPDIR)/test_quiesce-test_quiesce.Tpo -c -o test_quiesce-test_quiesce.o `test -f 'test_quiesce.c' || echo '$(srcdir)/'`test_quiesce.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce-test_quiesce.Tpo $(DEPDIR)/test_quiesce-test_quiesce.Po @@ -1380,6 +1481,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -c -o test_quiesce-test_quiesce.obj `if test -f 'test_quiesce.c'; then $(CYGPATH_W) 'test_quiesce.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce.c'; fi` +test_quiesce_stream-test_quiesce_stream.o: test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -MT test_quiesce_stream-test_quiesce_stream.o -MD -MP -MF $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo -c -o test_quiesce_stream-test_quiesce_stream.o `test -f 'test_quiesce_stream.c' || echo '$(srcdir)/'`test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce_stream.c' object='test_quiesce_stream-test_quiesce_stream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -c -o test_quiesce_stream-test_quiesce_stream.o `test -f 'test_quiesce_stream.c' || echo '$(srcdir)/'`test_quiesce_stream.c + +test_quiesce_stream-test_quiesce_stream.obj: test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -MT test_quiesce_stream-test_quiesce_stream.obj -MD -MP -MF $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo -c -o test_quiesce_stream-test_quiesce_stream.obj `if test -f 'test_quiesce_stream.c'; then $(CYGPATH_W) 'test_quiesce_stream.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce_stream.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce_stream.c' object='test_quiesce_stream-test_quiesce_stream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -c -o test_quiesce_stream-test_quiesce_stream.obj `if test -f 'test_quiesce_stream.c'; then $(CYGPATH_W) 'test_quiesce_stream.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce_stream.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1654,16 +1769,16 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -test_put.log: test_put$(EXEEXT) - @p='test_put$(EXEEXT)'; \ - b='test_put'; \ +test_delete.log: test_delete$(EXEEXT) + @p='test_delete$(EXEEXT)'; \ + b='test_delete'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -test_concurrent_stop.log: test_concurrent_stop$(EXEEXT) - @p='test_concurrent_stop$(EXEEXT)'; \ - b='test_concurrent_stop'; \ +test_put.log: test_put$(EXEEXT) + @p='test_put$(EXEEXT)'; \ + b='test_put'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ @@ -1724,6 +1839,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test_large_put_inc11.log: test_large_put_inc11$(EXEEXT) + @p='test_large_put_inc11$(EXEEXT)'; \ + b='test_large_put_inc11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test_long_header.log: test_long_header$(EXEEXT) @p='test_long_header$(EXEEXT)'; \ b='test_long_header'; \ @@ -1780,6 +1902,13 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +perf_get.log: perf_get$(EXEEXT) + @p='perf_get$(EXEEXT)'; \ + b='perf_get'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test_get_response_cleanup.log: test_get_response_cleanup$(EXEEXT) @p='test_get_response_cleanup$(EXEEXT)'; \ b='test_get_response_cleanup'; \ @@ -1787,9 +1916,16 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -perf_get.log: perf_get$(EXEEXT) - @p='perf_get$(EXEEXT)'; \ - b='perf_get'; \ +test_quiesce.log: test_quiesce$(EXEEXT) + @p='test_quiesce$(EXEEXT)'; \ + b='test_quiesce'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_concurrent_stop.log: test_concurrent_stop$(EXEEXT) + @p='test_concurrent_stop$(EXEEXT)'; \ + b='test_concurrent_stop'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ @@ -1801,9 +1937,9 @@ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) -test_quiesce.log: test_quiesce$(EXEEXT) - @p='test_quiesce$(EXEEXT)'; \ - b='test_quiesce'; \ +test_quiesce_stream.log: test_quiesce_stream$(EXEEXT) + @p='test_quiesce_stream$(EXEEXT)'; \ + b='test_quiesce_stream'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/perf_get.c libmicrohttpd-0.9.55/src/testcurl/perf_get.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/perf_get.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/perf_get.c 2017-05-28 22:34:00.000000000 +0200 @@ -28,7 +28,7 @@ * so the performance scores calculated with this code * should NOT be used to compare with other HTTP servers * (since MHD is actually better); only the relative - * scores between MHD versions are meaningful. + * scores between MHD versions are meaningful. * Furthermore, this code ONLY tests MHD processing * a single request at a time. This is again * not universally meaningful (i.e. when comparing @@ -80,11 +80,11 @@ /** - * Get the current timestamp + * Get the current timestamp * * @return current time in ms */ -static unsigned long long +static unsigned long long now () { struct timeval tv; @@ -98,7 +98,7 @@ /** * Start the timer. */ -static void +static void start_timer() { start_time = now (); @@ -110,7 +110,7 @@ * * @param desc description of the threading mode we used */ -static void +static void stop (const char *desc) { double rps = ((double) (ROUNDS * 1000)) / ((double) (now() - start_time)); @@ -136,8 +136,8 @@ static size_t -copyBuffer (void *ptr, - size_t size, size_t nmemb, +copyBuffer (void *ptr, + size_t size, size_t nmemb, void *ctx) { struct CBC *cbc = ctx; @@ -192,7 +192,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -226,8 +226,9 @@ } curl_easy_cleanup (c); } - stop (poll_flag == MHD_USE_POLL ? "internal poll" : - poll_flag == MHD_USE_EPOLL_LINUX_ONLY ? "internal epoll" : "internal select"); + stop (poll_flag == MHD_USE_AUTO ? "internal thread with 'auto'" : + poll_flag == MHD_USE_POLL ? "internal thread with poll()" : + poll_flag == MHD_USE_EPOLL ? "internal thread with epoll" : "internal thread with select()"); MHD_stop_daemon (d); if (cbc.pos != strlen ("/hello_world")) return 4; @@ -252,7 +253,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -286,8 +287,10 @@ } curl_easy_cleanup (c); } - stop ((poll_flag & MHD_USE_POLL) ? "thread with poll" : - (poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread with epoll" : "thread with select"); + stop ((poll_flag & MHD_USE_AUTO) ? "internal thread with 'auto' and thread per connection" : + (poll_flag & MHD_USE_POLL) ? "internal thread with poll() and thread per connection" : + (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll and thread per connection" : + "internal thread with select() and thread per connection"); MHD_stop_daemon (d); if (cbc.pos != strlen ("/hello_world")) return 64; @@ -311,7 +314,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -346,8 +349,9 @@ } curl_easy_cleanup (c); } - stop (0 != (poll_flag & MHD_USE_POLL) ? "thread pool with poll" : - 0 != (poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread pool with epoll" : "thread pool with select"); + stop (0 != (poll_flag & MHD_USE_AUTO) ? "internal thread pool with 'auto'" : + 0 != (poll_flag & MHD_USE_POLL) ? "internal thread pool with poll()" : + 0 != (poll_flag & MHD_USE_EPOLL) ? "internal thread pool with epoll" : "internal thread pool with select()"); MHD_stop_daemon (d); if (cbc.pos != strlen ("/hello_world")) return 64; @@ -368,7 +372,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -381,7 +390,7 @@ multi = NULL; cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -421,12 +430,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (c != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -435,7 +445,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -445,7 +455,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -510,6 +524,9 @@ "/hello_world", MHD_RESPMEM_MUST_COPY); errorCount += testExternalGet (port++); + errorCount += testInternalGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedPoolGet (port++, MHD_USE_AUTO); errorCount += testInternalGet (port++, 0); errorCount += testMultithreadedGet (port++, 0); errorCount += testMultithreadedPoolGet (port++, 0); @@ -521,8 +538,8 @@ } if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) { - errorCount += testInternalGet(port++, MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL_LINUX_ONLY); + errorCount += testInternalGet(port++, MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL); } MHD_destroy_response (response); if (errorCount != 0) diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/perf_get_concurrent.c libmicrohttpd-0.9.55/src/testcurl/perf_get_concurrent.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/perf_get_concurrent.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/perf_get_concurrent.c 2017-05-28 22:34:00.000000000 +0200 @@ -28,7 +28,7 @@ * so the performance scores calculated with this code * should NOT be used to compare with other HTTP servers * (since MHD is actually better); only the relative - * scores between MHD versions are meaningful. + * scores between MHD versions are meaningful. * @author Christian Grothoff */ @@ -39,6 +39,7 @@ #include #include #include +#include #include "gauger.h" #if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 @@ -74,13 +75,18 @@ */ static unsigned long long start_time; +/** + * Set to 1 if the worker threads are done. + */ +static volatile int signal_done; + /** - * Get the current timestamp + * Get the current timestamp * * @return current time in ms */ -static unsigned long long +static unsigned long long now () { struct timeval tv; @@ -94,7 +100,7 @@ /** * Start the timer. */ -static void +static void start_timer() { start_time = now (); @@ -106,7 +112,7 @@ * * @param desc description of the threading mode we used */ -static void +static void stop (const char *desc) { double rps = ((double) (PAR * ROUNDS * 1000)) / ((double) (now() - start_time)); @@ -124,13 +130,14 @@ static size_t -copyBuffer (void *ptr, - size_t size, size_t nmemb, +copyBuffer (void *ptr, + size_t size, size_t nmemb, void *ctx) { return size * nmemb; } + static int ahc_echo (void *cls, struct MHD_Connection *connection, @@ -159,73 +166,75 @@ } -static pid_t -do_gets (int port) +static void * +thread_gets (void *param) { - pid_t ret; CURL *c; CURLcode errornum; unsigned int i; - unsigned int j; - pid_t par[PAR]; - char url[64]; + char * const url = (char*) param; - sprintf(url, "http://127.0.0.1:%d/hello_world", port); - - ret = fork (); - if (ret == -1) abort (); - if (ret != 0) - return ret; - for (j=0;j= 0; j--) + pthread_join(par[j], NULL); + return "pthread_create error"; + } + } + for (j=0;j 0) ) { - max = MHD_INVALID_SOCKET; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO(&ws); FD_ZERO(&rs); FD_ZERO(&es); curl_multi_perform (multi, &running); if (NULL != multi) { - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -153,7 +164,7 @@ } } if (MHD_YES != - MHD_get_fdset(d, &rs, &ws, &es, &max)) + MHD_get_fdset(d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -163,7 +174,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select(max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } if (NULL != multi) { curl_multi_perform (multi, &running); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_concurrent_stop.c libmicrohttpd-0.9.55/src/testcurl/test_concurrent_stop.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_concurrent_stop.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_concurrent_stop.c 2017-05-28 22:34:00.000000000 +0200 @@ -1,6 +1,6 @@ /* This file is part of libmicrohttpd - Copyright (C) 2007, 2009, 2011, 2015 Christian Grothoff + Copyright (C) 2007, 2009, 2011, 2015, 2016 Christian Grothoff libmicrohttpd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -30,6 +30,7 @@ #include #include #include +#include #include "gauger.h" #ifdef CPU_COUNT @@ -68,13 +69,15 @@ return size * nmemb; } + static int ahc_echo (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, + const char *upload_data, + size_t *upload_data_size, void **unused) { static int ptr; @@ -97,99 +100,139 @@ return ret; } +static void +clean_curl(void * param) +{ + if (param) + { + CURL * const c = *((CURL **)param); + if (c) + curl_easy_cleanup (c); + } +} -static pid_t -do_gets (int port) +static void * +thread_gets (void *param) { - pid_t ret; CURL *c; CURLcode errornum; unsigned int i; - unsigned int j; - pid_t par[PAR]; + char * const url = (char*) param; + int pth_olst; + if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &pth_olst) || + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &pth_olst) ) + { + fprintf(stderr, + "pthread_setcancelstate()/pthread_setcanceltype() failed.\n"); + _exit(99); + } + + for (i=0;i= 0; j--) + { + pthread_cancel(par[j]); + pthread_join(par[j], NULL); + } + _exit(99); + } } + sleep (1); for (j=0;j +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + + if (0 != strcasecmp ("DELETE", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != 8) + return MHD_YES; /* not yet ready */ + if (0 == memcmp (upload_data, "Hello123", 8)) + { + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), (void*) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + // NOTE: use of CONNECTTIMEOUT without also + // setting NOSIGNAL results in really weird + // crashes on my system! + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + + +static int +testMultithreadedDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1081, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + // NOTE: use of CONNECTTIMEOUT without also + // setting NOSIGNAL results in really weird + // crashes on my system! + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + +static int +testMultithreadedPoolDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1081, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + // NOTE: use of CONNECTTIMEOUT without also + // setting NOSIGNAL results in really weird + // crashes on my system! + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + + +static int +testExternalDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 1082, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + // NOTE: use of CONNECTTIMEOUT without also + // setting NOSIGNAL results in really weird + // crashes on my system! + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalDelete (); + errorCount += testMultithreadedDelete (); + errorCount += testMultithreadedPoolDelete (); + errorCount += testExternalDelete (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_digestauth.c libmicrohttpd-0.9.55/src/testcurl/test_digestauth.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_digestauth.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_digestauth.c 2017-05-28 22:34:00.000000000 +0200 @@ -189,7 +189,7 @@ return 1; } #endif - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1337, NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, MHD_OPTION_NONCE_NC_SIZE, 300, diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_digestauth_with_arguments.c libmicrohttpd-0.9.55/src/testcurl/test_digestauth_with_arguments.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_digestauth_with_arguments.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_digestauth_with_arguments.c 2017-05-28 22:34:00.000000000 +0200 @@ -184,7 +184,7 @@ return 1; } #endif - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1337, NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, MHD_OPTION_NONCE_NC_SIZE, 300, diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get.c libmicrohttpd-0.9.55/src/testcurl/test_get.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_get.c 2017-05-28 22:34:00.000000000 +0200 @@ -27,12 +27,13 @@ #include "MHD_config.h" #include "platform.h" -#include "platform_interface.h" #include #include #include #include #include +#include "mhd_sockets.h" /* only macros used */ + #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN @@ -88,7 +89,7 @@ struct MHD_Response *response; int ret; - if (0 != strcmp (me, method)) + if (0 != strcasecmp (me, method)) return MHD_NO; /* unexpected method */ if (&ptr != *unused) { @@ -119,7 +120,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -169,7 +170,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -219,7 +220,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -270,7 +271,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -280,7 +286,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -319,12 +325,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -333,7 +340,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -343,7 +350,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -401,7 +412,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 1, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_SOCK_ADDR, &addr, MHD_OPTION_END); @@ -462,9 +473,8 @@ MHD_socket fd; struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, - 1081, NULL, NULL, &ahc_echo, "GET", - MHD_OPTION_CONNECTION_TIMEOUT, 5, MHD_OPTION_END); + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -483,7 +493,7 @@ if (connect (fd, (struct sockaddr *)(&sin), sizeof(sin)) < 0) { fprintf(stderr, "connect error\n"); - MHD_socket_close_ (fd); + MHD_socket_close_chk_ (fd); return 512; } @@ -494,7 +504,7 @@ /* printf("Stopping daemon\n"); */ MHD_stop_daemon (d); - MHD_socket_close_ (fd); + MHD_socket_close_chk_ (fd); /* printf("good\n"); */ return 0; @@ -514,7 +524,7 @@ struct MHD_Response *response; int ret; - if (0 != strcmp ("GET", method)) + if (0 != strcasecmp ("GET", method)) return MHD_NO; /* unexpected method */ if (&ptr != *unused) { @@ -560,7 +570,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 11081, NULL, NULL, &ahc_empty, NULL, MHD_OPTION_END); if (d == NULL) return 4194304; @@ -628,10 +638,10 @@ } if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) { - errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testUnknownPortGet(MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testEmptyGet(MHD_USE_EPOLL_LINUX_ONLY); + errorCount += testInternalGet(MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); + errorCount += testUnknownPortGet(MHD_USE_EPOLL); + errorCount += testEmptyGet(MHD_USE_EPOLL); } if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_chunked.c libmicrohttpd-0.9.55/src/testcurl/test_get_chunked.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_chunked.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_get_chunked.c 2017-05-28 22:34:00.000000000 +0200 @@ -164,7 +164,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -206,7 +206,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -248,7 +248,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -291,7 +291,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -301,7 +306,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -337,12 +342,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -351,7 +357,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -361,7 +367,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_response_cleanup.c libmicrohttpd-0.9.55/src/testcurl/test_get_response_cleanup.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_response_cleanup.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_get_response_cleanup.c 2017-05-28 22:34:00.000000000 +0200 @@ -35,6 +35,9 @@ #include #include #include +#ifdef __sun +#include +#endif /* __sun */ #ifndef WINDOWS #include @@ -71,12 +74,13 @@ if (ret != 0) return ret; execlp ("curl", "curl", "-s", "-N", "-o", "/dev/null", "-GET", url, NULL); - fprintf (stderr, + fprintf (stderr, "Failed to exec curl: %s\n", strerror (errno)); - _exit (-1); + _exit (-1); } + static void kill_curl (pid_t pid) { @@ -97,6 +101,7 @@ return 1; } + static void push_free_callback (void *cls) { @@ -130,7 +135,7 @@ return MHD_YES; } *unused = NULL; - response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 32 * 1024, &push_callback, &ok, @@ -150,7 +155,7 @@ pid_t curl; ok = 1; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -165,19 +170,20 @@ return 0; } + static int testMultithreadedGet () { struct MHD_Daemon *d; pid_t curl; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + ok = 1; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2, MHD_OPTION_END); if (d == NULL) return 16; - ok = 1; //fprintf (stderr, "Forking cURL!\n"); curl = fork_curl ("http://127.0.0.1:1081/"); sleep (1); @@ -201,18 +207,19 @@ return 0; } + static int testMultithreadedPoolGet () { struct MHD_Daemon *d; pid_t curl; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + ok = 1; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) return 64; - ok = 1; curl = fork_curl ("http://127.0.0.1:1081/"); sleep (1); kill_curl (curl); @@ -224,6 +231,7 @@ return 0; } + static int testExternalGet () { @@ -236,12 +244,13 @@ struct timeval tv; pid_t curl; - d = MHD_start_daemon (MHD_USE_DEBUG, + ok = 1; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; curl = fork_curl ("http://127.0.0.1:1082/"); - + start = time (NULL); while ((time (NULL) - start < 2)) { @@ -256,7 +265,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } MHD_run (d); } kill_curl (curl); @@ -274,7 +287,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } MHD_run (d); } // fprintf (stderr, "Stopping daemon!\n"); @@ -289,6 +306,13 @@ main (int argc, char *const *argv) { unsigned int errorCount = 0; +#ifdef __sun + struct sigaction act; + + /* Solaris has no way to disable SIGPIPE on socket disconnect. */ + act.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &act, NULL); +#endif /* __sun */ oneone = (NULL != strrchr (argv[0], (int) '/')) ? (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_sendfile.c libmicrohttpd-0.9.55/src/testcurl/test_get_sendfile.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_get_sendfile.c 2015-07-25 15:54:56.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_get_sendfile.c 2017-05-28 22:34:00.000000000 +0200 @@ -25,7 +25,6 @@ #include "MHD_config.h" #include "platform.h" -#include "platform_interface.h" #include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include "mhd_sockets.h" #ifndef WINDOWS #include @@ -101,7 +101,7 @@ { fprintf (stderr, "Failed to open `%s': %s\n", sourcefile, - MHD_strerror_ (errno)); + strerror (errno)); exit (1); } response = MHD_create_response_from_fd (strlen (TESTSTR), fd); @@ -125,7 +125,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -175,7 +175,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -225,7 +225,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -276,7 +276,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -286,7 +291,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -325,12 +330,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -339,7 +345,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -349,7 +355,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -407,7 +417,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_SOCK_ADDR, &addr, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_iplimit.c libmicrohttpd-0.9.55/src/testcurl/test_iplimit.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_iplimit.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_iplimit.c 2017-05-28 22:34:00.000000000 +0200 @@ -117,7 +117,7 @@ if (!oneone) return 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2, @@ -208,7 +208,7 @@ if (!oneone) return 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_large_put.c libmicrohttpd-0.9.55/src/testcurl/test_large_put.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_large_put.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_large_put.c 2017-05-28 22:34:00.000000000 +0200 @@ -36,6 +36,8 @@ #include #endif +#include "test_helpers.h" + #if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 #undef CPU_COUNT #endif @@ -44,16 +46,9 @@ #endif static int oneone; +static int incr_read; /* Use incremental read */ +static int verbose; /* Be verbose */ -/** - * Do not make this much larger since we will hit the - * MHD default buffer limit and the test code is not - * written for incremental upload processing... - * (larger values will likely cause MHD to generate - * an internal server error -- which would be avoided - * by writing the putBuffer method in a more general - * fashion). - */ #define PUT_SIZE (256 * 1024) static char *put_buffer; @@ -65,13 +60,41 @@ size_t size; }; +char* +alloc_init(size_t buf_size) +{ + static const char template[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz"; + static const size_t templ_size = sizeof(template) / sizeof(char) - 1; + char *buf; + char *fill_ptr; + size_t to_fill; + + buf = malloc(buf_size); + if (NULL == buf) + return NULL; + + fill_ptr = buf; + to_fill = buf_size; + while (to_fill > 0) + { + const size_t to_copy = to_fill > templ_size ? templ_size : to_fill; + memcpy (fill_ptr, template, to_copy); + fill_ptr += to_copy; + to_fill -= to_copy; + } + return buf; +} + static size_t putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) { - unsigned int *pos = ptr; - unsigned int wrt; + size_t *pos = (size_t *)ptr; + size_t wrt; wrt = size * nmemb; + /* Check for overflow. */ + if (wrt / size != nmemb) + return 0; if (wrt > PUT_SIZE - (*pos)) wrt = PUT_SIZE - (*pos); memcpy (stream, &put_buffer[*pos], wrt); @@ -98,39 +121,50 @@ const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **pparam) { int *done = cls; struct MHD_Response *response; int ret; + static size_t processed; if (0 != strcmp ("PUT", method)) return MHD_NO; /* unexpected method */ if ((*done) == 0) { - if (*upload_data_size != PUT_SIZE) + size_t *pproc; + if (NULL == *pparam) { -#if 0 - fprintf (stderr, - "Waiting for more data (%u/%u)...\n", - *upload_data_size, PUT_SIZE); -#endif - return MHD_YES; /* not yet ready */ + processed = 0; + *pparam = &processed; /* Safe as long as only one parallel request served. */ } - if (0 == memcmp (upload_data, put_buffer, PUT_SIZE)) + pproc = (size_t*) *pparam; + + if (0 == *upload_data_size) + return MHD_YES; /* No data to process. */ + + if (*pproc + *upload_data_size > PUT_SIZE) { - *upload_data_size = 0; + fprintf (stderr, "Incoming data larger than expected.\n"); + return MHD_NO; } - else + if ( (!incr_read) && (*upload_data_size != PUT_SIZE) ) + return MHD_YES; /* Wait until whole request is received. */ + + if (0 != memcmp(upload_data, put_buffer + (*pproc), *upload_data_size)) { - printf ("Invalid upload data!\n"); + fprintf (stderr, "Incoming data does not match sent data.\n"); return MHD_NO; } - *done = 1; + *pproc += *upload_data_size; + *upload_data_size = 0; /* Current block of data is fully processed. */ + + if (PUT_SIZE == *pproc) + *done = 1; /* Whole request is processed. */ return MHD_YES; } response = MHD_create_response_from_buffer (strlen (url), - (void *) url, + (void *) url, MHD_RESPMEM_MUST_COPY); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); @@ -139,12 +173,12 @@ static int -testInternalPut () +testPutInternalThread (unsigned int add_flag) { struct MHD_Daemon *d; CURL *c; struct CBC cbc; - unsigned int pos = 0; + size_t pos = 0; int done_flag = 0; CURLcode errornum; char buf[2048]; @@ -152,10 +186,10 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | add_flag, 1080, - NULL, NULL, &ahc_echo, &done_flag, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (1024*1024), + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), MHD_OPTION_END); if (d == NULL) return 1; @@ -197,12 +231,12 @@ } static int -testMultithreadedPut () +testPutThreadPerConn (unsigned int add_flag) { struct MHD_Daemon *d; CURL *c; struct CBC cbc; - unsigned int pos = 0; + size_t pos = 0; int done_flag = 0; CURLcode errornum; char buf[2048]; @@ -210,10 +244,11 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | + MHD_USE_ERROR_LOG | add_flag, 1081, - NULL, NULL, &ahc_echo, &done_flag, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (1024*1024), + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), MHD_OPTION_END); if (d == NULL) return 16; @@ -258,12 +293,12 @@ } static int -testMultithreadedPoolPut () +testPutThreadPool (unsigned int add_flag) { struct MHD_Daemon *d; CURL *c; struct CBC cbc; - unsigned int pos = 0; + size_t pos = 0; int done_flag = 0; CURLcode errornum; char buf[2048]; @@ -271,11 +306,11 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | add_flag, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (1024*1024), + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), MHD_OPTION_END); if (d == NULL) return 16; @@ -320,7 +355,7 @@ } static int -testExternalPut () +testPutExternal (void) { struct MHD_Daemon *d; CURL *c; @@ -330,12 +365,17 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; struct timeval tv; - unsigned int pos = 0; + size_t pos = 0; int done_flag = 0; char buf[2048]; @@ -343,11 +383,11 @@ cbc.size = 2048; cbc.pos = 0; multi = NULL; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, &done_flag, - MHD_OPTION_CONNECTION_MEMORY_LIMIT, - (size_t) (PUT_SIZE * 4), MHD_OPTION_END); + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), + MHD_OPTION_END); if (d == NULL) return 256; c = curl_easy_init (); @@ -389,12 +429,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -403,7 +444,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -413,7 +454,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -459,21 +504,63 @@ main (int argc, char *const *argv) { unsigned int errorCount = 0; + unsigned int lastErr; - oneone = (NULL != strrchr (argv[0], (int) '/')) ? - (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + oneone = has_in_name(argv[0], "11"); + incr_read = has_in_name(argv[0], "_inc"); + verbose = has_param(argc, argv, "-v"); if (0 != curl_global_init (CURL_GLOBAL_WIN32)) - return 2; - put_buffer = malloc (PUT_SIZE); - if (NULL == put_buffer) return 1; - memset (put_buffer, 1, PUT_SIZE); - errorCount += testInternalPut (); - errorCount += testMultithreadedPut (); - errorCount += testMultithreadedPoolPut (); - errorCount += testExternalPut (); + return 99; + put_buffer = alloc_init (PUT_SIZE); + if (NULL == put_buffer) + return 99; + lastErr = testPutInternalThread (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with select().\n"); + errorCount += lastErr; + lastErr = testPutThreadPerConn (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread per connection with select().\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with select().\n"); + errorCount += lastErr; + lastErr = testPutExternal (); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with external select().\n"); + errorCount += lastErr; + if (MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + lastErr = testPutInternalThread (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with poll().\n"); + errorCount += lastErr; + lastErr = testPutThreadPerConn (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread per connection with poll().\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with poll().\n"); + errorCount += lastErr; + } + if (MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + lastErr = testPutInternalThread (MHD_USE_EPOLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with epoll.\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (MHD_USE_EPOLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with epoll.\n"); + errorCount += lastErr; + } free (put_buffer); if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); + else if (verbose) + printf ("All checks passed successfully.\n"); curl_global_cleanup (); - return errorCount != 0; /* 0 == pass */ + return (errorCount == 0) ? 0 : 1; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_long_header.c libmicrohttpd-0.9.55/src/testcurl/test_long_header.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_long_header.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_long_header.c 2017-05-28 22:34:00.000000000 +0200 @@ -101,7 +101,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , 1080, &apc_all, NULL, @@ -152,7 +152,7 @@ curl_easy_cleanup (c); MHD_stop_daemon (d); free (url); - if (code != MHD_HTTP_REQUEST_URI_TOO_LONG) + if (code != MHD_HTTP_URI_TOO_LONG) return 8; return 0; } @@ -172,7 +172,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ , + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , 1080, &apc_all, NULL, @@ -230,7 +230,7 @@ curl_easy_cleanup (c); MHD_stop_daemon (d); free (url); - if (code != MHD_HTTP_REQUEST_ENTITY_TOO_LARGE) + if (code != MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE) return 128; return 0; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_options.c libmicrohttpd-0.9.55/src/testcurl/test_options.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_options.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_options.c 2017-05-28 22:34:00.000000000 +0200 @@ -26,6 +26,7 @@ #include "platform.h" #include "microhttpd.h" +#include "mhd_sockets.h" #define MHD_E_MEM "Error: memory error\n" #define MHD_E_SERVER_INIT "Error: failed to start server\n" @@ -89,7 +90,7 @@ daemon_ip_addr6.sin6_addr = in6addr_loopback; #endif - d = MHD_start_daemon (MHD_USE_DEBUG, 4233, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 4233, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, &daemon_ip_addr, MHD_OPTION_END); @@ -99,7 +100,7 @@ MHD_stop_daemon (d); #if HAVE_INET6 - d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_IPv6, 4233, + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 4233, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, &daemon_ip_addr6, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_parse_cookies.c libmicrohttpd-0.9.55/src/testcurl/test_parse_cookies.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_parse_cookies.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_parse_cookies.c 2017-05-28 22:34:00.000000000 +0200 @@ -81,7 +81,6 @@ return MHD_YES; } *unused = NULL; - ret = 0; hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name1"); if ((hdr == NULL) || (0 != strcmp (hdr, "var1"))) @@ -117,7 +116,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -127,7 +131,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -171,12 +175,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -185,7 +190,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -195,7 +200,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_post.c libmicrohttpd-0.9.55/src/testcurl/test_post.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_post.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_post.c 2017-05-28 22:34:00.000000000 +0200 @@ -71,7 +71,7 @@ struct MHD_PostProcessor *pp = *con_cls; if (NULL != pp) - MHD_destroy_post_processor (pp); + MHD_destroy_post_processor (pp); *con_cls = NULL; } @@ -105,10 +105,10 @@ { int *eok = cls; - if ((0 == strcmp (key, "name")) && + if ((0 == strcasecmp (key, "name")) && (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) (*eok) |= 1; - if ((0 == strcmp (key, "project")) && + if ((0 == strcasecmp (key, "project")) && (size == strlen ("curl")) && (0 == strncmp (value, "curl", size))) (*eok) |= 2; return MHD_YES; @@ -129,7 +129,7 @@ struct MHD_PostProcessor *pp; int ret; - if (0 != strcmp ("POST", method)) + if (0 != strcasecmp ("POST", method)) { printf ("METHOD: %s\n", method); return MHD_NO; /* unexpected method */ @@ -170,9 +170,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, - 1080, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 1; @@ -224,9 +224,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, - 1081, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1081, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 16; @@ -278,10 +278,10 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 16; @@ -333,7 +333,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -343,9 +348,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, - 1082, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 1082, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 256; @@ -387,12 +392,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -401,7 +407,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -411,7 +417,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -431,8 +441,7 @@ c = NULL; multi = NULL; } - } - MHD_run (d); + } MHD_run (d); } if (multi != NULL) { @@ -461,18 +470,18 @@ struct MHD_Response *response; int ret; - if (0 != strcmp ("POST", method)) + if (0 != strcasecmp ("POST", method)) { fprintf (stderr, "Unexpected method `%s'\n", method); - return MHD_NO; + return MHD_NO; } if (*unused == NULL) { *unused = "wibble"; /* We don't want the body. Send a 500. */ - response = MHD_create_response_from_buffer (0, NULL, + response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); ret = MHD_queue_response(connection, 500, response); if (ret != MHD_YES) @@ -482,7 +491,7 @@ } else { - fprintf(stderr, + fprintf(stderr, "In ahc_cancel again. This should not happen.\n"); return MHD_NO; } @@ -496,24 +505,24 @@ }; -static size_t +static size_t readBuffer(void *p, size_t size, size_t nmemb, void *opaque) { struct CRBC *data = opaque; size_t required = size * nmemb; size_t left = data->size - data->pos; - + if (required > left) required = left; - + memcpy(p, data->buffer + data->pos, required); data->pos += required; - + return required/size; } -static size_t +static size_t slowReadBuffer(void *p, size_t size, size_t nmemb, void *opaque) { sleep(1); @@ -550,8 +559,8 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, - 1081, NULL, NULL, &ahc_cancel, NULL, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1081, NULL, NULL, &ahc_cancel, NULL, MHD_OPTION_END); if (d == NULL) return 32768; @@ -559,7 +568,7 @@ crbc.buffer = "Test content"; crbc.size = strlen(crbc.buffer); crbc.pos = 0; - + c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); @@ -588,30 +597,45 @@ if (flags & FLAG_EXPECT_CONTINUE) headers = curl_slist_append(headers, "Expect: 100-Continue"); curl_easy_setopt(c, CURLOPT_HTTPHEADER, headers); - + if (CURLE_HTTP_RETURNED_ERROR != (errornum = curl_easy_perform (c))) { - fprintf (stderr, - "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n", - curl_easy_strerror (errornum), errornum); +#ifdef _WIN32 + curl_version_info_data *curlverd = curl_version_info(CURLVERSION_NOW); + if (0 != (flags & FLAG_SLOW_READ) && CURLE_RECV_ERROR == errornum && + (curlverd == NULL || curlverd->ares_num < 0x073100) ) + { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */ + fprintf (stderr, "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n"); + result = 0; + } + else +#else /* ! _WIN32 */ + if(1) +#endif /* ! _WIN32 */ + { + fprintf (stderr, + "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n", + curl_easy_strerror (errornum), errornum); + result = 65536; + } curl_easy_cleanup (c); MHD_stop_daemon (d); curl_slist_free_all(headers); - return 65536; + return result; } - + if (CURLE_OK != (cc = curl_easy_getinfo(c, CURLINFO_RESPONSE_CODE, &response_code))) { fprintf(stderr, "curl_easy_getinfo failed: '%s'\n", curl_easy_strerror(errornum)); result = 65536; } - + if (!result && (response_code != 500)) { fprintf(stderr, "Unexpected response code: %ld\n", response_code); result = 131072; } - + if (!result && (cbc.pos != 0)) result = 262144; @@ -628,7 +652,7 @@ int result = 0; int flags; for(flags = 0; flags < FLAG_COUNT; ++flags) - result |= testMultithreadedPostCancelPart(flags); + result |= testMultithreadedPostCancelPart(flags); return result; } diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_postform.c libmicrohttpd-0.9.55/src/testcurl/test_postform.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_postform.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_postform.c 2017-05-28 22:34:00.000000000 +0200 @@ -183,9 +183,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, - 1080, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 1; @@ -239,9 +239,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, - 1081, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 1081, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 16; @@ -295,10 +295,10 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 16; @@ -351,7 +351,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -362,9 +367,9 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, - 1082, NULL, NULL, &ahc_echo, NULL, - MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 1082, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, MHD_OPTION_END); if (d == NULL) return 256; @@ -407,12 +412,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -422,7 +428,7 @@ curl_formfree (pd); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -433,7 +439,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -446,7 +456,8 @@ printf ("%s failed at %s:%d: `%s'\n", "curl_multi_perform", __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); + __LINE__, + curl_easy_strerror (msg->data.result)); curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); curl_easy_cleanup (c); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_post_loop.c libmicrohttpd-0.9.55/src/testcurl/test_post_loop.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_post_loop.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_post_loop.c 2017-05-28 22:34:00.000000000 +0200 @@ -119,7 +119,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); if (d == NULL) return 1; @@ -183,7 +183,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); if (d == NULL) return 16; @@ -247,7 +247,7 @@ cbc.buf = buf; cbc.size = 2048; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -311,7 +311,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -325,7 +330,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); if (d == NULL) return 256; @@ -371,13 +376,14 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform (multi, &running)); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -386,7 +392,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -403,7 +409,7 @@ timeout = 0; /* terminate quickly... */ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) { if (EINTR == errno) continue; diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_process_arguments.c libmicrohttpd-0.9.55/src/testcurl/test_process_arguments.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_process_arguments.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_process_arguments.c 2017-05-28 22:34:00.000000000 +0200 @@ -120,7 +120,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -130,7 +135,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -170,12 +175,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -184,7 +190,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -194,7 +200,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_process_headers.c libmicrohttpd-0.9.55/src/testcurl/test_process_headers.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_process_headers.c 2015-07-25 15:54:56.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_process_headers.c 2017-05-28 22:34:00.000000000 +0200 @@ -157,7 +157,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -206,7 +206,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 16; @@ -255,7 +255,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -305,7 +305,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -315,7 +320,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 21080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; @@ -354,12 +359,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -368,7 +374,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -378,7 +384,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_put.c libmicrohttpd-0.9.55/src/testcurl/test_put.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_put.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_put.c 2017-05-28 22:34:00.000000000 +0200 @@ -91,7 +91,7 @@ struct MHD_Response *response; int ret; - if (0 != strcmp ("PUT", method)) + if (0 != strcasecmp ("PUT", method)) return MHD_NO; /* unexpected method */ if ((*done) == 0) { @@ -131,7 +131,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -187,7 +187,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -244,7 +244,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); @@ -301,7 +301,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -313,7 +318,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -357,12 +362,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -371,7 +377,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -381,7 +387,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_put_chunked.c libmicrohttpd-0.9.55/src/testcurl/test_put_chunked.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_put_chunked.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_put_chunked.c 2017-05-28 22:34:00.000000000 +0200 @@ -141,7 +141,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 11080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -197,7 +197,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 11081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -254,7 +254,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 11081, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); @@ -311,7 +311,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -323,7 +328,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 11082, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); if (d == NULL) @@ -367,12 +372,13 @@ start = time (NULL); while ((time (NULL) - start < 5) && (multi != NULL)) { - max = 0; + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; FD_ZERO (&rs); FD_ZERO (&ws); FD_ZERO (&es); curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); if (mret != CURLM_OK) { curl_multi_remove_handle (multi, c); @@ -381,7 +387,7 @@ MHD_stop_daemon (d); return 2048; } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) { curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); @@ -391,7 +397,11 @@ } tv.tv_sec = 0; tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } curl_multi_perform (multi, &running); if (running == 0) { @@ -404,7 +414,8 @@ printf ("%s failed at %s:%d: `%s'\n", "curl_multi_perform", __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); + __LINE__, + curl_easy_strerror (msg->data.result)); curl_multi_remove_handle (multi, c); curl_multi_cleanup (multi); curl_easy_cleanup (c); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_quiesce.c libmicrohttpd-0.9.55/src/testcurl/test_quiesce.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_quiesce.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_quiesce.c 2017-05-28 22:34:00.000000000 +0200 @@ -25,7 +25,6 @@ #include "MHD_config.h" #include "platform.h" -#include "platform_interface.h" #include #include #include @@ -33,6 +32,8 @@ #include #include #include +#include "mhd_sockets.h" /* only macros used */ + #ifndef WINDOWS #include @@ -124,7 +125,7 @@ fd = (MHD_socket) (intptr_t) param; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_LISTEN_SOCKET, fd, MHD_OPTION_NOTIFY_COMPLETED, &request_completed, &done, @@ -142,17 +143,26 @@ if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) { MHD_stop_daemon (d); - MHD_socket_close_(fd); + MHD_socket_close_chk_(fd); return "MHD_get_fdset() failed"; } tv.tv_sec = 0; tv.tv_usec = 1000; - MHD_SYS_select_ (max + 1, &rs, &ws, &es, &tv); + if (-1 == MHD_SYS_select_ (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } MHD_run (d); } + fd = MHD_quiesce_daemon (d); + if (MHD_INVALID_SOCKET == fd) + { + MHD_stop_daemon (d); + return "MHD_quiesce_daemon() failed in ServeOneRequest()"; + } MHD_stop_daemon (d); - MHD_socket_close_(fd); - return NULL; + return done ? NULL : "Requests was not served by ServeOneRequest()"; } @@ -194,12 +204,12 @@ cbc.size = 2048; cbc.pos = 0; if (pool_count > 0) { - d = MHD_start_daemon (type | MHD_USE_DEBUG | MHD_USE_PIPE_FOR_SHUTDOWN | poll_flag, + d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, pool_count, MHD_OPTION_END); } else { - d = MHD_start_daemon (type | MHD_USE_DEBUG | MHD_USE_PIPE_FOR_SHUTDOWN | poll_flag, + d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); } if (d == NULL) @@ -229,6 +239,14 @@ } fd = MHD_quiesce_daemon (d); + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, + "MHD_quiesce_daemon failed.\n"); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } if (0 != pthread_create(&thrd, NULL, &ServeOneRequest, (void*)(intptr_t) fd)) { fprintf (stderr, "pthread_create failed\n"); @@ -268,7 +286,7 @@ fprintf(stderr, "%s\n", cbc.buf); curl_easy_cleanup (c); MHD_stop_daemon (d); - MHD_socket_close_(fd); + MHD_socket_close_chk_(fd); return 4; } if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) @@ -276,7 +294,7 @@ fprintf(stderr, "%s\n", cbc.buf); curl_easy_cleanup (c); MHD_stop_daemon (d); - MHD_socket_close_(fd); + MHD_socket_close_chk_(fd); return 8; } @@ -288,12 +306,12 @@ fprintf (stderr, "curl_easy_perform should fail\n"); curl_easy_cleanup (c); MHD_stop_daemon (d); - MHD_socket_close_(fd); + MHD_socket_close_chk_(fd); return 2; } curl_easy_cleanup (c); MHD_stop_daemon (d); - MHD_socket_close_(fd); + MHD_socket_close_chk_(fd); return 0; } @@ -311,7 +329,12 @@ fd_set rs; fd_set ws; fd_set es; - MHD_socket max; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ int running; struct CURLMsg *msg; time_t start; @@ -323,8 +346,11 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_DEBUG, - 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 11080, + NULL, NULL, + &ahc_echo, "GET", + MHD_OPTION_END); if (d == NULL) return 256; c = setupCURL(&cbc); @@ -345,81 +371,107 @@ return 1024; } - for (i = 0; i < 2; i++) { - start = time (NULL); - while ((time (NULL) - start < 5) && (multi != NULL)) - { - max = 0; - FD_ZERO (&rs); - FD_ZERO (&ws); - FD_ZERO (&es); - curl_multi_perform (multi, &running); - mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); - if (mret != CURLM_OK) - { - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - MHD_stop_daemon (d); - return 2048; - } - if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) - { - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - MHD_stop_daemon (d); - return 4096; - } - tv.tv_sec = 0; - tv.tv_usec = 1000; - select (max + 1, &rs, &ws, &es, &tv); - curl_multi_perform (multi, &running); - if (running == 0) - { - msg = curl_multi_info_read (multi, &running); - if (msg == NULL) - break; - if (msg->msg == CURLMSG_DONE) - { - if (i == 0 && msg->data.result != CURLE_OK) - printf ("%s failed at %s:%d: `%s'\n", - "curl_multi_perform", - __FILE__, - __LINE__, curl_easy_strerror (msg->data.result)); - else if (i == 1 && msg->data.result == CURLE_OK) - printf ("%s should have failed at %s:%d\n", - "curl_multi_perform", - __FILE__, - __LINE__); - curl_multi_remove_handle (multi, c); - curl_multi_cleanup (multi); - curl_easy_cleanup (c); - c = NULL; - multi = NULL; - } - } - MHD_run (d); - } - - if (i == 0) { - /* quiesce the daemon on the 1st iteration, so the 2nd should fail */ - fd = MHD_quiesce_daemon(d); - if (MHD_INVALID_SOCKET == fd) - abort (); - MHD_socket_close_ (fd); - c = setupCURL (&cbc); - multi = curl_multi_init (); - mret = curl_multi_add_handle (multi, c); - } + for (i = 0; i < 2; i++) + { + start = time (NULL); + while ( (time (NULL) - start < 5) && + (NULL != multi) ) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } + curl_multi_perform (multi, &running); + if (0 == running) + { + msg = curl_multi_info_read (multi, &running); + if (NULL == msg) + break; + if (msg->msg == CURLMSG_DONE) + { + if (i == 0 && msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, + curl_easy_strerror (msg->data.result)); + else if ( (i == 1) && + (msg->data.result == CURLE_OK) ) + printf ("%s should have failed at %s:%d\n", + "curl_multi_perform", + __FILE__, + __LINE__); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + + if (0 == i) + { + /* quiesce the daemon on the 1st iteration, so the 2nd should fail */ + fd = MHD_quiesce_daemon(d); + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, + "MHD_quiesce_daemon failed.\n"); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + c = setupCURL (&cbc); + multi = curl_multi_init (); + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32768; + } + } } - if (multi != NULL) + if (NULL != multi) { curl_multi_remove_handle (multi, c); curl_easy_cleanup (c); curl_multi_cleanup (multi); } MHD_stop_daemon (d); + MHD_socket_close_chk_ (fd); if (cbc.pos != strlen ("/hello_world")) return 8192; if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) @@ -435,20 +487,20 @@ if (0 != curl_global_init (CURL_GLOBAL_WIN32)) return 2; - errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, 0); - errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION, 0, 0); - errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, 0); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, 0); errorCount += testExternalGet (); if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) { - errorCount += testGet(MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_POLL); - errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION, 0, MHD_USE_POLL); - errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_POLL); + errorCount += testGet(MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, MHD_USE_POLL); } if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) { - errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_EPOLL_LINUX_ONLY); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_EPOLL); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, MHD_USE_EPOLL); } if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_quiesce_stream.c libmicrohttpd-0.9.55/src/testcurl/test_quiesce_stream.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_quiesce_stream.c 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testcurl/test_quiesce_stream.c 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,213 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff + + libmicrohttpd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + libmicrohttpd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +/** + * @file test_quiesce_stream.c + * @brief Testcase for libmicrohttpd quiescing + * @author Markus Doppelbauer + * @author Christian Grothoff + */ +#include "mhd_options.h" +#include +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#elif defined(_WIN32) +#include +#define sleep(s) (Sleep((s)*1000), 0) +#endif /* _WIN32 */ + + +static volatile unsigned int request_counter; + + +static void +http_PanicCallback (void *cls, + const char *file, + unsigned int line, + const char *reason) +{ + fprintf( stderr, + "PANIC: exit process: %s at %s:%u\n", + reason, + file, + line); + exit (EXIT_FAILURE); +} + + +static void * +resume_connection (void *arg) +{ + struct MHD_Connection *connection = arg; + + /* fprintf (stderr, "Calling resume\n"); */ + MHD_resume_connection (connection); + return NULL; +} + + +static void +suspend_connection (struct MHD_Connection *connection) +{ + pthread_t thread_id; + + /* fprintf (stderr, "Calling suspend\n"); */ + MHD_suspend_connection (connection); + int status = pthread_create (&thread_id, + NULL, + &resume_connection, + connection); + if (0 != status) + { + fprintf (stderr, + "Could not create thead\n"); + exit( EXIT_FAILURE ); + } + pthread_detach (thread_id); +} + + +struct ContentReaderUserdata +{ + int bytes_written; + struct MHD_Connection *connection; +}; + + +static ssize_t +http_ContentReaderCallback (void *cls, + uint64_t pos, + char *buf, + size_t max) +{ + static const char alphabet[] = "\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + struct ContentReaderUserdata *userdata = cls; + + if( userdata->bytes_written >= 1024) + { + fprintf( stderr, + "finish: %d\n", + request_counter); + return MHD_CONTENT_READER_END_OF_STREAM; + } + userdata->bytes_written++; + buf[0] = alphabet[userdata->bytes_written % (sizeof(alphabet) - 1)]; + suspend_connection (userdata->connection); + + return 1; +} + + +static int +http_AccessHandlerCallback (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls ) +{ + int ret; + + /* Never respond on first call */ + if (NULL == *con_cls) + { + fprintf (stderr, + "start: %d\n", + ++request_counter); + + struct ContentReaderUserdata *userdata = malloc (sizeof(struct ContentReaderUserdata)); + + if (NULL == userdata) + return MHD_NO; + userdata->bytes_written = 0; + userdata->connection = connection; + *con_cls = userdata; + return MHD_YES; + } + + /* Second call: create response */ + struct MHD_Response *response + = MHD_create_response_from_callback (-1, + 32 * 1024, + &http_ContentReaderCallback, + *con_cls, + NULL); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + + suspend_connection (connection); + return ret; +} + + +int +main() +{ + /* Panic callback */ + MHD_set_panic_func (&http_PanicCallback, + NULL); + + /* Flags */ + unsigned int daemon_flags + = MHD_USE_INTERNAL_POLLING_THREAD + | MHD_USE_AUTO + | MHD_ALLOW_SUSPEND_RESUME + | MHD_USE_ITC; + + /* Create daemon */ + struct MHD_Daemon *daemon = MHD_start_daemon (daemon_flags, + 8000, + NULL, + NULL, + &http_AccessHandlerCallback, + NULL, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + if (0 != system ("curl -s http://127.0.0.1:8000")) + { + MHD_stop_daemon (daemon); + return 1; + } + /* wait for a request */ + while (0 == request_counter) + sleep (1); + + fprintf (stderr, + "quiesce\n"); + MHD_quiesce_daemon (daemon); + + /* wait a second */ + sleep (1); + + fprintf (stderr, + "stopping daemon\n"); + MHD_stop_daemon (daemon); + + return 0; +} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_start_stop.c libmicrohttpd-0.9.55/src/testcurl/test_start_stop.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_start_stop.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_start_stop.c 2017-05-28 22:34:00.000000000 +0200 @@ -54,7 +54,7 @@ { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; @@ -67,7 +67,7 @@ { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 2; @@ -80,7 +80,7 @@ { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); if (d == NULL) @@ -94,7 +94,7 @@ { struct MHD_Daemon *d; - d = MHD_start_daemon (MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 8; @@ -120,8 +120,8 @@ } if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) { - errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY); - errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY); + errorCount += testInternalGet(MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); } if (errorCount != 0) fprintf (stderr, "Error (code: %u)\n", errorCount); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_termination.c libmicrohttpd-0.9.55/src/testcurl/test_termination.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_termination.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_termination.c 2017-05-28 22:34:00.000000000 +0200 @@ -91,7 +91,7 @@ { struct MHD_Daemon *daemon; - daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, + daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, PORT, NULL, NULL, connection_handler, NULL, MHD_OPTION_END); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_timeout.c libmicrohttpd-0.9.55/src/testcurl/test_timeout.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_timeout.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_timeout.c 2017-05-28 22:34:00.000000000 +0200 @@ -172,7 +172,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_CONNECTION_TIMEOUT, 2, @@ -227,7 +227,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 1080, NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_CONNECTION_TIMEOUT, 2, diff -Nru libmicrohttpd-0.9.44+dfsg/src/testcurl/test_urlparse.c libmicrohttpd-0.9.55/src/testcurl/test_urlparse.c --- libmicrohttpd-0.9.44+dfsg/src/testcurl/test_urlparse.c 2015-06-30 21:11:10.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testcurl/test_urlparse.c 2017-05-28 22:34:00.000000000 +0200 @@ -134,7 +134,7 @@ cbc.buf = buf; cbc.size = 2048; cbc.pos = 0; - d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | poll_flag, + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/common.c libmicrohttpd-0.9.55/src/testspdy/common.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/common.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/common.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file common.c - * @brief Common functions used by the tests. - * @author Andrey Uzunov - */ - - -#include "common.h" -#include - -#ifdef __GNUC__ -#define FUNC_CONSTRUCTOR(f) static void __attribute__ ((constructor)) f -#define FUNC_DESTRUCTOR(f) static void __attribute__ ((destructor)) f -#else // !__GNUC__ -#define FUNC_CONSTRUCTOR(f) _MHD_EXTERN void f -#define FUNC_DESTRUCTOR(f) _MHD_EXTERN void f -#endif // __GNUC__ - -FUNC_CONSTRUCTOR (constructor)() -{ - printf("\nTEST START -------------------------------------------------------\n"); -} - -FUNC_DESTRUCTOR (destructor)() -{ - printf("------------------------------------------------------- TEST END\n"); -} - -uint16_t -get_port(uint16_t min) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - if(2 > min) min=2; - uint16_t port = min + (tv.tv_usec+10) % ((1 << 16) - min); - - //port = 12345; - printf("Port used: %i\n", port); - - return port; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/common.h libmicrohttpd-0.9.55/src/testspdy/common.h --- libmicrohttpd-0.9.44+dfsg/src/testspdy/common.h 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/common.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file common.h - * @brief Common functions used by the tests. - * @author Andrey Uzunov - */ - -#include -#include -#include -#include - -#define FAIL_TEST(msg) do{\ - printf("%i:%s\n", __LINE__, msg);\ - fflush(stdout);\ - exit(-10);\ - }\ - while(0) - -uint16_t -get_port(uint16_t min); diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/Makefile.am libmicrohttpd-0.9.55/src/testspdy/Makefile.am --- libmicrohttpd-0.9.44+dfsg/src/testspdy/Makefile.am 2015-02-08 00:18:02.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,115 +0,0 @@ -# This Makefile.am is in the public domain -SUBDIRS = . - -AM_CFLAGS = -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" - -if USE_COVERAGE - AM_CFLAGS += -fprofile-arcs -ftest-coverage -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/applicationlayer \ - $(LIBCURL_CPPFLAGS) - -if !HAVE_W32 -PERF_GET_CONCURRENT=perf_get_concurrent -endif - -if ENABLE_SPDY -if HAVE_OPENSSL -check_PROGRAMS = \ - test_daemon_start_stop \ - test_daemon_start_stop_many \ - test_struct_namevalue - -if HAVE_SPDYLAY -check_PROGRAMS += \ - test_new_connection \ - test_request_response \ - test_notls \ - test_request_response_with_callback \ - test_misc \ - test_session_timeout - #test_requests_with_assets -if HAVE_CURL_BINARY -check_PROGRAMS += \ - test_proxies -endif -endif -endif -endif - - -TESTS = $(check_PROGRAMS) - - -SPDY_SOURCES= \ - common.h common.c - -SPDY_LDADD= \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -test_daemon_start_stop_SOURCES = \ - test_daemon_start_stop.c \ - $(SPDY_SOURCES) -test_daemon_start_stop_LDADD = $(SPDY_LDADD) - -test_daemon_start_stop_many_SOURCES = \ - test_daemon_start_stop_many.c \ - $(SPDY_SOURCES) -test_daemon_start_stop_many_LDADD = $(SPDY_LDADD) - -test_struct_namevalue_SOURCES = \ - test_struct_namevalue.c \ - $(SPDY_SOURCES) -test_struct_namevalue_LDADD = $(SPDY_LDADD) - -if HAVE_SPDYLAY -test_new_connection_SOURCES = \ - test_new_connection.c \ - $(SPDY_SOURCES) -test_new_connection_LDADD = $(SPDY_LDADD) \ - -lspdylay - -test_request_response_SOURCES = \ - test_request_response.c \ - $(SPDY_SOURCES) -test_request_response_LDADD = $(SPDY_LDADD) \ - -lspdylay - -test_notls_SOURCES = \ - test_notls.c \ - $(SPDY_SOURCES) -test_notls_LDADD = $(SPDY_LDADD) \ - -lspdylay - -test_request_response_with_callback_SOURCES = \ - test_request_response_with_callback.c \ - $(SPDY_SOURCES) -test_request_response_with_callback_LDADD = $(SPDY_LDADD) - -#test_requests_with_assets_SOURCES = \ -# test_requests_with_assets.c \ -# $(SPDY_SOURCES) -#test_requests_with_assets_LDADD = $(SPDY_LDADD) - -test_misc_SOURCES = \ - test_misc.c \ - $(SPDY_SOURCES) -test_misc_LDADD = $(SPDY_LDADD) - -test_session_timeout_SOURCES = \ - test_session_timeout.c \ - $(SPDY_SOURCES) -test_session_timeout_LDADD = $(SPDY_LDADD) - - -test_proxies_SOURCES = \ - test_proxies.c \ - $(SPDY_SOURCES) -test_proxies_LDADD = $(SPDY_LDADD) - -endif diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/Makefile.in libmicrohttpd-0.9.55/src/testspdy/Makefile.in --- libmicrohttpd-0.9.44+dfsg/src/testspdy/Makefile.in 2015-10-01 21:22:18.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testspdy/Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,1414 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@USE_COVERAGE_TRUE@am__append_1 = -fprofile-arcs -ftest-coverage -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@check_PROGRAMS = test_daemon_start_stop$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@ test_daemon_start_stop_many$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@ test_struct_namevalue$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@ $(am__EXEEXT_1) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@ $(am__EXEEXT_2) -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@am__append_2 = \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_new_connection \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_request_response \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_notls \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_request_response_with_callback \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_misc \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_session_timeout - -@ENABLE_SPDY_TRUE@@HAVE_CURL_BINARY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@am__append_3 = \ -@ENABLE_SPDY_TRUE@@HAVE_CURL_BINARY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_proxies - -subdir = src/testspdy -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ - $(top_srcdir)/m4/ax_append_flag.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_check_link_flag.m4 \ - $(top_srcdir)/m4/ax_check_openssl.m4 \ - $(top_srcdir)/m4/ax_count_cpus.m4 \ - $(top_srcdir)/m4/ax_have_epoll.m4 \ - $(top_srcdir)/m4/ax_pthread.m4 \ - $(top_srcdir)/m4/ax_require_defined.m4 \ - $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/MHD_config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@am__EXEEXT_1 = test_new_connection$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_request_response$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_notls$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_request_response_with_callback$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_misc$(EXEEXT) \ -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ test_session_timeout$(EXEEXT) -@ENABLE_SPDY_TRUE@@HAVE_CURL_BINARY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@am__EXEEXT_2 = test_proxies$(EXEEXT) -am__objects_1 = common.$(OBJEXT) -am_test_daemon_start_stop_OBJECTS = test_daemon_start_stop.$(OBJEXT) \ - $(am__objects_1) -test_daemon_start_stop_OBJECTS = $(am_test_daemon_start_stop_OBJECTS) -am__DEPENDENCIES_1 = $(top_builddir)/src/microspdy/libmicrospdy.la -test_daemon_start_stop_DEPENDENCIES = $(am__DEPENDENCIES_1) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -am_test_daemon_start_stop_many_OBJECTS = \ - test_daemon_start_stop_many.$(OBJEXT) $(am__objects_1) -test_daemon_start_stop_many_OBJECTS = \ - $(am_test_daemon_start_stop_many_OBJECTS) -test_daemon_start_stop_many_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__test_misc_SOURCES_DIST = test_misc.c common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_misc_OBJECTS = test_misc.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_misc_OBJECTS = $(am_test_misc_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_misc_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__test_new_connection_SOURCES_DIST = test_new_connection.c common.h \ - common.c -@HAVE_SPDYLAY_TRUE@am_test_new_connection_OBJECTS = \ -@HAVE_SPDYLAY_TRUE@ test_new_connection.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_new_connection_OBJECTS = $(am_test_new_connection_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_new_connection_DEPENDENCIES = \ -@HAVE_SPDYLAY_TRUE@ $(am__DEPENDENCIES_1) -am__test_notls_SOURCES_DIST = test_notls.c common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_notls_OBJECTS = test_notls.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_notls_OBJECTS = $(am_test_notls_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_notls_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__test_proxies_SOURCES_DIST = test_proxies.c common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_proxies_OBJECTS = test_proxies.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_proxies_OBJECTS = $(am_test_proxies_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_proxies_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__test_request_response_SOURCES_DIST = test_request_response.c \ - common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_request_response_OBJECTS = \ -@HAVE_SPDYLAY_TRUE@ test_request_response.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_request_response_OBJECTS = $(am_test_request_response_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_request_response_DEPENDENCIES = \ -@HAVE_SPDYLAY_TRUE@ $(am__DEPENDENCIES_1) -am__test_request_response_with_callback_SOURCES_DIST = \ - test_request_response_with_callback.c common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_request_response_with_callback_OBJECTS = test_request_response_with_callback.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_request_response_with_callback_OBJECTS = \ - $(am_test_request_response_with_callback_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_request_response_with_callback_DEPENDENCIES = \ -@HAVE_SPDYLAY_TRUE@ $(am__DEPENDENCIES_1) -am__test_session_timeout_SOURCES_DIST = test_session_timeout.c \ - common.h common.c -@HAVE_SPDYLAY_TRUE@am_test_session_timeout_OBJECTS = \ -@HAVE_SPDYLAY_TRUE@ test_session_timeout.$(OBJEXT) \ -@HAVE_SPDYLAY_TRUE@ $(am__objects_1) -test_session_timeout_OBJECTS = $(am_test_session_timeout_OBJECTS) -@HAVE_SPDYLAY_TRUE@test_session_timeout_DEPENDENCIES = \ -@HAVE_SPDYLAY_TRUE@ $(am__DEPENDENCIES_1) -am_test_struct_namevalue_OBJECTS = test_struct_namevalue.$(OBJEXT) \ - $(am__objects_1) -test_struct_namevalue_OBJECTS = $(am_test_struct_namevalue_OBJECTS) -test_struct_namevalue_DEPENDENCIES = $(am__DEPENDENCIES_1) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(test_daemon_start_stop_SOURCES) \ - $(test_daemon_start_stop_many_SOURCES) $(test_misc_SOURCES) \ - $(test_new_connection_SOURCES) $(test_notls_SOURCES) \ - $(test_proxies_SOURCES) $(test_request_response_SOURCES) \ - $(test_request_response_with_callback_SOURCES) \ - $(test_session_timeout_SOURCES) \ - $(test_struct_namevalue_SOURCES) -DIST_SOURCES = $(test_daemon_start_stop_SOURCES) \ - $(test_daemon_start_stop_many_SOURCES) \ - $(am__test_misc_SOURCES_DIST) \ - $(am__test_new_connection_SOURCES_DIST) \ - $(am__test_notls_SOURCES_DIST) \ - $(am__test_proxies_SOURCES_DIST) \ - $(am__test_request_response_SOURCES_DIST) \ - $(am__test_request_response_with_callback_SOURCES_DIST) \ - $(am__test_session_timeout_SOURCES_DIST) \ - $(test_struct_namevalue_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - check recheck distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ - $(top_srcdir)/test-driver -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CPU_COUNT = @CPU_COUNT@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ -GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ -HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ -HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL = @LIBCURL@ -LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSPDY_VERSION_AGE = @LIBSPDY_VERSION_AGE@ -LIBSPDY_VERSION_CURRENT = @LIBSPDY_VERSION_CURRENT@ -LIBSPDY_VERSION_REVISION = @LIBSPDY_VERSION_REVISION@ -LIBTOOL = @LIBTOOL@ -LIB_VERSION_AGE = @LIB_VERSION_AGE@ -LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ -LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MHD_LIBDEPS = @MHD_LIBDEPS@ -MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ -MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ -MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ -MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ -MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ -MKDIR_P = @MKDIR_P@ -MS_LIB_TOOL = @MS_LIB_TOOL@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENSSL_INCLUDES = @OPENSSL_INCLUDES@ -OPENSSL_LDFLAGS = @OPENSSL_LDFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ -PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ -PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -RC = @RC@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SPDY_LIBDEPS = @SPDY_LIBDEPS@ -SPDY_LIB_CFLAGS = @SPDY_LIB_CFLAGS@ -SPDY_LIB_CPPFLAGS = @SPDY_LIB_CPPFLAGS@ -SPDY_LIB_LDFLAGS = @SPDY_LIB_LDFLAGS@ -STRIP = @STRIP@ -VERSION = @VERSION@ -_libcurl_config = @_libcurl_config@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -ax_pthread_config = @ax_pthread_config@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -have_socat = @have_socat@ -have_zzuf = @have_zzuf@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_cv_objdir = @lt_cv_objdir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# This Makefile.am is in the public domain -SUBDIRS = . -AM_CFLAGS = -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" $(am__append_1) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src/include \ - -I$(top_srcdir)/src/applicationlayer \ - $(LIBCURL_CPPFLAGS) - -@HAVE_W32_FALSE@PERF_GET_CONCURRENT = perf_get_concurrent -TESTS = $(check_PROGRAMS) -SPDY_SOURCES = \ - common.h common.c - -SPDY_LDADD = \ - $(top_builddir)/src/microspdy/libmicrospdy.la \ - -lz - -test_daemon_start_stop_SOURCES = \ - test_daemon_start_stop.c \ - $(SPDY_SOURCES) - -test_daemon_start_stop_LDADD = $(SPDY_LDADD) -test_daemon_start_stop_many_SOURCES = \ - test_daemon_start_stop_many.c \ - $(SPDY_SOURCES) - -test_daemon_start_stop_many_LDADD = $(SPDY_LDADD) -test_struct_namevalue_SOURCES = \ - test_struct_namevalue.c \ - $(SPDY_SOURCES) - -test_struct_namevalue_LDADD = $(SPDY_LDADD) -@HAVE_SPDYLAY_TRUE@test_new_connection_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_new_connection.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_new_connection_LDADD = $(SPDY_LDADD) \ -@HAVE_SPDYLAY_TRUE@ -lspdylay - -@HAVE_SPDYLAY_TRUE@test_request_response_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_request_response.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_request_response_LDADD = $(SPDY_LDADD) \ -@HAVE_SPDYLAY_TRUE@ -lspdylay - -@HAVE_SPDYLAY_TRUE@test_notls_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_notls.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_notls_LDADD = $(SPDY_LDADD) \ -@HAVE_SPDYLAY_TRUE@ -lspdylay - -@HAVE_SPDYLAY_TRUE@test_request_response_with_callback_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_request_response_with_callback.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_request_response_with_callback_LDADD = $(SPDY_LDADD) - -#test_requests_with_assets_SOURCES = \ -# test_requests_with_assets.c \ -# $(SPDY_SOURCES) -#test_requests_with_assets_LDADD = $(SPDY_LDADD) -@HAVE_SPDYLAY_TRUE@test_misc_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_misc.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_misc_LDADD = $(SPDY_LDADD) -@HAVE_SPDYLAY_TRUE@test_session_timeout_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_session_timeout.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_session_timeout_LDADD = $(SPDY_LDADD) -@HAVE_SPDYLAY_TRUE@test_proxies_SOURCES = \ -@HAVE_SPDYLAY_TRUE@ test_proxies.c \ -@HAVE_SPDYLAY_TRUE@ $(SPDY_SOURCES) - -@HAVE_SPDYLAY_TRUE@test_proxies_LDADD = $(SPDY_LDADD) -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testspdy/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/testspdy/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -test_daemon_start_stop$(EXEEXT): $(test_daemon_start_stop_OBJECTS) $(test_daemon_start_stop_DEPENDENCIES) $(EXTRA_test_daemon_start_stop_DEPENDENCIES) - @rm -f test_daemon_start_stop$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_daemon_start_stop_OBJECTS) $(test_daemon_start_stop_LDADD) $(LIBS) - -test_daemon_start_stop_many$(EXEEXT): $(test_daemon_start_stop_many_OBJECTS) $(test_daemon_start_stop_many_DEPENDENCIES) $(EXTRA_test_daemon_start_stop_many_DEPENDENCIES) - @rm -f test_daemon_start_stop_many$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_daemon_start_stop_many_OBJECTS) $(test_daemon_start_stop_many_LDADD) $(LIBS) - -test_misc$(EXEEXT): $(test_misc_OBJECTS) $(test_misc_DEPENDENCIES) $(EXTRA_test_misc_DEPENDENCIES) - @rm -f test_misc$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_misc_OBJECTS) $(test_misc_LDADD) $(LIBS) - -test_new_connection$(EXEEXT): $(test_new_connection_OBJECTS) $(test_new_connection_DEPENDENCIES) $(EXTRA_test_new_connection_DEPENDENCIES) - @rm -f test_new_connection$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_new_connection_OBJECTS) $(test_new_connection_LDADD) $(LIBS) - -test_notls$(EXEEXT): $(test_notls_OBJECTS) $(test_notls_DEPENDENCIES) $(EXTRA_test_notls_DEPENDENCIES) - @rm -f test_notls$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_notls_OBJECTS) $(test_notls_LDADD) $(LIBS) - -test_proxies$(EXEEXT): $(test_proxies_OBJECTS) $(test_proxies_DEPENDENCIES) $(EXTRA_test_proxies_DEPENDENCIES) - @rm -f test_proxies$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_proxies_OBJECTS) $(test_proxies_LDADD) $(LIBS) - -test_request_response$(EXEEXT): $(test_request_response_OBJECTS) $(test_request_response_DEPENDENCIES) $(EXTRA_test_request_response_DEPENDENCIES) - @rm -f test_request_response$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_request_response_OBJECTS) $(test_request_response_LDADD) $(LIBS) - -test_request_response_with_callback$(EXEEXT): $(test_request_response_with_callback_OBJECTS) $(test_request_response_with_callback_DEPENDENCIES) $(EXTRA_test_request_response_with_callback_DEPENDENCIES) - @rm -f test_request_response_with_callback$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_request_response_with_callback_OBJECTS) $(test_request_response_with_callback_LDADD) $(LIBS) - -test_session_timeout$(EXEEXT): $(test_session_timeout_OBJECTS) $(test_session_timeout_DEPENDENCIES) $(EXTRA_test_session_timeout_DEPENDENCIES) - @rm -f test_session_timeout$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_session_timeout_OBJECTS) $(test_session_timeout_LDADD) $(LIBS) - -test_struct_namevalue$(EXEEXT): $(test_struct_namevalue_OBJECTS) $(test_struct_namevalue_DEPENDENCIES) $(EXTRA_test_struct_namevalue_DEPENDENCIES) - @rm -f test_struct_namevalue$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_struct_namevalue_OBJECTS) $(test_struct_namevalue_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_daemon_start_stop.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_daemon_start_stop_many.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_misc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_new_connection.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_notls.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_proxies.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_request_response.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_request_response_with_callback.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_session_timeout.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_struct_namevalue.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_PROGRAMS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test_daemon_start_stop.log: test_daemon_start_stop$(EXEEXT) - @p='test_daemon_start_stop$(EXEEXT)'; \ - b='test_daemon_start_stop'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_daemon_start_stop_many.log: test_daemon_start_stop_many$(EXEEXT) - @p='test_daemon_start_stop_many$(EXEEXT)'; \ - b='test_daemon_start_stop_many'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_struct_namevalue.log: test_struct_namevalue$(EXEEXT) - @p='test_struct_namevalue$(EXEEXT)'; \ - b='test_struct_namevalue'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_new_connection.log: test_new_connection$(EXEEXT) - @p='test_new_connection$(EXEEXT)'; \ - b='test_new_connection'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_request_response.log: test_request_response$(EXEEXT) - @p='test_request_response$(EXEEXT)'; \ - b='test_request_response'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_notls.log: test_notls$(EXEEXT) - @p='test_notls$(EXEEXT)'; \ - b='test_notls'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_request_response_with_callback.log: test_request_response_with_callback$(EXEEXT) - @p='test_request_response_with_callback$(EXEEXT)'; \ - b='test_request_response_with_callback'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_misc.log: test_misc$(EXEEXT) - @p='test_misc$(EXEEXT)'; \ - b='test_misc'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_session_timeout.log: test_session_timeout$(EXEEXT) - @p='test_session_timeout$(EXEEXT)'; \ - b='test_session_timeout'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_proxies.log: test_proxies$(EXEEXT) - @p='test_proxies$(EXEEXT)'; \ - b='test_proxies'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(am__recursive_targets) check-am install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ - uninstall uninstall-am - -.PRECIOUS: Makefile - -@ENABLE_SPDY_TRUE@@HAVE_OPENSSL_TRUE@@HAVE_SPDYLAY_TRUE@ #test_requests_with_assets - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_daemon_start_stop.c libmicrohttpd-0.9.55/src/testspdy/test_daemon_start_stop.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_daemon_start_stop.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_daemon_start_stop.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,49 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file daemon_start_stop.c - * @brief starts and stops a SPDY daemon - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "common.h" - -int -main() -{ - SPDY_init(); - - struct SPDY_Daemon *daemon = SPDY_start_daemon(get_port(16123), - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - NULL,NULL,NULL,NULL,NULL,SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return 0; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_daemon_start_stop_many.c libmicrohttpd-0.9.55/src/testspdy/test_daemon_start_stop_many.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_daemon_start_stop_many.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_daemon_start_stop_many.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file daemon_start_stop_many.c - * @brief starts and stops several SPDY daemons, reusing port numbers - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "common.h" - -int -main() -{ - int i; - int j; - int num_daemons = 3; - int num_tries = 5; - int port = get_port(15123); - struct SPDY_Daemon *daemon[num_daemons]; - - SPDY_init(); - - for(i=0; i. -*/ - -/** - * @file misc.c - * @brief tests a lot of small calls and callbacks. TODO mention what - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "stdio.h" -#include -#include "common.h" - -int port; - -#define HTML "\ -\ -This is libmicrospdy" - -#define CSS "body{font-size:15px}" - -#define SESSION_CLS "1234567890" - -#define REQUEST_CLS "1234567890REQ" - -pid_t parent; -pid_t child; - -struct SPDY_Session *session1; -struct SPDY_Session *session2; - -void -killchild() -{ - kill(child, SIGKILL); - exit(1); -} - -void -killparent() -{ - kill(parent, SIGKILL); - _exit(1); -} - - -void -create_child() -{ - parent = getpid(); - - child = fork(); - if (-1 == child) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - int devnull; - char *uri; - fflush(stdout); - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort (); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - asprintf(&uri,"https://127.0.0.1:%i/",port); - execlp("spdycat", "spdycat","-anv",uri,NULL ); - printf("execlp failed\n"); - killparent(); - } -} - -void -response_done_callback(void *cls, - struct SPDY_Response * response, - struct SPDY_Request * request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)status; - (void)streamopened; - - if(strcmp(cls,"/main.css")) - { - session1 = SPDY_get_session_for_request(request); - if(NULL == session1) - { - printf("SPDY_get_session_for_request failed\n"); - killchild(); - } - - char *session_cls = strdup(SESSION_CLS); - SPDY_set_cls_to_session(session1,session_cls); - } - else - { - session2 = SPDY_get_session_for_request(request); - if(session1 != session2) - { - printf("SPDY_get_session_for_request failed the second time\n"); - killchild(); - } - printf("SPDY_get_session_for_request tested...\n"); - - void *session_cls = SPDY_get_cls_from_session(session2); - if(NULL == session_cls || strcmp(session_cls, SESSION_CLS)) - { - printf("SPDY_get_cls_from_session failed\n"); - killchild(); - } - printf("SPDY_set_cls_to_session tested...\n"); - printf("SPDY_get_cls_from_session tested...\n"); - - void *request_cls = SPDY_get_cls_from_request(request); - if(NULL == request_cls || strcmp(request_cls, REQUEST_CLS)) - { - printf("SPDY_get_cls_from_request failed\n"); - killchild(); - } - printf("SPDY_set_cls_to_request tested...\n"); - printf("SPDY_get_cls_from_request tested...\n"); - } - - SPDY_destroy_request(request); - SPDY_destroy_response(response); - free(cls); -} - -void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)method; - (void)version; - (void)more; - - struct SPDY_Response *response=NULL; - char *cls_path = strdup(path); - - if(strcmp(path,"/main.css")==0) - { - char *request_cls = strdup(REQUEST_CLS); - SPDY_set_cls_to_request(request,request_cls); - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,CSS,strlen(CSS)); - } - else - { - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,HTML,strlen(HTML)); - } - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - killchild(); - } - - if(SPDY_queue_response(request,response,true,false,&response_done_callback,cls_path)!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - killchild(); - } -} - -int -parentproc() -{ - int childstatus; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - daemon = SPDY_start_daemon(port, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - NULL, - NULL, - &standard_request_handler, - NULL, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - create_child(); - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(waitpid(child,&childstatus,WNOHANG) != child); - - SPDY_stop_daemon(daemon); - - return WEXITSTATUS(childstatus); -} - - -int -main() -{ - port = get_port(13123); - SPDY_init(); - - int ret = parentproc(); - - SPDY_deinit(); - - return ret; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_new_connection.c libmicrohttpd-0.9.55/src/testspdy/test_new_connection.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_new_connection.c 2015-08-02 19:04:09.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testspdy/test_new_connection.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1012 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file test_new_connection.c - * @brief tests new connection callback. spdycli.c - * code is reused here - * @author Andrey Uzunov - * @author Tatsuhiro Tsujikawa - */ - -//TODO child exits with ret val 1 sometimes - -#include "platform.h" -#include "microspdy.h" -#include -#include "common.h" - -#define RESPONSE_BODY "Hi, this is libmicrospdy!" - -#define CLS "anything" - -int port; -int loop = 1; - -pid_t parent; -pid_t child; - -int -spdylay_printf(const char *format, ...) -{ - (void)format; - - return 0; -} - -int -spdylay_fprintf(FILE *stream, const char *format, ...) -{ - (void)stream; - (void)format; - - return 0; -} - -void -killchild(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - exit(1); -} - -void -killparent(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - _exit(2); -} - - -/***** - * start of code needed to utilize spdylay - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -enum { - IO_NONE, - WANT_READ, - WANT_WRITE -}; - -struct Connection { - SSL *ssl; - spdylay_session *session; - /* WANT_READ if SSL connection needs more input; or WANT_WRITE if it - needs more output; or IO_NONE. This is necessary because SSL/TLS - re-negotiation is possible at any time. Spdylay API offers - similar functions like spdylay_session_want_read() and - spdylay_session_want_write() but they do not take into account - SSL connection. */ - int want_io; -}; - -struct Request { - char *host; - uint16_t port; - /* In this program, path contains query component as well. */ - char *path; - /* This is the concatenation of host and port with ":" in - between. */ - char *hostport; - /* Stream ID for this request. */ - int32_t stream_id; - /* The gzip stream inflater for the compressed response. */ - spdylay_gzip *inflater; -}; - -struct URI { - const char *host; - size_t hostlen; - uint16_t port; - /* In this program, path contains query component as well. */ - const char *path; - size_t pathlen; - const char *hostport; - size_t hostportlen; -}; - -/* - * Returns copy of string |s| with the length |len|. The returned - * string is NULL-terminated. - */ -static char* strcopy(const char *s, size_t len) -{ - char *dst; - dst = malloc(len+1); - if (NULL == dst) - abort (); - memcpy(dst, s, len); - dst[len] = '\0'; - return dst; -} - -/* - * Prints error message |msg| and exit. - */ -static void die(const char *msg) -{ - fprintf(stderr, "FATAL: %s\n", msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and message |msg| - * and exit. - */ -static void dief(const char *func, const char *msg) -{ - fprintf(stderr, "FATAL: %s: %s\n", func, msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and error code - * |error_code| and exit. - */ -static void diec(const char *func, int error_code) -{ - fprintf(stderr, "FATAL: %s: error_code=%d, msg=%s\n", func, error_code, - spdylay_strerror(error_code)); - exit(EXIT_FAILURE); -} - -/* - * Check response is content-encoding: gzip. We need this because SPDY - * client is required to support gzip. - */ -static void check_gzip(struct Request *req, char **nv) -{ - int gzip = 0; - size_t i; - for(i = 0; nv[i]; i += 2) { - if(strcmp("content-encoding", nv[i]) == 0) { - gzip = strcmp("gzip", nv[i+1]) == 0; - break; - } - } - if(gzip) { - int rv; - if(req->inflater) { - return; - } - rv = spdylay_gzip_inflate_new(&req->inflater); - if(rv != 0) { - die("Can't allocate inflate stream."); - } - } -} - -/* - * The implementation of spdylay_send_callback type. Here we write - * |data| with size |length| to the network and return the number of - * bytes actually written. See the documentation of - * spdylay_send_callback for the details. - */ -static ssize_t send_callback(spdylay_session *session, - const uint8_t *data, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - ERR_clear_error(); - rv = SSL_write(connection->ssl, data, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io = (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - return rv; -} - -/* - * The implementation of spdylay_recv_callback type. Here we read data - * from the network and write them in |buf|. The capacity of |buf| is - * |length| bytes. Returns the number of bytes stored in |buf|. See - * the documentation of spdylay_recv_callback for the details. - */ -static ssize_t recv_callback(spdylay_session *session, - uint8_t *buf, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - ERR_clear_error(); - rv = SSL_read(connection->ssl, buf, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io = (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } else if(rv == 0) { - rv = SPDYLAY_ERR_EOF; - } - return rv; -} - -/* - * The implementation of spdylay_before_ctrl_send_callback type. We - * use this function to get stream ID of the request. This is because - * stream ID is not known when we submit the request - * (spdylay_submit_request). - */ -static void before_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, - void *user_data) -{ - (void)user_data; - - if(type == SPDYLAY_SYN_STREAM) { - struct Request *req; - int stream_id = frame->syn_stream.stream_id; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req && req->stream_id == -1) { - req->stream_id = stream_id; - spdylay_printf("[INFO] Stream ID = %d\n", stream_id); - } - } -} - -static void on_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_STREAM: - nv = frame->syn_stream.nv; - name = "SYN_STREAM"; - stream_id = frame->syn_stream.stream_id; - break; - default: - break; - } - if(name && spdylay_session_get_stream_user_data(session, stream_id)) { - spdylay_printf("[INFO] C ----------------------------> S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - spdylay_printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -static void on_ctrl_recv_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - struct Request *req; - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_REPLY: - nv = frame->syn_reply.nv; - name = "SYN_REPLY"; - stream_id = frame->syn_reply.stream_id; - break; - case SPDYLAY_HEADERS: - nv = frame->headers.nv; - name = "HEADERS"; - stream_id = frame->headers.stream_id; - break; - default: - break; - } - if(!name) { - return; - } - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - check_gzip(req, nv); - spdylay_printf("[INFO] C <---------------------------- S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - spdylay_printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -/* - * The implementation of spdylay_on_stream_close_callback type. We use - * this function to know the response is fully received. Since we just - * fetch 1 resource in this program, after reception of the response, - * we submit GOAWAY and close the session. - */ -static void on_stream_close_callback(spdylay_session *session, - int32_t stream_id, - spdylay_status_code status_code, - void *user_data) -{ - (void)user_data; - (void)status_code; - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - int rv; - rv = spdylay_submit_goaway(session, SPDYLAY_GOAWAY_OK); - if(rv != 0) { - diec("spdylay_submit_goaway", rv); - } - } -} - -#define MAX_OUTLEN 4096 - -/* - * The implementation of spdylay_on_data_chunk_recv_callback type. We - * use this function to print the received response body. - */ -static void on_data_chunk_recv_callback(spdylay_session *session, uint8_t flags, - int32_t stream_id, - const uint8_t *data, size_t len, - void *user_data) -{ - (void)user_data; - (void)flags; - - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - spdylay_printf("[INFO] C <---------------------------- S (DATA)\n"); - spdylay_printf(" %lu bytes\n", (unsigned long int)len); - if(req->inflater) { - while(len > 0) { - uint8_t out[MAX_OUTLEN]; - size_t outlen = MAX_OUTLEN; - size_t tlen = len; - int rv; - rv = spdylay_gzip_inflate(req->inflater, out, &outlen, data, &tlen); - if(rv == -1) { - spdylay_submit_rst_stream(session, stream_id, SPDYLAY_INTERNAL_ERROR); - break; - } - fwrite(out, 1, outlen, stdout); - data += tlen; - len -= tlen; - } - } else { - /* TODO add support gzip */ - fwrite(data, 1, len, stdout); - - //check if the data is correct - if(strcmp(RESPONSE_BODY, (char *)data) != 0) - killparent(parent, "\nreceived data is not the same"); - } - spdylay_printf("\n"); - } -} - -/* - * Setup callback functions. Spdylay API offers many callback - * functions, but most of them are optional. The send_callback is - * always required. Since we use spdylay_session_recv(), the - * recv_callback is also required. - */ -static void setup_spdylay_callbacks(spdylay_session_callbacks *callbacks) -{ - memset(callbacks, 0, sizeof(spdylay_session_callbacks)); - callbacks->send_callback = send_callback; - callbacks->recv_callback = recv_callback; - callbacks->before_ctrl_send_callback = before_ctrl_send_callback; - callbacks->on_ctrl_send_callback = on_ctrl_send_callback; - callbacks->on_ctrl_recv_callback = on_ctrl_recv_callback; - callbacks->on_stream_close_callback = on_stream_close_callback; - callbacks->on_data_chunk_recv_callback = on_data_chunk_recv_callback; -} - -/* - * Callback function for SSL/TLS NPN. Since this program only supports - * SPDY protocol, if server does not offer SPDY protocol the Spdylay - * library supports, we terminate program. - */ -static int select_next_proto_cb(SSL* ssl, - unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - void *arg) -{ - (void)ssl; - - int rv; - uint16_t *spdy_proto_version; - /* spdylay_select_next_protocol() selects SPDY protocol version the - Spdylay library supports. */ - rv = spdylay_select_next_protocol(out, outlen, in, inlen); - if(rv <= 0) { - die("Server did not advertise spdy/2 or spdy/3 protocol."); - } - spdy_proto_version = (uint16_t*)arg; - *spdy_proto_version = rv; - return SSL_TLSEXT_ERR_OK; -} - -/* - * Setup SSL context. We pass |spdy_proto_version| to get negotiated - * SPDY protocol version in NPN callback. - */ -static void init_ssl_ctx(SSL_CTX *ssl_ctx, uint16_t *spdy_proto_version) -{ - /* Disable SSLv2 and enable all workarounds for buggy servers */ - SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL|SSL_OP_NO_SSLv2); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_AUTO_RETRY); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); - /* Set NPN callback */ - SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, - spdy_proto_version); -} - -static void ssl_handshake(SSL *ssl, int fd) -{ - int rv; - if(SSL_set_fd(ssl, fd) == 0) { - dief("SSL_set_fd", ERR_error_string(ERR_get_error(), NULL)); - } - ERR_clear_error(); - rv = SSL_connect(ssl); - if(rv <= 0) { - dief("SSL_connect", ERR_error_string(ERR_get_error(), NULL)); - } -} - -/* - * Connects to the host |host| and port |port|. This function returns - * the file descriptor of the client socket. - */ -static int connect_to(const char *host, uint16_t port) -{ - struct addrinfo hints; - int fd = -1; - int rv; - char service[NI_MAXSERV]; - struct addrinfo *res, *rp; - snprintf(service, sizeof(service), "%u", port); - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - rv = getaddrinfo(host, service, &hints, &res); - if(rv != 0) { - dief("getaddrinfo", gai_strerror(rv)); - } - for(rp = res; rp; rp = rp->ai_next) { - fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) { - continue; - } - while((rv = connect(fd, rp->ai_addr, rp->ai_addrlen)) == -1 && - errno == EINTR); - if(rv == 0) { - break; - } - MHD_socket_close_(fd); - fd = -1; - } - freeaddrinfo(res); - return fd; -} - -static void make_non_block(int fd) -{ - int flags, rv; - while((flags = fcntl(fd, F_GETFL, 0)) == -1 && errno == EINTR); - if(flags == -1) { - dief("fcntl", strerror(errno)); - } - while((rv = fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1 && errno == EINTR); - if(rv == -1) { - dief("fcntl", strerror(errno)); - } -} - -/* - * Setting TCP_NODELAY is not mandatory for the SPDY protocol. - */ -static void set_tcp_nodelay(int fd) -{ - int val = 1; - int rv; - rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(rv == -1) { - dief("setsockopt", strerror(errno)); - } -} - -/* - * Update |pollfd| based on the state of |connection|. - */ -static void ctl_poll(struct pollfd *pollfd, struct Connection *connection) -{ - pollfd->events = 0; - if(spdylay_session_want_read(connection->session) || - connection->want_io == WANT_READ) { - pollfd->events |= POLLIN; - } - if(spdylay_session_want_write(connection->session) || - connection->want_io == WANT_WRITE) { - pollfd->events |= POLLOUT; - } -} - -/* - * Submits the request |req| to the connection |connection|. This - * function does not send packets; just append the request to the - * internal queue in |connection->session|. - */ -static void submit_request(struct Connection *connection, struct Request *req) -{ - int pri = 0; - int rv; - const char *nv[15]; - /* We always use SPDY/3 style header even if the negotiated protocol - version is SPDY/2. The library translates the header name as - necessary. Make sure that the last item is NULL! */ - nv[0] = ":method"; nv[1] = "GET"; - nv[2] = ":path"; nv[3] = req->path; - nv[4] = ":version"; nv[5] = "HTTP/1.1"; - nv[6] = ":scheme"; nv[7] = "https"; - nv[8] = ":host"; nv[9] = req->hostport; - nv[10] = "accept"; nv[11] = "*/*"; - nv[12] = "user-agent"; nv[13] = "spdylay/"SPDYLAY_VERSION; - nv[14] = NULL; - rv = spdylay_submit_request(connection->session, pri, nv, NULL, req); - if(rv != 0) { - diec("spdylay_submit_request", rv); - } -} - -/* - * Performs the network I/O. - */ -static void exec_io(struct Connection *connection) -{ - int rv; - rv = spdylay_session_recv(connection->session); - if(rv != 0) { - diec("spdylay_session_recv", rv); - } - rv = spdylay_session_send(connection->session); - if(rv != 0) { - diec("spdylay_session_send", rv); - } -} - -static void request_init(struct Request *req, const struct URI *uri) -{ - req->host = strcopy(uri->host, uri->hostlen); - req->port = uri->port; - req->path = strcopy(uri->path, uri->pathlen); - req->hostport = strcopy(uri->hostport, uri->hostportlen); - req->stream_id = -1; - req->inflater = NULL; -} - -static void request_free(struct Request *req) -{ - free(req->host); - free(req->path); - free(req->hostport); - spdylay_gzip_inflate_del(req->inflater); -} - -/* - * Fetches the resource denoted by |uri|. - */ -static void -fetch_uri(const struct URI *uri) -{ - spdylay_session_callbacks callbacks; - int fd; - SSL_CTX *ssl_ctx; - SSL *ssl; - struct Request req; - struct Connection connection; - int rv; - nfds_t npollfds = 1; - struct pollfd pollfds[1]; - uint16_t spdy_proto_version; - - request_init(&req, uri); - - setup_spdylay_callbacks(&callbacks); - - /* Establish connection and setup SSL */ - fd = connect_to(req.host, req.port); - if (-1 == fd) - abort (); - ssl_ctx = SSL_CTX_new(SSLv23_client_method()); - if(ssl_ctx == NULL) { - dief("SSL_CTX_new", ERR_error_string(ERR_get_error(), NULL)); - } - init_ssl_ctx(ssl_ctx, &spdy_proto_version); - ssl = SSL_new(ssl_ctx); - if(ssl == NULL) { - dief("SSL_new", ERR_error_string(ERR_get_error(), NULL)); - } - /* To simplify the program, we perform SSL/TLS handshake in blocking - I/O. */ - ssl_handshake(ssl, fd); - - connection.ssl = ssl; - connection.want_io = IO_NONE; - - /* Here make file descriptor non-block */ - make_non_block(fd); - set_tcp_nodelay(fd); - - spdylay_printf("[INFO] SPDY protocol version = %d\n", spdy_proto_version); - rv = spdylay_session_client_new(&connection.session, spdy_proto_version, - &callbacks, &connection); - if(rv != 0) { - diec("spdylay_session_client_new", rv); - } - - /* Submit the HTTP request to the outbound queue. */ - submit_request(&connection, &req); - - pollfds[0].fd = fd; - ctl_poll(pollfds, &connection); - - /* Event loop */ - while(spdylay_session_want_read(connection.session) || - spdylay_session_want_write(connection.session)) { - int nfds = poll(pollfds, npollfds, -1); - if(nfds == -1) { - dief("poll", strerror(errno)); - } - if(pollfds[0].revents & (POLLIN | POLLOUT)) { - exec_io(&connection); - } - if((pollfds[0].revents & POLLHUP) || (pollfds[0].revents & POLLERR)) { - die("Connection error"); - } - ctl_poll(pollfds, &connection); - } - - /* Resource cleanup */ - spdylay_session_del(connection.session); - SSL_shutdown(ssl); - SSL_free(ssl); - SSL_CTX_free(ssl_ctx); - shutdown(fd, SHUT_WR); - MHD_socket_close_ (fd); - request_free(&req); -} - - -static int -parse_uri(struct URI *res, const char *uri) -{ - /* We only interested in https */ - size_t len, i, offset; - memset(res, 0, sizeof(struct URI)); - len = strlen(uri); - if(len < 9 || memcmp("https://", uri, 8) != 0) { - return -1; - } - offset = 8; - res->host = res->hostport = &uri[offset]; - res->hostlen = 0; - if(uri[offset] == '[') { - /* IPv6 literal address */ - ++offset; - ++res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == ']') { - res->hostlen = i-offset; - offset = i+1; - break; - } - } - } else { - const char delims[] = ":/?#"; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - } - res->hostlen = i-offset; - offset = i; - } - if(res->hostlen == 0) { - return -1; - } - /* Assuming https */ - res->port = 443; - if(offset < len) { - if(uri[offset] == ':') { - /* port */ - const char delims[] = "/?#"; - int port = 0; - ++offset; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - if('0' <= uri[i] && uri[i] <= '9') { - port *= 10; - port += uri[i]-'0'; - if(port > 65535) { - return -1; - } - } else { - return -1; - } - } - if(port == 0) { - return -1; - } - offset = i; - res->port = port; - } - } - res->hostportlen = uri+offset-res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == '#') { - break; - } - } - if(i-offset == 0) { - res->path = "/"; - res->pathlen = 1; - } else { - res->path = &uri[offset]; - res->pathlen = i-offset; - } - return 0; -} - - -/***** - * end of code needed to utilize spdylay - */ - - -/***** - * start of code needed to utilize microspdy - */ - -void -new_session_callback (void *cls, - struct SPDY_Session * session) -{ - char ipstr[1024]; - - struct sockaddr *addr; - socklen_t addr_len = SPDY_get_remote_addr(session, &addr); - - if(!addr_len) - { - printf("SPDY_get_remote_addr"); - abort(); - } - - if(strcmp(CLS,cls)!=0) - { - killchild(child,"wrong cls"); - } - - if(AF_INET == addr->sa_family) - { - struct sockaddr_in * addr4 = (struct sockaddr_in *) addr; - if(NULL == inet_ntop(AF_INET, &(addr4->sin_addr), ipstr, sizeof(ipstr))) - { - killchild(child,"inet_ntop"); - } - printf("New connection from: %s:%i\n", ipstr, ntohs(addr4->sin_port)); - - loop = 0; - } -#if HAVE_INET6 - else if(AF_INET6 == addr->sa_family) - { - struct sockaddr_in6 * addr6 = (struct sockaddr_in6 *) addr; - if(NULL == inet_ntop(AF_INET6, &(addr6->sin6_addr), ipstr, sizeof(ipstr))) - { - killchild(child,"inet_ntop"); - } - printf("New connection from: %s:%i\n", ipstr, ntohs(addr6->sin6_port)); - - loop = 0; - } -#endif - else - { - killchild(child,"wrong family"); - } -} - -/***** - * end of code needed to utilize microspdy - */ - -//child process -void -childproc(int parent) -{ - struct URI uri; - struct sigaction act; - int rv; - char *uristr; - - memset(&act, 0, sizeof(struct sigaction)); - act.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &act, 0); - - asprintf(&uristr, "https://127.0.0.1:%i/",port); - - SSL_load_error_strings(); - SSL_library_init(); - - rv = parse_uri(&uri, uristr); - if(rv != 0) { - killparent(parent,"parse_uri failed"); - } - fetch_uri(&uri); -} - -//parent proc -int -parentproc(int child) -{ - int childstatus = 0; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - SPDY_init(); - - daemon = SPDY_start_daemon(port, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - &new_session_callback,NULL,NULL,NULL,CLS,SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - killchild(child, "select error"); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(loop && waitpid(child,&childstatus,WNOHANG) != child); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - if(loop) - return WEXITSTATUS(childstatus); - if(waitpid(child,&childstatus,WNOHANG) == child) - return WEXITSTATUS(childstatus); - - kill(child,SIGKILL); - - waitpid(child,&childstatus,0); - - return 0; -} - -int main() -{ - port = get_port(14123); - parent = getpid(); - - child = fork(); - if (child == -1) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - childproc(parent); - _exit(0); - } - else - { - int ret = parentproc(child); - exit(ret); - } - return 1; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_notls.c libmicrohttpd-0.9.55/src/testspdy/test_notls.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_notls.c 2015-08-02 19:03:58.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testspdy/test_notls.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,973 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file request_response.c - * @brief tests receiving request and sending response. spdycli.c (spdylay) - * code is reused here - * @author Andrey Uzunov - * @author Tatsuhiro Tsujikawa - */ - -#include "platform.h" -#include "microspdy.h" -#include -#include "common.h" - -#define RESPONSE_BODY "Hi, this is libmicrospdy!" - -#define CLS "anything" - -pid_t parent; -pid_t child; -char *rcvbuf; -int rcvbuf_c = 0; - -int session_closed_called = 0; - -void -killchild(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - exit(1); -} - -void -killparent(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - _exit(1); -} - - -/***** - * start of code needed to utilize spdylay - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -enum { - IO_NONE, - WANT_READ, - WANT_WRITE -}; - -struct Connection { - spdylay_session *session; - /* WANT_READ if SSL connection needs more input; or WANT_WRITE if it - needs more output; or IO_NONE. This is necessary because SSL/TLS - re-negotiation is possible at any time. Spdylay API offers - similar functions like spdylay_session_want_read() and - spdylay_session_want_write() but they do not take into account - SSL connection. */ - int want_io; - int fd; -}; - -struct Request { - char *host; - uint16_t port; - /* In this program, path contains query component as well. */ - char *path; - /* This is the concatenation of host and port with ":" in - between. */ - char *hostport; - /* Stream ID for this request. */ - int32_t stream_id; - /* The gzip stream inflater for the compressed response. */ - spdylay_gzip *inflater; -}; - -struct URI { - const char *host; - size_t hostlen; - uint16_t port; - /* In this program, path contains query component as well. */ - const char *path; - size_t pathlen; - const char *hostport; - size_t hostportlen; -}; - -/* - * Returns copy of string |s| with the length |len|. The returned - * string is NULL-terminated. - */ -static char* strcopy(const char *s, size_t len) -{ - char *dst; - dst = malloc(len+1); - if (NULL == dst) - abort (); - memcpy(dst, s, len); - dst[len] = '\0'; - return dst; -} - -/* - * Prints error message |msg| and exit. - */ -static void die(const char *msg) -{ - fprintf(stderr, "FATAL: %s\n", msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and message |msg| - * and exit. - */ -static void dief(const char *func, const char *msg) -{ - fprintf(stderr, "FATAL: %s: %s\n", func, msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and error code - * |error_code| and exit. - */ -static void diec(const char *func, int error_code) -{ - fprintf(stderr, "FATAL: %s: error_code=%d, msg=%s\n", func, error_code, - spdylay_strerror(error_code)); - exit(EXIT_FAILURE); -} - -/* - * Check response is content-encoding: gzip. We need this because SPDY - * client is required to support gzip. - */ -static void check_gzip(struct Request *req, char **nv) -{ - int gzip = 0; - size_t i; - for(i = 0; nv[i]; i += 2) { - if(strcmp("content-encoding", nv[i]) == 0) { - gzip = strcmp("gzip", nv[i+1]) == 0; - break; - } - } - if(gzip) { - int rv; - if(req->inflater) { - return; - } - rv = spdylay_gzip_inflate_new(&req->inflater); - if(rv != 0) { - die("Can't allocate inflate stream."); - } - } -} - -/* - * The implementation of spdylay_send_callback type. Here we write - * |data| with size |length| to the network and return the number of - * bytes actually written. See the documentation of - * spdylay_send_callback for the details. - */ -static ssize_t send_callback(spdylay_session *session, - const uint8_t *data, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - - rv = write(connection->fd, - data, - length); - - if (rv < 0) - { - switch(errno) - { - case EAGAIN: - #if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: - #endif - connection->want_io = WANT_WRITE; - rv = SPDYLAY_ERR_WOULDBLOCK; - break; - - default: - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - return rv; -} - -/* - * The implementation of spdylay_recv_callback type. Here we read data - * from the network and write them in |buf|. The capacity of |buf| is - * |length| bytes. Returns the number of bytes stored in |buf|. See - * the documentation of spdylay_recv_callback for the details. - */ -static ssize_t recv_callback(spdylay_session *session, - uint8_t *buf, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - - rv = read(connection->fd, - buf, - length); - - if (rv < 0) - { - switch(errno) - { - case EAGAIN: - #if EAGAIN != EWOULDBLOCK - case EWOULDBLOCK: - #endif - connection->want_io = WANT_READ; - rv = SPDYLAY_ERR_WOULDBLOCK; - break; - - default: - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - else if(rv == 0) - rv = SPDYLAY_ERR_EOF; - return rv; -} - -/* - * The implementation of spdylay_before_ctrl_send_callback type. We - * use this function to get stream ID of the request. This is because - * stream ID is not known when we submit the request - * (spdylay_submit_request). - */ -static void before_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, - void *user_data) -{ - (void)user_data; - - if(type == SPDYLAY_SYN_STREAM) { - struct Request *req; - int stream_id = frame->syn_stream.stream_id; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req && req->stream_id == -1) { - req->stream_id = stream_id; - printf("[INFO] Stream ID = %d\n", stream_id); - } - } -} - -static void on_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_STREAM: - nv = frame->syn_stream.nv; - name = "SYN_STREAM"; - stream_id = frame->syn_stream.stream_id; - break; - default: - break; - } - if(name && spdylay_session_get_stream_user_data(session, stream_id)) { - printf("[INFO] C ----------------------------> S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -static void on_ctrl_recv_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - struct Request *req; - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_REPLY: - nv = frame->syn_reply.nv; - name = "SYN_REPLY"; - stream_id = frame->syn_reply.stream_id; - break; - case SPDYLAY_HEADERS: - nv = frame->headers.nv; - name = "HEADERS"; - stream_id = frame->headers.stream_id; - break; - default: - break; - } - if(!name) { - return; - } - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - check_gzip(req, nv); - printf("[INFO] C <---------------------------- S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -/* - * The implementation of spdylay_on_stream_close_callback type. We use - * this function to know the response is fully received. Since we just - * fetch 1 resource in this program, after reception of the response, - * we submit GOAWAY and close the session. - */ -static void on_stream_close_callback(spdylay_session *session, - int32_t stream_id, - spdylay_status_code status_code, - void *user_data) -{ - (void)status_code; - (void)user_data; - - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - int rv; - rv = spdylay_submit_goaway(session, SPDYLAY_GOAWAY_OK); - if(rv != 0) { - diec("spdylay_submit_goaway", rv); - } - } -} - -#define MAX_OUTLEN 4096 - -/* - * The implementation of spdylay_on_data_chunk_recv_callback type. We - * use this function to print the received response body. - */ -static void on_data_chunk_recv_callback(spdylay_session *session, uint8_t flags, - int32_t stream_id, - const uint8_t *data, size_t len, - void *user_data) -{ - (void)flags; - (void)user_data; - - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - printf("[INFO] C <---------------------------- S (DATA)\n"); - printf(" %lu bytes\n", (unsigned long int)len); - if(req->inflater) { - while(len > 0) { - uint8_t out[MAX_OUTLEN]; - size_t outlen = MAX_OUTLEN; - size_t tlen = len; - int rv; - rv = spdylay_gzip_inflate(req->inflater, out, &outlen, data, &tlen); - if(rv == -1) { - spdylay_submit_rst_stream(session, stream_id, SPDYLAY_INTERNAL_ERROR); - break; - } - fwrite(out, 1, outlen, stdout); - data += tlen; - len -= tlen; - } - } else { - /* TODO add support gzip */ - fwrite(data, 1, len, stdout); - - //check if the data is correct - //if(strcmp(RESPONSE_BODY, data) != 0) - //killparent(parent, "\nreceived data is not the same"); - if(len + rcvbuf_c > strlen(RESPONSE_BODY)) - killparent(parent, "\nreceived data is not the same"); - - strcpy(rcvbuf + rcvbuf_c,(char*)data); - rcvbuf_c+=len; - } - printf("\n"); - } -} - -/* - * Setup callback functions. Spdylay API offers many callback - * functions, but most of them are optional. The send_callback is - * always required. Since we use spdylay_session_recv(), the - * recv_callback is also required. - */ -static void setup_spdylay_callbacks(spdylay_session_callbacks *callbacks) -{ - memset(callbacks, 0, sizeof(spdylay_session_callbacks)); - callbacks->send_callback = send_callback; - callbacks->recv_callback = recv_callback; - callbacks->before_ctrl_send_callback = before_ctrl_send_callback; - callbacks->on_ctrl_send_callback = on_ctrl_send_callback; - callbacks->on_ctrl_recv_callback = on_ctrl_recv_callback; - callbacks->on_stream_close_callback = on_stream_close_callback; - callbacks->on_data_chunk_recv_callback = on_data_chunk_recv_callback; -} - - -/* - * Connects to the host |host| and port |port|. This function returns - * the file descriptor of the client socket. - */ -static int connect_to(const char *host, uint16_t port) -{ - struct addrinfo hints; - int fd = -1; - int rv; - char service[NI_MAXSERV]; - struct addrinfo *res, *rp; - snprintf(service, sizeof(service), "%u", port); - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - rv = getaddrinfo(host, service, &hints, &res); - if(rv != 0) { - dief("getaddrinfo", gai_strerror(rv)); - } - for(rp = res; rp; rp = rp->ai_next) { - fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) { - continue; - } - while((rv = connect(fd, rp->ai_addr, rp->ai_addrlen)) == -1 && - errno == EINTR); - if(rv == 0) { - break; - } - MHD_socket_close_(fd); - fd = -1; - dief("connect", strerror(errno)); - } - freeaddrinfo(res); - return fd; -} - -static void make_non_block(int fd) -{ - int flags, rv; - while((flags = fcntl(fd, F_GETFL, 0)) == -1 && errno == EINTR); - if(flags == -1) { - dief("fcntl1", strerror(errno)); - } - while((rv = fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1 && errno == EINTR); - if(rv == -1) { - dief("fcntl2", strerror(errno)); - } -} - -/* - * Setting TCP_NODELAY is not mandatory for the SPDY protocol. - */ -static void set_tcp_nodelay(int fd) -{ - int val = 1; - int rv; - rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(rv == -1) { - dief("setsockopt", strerror(errno)); - } -} - -/* - * Update |pollfd| based on the state of |connection|. - */ -static void ctl_poll(struct pollfd *pollfd, struct Connection *connection) -{ - pollfd->events = 0; - if(spdylay_session_want_read(connection->session) || - connection->want_io == WANT_READ) { - pollfd->events |= POLLIN; - } - if(spdylay_session_want_write(connection->session) || - connection->want_io == WANT_WRITE) { - pollfd->events |= POLLOUT; - } -} - -/* - * Submits the request |req| to the connection |connection|. This - * function does not send packets; just append the request to the - * internal queue in |connection->session|. - */ -static void submit_request(struct Connection *connection, struct Request *req) -{ - int pri = 0; - int rv; - const char *nv[15]; - /* We always use SPDY/3 style header even if the negotiated protocol - version is SPDY/2. The library translates the header name as - necessary. Make sure that the last item is NULL! */ - nv[0] = ":method"; nv[1] = "GET"; - nv[2] = ":path"; nv[3] = req->path; - nv[4] = ":version"; nv[5] = "HTTP/1.1"; - nv[6] = ":scheme"; nv[7] = "https"; - nv[8] = ":host"; nv[9] = req->hostport; - nv[10] = "accept"; nv[11] = "*/*"; - nv[12] = "user-agent"; nv[13] = "spdylay/"SPDYLAY_VERSION; - nv[14] = NULL; - rv = spdylay_submit_request(connection->session, pri, nv, NULL, req); - if(rv != 0) { - diec("spdylay_submit_request", rv); - } -} - -/* - * Performs the network I/O. - */ -static void exec_io(struct Connection *connection) -{ - int rv; - rv = spdylay_session_recv(connection->session); - if(rv != 0) { - diec("spdylay_session_recv", rv); - } - rv = spdylay_session_send(connection->session); - if(rv != 0) { - diec("spdylay_session_send", rv); - } -} - -static void request_init(struct Request *req, const struct URI *uri) -{ - req->host = strcopy(uri->host, uri->hostlen); - req->port = uri->port; - req->path = strcopy(uri->path, uri->pathlen); - req->hostport = strcopy(uri->hostport, uri->hostportlen); - req->stream_id = -1; - req->inflater = NULL; -} - -static void request_free(struct Request *req) -{ - free(req->host); - free(req->path); - free(req->hostport); - spdylay_gzip_inflate_del(req->inflater); -} - -/* - * Fetches the resource denoted by |uri|. - */ -static void fetch_uri(const struct URI *uri) -{ - spdylay_session_callbacks callbacks; - int fd; - struct Request req; - struct Connection connection; - int rv; - nfds_t npollfds = 1; - struct pollfd pollfds[1]; - uint16_t spdy_proto_version = 3; - - request_init(&req, uri); - - setup_spdylay_callbacks(&callbacks); - - /* Establish connection and setup SSL */ - fd = connect_to(req.host, req.port); - if (-1 == fd) - abort (); - - connection.fd = fd; - connection.want_io = IO_NONE; - - /* Here make file descriptor non-block */ - make_non_block(fd); - set_tcp_nodelay(fd); - - printf("[INFO] SPDY protocol version = %d\n", spdy_proto_version); - rv = spdylay_session_client_new(&connection.session, spdy_proto_version, - &callbacks, &connection); - if(rv != 0) { - diec("spdylay_session_client_new", rv); - } - - /* Submit the HTTP request to the outbound queue. */ - submit_request(&connection, &req); - - pollfds[0].fd = fd; - ctl_poll(pollfds, &connection); - - /* Event loop */ - while(spdylay_session_want_read(connection.session) || - spdylay_session_want_write(connection.session)) { - int nfds = poll(pollfds, npollfds, -1); - if(nfds == -1) { - dief("poll", strerror(errno)); - } - if(pollfds[0].revents & (POLLIN | POLLOUT)) { - exec_io(&connection); - } - if((pollfds[0].revents & POLLHUP) || (pollfds[0].revents & POLLERR)) { - die("Connection error"); - } - ctl_poll(pollfds, &connection); - } - - /* Resource cleanup */ - spdylay_session_del(connection.session); - shutdown(fd, SHUT_WR); - MHD_socket_close_(fd); - request_free(&req); -} - -static int parse_uri(struct URI *res, const char *uri) -{ - /* We only interested in https */ - size_t len, i, offset; - memset(res, 0, sizeof(struct URI)); - len = strlen(uri); - if(len < 9 || memcmp("https://", uri, 8) != 0) { - return -1; - } - offset = 8; - res->host = res->hostport = &uri[offset]; - res->hostlen = 0; - if(uri[offset] == '[') { - /* IPv6 literal address */ - ++offset; - ++res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == ']') { - res->hostlen = i-offset; - offset = i+1; - break; - } - } - } else { - const char delims[] = ":/?#"; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - } - res->hostlen = i-offset; - offset = i; - } - if(res->hostlen == 0) { - return -1; - } - /* Assuming https */ - res->port = 443; - if(offset < len) { - if(uri[offset] == ':') { - /* port */ - const char delims[] = "/?#"; - int port = 0; - ++offset; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - if('0' <= uri[i] && uri[i] <= '9') { - port *= 10; - port += uri[i]-'0'; - if(port > 65535) { - return -1; - } - } else { - return -1; - } - } - if(port == 0) { - return -1; - } - offset = i; - res->port = port; - } - } - res->hostportlen = uri+offset-res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == '#') { - break; - } - } - if(i-offset == 0) { - res->path = "/"; - res->pathlen = 1; - } else { - res->path = &uri[offset]; - res->pathlen = i-offset; - } - return 0; -} - - -/***** - * end of code needed to utilize spdylay - */ - - -/***** - * start of code needed to utilize microspdy - */ - - -void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)method; - (void)version; - (void)more; - - struct SPDY_Response *response=NULL; - - if(strcmp(CLS,cls)!=0) - { - killchild(child,"wrong cls"); - } - - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,RESPONSE_BODY,strlen(RESPONSE_BODY)); - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - exit(3); - } - - if(SPDY_queue_response(request,response,true,false,NULL,(void*)strdup(path))!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - exit(4); - } -} - -void -session_closed_handler (void *cls, - struct SPDY_Session * session, - int by_client) -{ - printf("session_closed_handler called\n"); - - if(strcmp(CLS,cls)!=0) - { - killchild(child,"wrong cls"); - } - - if(SPDY_YES != by_client) - { - //killchild(child,"wrong by_client"); - printf("session closed by server\n"); - } - else - { - printf("session closed by client\n"); - } - - if(NULL == session) - { - killchild(child,"session is NULL"); - } - - session_closed_called = 1; -} - - -/***** - * end of code needed to utilize microspdy - */ - -//child process -void -childproc(int port) -{ - struct URI uri; - struct sigaction act; - int rv; - char *uristr; - - memset(&act, 0, sizeof(struct sigaction)); - act.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &act, 0); - - usleep(10000); - asprintf(&uristr, "https://127.0.0.1:%i/",port); - if(NULL == (rcvbuf = malloc(strlen(RESPONSE_BODY)+1))) - killparent(parent,"no memory"); - - rv = parse_uri(&uri, uristr); - if(rv != 0) { - killparent(parent,"parse_uri failed"); - } - fetch_uri(&uri); - - if(strcmp(rcvbuf, RESPONSE_BODY)) - killparent(parent,"received data is different"); -} - -//parent proc -int -parentproc( int port) -{ - int childstatus; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - SPDY_init(); - - daemon = SPDY_start_daemon(port, - NULL, - NULL, - NULL,&session_closed_handler,&standard_request_handler,NULL,CLS, - SPDY_DAEMON_OPTION_IO_SUBSYSTEM, SPDY_IO_SUBSYSTEM_RAW, - SPDY_DAEMON_OPTION_FLAGS, SPDY_DAEMON_FLAG_NO_DELAY, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - killchild(child, "select error"); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(waitpid(child,&childstatus,WNOHANG) != child); - - //give chance to the client to close socket and handle this in run - usleep(100000); - SPDY_run(daemon); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return WEXITSTATUS(childstatus); -} - -int main() -{ - int port = get_port(12123); - parent = getpid(); - - child = fork(); - if (child == -1) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - childproc(port); - _exit(0); - } - else - { - int ret = parentproc(port); - if(1 == session_closed_called && 0 == ret) - exit(0); - else - exit(ret ? ret : 21); - } - return 1; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_proxies.c libmicrohttpd-0.9.55/src/testspdy/test_proxies.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_proxies.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_proxies.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,255 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file test_proxies.c - * @brief test curl > mhd2spdylay > microspdy2http > mhd - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "common.h" -#include -#include /* printf, stderr, fprintf */ -#include /* pid_t */ -#include /* _exit, fork */ -#include /* exit */ -#include /* errno */ -#include /* pid_t */ -#include "common.h" - -#ifdef _WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif /* !WIN32_LEAN_AND_MEAN */ -#include -#endif - -#define EXPECTED_BODY "libmicrohttpd demolibmicrohttpd demo" - - -pid_t parent; - pid_t child_mhd; - pid_t child_spdy2http; - pid_t child_mhd2spdy; - pid_t child_curl; - - uint16_t mhd_port; - uint16_t spdy2http_port; - uint16_t mhd2spdy_port; - -void -killproc(int pid, const char *message) -{ - printf("%s\nkilling %i\n",message,pid); - kill(pid, SIGKILL); -} - - -void killchildren() -{ - if(0 != child_mhd) - killproc(child_mhd,"kill mhd\n"); - if(0 != child_spdy2http) - killproc(child_spdy2http,"kill spdy2http\n"); - if(0 != child_mhd2spdy) - killproc(child_mhd2spdy,"kill mhd2spdy\n"); - if(0 != child_curl) - killproc(child_curl,"kill curl\n"); -} - -pid_t au_fork() -{ - pid_t child = fork(); - if (child == -1) - { - killchildren(); - - killproc(parent,"fork failed\n"); - } - - return child; -} - - -int main() -{ - //pid_t child; - int childstatus; - pid_t wpid; - - parent = getpid(); - mhd_port = get_port(4000); - spdy2http_port = get_port(4100); - mhd2spdy_port = get_port(4200); - - child_mhd = au_fork(); - if (child_mhd == 0) - { - //run MHD - pid_t devnull; - char *port_s; - - close(1); - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort(); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - asprintf(&port_s, "%i", mhd_port); - execlp ("../examples/minimal_example", "minimal_example", port_s, NULL); - fprintf(stderr, "executing mhd failed\nFor this test 'make' must be run before 'make check'!\n"); - //killchildren(); - _exit(1); - } - - - child_spdy2http = au_fork(); - if (child_spdy2http == 0) - { - //run spdy2http - pid_t devnull; - char *port_s; - //char *url; - - close(1); - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort(); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - //asprintf(&url, "127.0.0.1:%i", mhd_port); - asprintf(&port_s, "%i", spdy2http_port); - sleep(1); - execlp ("../spdy2http/microspdy2http", "microspdy2http", "-v4rtT", "10", "-p", port_s, NULL); - fprintf(stderr, "executing microspdy2http failed\n"); - //killchildren(); - _exit(1); - } - - child_mhd2spdy = au_fork(); - if (child_mhd2spdy == 0) - { - //run MHD2sdpy - pid_t devnull; - char *port_s; - char *url; - - close(1); - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort(); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - asprintf(&url, "http://127.0.0.1:%i", spdy2http_port); - asprintf(&port_s, "%i", mhd2spdy_port); - sleep(2); - execlp ("../examples/mhd2spdy", "mhd2spdy", "-vosb", url, "-p", port_s, NULL); - fprintf(stderr, "executing mhd2spdy failed\n"); - //killchildren(); - _exit(1); - } - - child_curl = au_fork(); - if (child_curl == 0) - { - //run curl - FILE *p; - pid_t devnull; - char *cmd; - unsigned int i; - int retc; - char buf[strlen(EXPECTED_BODY) + 1]; - - close(1); - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort (); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - - asprintf (&cmd, "curl --proxy http://127.0.0.1:%i http://127.0.0.1:%i/", mhd2spdy_port, mhd_port); - sleep(3); - p = popen(cmd, "r"); - if (p != NULL) - { - for (i = 0; i < strlen(EXPECTED_BODY) && !feof(p); i++) - { - retc = fgetc (p); - if (EOF == retc) - abort (); /* what did feof(p) do there!? */ - buf[i] = (char) retc; - } - - pclose(p); - buf[i] = 0; - _exit(strcmp(EXPECTED_BODY, buf)); - } - fprintf(stderr, "executing curl failed\n"); - //killchildren(); - _exit(1); - } - - do - { - wpid = waitpid(child_mhd,&childstatus,WNOHANG); - if(wpid == child_mhd) - { - fprintf(stderr, "mhd died unexpectedly\n"); - killchildren(); - return 1; - } - - wpid = waitpid(child_spdy2http,&childstatus,WNOHANG); - if(wpid == child_spdy2http) - { - fprintf(stderr, "spdy2http died unexpectedly\n"); - killchildren(); - return 1; - } - - wpid = waitpid(child_mhd2spdy,&childstatus,WNOHANG); - if(wpid == child_mhd2spdy) - { - fprintf(stderr, "mhd2spdy died unexpectedly\n"); - killchildren(); - return 1; - } - - if(waitpid(child_curl,&childstatus,WNOHANG) == child_curl) - { - killchildren(); - return WEXITSTATUS(childstatus); - } - sleep(1); - } - while(true); -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_request_response.c libmicrohttpd-0.9.55/src/testspdy/test_request_response.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_request_response.c 2015-08-02 19:07:58.000000000 +0200 +++ libmicrohttpd-0.9.55/src/testspdy/test_request_response.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1029 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file test_request_response.c - * @brief tests receiving request and sending response. spdycli.c (spdylay) - * code is reused here - * @author Andrey Uzunov - * @author Tatsuhiro Tsujikawa - */ - -#include "platform.h" -#include "microspdy.h" -#include -#include "common.h" - -#define RESPONSE_BODY "Hi, this is libmicrospdy!" - -#define CLS "anything" - -pid_t parent; -pid_t child; -char *rcvbuf; -int rcvbuf_c = 0; - -int session_closed_called = 0; - -void -killchild(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - exit(1); -} - -void -killparent(int pid, char *message) -{ - printf("%s\n",message); - kill(pid, SIGKILL); - _exit(1); -} - - -/***** - * start of code needed to utilize spdylay - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -enum { - IO_NONE, - WANT_READ, - WANT_WRITE -}; - -struct Connection { - SSL *ssl; - spdylay_session *session; - /* WANT_READ if SSL connection needs more input; or WANT_WRITE if it - needs more output; or IO_NONE. This is necessary because SSL/TLS - re-negotiation is possible at any time. Spdylay API offers - similar functions like spdylay_session_want_read() and - spdylay_session_want_write() but they do not take into account - SSL connection. */ - int want_io; -}; - -struct Request { - char *host; - uint16_t port; - /* In this program, path contains query component as well. */ - char *path; - /* This is the concatenation of host and port with ":" in - between. */ - char *hostport; - /* Stream ID for this request. */ - int32_t stream_id; - /* The gzip stream inflater for the compressed response. */ - spdylay_gzip *inflater; -}; - -struct URI { - const char *host; - size_t hostlen; - uint16_t port; - /* In this program, path contains query component as well. */ - const char *path; - size_t pathlen; - const char *hostport; - size_t hostportlen; -}; - -/* - * Returns copy of string |s| with the length |len|. The returned - * string is NULL-terminated. - */ -static char* strcopy(const char *s, size_t len) -{ - char *dst; - dst = malloc(len+1); - if (NULL == dst) - abort (); - memcpy(dst, s, len); - dst[len] = '\0'; - return dst; -} - -/* - * Prints error message |msg| and exit. - */ -static void die(const char *msg) -{ - fprintf(stderr, "FATAL: %s\n", msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and message |msg| - * and exit. - */ -static void dief(const char *func, const char *msg) -{ - fprintf(stderr, "FATAL: %s: %s\n", func, msg); - exit(EXIT_FAILURE); -} - -/* - * Prints error containing the function name |func| and error code - * |error_code| and exit. - */ -static void diec(const char *func, int error_code) -{ - fprintf(stderr, "FATAL: %s: error_code=%d, msg=%s\n", func, error_code, - spdylay_strerror(error_code)); - exit(EXIT_FAILURE); -} - -/* - * Check response is content-encoding: gzip. We need this because SPDY - * client is required to support gzip. - */ -static void check_gzip(struct Request *req, char **nv) -{ - int gzip = 0; - size_t i; - for(i = 0; nv[i]; i += 2) { - if(strcmp("content-encoding", nv[i]) == 0) { - gzip = strcmp("gzip", nv[i+1]) == 0; - break; - } - } - if(gzip) { - int rv; - if(req->inflater) { - return; - } - rv = spdylay_gzip_inflate_new(&req->inflater); - if(rv != 0) { - die("Can't allocate inflate stream."); - } - } -} - -/* - * The implementation of spdylay_send_callback type. Here we write - * |data| with size |length| to the network and return the number of - * bytes actually written. See the documentation of - * spdylay_send_callback for the details. - */ -static ssize_t send_callback(spdylay_session *session, - const uint8_t *data, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - ERR_clear_error(); - rv = SSL_write(connection->ssl, data, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io = (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } - return rv; -} - -/* - * The implementation of spdylay_recv_callback type. Here we read data - * from the network and write them in |buf|. The capacity of |buf| is - * |length| bytes. Returns the number of bytes stored in |buf|. See - * the documentation of spdylay_recv_callback for the details. - */ -static ssize_t recv_callback(spdylay_session *session, - uint8_t *buf, size_t length, int flags, - void *user_data) -{ - (void)session; - (void)flags; - - struct Connection *connection; - ssize_t rv; - connection = (struct Connection*)user_data; - connection->want_io = IO_NONE; - ERR_clear_error(); - rv = SSL_read(connection->ssl, buf, length); - if(rv < 0) { - int err = SSL_get_error(connection->ssl, rv); - if(err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { - connection->want_io = (err == SSL_ERROR_WANT_READ ? - WANT_READ : WANT_WRITE); - rv = SPDYLAY_ERR_WOULDBLOCK; - } else { - rv = SPDYLAY_ERR_CALLBACK_FAILURE; - } - } else if(rv == 0) { - rv = SPDYLAY_ERR_EOF; - } - return rv; -} - -/* - * The implementation of spdylay_before_ctrl_send_callback type. We - * use this function to get stream ID of the request. This is because - * stream ID is not known when we submit the request - * (spdylay_submit_request). - */ -static void before_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, - void *user_data) -{ - (void)user_data; - - if(type == SPDYLAY_SYN_STREAM) { - struct Request *req; - int stream_id = frame->syn_stream.stream_id; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req && req->stream_id == -1) { - req->stream_id = stream_id; - printf("[INFO] Stream ID = %d\n", stream_id); - } - } -} - -static void on_ctrl_send_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_STREAM: - nv = frame->syn_stream.nv; - name = "SYN_STREAM"; - stream_id = frame->syn_stream.stream_id; - break; - default: - break; - } - if(name && spdylay_session_get_stream_user_data(session, stream_id)) { - printf("[INFO] C ----------------------------> S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -static void on_ctrl_recv_callback(spdylay_session *session, - spdylay_frame_type type, - spdylay_frame *frame, void *user_data) -{ - (void)user_data; - - struct Request *req; - char **nv; - const char *name = NULL; - int32_t stream_id; - size_t i; - switch(type) { - case SPDYLAY_SYN_REPLY: - nv = frame->syn_reply.nv; - name = "SYN_REPLY"; - stream_id = frame->syn_reply.stream_id; - break; - case SPDYLAY_HEADERS: - nv = frame->headers.nv; - name = "HEADERS"; - stream_id = frame->headers.stream_id; - break; - default: - break; - } - if(!name) { - return; - } - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - check_gzip(req, nv); - printf("[INFO] C <---------------------------- S (%s)\n", name); - for(i = 0; nv[i]; i += 2) { - printf(" %s: %s\n", nv[i], nv[i+1]); - } - } -} - -/* - * The implementation of spdylay_on_stream_close_callback type. We use - * this function to know the response is fully received. Since we just - * fetch 1 resource in this program, after reception of the response, - * we submit GOAWAY and close the session. - */ -static void on_stream_close_callback(spdylay_session *session, - int32_t stream_id, - spdylay_status_code status_code, - void *user_data) -{ - (void)user_data; - (void)status_code; - - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - int rv; - rv = spdylay_submit_goaway(session, SPDYLAY_GOAWAY_OK); - if(rv != 0) { - diec("spdylay_submit_goaway", rv); - } - } -} - -#define MAX_OUTLEN 4096 - -/* - * The implementation of spdylay_on_data_chunk_recv_callback type. We - * use this function to print the received response body. - */ -static void on_data_chunk_recv_callback(spdylay_session *session, uint8_t flags, - int32_t stream_id, - const uint8_t *data, size_t len, - void *user_data) -{ - (void)user_data; - (void)flags; - - struct Request *req; - req = spdylay_session_get_stream_user_data(session, stream_id); - if(req) { - printf("[INFO] C <---------------------------- S (DATA)\n"); - printf(" %lu bytes\n", (unsigned long int)len); - if(req->inflater) { - while(len > 0) { - uint8_t out[MAX_OUTLEN]; - size_t outlen = MAX_OUTLEN; - size_t tlen = len; - int rv; - rv = spdylay_gzip_inflate(req->inflater, out, &outlen, data, &tlen); - if(rv == -1) { - spdylay_submit_rst_stream(session, stream_id, SPDYLAY_INTERNAL_ERROR); - break; - } - fwrite(out, 1, outlen, stdout); - data += tlen; - len -= tlen; - } - } else { - /* TODO add support gzip */ - fwrite(data, 1, len, stdout); - - //check if the data is correct - //if(strcmp(RESPONSE_BODY, data) != 0) - //killparent(parent, "\nreceived data is not the same"); - if(len + rcvbuf_c > strlen(RESPONSE_BODY)) - killparent(parent, "\nreceived data is not the same"); - - strcpy(rcvbuf + rcvbuf_c,(char*)data); - rcvbuf_c+=len; - } - printf("\n"); - } -} - -/* - * Setup callback functions. Spdylay API offers many callback - * functions, but most of them are optional. The send_callback is - * always required. Since we use spdylay_session_recv(), the - * recv_callback is also required. - */ -static void setup_spdylay_callbacks(spdylay_session_callbacks *callbacks) -{ - memset(callbacks, 0, sizeof(spdylay_session_callbacks)); - callbacks->send_callback = send_callback; - callbacks->recv_callback = recv_callback; - callbacks->before_ctrl_send_callback = before_ctrl_send_callback; - callbacks->on_ctrl_send_callback = on_ctrl_send_callback; - callbacks->on_ctrl_recv_callback = on_ctrl_recv_callback; - callbacks->on_stream_close_callback = on_stream_close_callback; - callbacks->on_data_chunk_recv_callback = on_data_chunk_recv_callback; -} - -/* - * Callback function for SSL/TLS NPN. Since this program only supports - * SPDY protocol, if server does not offer SPDY protocol the Spdylay - * library supports, we terminate program. - */ -static int select_next_proto_cb(SSL* ssl, - unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - void *arg) -{ - (void)ssl; - - int rv; - uint16_t *spdy_proto_version; - /* spdylay_select_next_protocol() selects SPDY protocol version the - Spdylay library supports. */ - rv = spdylay_select_next_protocol(out, outlen, in, inlen); - if(rv <= 0) { - die("Server did not advertise spdy/2 or spdy/3 protocol."); - } - spdy_proto_version = (uint16_t*)arg; - *spdy_proto_version = rv; - return SSL_TLSEXT_ERR_OK; -} - -/* - * Setup SSL context. We pass |spdy_proto_version| to get negotiated - * SPDY protocol version in NPN callback. - */ -static void init_ssl_ctx(SSL_CTX *ssl_ctx, uint16_t *spdy_proto_version) -{ - /* Disable SSLv2 and enable all workarounds for buggy servers */ - SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL|SSL_OP_NO_SSLv2); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_AUTO_RETRY); - SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); - /* Set NPN callback */ - SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, - spdy_proto_version); -} - -static void ssl_handshake(SSL *ssl, int fd) -{ - int rv; - if(SSL_set_fd(ssl, fd) == 0) { - dief("SSL_set_fd", ERR_error_string(ERR_get_error(), NULL)); - } - ERR_clear_error(); - rv = SSL_connect(ssl); - if(rv <= 0) { - dief("SSL_connect", ERR_error_string(ERR_get_error(), NULL)); - } -} - -/* - * Connects to the host |host| and port |port|. This function returns - * the file descriptor of the client socket. - */ -static int connect_to(const char *host, uint16_t port) -{ - struct addrinfo hints; - int fd = -1; - int rv; - char service[NI_MAXSERV]; - struct addrinfo *res, *rp; - snprintf(service, sizeof(service), "%u", port); - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - rv = getaddrinfo(host, service, &hints, &res); - if(rv != 0) { - dief("getaddrinfo", gai_strerror(rv)); - } - for(rp = res; rp; rp = rp->ai_next) { - fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) { - continue; - } - while((rv = connect(fd, rp->ai_addr, rp->ai_addrlen)) == -1 && - errno == EINTR); - if(rv == 0) { - break; - } - MHD_socket_close_(fd); - fd = -1; - } - freeaddrinfo(res); - return fd; -} - -static void make_non_block(int fd) -{ - int flags, rv; - while((flags = fcntl(fd, F_GETFL, 0)) == -1 && errno == EINTR); - if(flags == -1) { - dief("fcntl", strerror(errno)); - } - while((rv = fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1 && errno == EINTR); - if(rv == -1) { - dief("fcntl", strerror(errno)); - } -} - -/* - * Setting TCP_NODELAY is not mandatory for the SPDY protocol. - */ -static void set_tcp_nodelay(int fd) -{ - int val = 1; - int rv; - rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, (socklen_t)sizeof(val)); - if(rv == -1) { - dief("setsockopt", strerror(errno)); - } -} - -/* - * Update |pollfd| based on the state of |connection|. - */ -static void ctl_poll(struct pollfd *pollfd, struct Connection *connection) -{ - pollfd->events = 0; - if(spdylay_session_want_read(connection->session) || - connection->want_io == WANT_READ) { - pollfd->events |= POLLIN; - } - if(spdylay_session_want_write(connection->session) || - connection->want_io == WANT_WRITE) { - pollfd->events |= POLLOUT; - } -} - -/* - * Submits the request |req| to the connection |connection|. This - * function does not send packets; just append the request to the - * internal queue in |connection->session|. - */ -static void submit_request(struct Connection *connection, struct Request *req) -{ - int pri = 0; - int rv; - const char *nv[15]; - /* We always use SPDY/3 style header even if the negotiated protocol - version is SPDY/2. The library translates the header name as - necessary. Make sure that the last item is NULL! */ - nv[0] = ":method"; nv[1] = "GET"; - nv[2] = ":path"; nv[3] = req->path; - nv[4] = ":version"; nv[5] = "HTTP/1.1"; - nv[6] = ":scheme"; nv[7] = "https"; - nv[8] = ":host"; nv[9] = req->hostport; - nv[10] = "accept"; nv[11] = "*/*"; - nv[12] = "user-agent"; nv[13] = "spdylay/"SPDYLAY_VERSION; - nv[14] = NULL; - rv = spdylay_submit_request(connection->session, pri, nv, NULL, req); - if(rv != 0) { - diec("spdylay_submit_request", rv); - } -} - -/* - * Performs the network I/O. - */ -static void exec_io(struct Connection *connection) -{ - int rv; - rv = spdylay_session_recv(connection->session); - if(rv != 0) { - diec("spdylay_session_recv", rv); - } - rv = spdylay_session_send(connection->session); - if(rv != 0) { - diec("spdylay_session_send", rv); - } -} - -static void request_init(struct Request *req, const struct URI *uri) -{ - req->host = strcopy(uri->host, uri->hostlen); - req->port = uri->port; - req->path = strcopy(uri->path, uri->pathlen); - req->hostport = strcopy(uri->hostport, uri->hostportlen); - req->stream_id = -1; - req->inflater = NULL; -} - -static void request_free(struct Request *req) -{ - free(req->host); - free(req->path); - free(req->hostport); - spdylay_gzip_inflate_del(req->inflater); -} - -/* - * Fetches the resource denoted by |uri|. - */ -static void fetch_uri(const struct URI *uri) -{ - spdylay_session_callbacks callbacks; - int fd; - SSL_CTX *ssl_ctx; - SSL *ssl; - struct Request req; - struct Connection connection; - int rv; - nfds_t npollfds = 1; - struct pollfd pollfds[1]; - uint16_t spdy_proto_version; - - request_init(&req, uri); - - setup_spdylay_callbacks(&callbacks); - - /* Establish connection and setup SSL */ - fd = connect_to(req.host, req.port); - if (-1 == fd) - abort (); - ssl_ctx = SSL_CTX_new(SSLv23_client_method()); - if(ssl_ctx == NULL) { - dief("SSL_CTX_new", ERR_error_string(ERR_get_error(), NULL)); - } - init_ssl_ctx(ssl_ctx, &spdy_proto_version); - ssl = SSL_new(ssl_ctx); - if(ssl == NULL) { - dief("SSL_new", ERR_error_string(ERR_get_error(), NULL)); - } - /* To simplify the program, we perform SSL/TLS handshake in blocking - I/O. */ - ssl_handshake(ssl, fd); - - connection.ssl = ssl; - connection.want_io = IO_NONE; - - /* Here make file descriptor non-block */ - make_non_block(fd); - set_tcp_nodelay(fd); - - printf("[INFO] SPDY protocol version = %d\n", spdy_proto_version); - rv = spdylay_session_client_new(&connection.session, spdy_proto_version, - &callbacks, &connection); - if(rv != 0) { - diec("spdylay_session_client_new", rv); - } - - /* Submit the HTTP request to the outbound queue. */ - submit_request(&connection, &req); - - pollfds[0].fd = fd; - ctl_poll(pollfds, &connection); - - /* Event loop */ - while(spdylay_session_want_read(connection.session) || - spdylay_session_want_write(connection.session)) { - int nfds = poll(pollfds, npollfds, -1); - if(nfds == -1) { - dief("poll", strerror(errno)); - } - if(pollfds[0].revents & (POLLIN | POLLOUT)) { - exec_io(&connection); - } - if((pollfds[0].revents & POLLHUP) || (pollfds[0].revents & POLLERR)) { - die("Connection error"); - } - ctl_poll(pollfds, &connection); - } - - /* Resource cleanup */ - spdylay_session_del(connection.session); - SSL_shutdown(ssl); - SSL_free(ssl); - SSL_CTX_free(ssl_ctx); - shutdown(fd, SHUT_WR); - MHD_socket_close_(fd); - request_free(&req); -} - -static int parse_uri(struct URI *res, const char *uri) -{ - /* We only interested in https */ - size_t len, i, offset; - memset(res, 0, sizeof(struct URI)); - len = strlen(uri); - if(len < 9 || memcmp("https://", uri, 8) != 0) { - return -1; - } - offset = 8; - res->host = res->hostport = &uri[offset]; - res->hostlen = 0; - if(uri[offset] == '[') { - /* IPv6 literal address */ - ++offset; - ++res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == ']') { - res->hostlen = i-offset; - offset = i+1; - break; - } - } - } else { - const char delims[] = ":/?#"; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - } - res->hostlen = i-offset; - offset = i; - } - if(res->hostlen == 0) { - return -1; - } - /* Assuming https */ - res->port = 443; - if(offset < len) { - if(uri[offset] == ':') { - /* port */ - const char delims[] = "/?#"; - int port = 0; - ++offset; - for(i = offset; i < len; ++i) { - if(strchr(delims, uri[i]) != NULL) { - break; - } - if('0' <= uri[i] && uri[i] <= '9') { - port *= 10; - port += uri[i]-'0'; - if(port > 65535) { - return -1; - } - } else { - return -1; - } - } - if(port == 0) { - return -1; - } - offset = i; - res->port = port; - } - } - res->hostportlen = uri+offset-res->host; - for(i = offset; i < len; ++i) { - if(uri[i] == '#') { - break; - } - } - if(i-offset == 0) { - res->path = "/"; - res->pathlen = 1; - } else { - res->path = &uri[offset]; - res->pathlen = i-offset; - } - return 0; -} - - -/***** - * end of code needed to utilize spdylay - */ - - -/***** - * start of code needed to utilize microspdy - */ - - -void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)method; - (void)version; - - struct SPDY_Response *response=NULL; - - if(strcmp(CLS,cls)!=0) - { - killchild(child,"wrong cls"); - } - - if(false != more){ - fprintf(stdout,"more has wrong value\n"); - exit(5); - } - - response = SPDY_build_response(200,NULL,SPDY_HTTP_VERSION_1_1,NULL,RESPONSE_BODY,strlen(RESPONSE_BODY)); - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - exit(3); - } - - if(SPDY_queue_response(request,response,true,false,NULL,(void*)strdup(path))!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - exit(4); - } -} - -void -session_closed_handler (void *cls, - struct SPDY_Session * session, - int by_client) -{ - printf("session_closed_handler called\n"); - - if(strcmp(CLS,cls)!=0) - { - killchild(child,"wrong cls"); - } - - if(SPDY_YES != by_client) - { - //killchild(child,"wrong by_client"); - printf("session closed by server\n"); - } - else - { - printf("session closed by client\n"); - } - - if(NULL == session) - { - killchild(child,"session is NULL"); - } - - session_closed_called = 1; -} - - -/***** - * end of code needed to utilize microspdy - */ - -//child process -void -childproc(int port) -{ - struct URI uri; - struct sigaction act; - int rv; - char *uristr; - - memset(&act, 0, sizeof(struct sigaction)); - act.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &act, 0); - - asprintf(&uristr, "https://127.0.0.1:%i/",port); - if(NULL == (rcvbuf = malloc(strlen(RESPONSE_BODY)+1))) - killparent(parent,"no memory"); - - SSL_load_error_strings(); - SSL_library_init(); - - rv = parse_uri(&uri, uristr); - if(rv != 0) { - killparent(parent,"parse_uri failed"); - } - fetch_uri(&uri); - - if(strcmp(rcvbuf, RESPONSE_BODY)) - killparent(parent,"received data is different"); -} - -//parent proc -int -parentproc( int port) -{ - int childstatus; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - SPDY_init(); - - daemon = SPDY_start_daemon(port, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - NULL,&session_closed_handler,&standard_request_handler,NULL,CLS,SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - killchild(child, "select error"); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(waitpid(child,&childstatus,WNOHANG) != child); - - //give chance to the client to close socket and handle this in run - usleep(100000); - SPDY_run(daemon); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return WEXITSTATUS(childstatus); -} - -int main() -{ - int port = get_port(12123); - parent = getpid(); - - child = fork(); - if (child == -1) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - childproc(port); - _exit(0); - } - else - { - int ret = parentproc(port); - if(1 == session_closed_called && 0 == ret) - exit(0); - else - exit(ret ? ret : 21); - } - return 1; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_request_response_with_callback.c libmicrohttpd-0.9.55/src/testspdy/test_request_response_with_callback.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_request_response_with_callback.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_request_response_with_callback.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,320 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file request_response_with_callback.c - * @brief tests responses with callbacks - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "stdio.h" -#include -#include -#include "common.h" -#include -#include - -int port; - -pid_t parent; -pid_t child; - -int run = 1; -int chunk_size=1; - -void -killchild() -{ - kill(child, SIGKILL); - exit(1); -} - -void -killparent() -{ - kill(parent, SIGKILL); - _exit(1); -} - -ssize_t -response_callback (void *cls, - void *buffer, - size_t max, - bool *more) -{ - FILE *fd =(FILE*)cls; - - size_t n; - if(chunk_size % 2) - n = chunk_size; - else - n = max - chunk_size; - - if(n < 1) n = 1; - else if (n > max) n=max; - chunk_size++; - - int ret = fread(buffer,1,n,fd); - *more = feof(fd) == 0; - - //printf("more is %i\n",*more); - - if(!(*more)) - fclose(fd); - - return ret; -} - - -void -response_done_callback(void *cls, - struct SPDY_Response * response, - struct SPDY_Request * request, - enum SPDY_RESPONSE_RESULT status, - bool streamopened) -{ - (void)status; - (void)streamopened; - - printf("answer for %s was sent\n", (char*)cls); - - SPDY_destroy_request(request); - SPDY_destroy_response(response); - free(cls); - - run = 0; -} - -void -standard_request_handler(void *cls, - struct SPDY_Request * request, - uint8_t priority, - const char *method, - const char *path, - const char *version, - const char *host, - const char *scheme, - struct SPDY_NameValue * headers, - bool more) -{ - (void)cls; - (void)request; - (void)priority; - (void)host; - (void)scheme; - (void)headers; - (void)method; - (void)version; - (void)more; - - struct SPDY_Response *response=NULL; - struct SPDY_NameValue *resp_headers; - - printf("received request for '%s %s %s'\n", method, path, version); - - FILE *fd = fopen(DATA_DIR "spdy-draft.txt","r"); - - if(NULL == (resp_headers = SPDY_name_value_create())) - { - fprintf(stdout,"SPDY_name_value_create failed\n"); - killchild(); - } - if(SPDY_YES != SPDY_name_value_add(resp_headers,SPDY_HTTP_HEADER_CONTENT_TYPE,"text/plain")) - { - fprintf(stdout,"SPDY_name_value_add failed\n"); - killchild(); - } - - response = SPDY_build_response_with_callback(200,NULL, - SPDY_HTTP_VERSION_1_1,resp_headers,&response_callback,fd,SPDY_MAX_SUPPORTED_FRAME_SIZE); - SPDY_name_value_destroy(resp_headers); - - if(NULL==response){ - fprintf(stdout,"no response obj\n"); - killchild(); - } - - void *clspath = strdup(path); - - if(SPDY_queue_response(request,response,true,false,&response_done_callback,clspath)!=SPDY_YES) - { - fprintf(stdout,"queue\n"); - killchild(); - } -} - -int -parentproc() -{ - int childstatus; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - - SPDY_init(); - - daemon = SPDY_start_daemon(port, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - NULL, - NULL, - &standard_request_handler, - NULL, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - 1800, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - if(SPDY_NO == ret || timeoutlong > 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - break; - case 0: - - break; - default: - SPDY_run(daemon); - - break; - } - } - while(waitpid(child,&childstatus,WNOHANG) != child); - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return WEXITSTATUS(childstatus); -} - -#define MD5_LEN 32 - -int -md5(char *cmd, char *md5_sum) -{ - FILE *p = popen(cmd, "r"); - if (p == NULL) return 0; - - int i, ch; - for (i = 0; i < MD5_LEN && isxdigit(ch = fgetc(p)); i++) { - *md5_sum++ = ch; - } - - *md5_sum = '\0'; - pclose(p); - return i == MD5_LEN; -} - -int -childproc() -{ - char *cmd1; - char *cmd2; - char md5_sum1[33]; - char md5_sum2[33]; - int ret; - struct timeval tv1; - struct timeval tv2; - struct stat st; - //int secs; - uint64_t usecs; - - asprintf(&cmd1, "spdycat https://127.0.0.1:%i/ | md5sum",port); - asprintf(&cmd2, "md5sum " DATA_DIR "spdy-draft.txt"); - - gettimeofday(&tv1, NULL); - md5(cmd1,md5_sum1); - gettimeofday(&tv2, NULL); - md5(cmd2,md5_sum2); - - printf("downloaded file md5: %s\n", md5_sum1); - printf("original file md5: %s\n", md5_sum2); - ret = strcmp(md5_sum1, md5_sum2); - - if(0 == ret && 0 == stat(DATA_DIR "spdy-draft.txt", &st)) - { - usecs = (uint64_t)1000000 * (uint64_t)(tv2.tv_sec - tv1.tv_sec) + tv2.tv_usec - tv1.tv_usec; - printf("%lld bytes read in %llu usecs\n", (long long)st.st_size, (long long unsigned )usecs); - } - - return ret; -} - - -int -main() -{ - port = get_port(11123); - parent = getpid(); - - child = fork(); - if (-1 == child) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - int ret = childproc(); - _exit(ret); - } - else - { - int ret = parentproc(); - exit(ret); - } - return 1; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_session_timeout.c libmicrohttpd-0.9.55/src/testspdy/test_session_timeout.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_session_timeout.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_session_timeout.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,338 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2013 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file session_timeout.c - * @brief tests closing sessions after set timeout. Openssl is used for - * client - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "stdio.h" -#include -#include -#include "common.h" -#include -#include -#include "../microspdy/internal.h" - -#define TIMEOUT 2 -#define SELECT_MS_TIMEOUT 20 - -int port; - -pid_t parent; -pid_t child; - -int run = 1; -int chunk_size=1; -int new_session; -int closed_session; -int do_sleep; - - - -static unsigned long long -monotonic_time (void) -{ -#ifdef HAVE_CLOCK_GETTIME -#ifdef CLOCK_MONOTONIC - struct timespec ts; - if (0 == clock_gettime (CLOCK_MONOTONIC, &ts)) - return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; -#endif -#endif - return time (NULL) * 1000; -} - - -static void -killchild(char *msg) -{ - printf("%s\n",msg); - kill(child, SIGKILL); - exit(1); -} - - -static void -killparent(char *msg) -{ - printf("%s\n",msg); - kill(parent, SIGKILL); - _exit(1); -} - - -static void -new_session_cb (void *cls, - struct SPDY_Session * session) -{ - (void)cls; - (void)session; - - if(!new_session)do_sleep = 1; - new_session = 1; - printf("new session\n"); -} - - -static void -closed_session_cb (void *cls, - struct SPDY_Session * session, - int by_client) -{ - (void)cls; - (void)session; - - printf("closed_session_cb called\n"); - - if(SPDY_YES == by_client) - { - killchild("closed by the client"); - } - if(closed_session) - { - killchild("closed_session_cb called twice"); - } - - closed_session = 1; -} - - -static int -parentproc() -{ - int childstatus; - unsigned long long timeoutlong=0; - struct timeval timeout; - int ret; - fd_set read_fd_set; - fd_set write_fd_set; - fd_set except_fd_set; - int maxfd = -1; - struct SPDY_Daemon *daemon; - unsigned long long beginning = 0; - unsigned long long now; - - SPDY_init(); - - daemon = SPDY_start_daemon(port, - DATA_DIR "cert-and-key.pem", - DATA_DIR "cert-and-key.pem", - &new_session_cb, - &closed_session_cb, - NULL, - NULL, - NULL, - SPDY_DAEMON_OPTION_SESSION_TIMEOUT, - TIMEOUT, - SPDY_DAEMON_OPTION_END); - - if(NULL==daemon){ - printf("no daemon\n"); - return 1; - } - - do - { - do_sleep=0; - FD_ZERO(&read_fd_set); - FD_ZERO(&write_fd_set); - FD_ZERO(&except_fd_set); - - ret = SPDY_get_timeout(daemon, &timeoutlong); - - if(new_session && !closed_session) - { - if(SPDY_NO == ret) - { - killchild("SPDY_get_timeout returned wrong SPDY_NO"); - } - /*if(timeoutlong) - { - killchild("SPDY_get_timeout returned wrong timeout"); - }*/ - now = monotonic_time (); - if(now - beginning > TIMEOUT*1000 + SELECT_MS_TIMEOUT) - { - printf("Started at: %llums\n",beginning); - printf("Now is: %llums\n",now); - printf("Timeout is: %i\n",TIMEOUT); - printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT); - printf("SPDY_get_timeout gave: %llums\n",timeoutlong); - killchild("Timeout passed but session was not closed"); - } - if(timeoutlong > beginning + TIMEOUT *1000) - { - printf("Started at: %llums\n",beginning); - printf("Now is: %llums\n",now); - printf("Timeout is: %i\n",TIMEOUT); - printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT); - printf("SPDY_get_timeout gave: %llums\n",timeoutlong); - killchild("SPDY_get_timeout returned wrong timeout"); - } - } - else - { - if(SPDY_YES == ret) - { - killchild("SPDY_get_timeout returned wrong SPDY_YES"); - } - } - - if(SPDY_NO == ret || timeoutlong >= 1000) - { - timeout.tv_sec = 1; - timeout.tv_usec = 0; - } - else - { - timeout.tv_sec = timeoutlong / 1000; - timeout.tv_usec = (timeoutlong % 1000) * 1000; - } - - //ignore values - timeout.tv_sec = 0; - timeout.tv_usec = SELECT_MS_TIMEOUT * 1000; - - maxfd = SPDY_get_fdset (daemon, - &read_fd_set, - &write_fd_set, - &except_fd_set); - - ret = select(maxfd+1, &read_fd_set, &write_fd_set, &except_fd_set, &timeout); - - switch(ret) { - case -1: - printf("select error: %i\n", errno); - break; - case 0: - /*if(new_session) - { - killchild("select returned wrong number"); - }*/ - break; - default: - SPDY_run(daemon); - if(0 == beginning) - { - beginning = monotonic_time (); - } - /*if(do_sleep) - { - sleep(TIMEOUT); - do_sleep = 0; - }*/ - break; - } - } - while(waitpid(child,&childstatus,WNOHANG) != child); - - if(!new_session || !closed_session) - { - killchild("child is dead, callback wasn't called"); - } - - ret = SPDY_get_timeout(daemon, &timeoutlong); - - if(SPDY_YES == ret) - { - killchild("SPDY_get_timeout returned wrong SPDY_YES after child died"); - } - - SPDY_stop_daemon(daemon); - - SPDY_deinit(); - - return 0; -} - - -static int -childproc() -{ - pid_t devnull; - int out; - - out=dup(1); - if (-1 == out) - abort(); - //close(0); - close(1); - close(2); - /*devnull = open("/dev/null", O_RDONLY); - if (0 != devnull) - { - dup2(devnull, 0); - close(devnull); - }*/ - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort (); - if (1 != devnull) - { - dup2(devnull, 1); - close(devnull); - } - devnull = open("/dev/null", O_WRONLY); - if (-1 == devnull) - abort (); - if (2 != devnull) - { - dup2(devnull, 2); - close(devnull); - } - char *uri; - asprintf (&uri, "127.0.0.1:%i", port); - execlp ("openssl", "openssl", "s_client", "-connect", uri, NULL); - close(1); - dup2(out,1); - close(out); - killparent ("executing openssl failed"); - return 1; -} - - -int -main() -{ - port = get_port(11123); - parent = getpid(); - - child = fork(); - if (-1 == child) - { - fprintf(stderr, "can't fork, error %d\n", errno); - exit(EXIT_FAILURE); - } - - if (child == 0) - { - int ret = childproc(); - _exit(ret); - } - else - { - int ret = parentproc(); - exit(ret); - } - return 1; -} diff -Nru libmicrohttpd-0.9.44+dfsg/src/testspdy/test_struct_namevalue.c libmicrohttpd-0.9.55/src/testspdy/test_struct_namevalue.c --- libmicrohttpd-0.9.44+dfsg/src/testspdy/test_struct_namevalue.c 2015-02-08 00:10:32.000000000 +0100 +++ libmicrohttpd-0.9.55/src/testspdy/test_struct_namevalue.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,346 +0,0 @@ -/* - This file is part of libmicrospdy - Copyright Copyright (C) 2012 Andrey Uzunov - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file struct_namevalue.c - * @brief tests all the API functions for handling struct SPDY_NameValue - * @author Andrey Uzunov - */ - -#include "platform.h" -#include "microspdy.h" -#include "common.h" -#include "../microspdy/structures.h" -#include "../microspdy/alstructures.h" - -char *pairs[] = {"one","1","two","2","three","3","four","4","five","5"}; -char *pairs_with_dups[] = {"one","1","two","2","one","11","two","22","three","3","two","222","two","2222","four","","five","5"};//82 -char *pairs_with_empty[] = {"name","","name","value"}; -char *pairs_different[] = {"30","thirty","40","fouthy"}; -int size; -int size2; -int brake_at = 3; -bool flag; - - -int -iterate_cb (void *cls, const char *name, const char * const * value, int num_values) -{ - int *c = (int*)cls; - - if(*c < 0 || *c > size) - exit(11); - - if(strcmp(name,pairs[*c]) != 0) - { - FAIL_TEST("name is wrong\n"); - } - - if(1 != num_values) - { - FAIL_TEST("num_values is wrong\n"); - } - - if(strcmp(value[0],pairs[(*c)+1]) != 0) - { - FAIL_TEST("value is wrong\n"); - } - - (*c)+=2; - - return SPDY_YES; -} - -int -iterate_brake_cb (void *cls, const char *name, const char * const *value, int num_values) -{ - (void)name; - (void)value; - (void)num_values; - - int *c = (int*)cls; - - if(*c < 0 || *c >= brake_at) - { - FAIL_TEST("iteration was not interrupted\n"); - } - - (*c)++; - - if(*c == brake_at) return SPDY_NO; - - return SPDY_YES; -} - -int -main() -{ - SPDY_init(); - - const char *const*value; - const char *const*value2; - int i; - int j; - int cls = 0; - int ret; - int ret2; - void *ob1; - void *ob2; - void *ob3; - void *stream; - char data[] = "anything"; - struct SPDY_NameValue *container; - struct SPDY_NameValue *container2; - struct SPDY_NameValue *container3; - struct SPDY_NameValue *container_arr[2]; - - size = sizeof(pairs)/sizeof(pairs[0]); - - if(NULL == (container = SPDY_name_value_create ())) - { - FAIL_TEST("SPDY_name_value_create failed\n"); - } - - if(NULL != SPDY_name_value_lookup (container, "anything", &ret)) - { - FAIL_TEST("SPDY_name_value_lookup failed\n"); - } - - if(SPDY_name_value_iterate (container, NULL, NULL) != 0) - { - FAIL_TEST("SPDY_name_value_iterate failed\n"); - } - - for(i=0;i= 0; i-=2) - { - value = SPDY_name_value_lookup(container,pairs[i], &ret); - if(NULL == value || 1 !=ret || strcmp(value[0], pairs[i+1]) != 0) - { - printf("%p; %i; %i\n", value, ret, - (NULL == value) ? -1 : strcmp(value[0], pairs[i+1])); - FAIL_TEST("SPDY_name_value_lookup failed\n"); - } - } - - SPDY_name_value_iterate (container, &iterate_cb, &cls); - - cls = 0; - if(SPDY_name_value_iterate (container, &iterate_brake_cb, &cls) != brake_at) - { - FAIL_TEST("SPDY_name_value_iterate with brake failed\n"); - } - - SPDY_name_value_destroy(container); - - //check everything with NULL values - for(i=0; i<7; ++i) - { - printf("%i ",i); - ob1 = (i & 4) ? data : NULL; - ob2 = (i & 2) ? data : NULL; - ob3 = (i & 1) ? data : NULL; - if(SPDY_INPUT_ERROR != SPDY_name_value_add(ob1,ob2,ob3)) - { - FAIL_TEST("SPDY_name_value_add with NULLs failed\n"); - } - } - printf("\n"); - fflush(stdout); - - if(SPDY_INPUT_ERROR != SPDY_name_value_iterate(NULL,NULL,NULL)) - { - FAIL_TEST("SPDY_name_value_iterate with NULLs failed\n"); - } - - for(i=0; i<7; ++i) - { - printf("%i ",i); - ob1 = (i & 4) ? data : NULL; - ob2 = (i & 2) ? data : NULL; - ob3 = (i & 1) ? data : NULL; - if(NULL != SPDY_name_value_lookup(ob1,ob2,ob3)) - { - FAIL_TEST("SPDY_name_value_lookup with NULLs failed\n"); - } - } - printf("\n"); - SPDY_name_value_destroy(NULL); - - if(NULL == (container = SPDY_name_value_create ())) - { - FAIL_TEST("SPDY_name_value_create failed\n"); - } - - size = sizeof(pairs_with_dups)/sizeof(pairs_with_dups[0]); - - for(i=0;i= 0; i-=2) - { - value = SPDY_name_value_lookup(container,pairs_with_dups[i], &ret); - if(NULL == value) - { - FAIL_TEST("SPDY_name_value_lookup failed\n"); - } - flag = false; - for(j=0; j (ret = SPDYF_name_value_to_stream(container_arr, 2, &stream)) || NULL == stream) - FAIL_TEST("SPDYF_name_value_to_stream failed\n"); - ret = SPDYF_name_value_from_stream(stream, ret, &container3); - if(SPDY_YES != ret) - FAIL_TEST("SPDYF_name_value_from_stream failed\n"); - - if(SPDY_name_value_iterate(container3, NULL, NULL) - != (SPDY_name_value_iterate(container, NULL, NULL) + SPDY_name_value_iterate(container2, NULL, NULL))) - FAIL_TEST("SPDYF_name_value_from_stream failed\n"); - - for(i=size - 2; i >= 0; i-=2) - { - value = SPDY_name_value_lookup(container,pairs_with_dups[i], &ret); - if(NULL == value) - FAIL_TEST("SPDY_name_value_lookup failed\n"); - value2 = SPDY_name_value_lookup(container3,pairs_with_dups[i], &ret2); - if(NULL == value2) - FAIL_TEST("SPDY_name_value_lookup failed\n"); - - for(j=0; j= 0; i-=2) - { - value = SPDY_name_value_lookup(container2,pairs_different[i], &ret); - if(NULL == value) - FAIL_TEST("SPDY_name_value_lookup failed\n"); - value2 = SPDY_name_value_lookup(container3,pairs_different[i], &ret2); - if(NULL == value2) - FAIL_TEST("SPDY_name_value_lookup failed\n"); - - for(j=0; j + + + $(ProjectName)_d + + + $(ProjectName)-dll_d + + + $(ProjectName) + + + $(ProjectName)-dll + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + MultiThreadedDebug + MultiThreadedDebugDLL + MultiThreaded + MultiThreadedDLL + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/common-build-settings.vcxproj libmicrohttpd-0.9.55/w32/common/common-build-settings.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/common-build-settings.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/common-build-settings.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,100 @@ + + + + + 0 + 1 + + + $(SolutionDir);$(MhdW32Common);$(MhdSrc)include;$(IncludePath) + + + $(SolutionDir)$(ProjectName)\$(Configuration)\ + $(SolutionDir)Output\ + + + $(SolutionDir)$(ProjectName)\$(Configuration)\$(Platform)\ + $(SolutionDir)Output\$(Platform)\ + + + true + + + false + + + + NotUsing + Level3 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4996 + 4013 + $(IntDir)$(TargetName).pdb + ProgramDatabase + + + true + + + + + _WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + + + 6.00 + + + 6.00 + + + + + _WIN32_WINNT=0x0501;%(PreprocessorDefinitions) + + + 5.01 + + + 5.01 + + + + + _WIN32_WINNT=0x0502;%(PreprocessorDefinitions) + + + 5.02 + + + 5.02 + + + + + Disabled + true + + + _DEBUG;%(PreprocessorDefinitions) + + + + + Full + true + true + AnySuitable + Speed + true + + + true + true + UseLinkTimeCodeGeneration + + + NDEBUG;%(PreprocessorDefinitions) + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/gen_dll_res.ps1 libmicrohttpd-0.9.55/w32/common/gen_dll_res.ps1 --- libmicrohttpd-0.9.44+dfsg/w32/common/gen_dll_res.ps1 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/gen_dll_res.ps1 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,38 @@ +param ([string]$BasePath = ".\") + +$Host.SetShouldExit(111) # Set non-zero return code until task successfully finished +$ErrorActionPreference = "Stop" # Stop on any error + +Remove-Variable MHD_ver,MHD_ver_major,MHD_ver_minor,MHD_ver_patchlev -ErrorAction:SilentlyContinue + +Write-Output "Processing: ${BasePath}..\..\configure.ac" +foreach($line in Get-Content "${BasePath}..\..\configure.ac") +{ + if ($line -match '^AC_INIT\(\[(?:GNU )?libmicrohttpd\],\[((\d+).(\d+).(\d+))\]') + { + [string]$MHD_ver = $Matches[1].ToString() + [string]$MHD_ver_major = $Matches[2].ToString() + [string]$MHD_ver_minor = $Matches[3].ToString() + [string]$MHD_ver_patchlev = $Matches[4].ToString() + break + } +} +if ("$MHD_ver" -eq "" -or "$MHD_ver_major" -eq "" -or "$MHD_ver_minor" -eq "" -or "$MHD_ver_patchlev" -eq "") +{ + Throw "Can't find MHD version in ${BasePath}..\..\configure.ac" +} + +Write-Output "Detected MHD version: $MHD_ver" + +Write-Output "Generating ${BasePath}microhttpd_dll_res_vc.rc" +Get-Content "${BasePath}microhttpd_dll_res_vc.rc.in" | ForEach-Object { + $_ -replace '@PACKAGE_VERSION_MAJOR@',"$MHD_ver_major" ` + -replace '@PACKAGE_VERSION_MINOR@', "$MHD_ver_minor" ` + -replace '@PACKAGE_VERSION_SUBMINOR@', "$MHD_ver_patchlev" ` + -replace '@PACKAGE_VERSION@', "$MHD_ver" +} | Out-File -FilePath "${BasePath}microhttpd_dll_res_vc.rc" -Force + +$Host.SetShouldExit(0) # Reset return code + +Write-Output "${BasePath}microhttpd_dll_res_vc.rc was generated " +exit 0 # Exit with success code diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/hellobrowser-files.vcxproj libmicrohttpd-0.9.55/w32/common/hellobrowser-files.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/hellobrowser-files.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/hellobrowser-files.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,11 @@ + + + + + + + + {9cfb0342-a9e7-483e-bee5-a1de22584c5a} + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/hellobrowser-filters.vcxproj libmicrohttpd-0.9.55/w32/common/hellobrowser-filters.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/hellobrowser-filters.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/hellobrowser-filters.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-build-settings.vcxproj libmicrohttpd-0.9.55/w32/common/libmicrohttpd-build-settings.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-build-settings.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/libmicrohttpd-build-settings.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,55 @@ + + + + ResourceCompile + + + $(ProjectName)_d + $(ProjectName) + + + $(ProjectName)-dll_d + $(ProjectName)-dll + + + + BUILDING_MHD_LIB;%(PreprocessorDefinitions) + + + WINDOWS + + + Windows + + + Copy headers to output + xcopy /F /I /Y "$(MhdSrc)include\microhttpd.h" "$(OutputPath)" + $(OutputPath)microhttpd.h;%(Outputs) + $(MhdSrc)include\microhttpd.h + + + + + _LIB;MHD_W32LIB;%(PreprocessorDefinitions) + MultiThreadedDebug + MultiThreaded + + + Ws2_32.lib + + + xcopy /F /I /Y "$(IntermediateOutputPath)$(TargetName).pdb" "$(OutputPath)" + Copy .pdb to output directory + + + + + _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + MultiThreadedDLL + + + Ws2_32.lib;%(AdditionalDependencies) + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-files.vcxproj libmicrohttpd-0.9.55/w32/common/libmicrohttpd-files.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-files.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/libmicrohttpd-files.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + true + false + Document + PowerShell.exe -Version 3.0 -NonInteractive -NoProfile -ExecutionPolicy Bypass -File "$(MhdW32Common)gen_dll_res.ps1" -BasePath "$(MhdW32Common)\" + Generating .dll description resource + $(MhdW32Common)microhttpd_dll_res_vc.rc + $(MhdW32Common)gen_dll_res.ps1;$(MhdRoot)configure.ac + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-filters.vcxproj libmicrohttpd-0.9.55/w32/common/libmicrohttpd-filters.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/common/libmicrohttpd-filters.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/libmicrohttpd-filters.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,161 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {df5ad836-e372-437b-a0e3-299d3675d6b4} + in + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Template Files + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/MHD_config.h libmicrohttpd-0.9.55/w32/common/MHD_config.h --- libmicrohttpd-0.9.44+dfsg/w32/common/MHD_config.h 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/MHD_config.h 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,162 @@ +/* MHD_config.h for W32 */ +/* Created manually. */ + +/* *** Basic OS/compiler information *** */ + +/* This is a Windows system */ +#define WINDOWS 1 + +/* Define if MS VC compiler is used */ +#define MSVC 1 + +/* Define to 1 if your C compiler supports inline functions. */ +#define INLINE_FUNC 1 + +/* Define to prefix which will be used with MHD inline functions. */ +#define _MHD_inline static __forceinline + + +/* *** MHD configuration *** */ +/* Undef to disable feature */ + +/* Enable basic Auth support */ +#define BAUTH_SUPPORT 1 + +/* Enable digest Auth support */ +#define DAUTH_SUPPORT 1 + +/* Enable postprocessor.c */ +#define HAVE_POSTPROCESSOR 1 + +/* Enable error messages */ +#define HAVE_MESSAGES 1 + +/* Enable HTTP Upgrade support. */ +#define UPGRADE_SUPPORT 1 + +/* *** OS features *** */ + +/* Provides IPv6 headers */ +#define HAVE_INET6 1 + +/* Define to use socketpair for inter-thread communication */ +#define _MHD_ITC_SOCKETPAIR 1 + +/* define to use W32 threads */ +#define MHD_USE_W32_THREADS 1 + +#ifndef _WIN32_WINNT +/* MHD supports Windows XP and later W32 systems*/ +#define _WIN32_WINNT 0x0501 +#endif /* _WIN32_WINNT */ + +/* winsock poll is available only on Vista and later */ +#if _WIN32_WINNT >= 0x0600 +#define HAVE_POLL 1 +#endif /* _WIN32_WINNT >= 0x0600 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + +/* Define to 1 if you have the `_lseeki64' function. */ +#define HAVE___LSEEKI64 1 + +/* Define to 1 if you have the `gmtime_s' function in W32 form. */ +#define HAVE_W32_GMTIME_S 1 + +/* Define to 1 if you have the usable `calloc' function. */ +#define HAVE_CALLOC 1 + +#if _MSC_VER >= 1900 /* snprintf() supported natively since VS2015 */ +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 +#endif + +#if _MSC_VER >= 1800 +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 +#endif + + +/* *** Headers information *** */ +/* Not really important as not used by code currently */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MATH_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +#if _MSC_VER+0 >= 1800 /* VS 2013 and later */ +/* Define to 1 if you have the header file and defines + 'bool' type. */ +#define HAVE_STDBOOL_H 1 +#else /* before VS 2013 */ + +/* Define to type name which will be used as boolean type. */ +#define bool int + +/* Define to value interpreted by compiler as boolean "false", if "false" is + not defined by system headers. */ +#define false 0 + +/* Define to value interpreted by compiler as boolean "true", if "true" is not + defined by system headers. */ +#define true (!0) +#endif /* before VS 2013 */ + + +/* *** Other useful staff *** */ + +#define _GNU_SOURCE 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + + +/* End of MHD_config.h */ diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/microhttpd_dll_res_vc.rc libmicrohttpd-0.9.55/w32/common/microhttpd_dll_res_vc.rc --- libmicrohttpd-0.9.44+dfsg/w32/common/microhttpd_dll_res_vc.rc 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/microhttpd_dll_res_vc.rc 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,42 @@ +/* W32 resources for .dll */ + +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,9,55,0 + PRODUCTVERSION 0,9,55,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#if defined(_DEBUG) + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" /* Lang = US English, Charset = ASCII */ + BEGIN + VALUE "ProductName", "GNU libmicrohttpd\0" + VALUE "ProductVersion", "0.9.55\0" + VALUE "FileVersion", "0.9.55\0" + VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" + VALUE "InternalName", "libmicrohttpd\0" +#if defined(_DEBUG) + VALUE "OriginalFilename", "libmicrohttpd_d.dll\0" +#else + VALUE "OriginalFilename", "libmicrohttpd.dll\0" +#endif + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "LegalCopyright", "Copyright (C) 2007-2015 Christian Grothoff and project contributors\0" + VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0 /* US English, ASCII */ + END +END diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/microhttpd_dll_res_vc.rc.in libmicrohttpd-0.9.55/w32/common/microhttpd_dll_res_vc.rc.in --- libmicrohttpd-0.9.44+dfsg/w32/common/microhttpd_dll_res_vc.rc.in 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/microhttpd_dll_res_vc.rc.in 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,42 @@ +/* W32 resources for .dll */ + +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + PRODUCTVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#if defined(_DEBUG) + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" /* Lang = US English, Charset = ASCII */ + BEGIN + VALUE "ProductName", "GNU libmicrohttpd\0" + VALUE "ProductVersion", "@PACKAGE_VERSION@\0" + VALUE "FileVersion", "@PACKAGE_VERSION@\0" + VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" + VALUE "InternalName", "libmicrohttpd\0" +#if defined(_DEBUG) + VALUE "OriginalFilename", "libmicrohttpd_d.dll\0" +#else + VALUE "OriginalFilename", "libmicrohttpd.dll\0" +#endif + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "LegalCopyright", "Copyright (C) 2007-2015 Christian Grothoff and project contributors\0" + VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0 /* US English, ASCII */ + END +END diff -Nru libmicrohttpd-0.9.44+dfsg/w32/common/vs_dirs.props libmicrohttpd-0.9.55/w32/common/vs_dirs.props --- libmicrohttpd-0.9.44+dfsg/w32/common/vs_dirs.props 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/common/vs_dirs.props 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,9 @@ + + + + $(SolutionDir)..\..\ + $(SolutionDir)..\..\src\ + $(SolutionDir)..\ + $(MhdW32Dir)common\ + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/gen_dll_res.ps1 libmicrohttpd-0.9.55/w32/VS2013/gen_dll_res.ps1 --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/gen_dll_res.ps1 2015-01-08 18:17:42.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2013/gen_dll_res.ps1 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -param ([string]$BasePath = ".\") - -$Host.SetShouldExit(111) # Set non-zero return code until task successfully finished -$ErrorActionPreference = "Stop" # Stop on any error - -Remove-Variable MHD_ver,MHD_ver_major,MHD_ver_minor,MHD_ver_patchlev -ErrorAction:SilentlyContinue - -Write-Output "Processing: ${BasePath}..\..\configure.ac" -foreach($line in Get-Content "${BasePath}..\..\configure.ac") -{ - if ($line -match '^AC_INIT\(\[libmicrohttpd\],\[((\d+).(\d+).(\d+))\]') - { - [string]$MHD_ver = $Matches[1].ToString() - [string]$MHD_ver_major = $Matches[2].ToString() - [string]$MHD_ver_minor = $Matches[3].ToString() - [string]$MHD_ver_patchlev = $Matches[4].ToString() - break - } -} -if ("$MHD_ver" -eq "" -or "$MHD_ver_major" -eq "" -or "$MHD_ver_minor" -eq "" -or "$MHD_ver_patchlev" -eq "") -{ - Throw "Can't find MHD version in ${BasePath}..\..\configure.ac" -} - -Write-Output "Detected MHD version: $MHD_ver" - -Write-Output "Generating ${BasePath}microhttpd_dll_res_vc.rc" -Get-Content "${BasePath}microhttpd_dll_res_vc.rc.in" | ForEach-Object { - $_ -replace '@PACKAGE_VERSION_MAJOR@',"$MHD_ver_major" ` - -replace '@PACKAGE_VERSION_MINOR@', "$MHD_ver_minor" ` - -replace '@PACKAGE_VERSION_SUBMINOR@', "$MHD_ver_patchlev" ` - -replace '@PACKAGE_VERSION@', "$MHD_ver" -} | Out-File -FilePath "${BasePath}microhttpd_dll_res_vc.rc" -Force - -$Host.SetShouldExit(0) # Reset return code - -Write-Output "${BasePath}microhttpd_dll_res_vc.rc was generated " -exit 0 # Exit with success code diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/hellobrowser.vcxproj libmicrohttpd-0.9.55/w32/VS2013/hellobrowser.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/hellobrowser.vcxproj 2015-05-11 21:13:10.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/hellobrowser.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,6 @@  + Debug-dll @@ -34,15 +35,16 @@ x64 - - - + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} Win32Proj hellobrowser + + x64 + Application true @@ -75,103 +77,14 @@ - - - $(SolutionDir)..\..\src\include;$(SolutionDir);$(IncludePath) - - - $(SolutionDir)$(ProjectName)\$(Configuration)\ - $(SolutionDir)\Output\ - - - $(SolutionDir)$(ProjectName)\$(Configuration)\$(Platform)\ - $(SolutionDir)\Output\$(Platform)\ - - - true - - - false - - - $(ProjectName)_d - - - $(ProjectName)-dll_d - - - $(ProjectName) - - - $(ProjectName)-dll - + + + - - NotUsing - Level3 - WIN32;_CONSOLE;_LIB;%(PreprocessorDefinitions) - - - Console - true - $(OutDir);%(AdditionalLibraryDirectories) - - - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - + + - - - MaxSpeed - true - true - NDEBUG;%(PreprocessorDefinitions) - - - true - true - - - - - - MultiThreadedDebug - - - libmicrohttpd_d.lib;%(AdditionalDependencies) - - - - - - MultiThreadedDebugDLL - - - libmicrohttpd-dll_d.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - - MultiThreaded - - - libmicrohttpd.lib;%(AdditionalDependencies) - - - - - MultiThreadedDLL - - - libmicrohttpd-dll.lib;ws2_32.lib;%(AdditionalDependencies) - - diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/hellobrowser.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2013/hellobrowser.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/hellobrowser.vcxproj.filters 2014-12-25 16:45:58.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2013/hellobrowser.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -1,22 +1,5 @@  - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/largepost.vcxproj libmicrohttpd-0.9.55/w32/VS2013/largepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/largepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2013/largepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.sln libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.sln --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.sln 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.sln 2017-05-28 22:34:00.000000000 +0200 @@ -3,13 +3,23 @@ # Visual Studio 2013 VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" ProjectSection(ProjectDependencies) = postProject {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug-dll|Win32 = Debug-dll|Win32 @@ -94,6 +104,70 @@ {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.vcxproj libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.vcxproj 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -1,5 +1,6 @@  + Debug-dll-xp @@ -66,83 +67,16 @@ x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - true - true - true - true - true - true - - - - - true - true - true - true - true - true - true - true - false - false - false - false - false - false - false - false - Document - PowerShell.exe -Version 3.0 -NonInteractive -NoProfile -ExecutionPolicy Bypass -File "$(SolutionDir)gen_dll_res.ps1" -BasePath $(SolutionDir) - Generating .dll description resource - $(SolutionDir)microhttpd_dll_res_vc.rc - $(SolutionDir)gen_dll_res.ps1;$(SolutionDir).\..\..\configure.ac - - + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} Win32Proj libmicrohttpd + + x64 + StaticLibrary true @@ -201,145 +135,13 @@ - - - 0 - 1 - - - $(SolutionDir)..\..\src\include;$(SolutionDir);$(IncludePath) - ResourceCompile - - - $(SolutionDir)$(ProjectName)\$(Configuration)\ - $(SolutionDir)\Output\ - - - $(SolutionDir)$(ProjectName)\$(Configuration)\$(Platform)\ - $(SolutionDir)\Output\$(Platform)\ - - - $(ProjectName)_d - $(ProjectName) - - - $(ProjectName)-dll_d - $(ProjectName)-dll - + + + - - NotUsing - Level3 - Disabled - WIN32;BUILDING_MHD_LIB;_UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - 4996 - 4013 - $(IntDir)$(TargetName).pdb - - - WINDOWS - true - - - Copy headers to output - xcopy /F /I /Y $(SolutionDir)\..\..\src\include\microhttpd.h $(OutputPath) - $(OutputPath)microhttpd.h;%(Outputs) - $(SolutionDir)\..\..\src\include\microhttpd.h - - - - - _WIN32_WINNT=0x0600;%(PreprocessorDefinitions) - - - 6.00 - /SUBSYSTEM:WINDOWS,6.00 %(AdditionalOptions) - - - 6.00 - /SUBSYSTEM:WINDOWS,6.00 %(AdditionalOptions) - - - - - _WIN32_WINNT=0x0501;%(PreprocessorDefinitions) - - - 5.01 - /SUBSYSTEM:WINDOWS,5.01 %(AdditionalOptions) - - - 5.01 - /SUBSYSTEM:WINDOWS,5.01 %(AdditionalOptions) - - - 5.02 - /SUBSYSTEM:WINDOWS,5.02 %(AdditionalOptions) - - - 5.02 - /SUBSYSTEM:WINDOWS,5.02 %(AdditionalOptions) - - - - - _LIB;MHD_W32LIB;%(PreprocessorDefinitions) - - - Ws2_32.lib - - - xcopy /F /I /Y $(IntermediateOutputPath)$(TargetName).pdb $(OutputPath) - Copy .pdb to output directory - - - - - _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) - - - Ws2_32.lib;%(AdditionalDependencies) - - - - - Disabled - true - - - _DEBUG;%(PreprocessorDefinitions) - - - - - Full - true - true - AnySuitable - Speed - true - - - true - true - true - - - NDEBUG;%(PreprocessorDefinitions) - - - - - MultiThreadedDebug - MultiThreaded - - - - - MultiThreadedDebugDLL - MultiThreadedDLL - + + + diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/libmicrohttpd.vcxproj.filters 2015-10-01 18:31:33.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/libmicrohttpd.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -1,128 +1,5 @@  - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {af799bf7-9787-4134-8e56-9e5aae50c7e3} - - - {df5ad836-e372-437b-a0e3-299d3675d6b4} - in - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\platform_interface - - - Source Files - - - Source Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Template Files - - + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/MHD_config.h libmicrohttpd-0.9.55/w32/VS2013/MHD_config.h --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/MHD_config.h 2015-06-20 16:20:21.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/MHD_config.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,137 +0,0 @@ -/* MHD_config.h for W32 */ -/* Created manually. */ - -/* *** Basic OS/compiler information *** */ - -/* This is a Windows system */ -#define WINDOWS 1 - -/* Define if MS VC compiler is used */ -#define MSVC 1 - -/* *** MHD configuration *** */ -/* Undef to disable feature */ - -/* Enable basic Auth support */ -#define BAUTH_SUPPORT 1 - -/* Enable digest Auth support */ -#define DAUTH_SUPPORT 1 - -/* Enable postprocessor.c */ -#define HAVE_POSTPROCESSOR 1 - -/* Enable error messages */ -#define HAVE_MESSAGES 1 - -/* Disable HTTPS support */ -#define HTTPS_SUPPORT 0 - - -/* *** OS features *** */ - -/* Provides IPv6 headers */ -#define HAVE_INET6 1 - -/* Define to use pair of sockets instead of pipes for signaling */ -#define MHD_DONT_USE_PIPES 1 - -/* define to use W32 threads */ -#define MHD_USE_W32_THREADS 1 - -#ifndef _WIN32_WINNT -/* MHD supports Windows XP and later W32 systems*/ -#define _WIN32_WINNT 0x0501 -#endif /* _WIN32_WINNT */ - -/* winsock poll is available only on Vista and later */ -#if _WIN32_WINNT >= 0x0600 -#define HAVE_POLL 1 -#endif /* _WIN32_WINNT >= 0x0600 */ - -/* define to 0 to disable epoll support */ -#define EPOLL_SUPPORT 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_WINSOCK2_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_WS2TCPIP_H 1 - -/* Define to 1 if you have the declaration of `SOCK_NONBLOCK', and to 0 if you - don't. */ -#define HAVE_DECL_SOCK_NONBLOCK 0 - -/* Define to 1 if you have the declaration of `TCP_CORK', and to 0 if you - don't. */ -#define HAVE_DECL_TCP_CORK 0 - -/* Define to 1 if you have the declaration of `TCP_NOPUSH', and to 0 if you - don't. */ -#define HAVE_DECL_TCP_NOPUSH 0 - -/* Define to 1 if you have the `_lseeki64' function. */ -#define HAVE___LSEEKI64 1 - - -/* *** Headers information *** */ -/* Not really important as not used by code currently */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MATH_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_PTHREAD_H 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - - -/* *** Other useful staff *** */ - -#define _GNU_SOURCE 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - - -/* End of MHD_config.h */ diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/microhttpd_dll_res_vc.rc libmicrohttpd-0.9.55/w32/VS2013/microhttpd_dll_res_vc.rc --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/microhttpd_dll_res_vc.rc 2015-10-01 21:22:43.000000000 +0200 +++ libmicrohttpd-0.9.55/w32/VS2013/microhttpd_dll_res_vc.rc 1970-01-01 01:00:00.000000000 +0100 @@ -1,42 +0,0 @@ -/* W32 resources for .dll */ - -#include - -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,44,0 - PRODUCTVERSION 0,9,44,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#if defined(_DEBUG) - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "04090000" /* Lang = US English, Charset = ASCII */ - BEGIN - VALUE "ProductName", "GNU libmicrohttpd\0" - VALUE "ProductVersion", "0.9.44\0" - VALUE "FileVersion", "0.9.44\0" - VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" - VALUE "InternalName", "libmicrohttpd\0" -#if defined(_DEBUG) - VALUE "OriginalFilename", "libmicrohttpd_d.dll\0" -#else - VALUE "OriginalFilename", "libmicrohttpd.dll\0" -#endif - VALUE "CompanyName", "Free Software Foundation\0" - VALUE "LegalCopyright", "Copyright (C) 2007-2015 Christian Grothoff and project contributors\0" - VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 0 /* US English, ASCII */ - END -END diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/microhttpd_dll_res_vc.rc.in libmicrohttpd-0.9.55/w32/VS2013/microhttpd_dll_res_vc.rc.in --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/microhttpd_dll_res_vc.rc.in 2015-01-08 18:17:42.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2013/microhttpd_dll_res_vc.rc.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,42 +0,0 @@ -/* W32 resources for .dll */ - -#include - -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -VS_VERSION_INFO VERSIONINFO - FILEVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 - PRODUCTVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#if defined(_DEBUG) - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "04090000" /* Lang = US English, Charset = ASCII */ - BEGIN - VALUE "ProductName", "GNU libmicrohttpd\0" - VALUE "ProductVersion", "@PACKAGE_VERSION@\0" - VALUE "FileVersion", "@PACKAGE_VERSION@\0" - VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" - VALUE "InternalName", "libmicrohttpd\0" -#if defined(_DEBUG) - VALUE "OriginalFilename", "libmicrohttpd_d.dll\0" -#else - VALUE "OriginalFilename", "libmicrohttpd.dll\0" -#endif - VALUE "CompanyName", "Free Software Foundation\0" - VALUE "LegalCopyright", "Copyright (C) 2007-2015 Christian Grothoff and project contributors\0" - VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 0 /* US English, ASCII */ - END -END diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2013/simplepost.vcxproj libmicrohttpd-0.9.55/w32/VS2013/simplepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2013/simplepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2013/simplepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/hellobrowser.vcxproj libmicrohttpd-0.9.55/w32/VS2015/hellobrowser.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/hellobrowser.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/hellobrowser.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} + Win32Proj + hellobrowser + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/hellobrowser.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2015/hellobrowser.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/hellobrowser.vcxproj.filters 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/hellobrowser.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/largepost.vcxproj libmicrohttpd-0.9.55/w32/VS2015/largepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/largepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/largepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.sln libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.sln --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.sln 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.sln 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,175 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Debug-dll-xp|Win32 = Debug-dll-xp|Win32 + Debug-dll-xp|x64 = Debug-dll-xp|x64 + Debug-static|Win32 = Debug-static|Win32 + Debug-static|x64 = Debug-static|x64 + Debug-static-xp|Win32 = Debug-static-xp|Win32 + Debug-static-xp|x64 = Debug-static-xp|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + Release-dll-xp|Win32 = Release-dll-xp|Win32 + Release-dll-xp|x64 = Release-dll-xp|x64 + Release-static|Win32 = Release-static|Win32 + Release-static|x64 = Release-static|x64 + Release-static-xp|Win32 = Release-static-xp|Win32 + Release-static-xp|x64 = Release-static-xp|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.Build.0 = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.ActiveCfg = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.Build.0 = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.Build.0 = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.ActiveCfg = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.Build.0 = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.ActiveCfg = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.Build.0 = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.Build.0 = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.ActiveCfg = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.Build.0 = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.ActiveCfg = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.Build.0 = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.Build.0 = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.ActiveCfg = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.Build.0 = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.ActiveCfg = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.Build.0 = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.ActiveCfg = Release-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.Build.0 = Release-static-xp|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.Build.0 = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.vcxproj libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,149 @@ + + + + + + Debug-dll-xp + Win32 + + + Debug-dll-xp + x64 + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static-xp + Win32 + + + Debug-static-xp + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll-xp + Win32 + + + Release-dll-xp + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static-xp + Win32 + + + Release-static-xp + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + Win32Proj + libmicrohttpd + + + + x64 + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140_xp + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + true + v140_xp + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140_xp + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/libmicrohttpd.vcxproj.filters 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/libmicrohttpd.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2015/simplepost.vcxproj libmicrohttpd-0.9.55/w32/VS2015/simplepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2015/simplepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2015/simplepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/hellobrowser.vcxproj libmicrohttpd-0.9.55/w32/VS2017/hellobrowser.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/hellobrowser.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/hellobrowser.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} + Win32Proj + hellobrowser + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/hellobrowser.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2017/hellobrowser.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/hellobrowser.vcxproj.filters 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/hellobrowser.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/largepost.vcxproj libmicrohttpd-0.9.55/w32/VS2017/largepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/largepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/largepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.sln libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.sln --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.sln 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.sln 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,175 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.9 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Debug-dll-xp|Win32 = Debug-dll-xp|Win32 + Debug-dll-xp|x64 = Debug-dll-xp|x64 + Debug-static|Win32 = Debug-static|Win32 + Debug-static|x64 = Debug-static|x64 + Debug-static-xp|Win32 = Debug-static-xp|Win32 + Debug-static-xp|x64 = Debug-static-xp|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + Release-dll-xp|Win32 = Release-dll-xp|Win32 + Release-dll-xp|x64 = Release-dll-xp|x64 + Release-static|Win32 = Release-static|Win32 + Release-static|x64 = Release-static|x64 + Release-static-xp|Win32 = Release-static-xp|Win32 + Release-static-xp|x64 = Release-static-xp|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.Build.0 = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.ActiveCfg = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.Build.0 = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.Build.0 = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.ActiveCfg = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.Build.0 = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.ActiveCfg = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.Build.0 = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.Build.0 = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.ActiveCfg = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.Build.0 = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.ActiveCfg = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.Build.0 = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.Build.0 = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.ActiveCfg = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.Build.0 = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.ActiveCfg = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.Build.0 = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.ActiveCfg = Release-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.Build.0 = Release-static-xp|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.Build.0 = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.vcxproj libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,107 @@ + + + + + + Debug-dll-xp + Win32 + + + Debug-dll-xp + x64 + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static-xp + Win32 + + + Debug-static-xp + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll-xp + Win32 + + + Release-dll-xp + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static-xp + Win32 + + + Release-static-xp + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + Win32Proj + libmicrohttpd + + + + x64 + + + StaticLibrary + DynamicLibrary + true + false + v141 + v141_xp + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.vcxproj.filters libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.vcxproj.filters --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/libmicrohttpd.vcxproj.filters 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/libmicrohttpd.vcxproj.filters 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff -Nru libmicrohttpd-0.9.44+dfsg/w32/VS2017/simplepost.vcxproj libmicrohttpd-0.9.55/w32/VS2017/simplepost.vcxproj --- libmicrohttpd-0.9.44+dfsg/w32/VS2017/simplepost.vcxproj 1970-01-01 01:00:00.000000000 +0100 +++ libmicrohttpd-0.9.55/w32/VS2017/simplepost.vcxproj 2017-05-28 22:34:00.000000000 +0200 @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file