Skip to content

Commit a730551

Browse files
author
Sebastiano Merlino
committed
Updated the library to use latest libmicrohttpd improvements
* Removed POLL start config. Now THREAD defaults to POLL on windows and EPOLL on linux * Use TCP_FASTOPEN on linux >= 3.6o
1 parent 2c99b02 commit a730551

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Sun Jan 27 19:39:01 2016 +0100
2+
Removed POLL start configuration (THREAD now defaults to POLL or EPOLL on Linux)
3+
Use TCP_FASTOPEN on linux >= 3.6
4+
15
Sat Jan 26 15:08:22 2016 +0100
26
Changed http_resource to use classic C++ polymorphism using virtual instead of CRTP
37

configure.ac

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
AC_PREREQ(2.57)
2323
m4_define([libhttpserver_MAJOR_VERSION],[0])dnl
2424
m4_define([libhttpserver_MINOR_VERSION],[10])dnl
25-
m4_define([libhttpserver_REVISION],[0])dnl
25+
m4_define([libhttpserver_REVISION],[1])dnl
2626
m4_define([libhttpserver_PKG_VERSION],[libhttpserver_MAJOR_VERSION.libhttpserver_MINOR_VERSION.libhttpserver_REVISION])dnl
2727
m4_define([libhttpserver_LDF_VERSION],[libhttpserver_MAJOR_VERSION:libhttpserver_MINOR_VERSION:libhttpserver_REVISION])dnl
2828
AC_INIT([libhttpserver], libhttpserver_PKG_VERSION, [electrictwister2000@gmail.com])
@@ -56,19 +56,21 @@ if test x"$samedirectory" = x"no"; then
5656
fi
5757
fi
5858

59+
is_windows=yes;
5960
case "$host" in
6061
*-mingw*)
61-
NETWORK_HEADER="winsock2.h"
62-
REGEX_LIBS="-lregex -lpthread -no-undefined"
62+
NETWORK_HEADER="winsock2.h"
63+
REGEX_LIBS="-lregex -lpthread -no-undefined"
6364
native_srcdir=$(cd $srcdir; pwd -W)
6465
;;
6566
*-cygwin*)
66-
NETWORK_HEADER="winsock2.h"
67-
REGEX_LIBS="-lregex -lpthread -no-undefined"
67+
NETWORK_HEADER="winsock2.h"
68+
REGEX_LIBS="-lregex -lpthread -no-undefined"
6869
;;
6970
*)
70-
NETWORK_HEADER="arpa/inet.h"
71-
REGEX_LIBS=""
71+
NETWORK_HEADER="arpa/inet.h"
72+
REGEX_LIBS=""
73+
is_windows=no
7274
;;
7375
esac
7476

@@ -111,6 +113,14 @@ AC_CHECK_HEADER([microhttpd.h],
111113
CXXFLAGS="-DHTTPSERVER_COMPILATION -D_REENTRANT $LIBMICROHTTPD_CFLAGS $CXXFLAGS"
112114
LDFLAGS="$LIBMICROHTTPD_LIBS $REGEX_LIBS $LD_FLAGS"
113115

116+
if test x"$is_windows" = x"no"; then
117+
if test `uname -r |cut -d. -f1` -ge 3; then
118+
if test `uname -r |cut -d. -f2` -ge 6; then
119+
CXXFLAGS="-DUSE_FASTOPEN $CXXFLAGS"
120+
fi
121+
fi
122+
fi
123+
114124
m4_pattern_allow([AC_TYPE_SIZE_T])
115125
m4_pattern_allow([AC_TYPE_UINT16_T])
116126
m4_pattern_allow([AC_TYPE_UINT32_T])

debian/changelog.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
libhttpserver (0.10.1) unstable; urgency=low
2+
* Removed POLL start configuration (THREAD now defaults to POLL or EPOLL on Linux)
3+
* Use TCP_FASTOPEN on linux >= 3.6
4+
5+
-- Sebastiano Merlino <electrictwister2000@gmail.com> Sat, 27 Jan 2016 19:39:01 +0100
6+
17
libhttpserver (0.10.0) unstable; urgency=low
28
* Changed http_resource to use classic C++ polymorphism using virtual instead of CRTP
39

src/httpserver/http_utils.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ class http_utils
7777
enum start_method_T
7878
{
7979
INTERNAL_SELECT = MHD_NO_FLAG,
80-
THREADS = MHD_USE_THREAD_PER_CONNECTION,
81-
POLL = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL
80+
#if defined(__MINGW32__) || defined(__CYGWIN32__)
81+
THREAD = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL
82+
#else
83+
THREAD = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_EPOLL_LINUX_ONLY
84+
#endif
8285
};
8386

8487
enum policy_T

src/webserver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ bool webserver::start(bool blocking)
547547
if(pedantic)
548548
start_conf |= MHD_USE_PEDANTIC_CHECKS;
549549

550+
#ifdef USE_FASTOPEN
551+
start_conf |= MHD_USE_TCP_FASTOPEN;
552+
#endif
553+
550554
int num_threads = 1;
551555
if(max_threads > num_threads)
552556
num_threads = max_threads;

0 commit comments

Comments
 (0)