Enable IndentPPDirectives

This commit is contained in:
Tatsuhiro Tsujikawa 2018-06-09 16:21:30 +09:00
parent bda7e079e2
commit 880f948684
107 changed files with 315 additions and 315 deletions

View File

@ -68,7 +68,7 @@ IncludeCategories:
Priority: 1 Priority: 1
IncludeIsMainRegex: '$' IncludeIsMainRegex: '$'
IndentCaseLabels: false IndentCaseLabels: false
IndentPPDirectives: None IndentPPDirectives: AfterHash
IndentWidth: 2 IndentWidth: 2
IndentWrappedFunctionNames: false IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave JavaScriptQuotes: Leave

View File

@ -36,10 +36,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#include <iostream> #include <iostream>
#include <string> #include <string>

View File

@ -27,26 +27,26 @@
* intentionally made simple. * intentionally made simple.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <inttypes.h> #include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif /* HAVE_FCNTL_H */ #endif /* HAVE_FCNTL_H */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */ #endif /* HAVE_SYS_SOCKET_H */
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif /* HAVE_NETDB_H */ #endif /* HAVE_NETDB_H */
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */ #endif /* HAVE_NETINET_IN_H */
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <poll.h> #include <poll.h>

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* !HAVE_CONFIG_H */ #endif /* !HAVE_CONFIG_H */
#include <stdio.h> #include <stdio.h>

View File

@ -23,33 +23,33 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef __sgi #ifdef __sgi
#include <string.h> # include <string.h>
#define errx(exitcode, format, args...) \ # define errx(exitcode, format, args...) \
{ \ { \
warnx(format, ##args); \ warnx(format, ##args); \
exit(exitcode); \ exit(exitcode); \
} }
#define warnx(format, args...) fprintf(stderr, format "\n", ##args) # define warnx(format, args...) fprintf(stderr, format "\n", ##args)
char *strndup(const char *s, size_t size); char *strndup(const char *s, size_t size);
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */ #endif /* HAVE_SYS_SOCKET_H */
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */ #endif /* HAVE_NETINET_IN_H */
#include <netinet/tcp.h> #include <netinet/tcp.h>
#ifndef __sgi #ifndef __sgi
#include <err.h> # include <err.h>
#endif #endif
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>

View File

@ -23,41 +23,41 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef __sgi #ifdef __sgi
#define errx(exitcode, format, args...) \ # define errx(exitcode, format, args...) \
{ \ { \
warnx(format, ##args); \ warnx(format, ##args); \
exit(exitcode); \ exit(exitcode); \
} }
#define warn(format, args...) warnx(format ": %s", ##args, strerror(errno)) # define warn(format, args...) warnx(format ": %s", ##args, strerror(errno))
#define warnx(format, args...) fprintf(stderr, format "\n", ##args) # define warnx(format, args...) fprintf(stderr, format "\n", ##args)
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */ #endif /* HAVE_SYS_SOCKET_H */
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif /* HAVE_NETDB_H */ #endif /* HAVE_NETDB_H */
#include <signal.h> #include <signal.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif /* HAVE_FCNTL_H */ #endif /* HAVE_FCNTL_H */
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */ #endif /* HAVE_NETINET_IN_H */
#include <netinet/tcp.h> #include <netinet/tcp.h>
#ifndef __sgi #ifndef __sgi
#include <err.h> # include <err.h>
#endif #endif
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>

View File

@ -28,7 +28,7 @@
/* Define WIN32 when build target is Win32 API (borrowed from /* Define WIN32 when build target is Win32 API (borrowed from
libcurl) */ libcurl) */
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32 # define WIN32
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -40,9 +40,9 @@ extern "C" {
/* MSVC < 2013 does not have inttypes.h because it is not C99 /* MSVC < 2013 does not have inttypes.h because it is not C99
compliant. See compiler macros and version number in compliant. See compiler macros and version number in
https://sourceforge.net/p/predef/wiki/Compilers/ */ https://sourceforge.net/p/predef/wiki/Compilers/ */
#include <stdint.h> # include <stdint.h>
#else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */ #else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#include <inttypes.h> # include <inttypes.h>
#endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */ #endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#include <sys/types.h> #include <sys/types.h>
#include <stdarg.h> #include <stdarg.h>
@ -50,20 +50,20 @@ extern "C" {
#include <nghttp2/nghttp2ver.h> #include <nghttp2/nghttp2ver.h>
#ifdef NGHTTP2_STATICLIB #ifdef NGHTTP2_STATICLIB
#define NGHTTP2_EXTERN # define NGHTTP2_EXTERN
#elif defined(WIN32) #elif defined(WIN32)
#ifdef BUILDING_NGHTTP2 # ifdef BUILDING_NGHTTP2
#define NGHTTP2_EXTERN __declspec(dllexport) # define NGHTTP2_EXTERN __declspec(dllexport)
#else /* !BUILDING_NGHTTP2 */ # else /* !BUILDING_NGHTTP2 */
#define NGHTTP2_EXTERN __declspec(dllimport) # define NGHTTP2_EXTERN __declspec(dllimport)
#endif /* !BUILDING_NGHTTP2 */ # endif /* !BUILDING_NGHTTP2 */
#else /* !defined(WIN32) */ #else /* !defined(WIN32) */
#ifdef BUILDING_NGHTTP2 # ifdef BUILDING_NGHTTP2
#define NGHTTP2_EXTERN __attribute__((visibility("default"))) # define NGHTTP2_EXTERN __attribute__((visibility("default")))
#else /* !BUILDING_NGHTTP2 */ # else /* !BUILDING_NGHTTP2 */
#define NGHTTP2_EXTERN # define NGHTTP2_EXTERN
#endif /* !BUILDING_NGHTTP2 */ # endif /* !BUILDING_NGHTTP2 */
#endif /* !defined(WIN32) */ #endif /* !defined(WIN32) */
/** /**
* @macro * @macro

View File

@ -26,7 +26,7 @@
#define NGHTTP2_BUF_H #define NGHTTP2_BUF_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_CALLBACKS_H #define NGHTTP2_CALLBACKS_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,18 +26,18 @@
#define NGHTTP2_DEBUG_H #define NGHTTP2_DEBUG_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
#define DEBUGF(...) nghttp2_debug_vprintf(__VA_ARGS__) # define DEBUGF(...) nghttp2_debug_vprintf(__VA_ARGS__)
void nghttp2_debug_vprintf(const char *format, ...); void nghttp2_debug_vprintf(const char *format, ...);
#else #else
#define DEBUGF(...) \ # define DEBUGF(...) \
do { \ do { \
} while (0) } while (0)
#endif #endif
#endif /* NGHTTP2_DEBUG_H */ #endif /* NGHTTP2_DEBUG_H */

View File

@ -26,7 +26,7 @@
#define NGHTTP2_FRAME_H #define NGHTTP2_FRAME_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HD_H #define NGHTTP2_HD_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HD_HUFFMAN_H #define NGHTTP2_HD_HUFFMAN_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HELPER_H #define NGHTTP2_HELPER_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <string.h> #include <string.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HTTP_H #define NGHTTP2_HTTP_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_INT_H #define NGHTTP2_INT_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_MAP_H #define NGHTTP2_MAP_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_MEM_H #define NGHTTP2_MEM_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,15 +26,15 @@
#define NGHTTP2_NET_H #define NGHTTP2_NET_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */ #endif /* HAVE_ARPA_INET_H */
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */ #endif /* HAVE_NETINET_IN_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>
@ -44,11 +44,11 @@
define inline functions for those function so that we don't have define inline functions for those function so that we don't have
dependeny on that lib. */ dependeny on that lib. */
#ifdef _MSC_VER # ifdef _MSC_VER
#define STIN static __inline # define STIN static __inline
#else # else
#define STIN static inline # define STIN static inline
#endif # endif
STIN uint32_t htonl(uint32_t hostlong) { STIN uint32_t htonl(uint32_t hostlong) {
uint32_t res; uint32_t res;

View File

@ -26,7 +26,7 @@
#define NGHTTP2_NPN_H #define NGHTTP2_NPN_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_OPTION_H #define NGHTTP2_OPTION_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_OUTBOUND_ITEM_H #define NGHTTP2_OUTBOUND_ITEM_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_PQ_H #define NGHTTP2_PQ_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_PRIORITY_SPEC_H #define NGHTTP2_PRIORITY_SPEC_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_QUEUE_H #define NGHTTP2_QUEUE_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" # include "config.h"
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_RCBUF_H #define NGHTTP2_RCBUF_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_SESSION_H #define NGHTTP2_SESSION_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_STREAM_H #define NGHTTP2_STREAM_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_SUBMIT_H #define NGHTTP2_SUBMIT_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>

View File

@ -32,7 +32,7 @@
#ifdef HAVE_LIBXML2 #ifdef HAVE_LIBXML2
#include <libxml/HTMLparser.h> # include <libxml/HTMLparser.h>
#endif // HAVE_LIBXML2 #endif // HAVE_LIBXML2

View File

@ -26,23 +26,23 @@
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif // HAVE_ARPA_INET_H #endif // HAVE_ARPA_INET_H
#include <cassert> #include <cassert>
@ -64,7 +64,7 @@
#include "template.h" #include "template.h"
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY (0) # define O_BINARY (0)
#endif // O_BINARY #endif // O_BINARY
namespace nghttp2 { namespace nghttp2 {

View File

@ -28,7 +28,7 @@
#include "nghttp2_config.h" #include "nghttp2_config.h"
#ifndef _WIN32 #ifndef _WIN32
#include <sys/uio.h> # include <sys/uio.h>
#endif // !_WIN32 #endif // !_WIN32
#include <cassert> #include <cassert>

View File

@ -24,19 +24,19 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <poll.h> #include <poll.h>

View File

@ -30,7 +30,7 @@
#include <cinttypes> #include <cinttypes>
#include <cstdlib> #include <cstdlib>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> # include <sys/time.h>
#endif // HAVE_SYS_TIME_H #endif // HAVE_SYS_TIME_H
#include <poll.h> #include <poll.h>

View File

@ -26,7 +26,7 @@
#define BASE64_TEST_H #define BASE64_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace nghttp2 { namespace nghttp2 {

View File

@ -26,7 +26,7 @@
#define BUFFER_TEST_H #define BUFFER_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace nghttp2 { namespace nghttp2 {

View File

@ -26,7 +26,7 @@
#define NGHTTP2_COMP_HELPER_H #define NGHTTP2_COMP_HELPER_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <jansson.h> #include <jansson.h>

View File

@ -23,11 +23,11 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <getopt.h> #include <getopt.h>

View File

@ -27,12 +27,12 @@
#include <getopt.h> #include <getopt.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#include <cstdio> #include <cstdio>
@ -58,7 +58,7 @@
#include "template.h" #include "template.h"
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY (0) # define O_BINARY (0)
#endif // O_BINARY #endif // O_BINARY
using namespace nghttp2; using namespace nghttp2;

View File

@ -29,10 +29,10 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <sys/un.h> #include <sys/un.h>

View File

@ -26,7 +26,7 @@
#define SHRPX_HTTP2_TEST_H #define SHRPX_HTTP2_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -23,11 +23,11 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <getopt.h> #include <getopt.h>

View File

@ -35,7 +35,7 @@ struct iovec {
size_t iov_len; /* Length of data. */ size_t iov_len; /* Length of data. */
}; };
#else // !_WIN32 #else // !_WIN32
#include <sys/uio.h> # include <sys/uio.h>
#endif // !_WIN32 #endif // !_WIN32
#include <cassert> #include <cassert>
@ -52,9 +52,9 @@ namespace nghttp2 {
#define DEFAULT_WR_IOVCNT 16 #define DEFAULT_WR_IOVCNT 16
#if defined(IOV_MAX) && IOV_MAX < DEFAULT_WR_IOVCNT #if defined(IOV_MAX) && IOV_MAX < DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT IOV_MAX # define MAX_WR_IOVCNT IOV_MAX
#else // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT #else // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT DEFAULT_WR_IOVCNT # define MAX_WR_IOVCNT DEFAULT_WR_IOVCNT
#endif // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT #endif // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
template <size_t N> struct Memchunk { template <size_t N> struct Memchunk {

View File

@ -26,7 +26,7 @@
#define MEMCHUNK_TEST_H #define MEMCHUNK_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace nghttp2 { namespace nghttp2 {

View File

@ -26,23 +26,23 @@
#define NETWORK_H #define NETWORK_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef _WIN32 #ifdef _WIN32
#include <ws2tcpip.h> # include <ws2tcpip.h>
#else // !_WIN32 #else // !_WIN32
#include <sys/un.h> # include <sys/un.h>
#endif // !_WIN32 #endif // !_WIN32
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif // HAVE_ARPA_INET_H #endif // HAVE_ARPA_INET_H
namespace nghttp2 { namespace nghttp2 {

View File

@ -26,13 +26,13 @@
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <getopt.h> #include <getopt.h>
@ -50,7 +50,7 @@
#include <openssl/err.h> #include <openssl/err.h>
#ifdef HAVE_JANSSON #ifdef HAVE_JANSSON
#include <jansson.h> # include <jansson.h>
#endif // HAVE_JANSSON #endif // HAVE_JANSSON
#include "app_helper.h" #include "app_helper.h"
@ -62,7 +62,7 @@
#include "ssl_compat.h" #include "ssl_compat.h"
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY (0) # define O_BINARY (0)
#endif // O_BINARY #endif // O_BINARY
namespace nghttp2 { namespace nghttp2 {

View File

@ -29,10 +29,10 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <string> #include <string>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_CONFIG_H #define NGHTTP2_CONFIG_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#endif // NGHTTP2_CONFIG_H #endif // NGHTTP2_CONFIG_H

View File

@ -24,16 +24,16 @@
*/ */
#ifndef NGHTTP2_GZIP_H #ifndef NGHTTP2_GZIP_H
#ifdef HAVE_CONFIG_H # ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ # endif /* HAVE_CONFIG_H */
#include <zlib.h> # include <zlib.h>
#include <nghttp2/nghttp2.h> # include <nghttp2/nghttp2.h>
#ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
#endif # endif
/** /**
* @struct * @struct
@ -115,8 +115,8 @@ int nghttp2_gzip_inflate(nghttp2_gzip *inflater, uint8_t *out,
*/ */
int nghttp2_gzip_inflate_finished(nghttp2_gzip *inflater); int nghttp2_gzip_inflate_finished(nghttp2_gzip *inflater);
#ifdef __cplusplus # ifdef __cplusplus
} }
#endif # endif
#endif /* NGHTTP2_GZIP_H */ #endif /* NGHTTP2_GZIP_H */

View File

@ -26,7 +26,7 @@
#define NGHTTP2_GZIP_TEST_H #define NGHTTP2_GZIP_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -25,11 +25,11 @@
#include "nghttp2_config.h" #include "nghttp2_config.h"
#ifdef __sgi #ifdef __sgi
#define daemon _daemonize # define daemon _daemonize
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <signal.h> #include <signal.h>
#include <getopt.h> #include <getopt.h>

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <stdio.h> #include <stdio.h>

View File

@ -28,36 +28,36 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#include <sys/un.h> #include <sys/un.h>
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <signal.h> #include <signal.h>
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif // HAVE_ARPA_INET_H #endif // HAVE_ARPA_INET_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <getopt.h> #include <getopt.h>
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
#include <syslog.h> # include <syslog.h>
#endif // HAVE_SYSLOG_H #endif // HAVE_SYSLOG_H
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> # include <limits.h>
#endif // HAVE_LIMITS_H #endif // HAVE_LIMITS_H
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> # include <sys/time.h>
#endif // HAVE_SYS_TIME_H #endif // HAVE_SYS_TIME_H
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_LIBSYSTEMD #ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-daemon.h> # include <systemd/sd-daemon.h>
#endif // HAVE_LIBSYSTEMD #endif // HAVE_LIBSYSTEMD
#include <cinttypes> #include <cinttypes>
@ -131,16 +131,16 @@ constexpr auto ENV_ACCEPT_PREFIX = StringRef::from_lit("NGHTTPX_ACCEPT_");
constexpr auto ENV_ORIG_PID = StringRef::from_lit("NGHTTPX_ORIG_PID"); constexpr auto ENV_ORIG_PID = StringRef::from_lit("NGHTTPX_ORIG_PID");
#ifndef _KERNEL_FASTOPEN #ifndef _KERNEL_FASTOPEN
#define _KERNEL_FASTOPEN # define _KERNEL_FASTOPEN
// conditional define for TCP_FASTOPEN mostly on ubuntu // conditional define for TCP_FASTOPEN mostly on ubuntu
#ifndef TCP_FASTOPEN # ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23 # define TCP_FASTOPEN 23
#endif # endif
// conditional define for SOL_TCP mostly on ubuntu // conditional define for SOL_TCP mostly on ubuntu
#ifndef SOL_TCP # ifndef SOL_TCP
#define SOL_TCP 6 # define SOL_TCP 6
#endif # endif
#endif #endif
// This configuration is fixed at the first startup of the main // This configuration is fixed at the first startup of the main
@ -1140,15 +1140,15 @@ int call_daemon() {
#ifdef __sgi #ifdef __sgi
return _daemonize(0, 0, 0, 0); return _daemonize(0, 0, 0, 0);
#else // !__sgi #else // !__sgi
#ifdef HAVE_LIBSYSTEMD # ifdef HAVE_LIBSYSTEMD
if (sd_booted() && (getenv("NOTIFY_SOCKET") != nullptr)) { if (sd_booted() && (getenv("NOTIFY_SOCKET") != nullptr)) {
LOG(NOTICE) << "Daemonising disabled under systemd"; LOG(NOTICE) << "Daemonising disabled under systemd";
chdir("/"); chdir("/");
return 0; return 0;
} }
#endif // HAVE_LIBSYSTEMD # endif // HAVE_LIBSYSTEMD
return daemon(0, 0); return daemon(0, 0);
#endif // !__sgi #endif // !__sgi
} }
} // namespace } // namespace

View File

@ -26,20 +26,20 @@
#define SHRPX_H #define SHRPX_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#include <cassert> #include <cassert>
#ifndef HAVE__EXIT #ifndef HAVE__EXIT
#define nghttp2_Exit(status) _exit(status) # define nghttp2_Exit(status) _exit(status)
#else // HAVE__EXIT #else // HAVE__EXIT
#define nghttp2_Exit(status) _Exit(status) # define nghttp2_Exit(status) _Exit(status)
#endif // HAVE__EXIT #endif // HAVE__EXIT
#define DIE() nghttp2_Exit(EXIT_FAILURE) #define DIE() nghttp2_Exit(EXIT_FAILURE)

View File

@ -25,7 +25,7 @@
#include "shrpx_accept_handler.h" #include "shrpx_accept_handler.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <cerrno> #include <cerrno>

View File

@ -25,13 +25,13 @@
#include "shrpx_client_handler.h" #include "shrpx_client_handler.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <cerrno> #include <cerrno>

View File

@ -25,21 +25,21 @@
#include "shrpx_config.h" #include "shrpx_config.h"
#ifdef HAVE_PWD_H #ifdef HAVE_PWD_H
#include <pwd.h> # include <pwd.h>
#endif // HAVE_PWD_H #endif // HAVE_PWD_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
#include <syslog.h> # include <syslog.h>
#endif // HAVE_SYSLOG_H #endif // HAVE_SYSLOG_H
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <dirent.h> #include <dirent.h>

View File

@ -29,14 +29,14 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#include <sys/un.h> #include <sys/un.h>
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif // HAVE_ARPA_INET_H #endif // HAVE_ARPA_INET_H
#include <cinttypes> #include <cinttypes>
#include <cstdio> #include <cstdio>

View File

@ -25,7 +25,7 @@
#include "shrpx_config_test.h" #include "shrpx_config_test.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <cstdlib> #include <cstdlib>

View File

@ -26,7 +26,7 @@
#define SHRPX_CONFIG_TEST_H #define SHRPX_CONFIG_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -25,7 +25,7 @@
#include "shrpx_connection.h" #include "shrpx_connection.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
@ -817,11 +817,11 @@ int Connection::get_tcp_hint(TCPHint *hint) const {
// For TLSv1.3, AES-GCM and CHACHA20_POLY1305 overhead are now 22 // For TLSv1.3, AES-GCM and CHACHA20_POLY1305 overhead are now 22
// bytes (5 (header) + 1 (ContentType) + 16 (tag)). // bytes (5 (header) + 1 (ContentType) + 16 (tag)).
size_t tls_overhead; size_t tls_overhead;
#ifdef TLS1_3_VERSION # ifdef TLS1_3_VERSION
if (SSL_version(tls.ssl) == TLS1_3_VERSION) { if (SSL_version(tls.ssl) == TLS1_3_VERSION) {
tls_overhead = 22; tls_overhead = 22;
} else } else
#endif // TLS1_3_VERSION # endif // TLS1_3_VERSION
{ {
tls_overhead = 29; tls_overhead = 29;
} }

View File

@ -25,7 +25,7 @@
#include "shrpx_connection_handler.h" #include "shrpx_connection_handler.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -254,15 +254,15 @@ int ConnectionHandler::create_worker_thread(size_t num) {
cert_tree_ = tls::create_cert_lookup_tree(); cert_tree_ = tls::create_cert_lookup_tree();
auto sv_ssl_ctx = tls::setup_server_ssl_context( auto sv_ssl_ctx = tls::setup_server_ssl_context(
all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get() all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get()
#ifdef HAVE_NEVERBLEED # ifdef HAVE_NEVERBLEED
, ,
nb_.get() nb_.get()
#endif // HAVE_NEVERBLEED # endif // HAVE_NEVERBLEED
); );
auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context( auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context(
#ifdef HAVE_NEVERBLEED # ifdef HAVE_NEVERBLEED
nb_.get() nb_.get()
#endif // HAVE_NEVERBLEED # endif // HAVE_NEVERBLEED
); );
if (cl_ssl_ctx) { if (cl_ssl_ctx) {
@ -284,9 +284,9 @@ int ConnectionHandler::create_worker_thread(size_t num) {
if (memcachedconf.tls) { if (memcachedconf.tls) {
session_cache_ssl_ctx = tls::create_ssl_client_context( session_cache_ssl_ctx = tls::create_ssl_client_context(
#ifdef HAVE_NEVERBLEED # ifdef HAVE_NEVERBLEED
nb_.get(), nb_.get(),
#endif // HAVE_NEVERBLEED # endif // HAVE_NEVERBLEED
tlsconf.cacert, memcachedconf.cert_file, tlsconf.cacert, memcachedconf.cert_file,
memcachedconf.private_key_file, nullptr); memcachedconf.private_key_file, nullptr);
all_ssl_ctx_.push_back(session_cache_ssl_ctx); all_ssl_ctx_.push_back(session_cache_ssl_ctx);
@ -299,11 +299,11 @@ int ConnectionHandler::create_worker_thread(size_t num) {
auto worker = make_unique<Worker>( auto worker = make_unique<Worker>(
loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(),
ticket_keys_, this, config->conn.downstream); ticket_keys_, this, config->conn.downstream);
#ifdef HAVE_MRUBY # ifdef HAVE_MRUBY
if (worker->create_mruby_context() != 0) { if (worker->create_mruby_context() != 0) {
return -1; return -1;
} }
#endif // HAVE_MRUBY # endif // HAVE_MRUBY
workers_.push_back(std::move(worker)); workers_.push_back(std::move(worker));
worker_loops_.push_back(loop); worker_loops_.push_back(loop);
@ -629,19 +629,19 @@ void ConnectionHandler::handle_ocsp_complete() {
tls::verify_ocsp_response(ssl_ctx, ocsp_.resp.data(), tls::verify_ocsp_response(ssl_ctx, ocsp_.resp.data(),
ocsp_.resp.size()) == 0) { ocsp_.resp.size()) == 0) {
#ifndef OPENSSL_IS_BORINGSSL #ifndef OPENSSL_IS_BORINGSSL
#ifdef HAVE_ATOMIC_STD_SHARED_PTR # ifdef HAVE_ATOMIC_STD_SHARED_PTR
std::atomic_store_explicit( std::atomic_store_explicit(
&tls_ctx_data->ocsp_data, &tls_ctx_data->ocsp_data,
std::make_shared<std::vector<uint8_t>>(std::move(ocsp_.resp)), std::make_shared<std::vector<uint8_t>>(std::move(ocsp_.resp)),
std::memory_order_release); std::memory_order_release);
#else // !HAVE_ATOMIC_STD_SHARED_PTR # else // !HAVE_ATOMIC_STD_SHARED_PTR
std::lock_guard<std::mutex> g(tls_ctx_data->mu); std::lock_guard<std::mutex> g(tls_ctx_data->mu);
tls_ctx_data->ocsp_data = tls_ctx_data->ocsp_data =
std::make_shared<std::vector<uint8_t>>(std::move(ocsp_.resp)); std::make_shared<std::vector<uint8_t>>(std::move(ocsp_.resp));
#endif // !HAVE_ATOMIC_STD_SHARED_PTR # endif // !HAVE_ATOMIC_STD_SHARED_PTR
#else // OPENSSL_IS_BORINGSSL #else // OPENSSL_IS_BORINGSSL
SSL_CTX_set_ocsp_response(ssl_ctx, ocsp_.resp.data(), ocsp_.resp.size()); SSL_CTX_set_ocsp_response(ssl_ctx, ocsp_.resp.data(), ocsp_.resp.size());
#endif // OPENSSL_IS_BORINGSSL #endif // OPENSSL_IS_BORINGSSL
} }
++ocsp_.next; ++ocsp_.next;

View File

@ -29,7 +29,7 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#include <mutex> #include <mutex>
@ -37,7 +37,7 @@
#include <vector> #include <vector>
#include <random> #include <random>
#ifndef NOTHREADS #ifndef NOTHREADS
#include <future> # include <future>
#endif // NOTHREADS #endif // NOTHREADS
#include <openssl/ssl.h> #include <openssl/ssl.h>
@ -45,7 +45,7 @@
#include <ev.h> #include <ev.h>
#ifdef HAVE_NEVERBLEED #ifdef HAVE_NEVERBLEED
#include <neverbleed.h> # include <neverbleed.h>
#endif // HAVE_NEVERBLEED #endif // HAVE_NEVERBLEED
#include "shrpx_downstream_connection_pool.h" #include "shrpx_downstream_connection_pool.h"

View File

@ -38,7 +38,7 @@
#include "shrpx_http2_session.h" #include "shrpx_http2_session.h"
#include "shrpx_log.h" #include "shrpx_log.h"
#ifdef HAVE_MRUBY #ifdef HAVE_MRUBY
#include "shrpx_mruby.h" # include "shrpx_mruby.h"
#endif // HAVE_MRUBY #endif // HAVE_MRUBY
#include "util.h" #include "util.h"
#include "http2.h" #include "http2.h"

View File

@ -26,7 +26,7 @@
#define SHRPX_DOWNSTREAM_TEST_H #define SHRPX_DOWNSTREAM_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -25,7 +25,7 @@
#include "shrpx_http2_downstream_connection.h" #include "shrpx_http2_downstream_connection.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include "http-parser/http_parser.h" #include "http-parser/http_parser.h"

View File

@ -26,7 +26,7 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <vector> #include <vector>

View File

@ -39,7 +39,7 @@
#include "shrpx_http2_session.h" #include "shrpx_http2_session.h"
#include "shrpx_log.h" #include "shrpx_log.h"
#ifdef HAVE_MRUBY #ifdef HAVE_MRUBY
#include "shrpx_mruby.h" # include "shrpx_mruby.h"
#endif // HAVE_MRUBY #endif // HAVE_MRUBY
#include "http2.h" #include "http2.h"
#include "util.h" #include "util.h"

View File

@ -25,7 +25,7 @@
#include "shrpx_http_test.h" #include "shrpx_http_test.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <cstdlib> #include <cstdlib>

View File

@ -26,7 +26,7 @@
#define SHRPX_HTTP_TEST_H #define SHRPX_HTTP_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -39,7 +39,7 @@
#include "shrpx_http2_session.h" #include "shrpx_http2_session.h"
#include "shrpx_log.h" #include "shrpx_log.h"
#ifdef HAVE_MRUBY #ifdef HAVE_MRUBY
#include "shrpx_mruby.h" # include "shrpx_mruby.h"
#endif // HAVE_MRUBY #endif // HAVE_MRUBY
#include "http2.h" #include "http2.h"
#include "util.h" #include "util.h"

View File

@ -25,18 +25,18 @@
#include "shrpx_log.h" #include "shrpx_log.h"
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
#include <syslog.h> # include <syslog.h>
#endif // HAVE_SYSLOG_H #endif // HAVE_SYSLOG_H
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#ifdef HAVE_INTTYPES_H #ifdef HAVE_INTTYPES_H
#include <inttypes.h> # include <inttypes.h>
#endif // HAVE_INTTYPES_H #endif // HAVE_INTTYPES_H
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#include <sys/wait.h> #include <sys/wait.h>

View File

@ -57,14 +57,14 @@ LogConfig::LogConfig()
} }
#ifndef NOTHREADS #ifndef NOTHREADS
#ifdef HAVE_THREAD_LOCAL # ifdef HAVE_THREAD_LOCAL
namespace { namespace {
thread_local std::unique_ptr<LogConfig> config = make_unique<LogConfig>(); thread_local std::unique_ptr<LogConfig> config = make_unique<LogConfig>();
} // namespace } // namespace
LogConfig *log_config() { return config.get(); } LogConfig *log_config() { return config.get(); }
void delete_log_config() {} void delete_log_config() {}
#else // !HAVE_THREAD_LOCAL # else // !HAVE_THREAD_LOCAL
namespace { namespace {
pthread_key_t lckey; pthread_key_t lckey;
pthread_once_t lckey_once = PTHREAD_ONCE_INIT; pthread_once_t lckey_once = PTHREAD_ONCE_INIT;
@ -85,8 +85,8 @@ LogConfig *log_config() {
} }
void delete_log_config() { delete log_config(); } void delete_log_config() { delete log_config(); }
#endif // !HAVE_THREAD_LOCAL # endif // !HAVE_THREAD_LOCAL
#else // NOTHREADS #else // NOTHREADS
namespace { namespace {
std::unique_ptr<LogConfig> config = make_unique<LogConfig>(); std::unique_ptr<LogConfig> config = make_unique<LogConfig>();
} // namespace } // namespace
@ -94,7 +94,7 @@ std::unique_ptr<LogConfig> config = make_unique<LogConfig>();
LogConfig *log_config() { return config.get(); } LogConfig *log_config() { return config.get(); }
void delete_log_config() {} void delete_log_config() {}
#endif // NOTHREADS #endif // NOTHREADS
void LogConfig::update_tstamp_millis( void LogConfig::update_tstamp_millis(
const std::chrono::system_clock::time_point &now) { const std::chrono::system_clock::time_point &now) {

View File

@ -578,9 +578,9 @@ int MemcachedConnection::parse_packet() {
#define DEFAULT_WR_IOVCNT 128 #define DEFAULT_WR_IOVCNT 128
#if defined(IOV_MAX) && IOV_MAX < DEFAULT_WR_IOVCNT #if defined(IOV_MAX) && IOV_MAX < DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT IOV_MAX # define MAX_WR_IOVCNT IOV_MAX
#else // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT #else // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT DEFAULT_WR_IOVCNT # define MAX_WR_IOVCNT DEFAULT_WR_IOVCNT
#endif // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT #endif // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
size_t MemcachedConnection::fill_request_buffer(struct iovec *iov, size_t MemcachedConnection::fill_request_buffer(struct iovec *iov,

View File

@ -26,7 +26,7 @@
#define SHRPX_ROUTER_TEST_H #define SHRPX_ROUTER_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -25,10 +25,10 @@
#include "shrpx_tls.h" #include "shrpx_tls.h"
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <pthread.h> #include <pthread.h>
@ -46,7 +46,7 @@
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/dh.h> #include <openssl/dh.h>
#ifndef OPENSSL_NO_OCSP #ifndef OPENSSL_NO_OCSP
#include <openssl/ocsp.h> # include <openssl/ocsp.h>
#endif // OPENSSL_NO_OCSP #endif // OPENSSL_NO_OCSP
#include <nghttp2/nghttp2.h> #include <nghttp2/nghttp2.h>
@ -204,21 +204,21 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
for (auto ssl_ctx : ssl_ctx_list) { for (auto ssl_ctx : ssl_ctx_list) {
auto cert = SSL_CTX_get0_certificate(ssl_ctx); auto cert = SSL_CTX_get0_certificate(ssl_ctx);
#if OPENSSL_1_1_API # if OPENSSL_1_1_API
auto pubkey = X509_get0_pubkey(cert); auto pubkey = X509_get0_pubkey(cert);
#else // !OPENSSL_1_1_API # else // !OPENSSL_1_1_API
auto pubkey = X509_get_pubkey(cert); auto pubkey = X509_get_pubkey(cert);
#endif // !OPENSSL_1_1_API # endif // !OPENSSL_1_1_API
if (EVP_PKEY_base_id(pubkey) != EVP_PKEY_EC) { if (EVP_PKEY_base_id(pubkey) != EVP_PKEY_EC) {
continue; continue;
} }
#if OPENSSL_1_1_API # if OPENSSL_1_1_API
auto eckey = EVP_PKEY_get0_EC_KEY(pubkey); auto eckey = EVP_PKEY_get0_EC_KEY(pubkey);
#else // !OPENSSL_1_1_API # else // !OPENSSL_1_1_API
auto eckey = EVP_PKEY_get1_EC_KEY(pubkey); auto eckey = EVP_PKEY_get1_EC_KEY(pubkey);
#endif // !OPENSSL_1_1_API # endif // !OPENSSL_1_1_API
if (eckey == nullptr) { if (eckey == nullptr) {
continue; continue;
@ -227,10 +227,10 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
auto ecgroup = EC_KEY_get0_group(eckey); auto ecgroup = EC_KEY_get0_group(eckey);
auto cert_curve = EC_GROUP_get_curve_name(ecgroup); auto cert_curve = EC_GROUP_get_curve_name(ecgroup);
#if !OPENSSL_1_1_API # if !OPENSSL_1_1_API
EC_KEY_free(eckey); EC_KEY_free(eckey);
EVP_PKEY_free(pubkey); EVP_PKEY_free(pubkey);
#endif // !OPENSSL_1_1_API # endif // !OPENSSL_1_1_API
if (shared_curve == cert_curve) { if (shared_curve == cert_curve) {
SSL_set_SSL_CTX(ssl, ssl_ctx); SSL_set_SSL_CTX(ssl, ssl_ctx);
@ -251,13 +251,13 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
namespace { namespace {
std::shared_ptr<std::vector<uint8_t>> std::shared_ptr<std::vector<uint8_t>>
get_ocsp_data(TLSContextData *tls_ctx_data) { get_ocsp_data(TLSContextData *tls_ctx_data) {
#ifdef HAVE_ATOMIC_STD_SHARED_PTR # ifdef HAVE_ATOMIC_STD_SHARED_PTR
return std::atomic_load_explicit(&tls_ctx_data->ocsp_data, return std::atomic_load_explicit(&tls_ctx_data->ocsp_data,
std::memory_order_acquire); std::memory_order_acquire);
#else // !HAVE_ATOMIC_STD_SHARED_PTR # else // !HAVE_ATOMIC_STD_SHARED_PTR
std::lock_guard<std::mutex> g(tls_ctx_data->mu); std::lock_guard<std::mutex> g(tls_ctx_data->mu);
return tls_ctx_data->ocsp_data; return tls_ctx_data->ocsp_data;
#endif // !HAVE_ATOMIC_STD_SHARED_PTR # endif // !HAVE_ATOMIC_STD_SHARED_PTR
} }
} // namespace } // namespace
@ -567,9 +567,9 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
#if !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L #if !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L
#ifndef TLSEXT_TYPE_signed_certificate_timestamp # ifndef TLSEXT_TYPE_signed_certificate_timestamp
#define TLSEXT_TYPE_signed_certificate_timestamp 18 # define TLSEXT_TYPE_signed_certificate_timestamp 18
#endif // !TLSEXT_TYPE_signed_certificate_timestamp # endif // !TLSEXT_TYPE_signed_certificate_timestamp
namespace { namespace {
int sct_add_cb(SSL *ssl, unsigned int ext_type, unsigned int context, int sct_add_cb(SSL *ssl, unsigned int ext_type, unsigned int context,
@ -629,7 +629,7 @@ int sct_parse_cb(SSL *ssl, unsigned int ext_type, unsigned int context,
} }
} // namespace } // namespace
#if !OPENSSL_1_1_1_API # if !OPENSSL_1_1_1_API
namespace { namespace {
int legacy_sct_add_cb(SSL *ssl, unsigned int ext_type, int legacy_sct_add_cb(SSL *ssl, unsigned int ext_type,
@ -654,8 +654,8 @@ int legacy_sct_parse_cb(SSL *ssl, unsigned int ext_type,
} }
} // namespace } // namespace
#endif // !OPENSSL_1_1_1_API # endif // !OPENSSL_1_1_1_API
#endif // !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L #endif // !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L
#ifndef OPENSSL_NO_PSK #ifndef OPENSSL_NO_PSK
namespace { namespace {
@ -794,18 +794,18 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
} }
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
#if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L # if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L
if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.c_str()) != 1) { if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.c_str()) != 1) {
LOG(FATAL) << "SSL_CTX_set1_curves_list " << tlsconf.ecdh_curves LOG(FATAL) << "SSL_CTX_set1_curves_list " << tlsconf.ecdh_curves
<< " failed"; << " failed";
DIE(); DIE();
} }
#if !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API # if !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API
// It looks like we need this function call for OpenSSL 1.0.2. This // It looks like we need this function call for OpenSSL 1.0.2. This
// function was deprecated in OpenSSL 1.1.0 and BoringSSL. // function was deprecated in OpenSSL 1.1.0 and BoringSSL.
SSL_CTX_set_ecdh_auto(ssl_ctx, 1); SSL_CTX_set_ecdh_auto(ssl_ctx, 1);
#endif // !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API # endif // !defined(OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API
#else // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L # else // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L
// Use P-256, which is sufficiently secure at the time of this // Use P-256, which is sufficiently secure at the time of this
// writing. // writing.
auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
@ -816,8 +816,8 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
} }
SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh); SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh);
EC_KEY_free(ecdh); EC_KEY_free(ecdh);
#endif // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L # endif // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L
#endif // OPENSSL_NO_EC #endif // OPENSSL_NO_EC
if (!tlsconf.dh_param_file.empty()) { if (!tlsconf.dh_param_file.empty()) {
// Read DH parameters from file // Read DH parameters from file
@ -939,7 +939,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
// OpenSSL handles signed_certificate_timestamp extension specially, // OpenSSL handles signed_certificate_timestamp extension specially,
// and it lets custom handler to process the extension. // and it lets custom handler to process the extension.
if (!sct_data.empty()) { if (!sct_data.empty()) {
#if OPENSSL_1_1_1_API # if OPENSSL_1_1_1_API
// It is not entirely clear to me that SSL_EXT_CLIENT_HELLO is // It is not entirely clear to me that SSL_EXT_CLIENT_HELLO is
// required here. sct_parse_cb is called without // required here. sct_parse_cb is called without
// SSL_EXT_CLIENT_HELLO being set. But the passed context value // SSL_EXT_CLIENT_HELLO being set. But the passed context value
@ -953,7 +953,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
<< ERR_error_string(ERR_get_error(), nullptr); << ERR_error_string(ERR_get_error(), nullptr);
DIE(); DIE();
} }
#else // !OPENSSL_1_1_1_API # else // !OPENSSL_1_1_1_API
if (SSL_CTX_add_server_custom_ext( if (SSL_CTX_add_server_custom_ext(
ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp,
legacy_sct_add_cb, legacy_sct_free_cb, nullptr, legacy_sct_parse_cb, legacy_sct_add_cb, legacy_sct_free_cb, nullptr, legacy_sct_parse_cb,
@ -962,7 +962,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
<< ERR_error_string(ERR_get_error(), nullptr); << ERR_error_string(ERR_get_error(), nullptr);
DIE(); DIE();
} }
#endif // !OPENSSL_1_1_1_API # endif // !OPENSSL_1_1_1_API
} }
#endif // !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L #endif // !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L
@ -1893,11 +1893,11 @@ int verify_ocsp_response(SSL_CTX *ssl_ctx, const uint8_t *ocsp_resp,
return -1; return -1;
} }
#if OPENSSL_1_1_API # if OPENSSL_1_1_API
auto certid = OCSP_SINGLERESP_get0_id(sresp); auto certid = OCSP_SINGLERESP_get0_id(sresp);
#else // !OPENSSL_1_1_API # else // !OPENSSL_1_1_API
auto certid = sresp->certId; auto certid = sresp->certId;
#endif // !OPENSSL_1_1_API # endif // !OPENSSL_1_1_API
assert(certid != nullptr); assert(certid != nullptr);
ASN1_INTEGER *serial; ASN1_INTEGER *serial;
@ -1971,10 +1971,10 @@ StringRef get_x509_issuer_name(BlockAllocator &balloc, X509 *x) {
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define bswap64(N) (N) # define bswap64(N) (N)
#else /* !WORDS_BIGENDIAN */ #else /* !WORDS_BIGENDIAN */
#define bswap64(N) \ # define bswap64(N) \
((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32))) ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
#endif /* !WORDS_BIGENDIAN */ #endif /* !WORDS_BIGENDIAN */
StringRef get_x509_serial(BlockAllocator &balloc, X509 *x) { StringRef get_x509_serial(BlockAllocator &balloc, X509 *x) {

View File

@ -36,7 +36,7 @@
#include <ev.h> #include <ev.h>
#ifdef HAVE_NEVERBLEED #ifdef HAVE_NEVERBLEED
#include <neverbleed.h> # include <neverbleed.h>
#endif // HAVE_NEVERBLEED #endif // HAVE_NEVERBLEED
#include "network.h" #include "network.h"

View File

@ -26,7 +26,7 @@
#define SHRPX_TLS_TEST_H #define SHRPX_TLS_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -25,7 +25,7 @@
#include "shrpx_worker.h" #include "shrpx_worker.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <memory> #include <memory>
@ -37,7 +37,7 @@
#include "shrpx_log_config.h" #include "shrpx_log_config.h"
#include "shrpx_memcached_dispatcher.h" #include "shrpx_memcached_dispatcher.h"
#ifdef HAVE_MRUBY #ifdef HAVE_MRUBY
#include "shrpx_mruby.h" # include "shrpx_mruby.h"
#endif // HAVE_MRUBY #endif // HAVE_MRUBY
#include "util.h" #include "util.h"
#include "template.h" #include "template.h"

View File

@ -34,7 +34,7 @@
#include <deque> #include <deque>
#include <thread> #include <thread>
#ifndef NOTHREADS #ifndef NOTHREADS
#include <future> # include <future>
#endif // NOTHREADS #endif // NOTHREADS
#include <openssl/ssl.h> #include <openssl/ssl.h>

View File

@ -26,7 +26,7 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/wait.h> #include <sys/wait.h>

View File

@ -25,7 +25,7 @@
#include "shrpx_worker_test.h" #include "shrpx_worker_test.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <cstdlib> #include <cstdlib>

View File

@ -26,7 +26,7 @@
#define SHRPX_WORKER_TEST_H #define SHRPX_WORKER_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -24,20 +24,20 @@
*/ */
#ifndef OPENSSL_COMPAT_H #ifndef OPENSSL_COMPAT_H
#include <openssl/opensslv.h> # include <openssl/opensslv.h>
#if defined(LIBRESSL_VERSION_NUMBER) # if defined(LIBRESSL_VERSION_NUMBER)
#define OPENSSL_1_1_API 0 # define OPENSSL_1_1_API 0
#define OPENSSL_1_1_1_API 0 # define OPENSSL_1_1_1_API 0
#define LIBRESSL_IN_USE 1 # define LIBRESSL_IN_USE 1
#define LIBRESSL_LEGACY_API (LIBRESSL_VERSION_NUMBER < 0x20700000L) # define LIBRESSL_LEGACY_API (LIBRESSL_VERSION_NUMBER < 0x20700000L)
#define LIBRESSL_2_7_API (LIBRESSL_VERSION_NUMBER >= 0x20700000L) # define LIBRESSL_2_7_API (LIBRESSL_VERSION_NUMBER >= 0x20700000L)
#else // !defined(LIBRESSL_VERSION_NUMBER) # else // !defined(LIBRESSL_VERSION_NUMBER)
#define OPENSSL_1_1_API (OPENSSL_VERSION_NUMBER >= 0x1010000fL) # define OPENSSL_1_1_API (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
#define OPENSSL_1_1_1_API (OPENSSL_VERSION_NUMBER >= 0x10101000L) # define OPENSSL_1_1_1_API (OPENSSL_VERSION_NUMBER >= 0x10101000L)
#define LIBRESSL_IN_USE 0 # define LIBRESSL_IN_USE 0
#define LIBRESSL_LEGACY_API 0 # define LIBRESSL_LEGACY_API 0
#define LIBRESSL_2_7_API 0 # define LIBRESSL_2_7_API 0
#endif // !defined(LIBRESSL_VERSION_NUMBER) # endif // !defined(LIBRESSL_VERSION_NUMBER)
#endif // OPENSSL_COMPAT_H #endif // OPENSSL_COMPAT_H

View File

@ -26,7 +26,7 @@
#define TEMPLATE_TEST_H #define TEMPLATE_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace nghttp2 { namespace nghttp2 {

View File

@ -26,7 +26,7 @@
#define TIMEGM_H #define TIMEGM_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#ifdef __cplusplus #ifdef __cplusplus
@ -34,7 +34,7 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifdef HAVE_TIME_H #ifdef HAVE_TIME_H
#include <time.h> # include <time.h>
#endif // HAVE_TIME_H #endif // HAVE_TIME_H
time_t nghttp2_timegm(struct tm *tm); time_t nghttp2_timegm(struct tm *tm);

View File

@ -25,30 +25,30 @@
#include "util.h" #include "util.h"
#ifdef HAVE_TIME_H #ifdef HAVE_TIME_H
#include <time.h> # include <time.h>
#endif // HAVE_TIME_H #endif // HAVE_TIME_H
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> # include <sys/socket.h>
#endif // HAVE_SYS_SOCKET_H #endif // HAVE_SYS_SOCKET_H
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> # include <fcntl.h>
#endif // HAVE_FCNTL_H #endif // HAVE_FCNTL_H
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#ifdef _WIN32 #ifdef _WIN32
#include <ws2tcpip.h> # include <ws2tcpip.h>
#include <boost/date_time/posix_time/posix_time.hpp> # include <boost/date_time/posix_time/posix_time.hpp>
#else // !_WIN32 #else // !_WIN32
#include <netinet/tcp.h> # include <netinet/tcp.h>
#endif // !_WIN32 #endif // !_WIN32
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> # include <arpa/inet.h>
#endif // HAVE_ARPA_INET_H #endif // HAVE_ARPA_INET_H
#include <cmath> #include <cmath>
@ -80,9 +80,9 @@ int nghttp2_inet_pton(int af, const char *src, void *dst) {
namespace { namespace {
// inet_pton-wrapper for Windows // inet_pton-wrapper for Windows
int nghttp2_inet_pton(int af, const char *src, void *dst) { int nghttp2_inet_pton(int af, const char *src, void *dst) {
#if _WIN32_WINNT >= 0x0600 # if _WIN32_WINNT >= 0x0600
return InetPtonA(af, src, dst); return InetPtonA(af, src, dst);
#else # else
// the function takes a 'char*', so we need to make a copy // the function takes a 'char*', so we need to make a copy
char addr[INET6_ADDRSTRLEN + 1]; char addr[INET6_ADDRSTRLEN + 1];
strncpy(addr, src, sizeof(addr)); strncpy(addr, src, sizeof(addr));
@ -93,7 +93,7 @@ int nghttp2_inet_pton(int af, const char *src, void *dst) {
if (WSAStringToAddress(addr, af, NULL, (LPSOCKADDR)dst, &size) == 0) if (WSAStringToAddress(addr, af, NULL, (LPSOCKADDR)dst, &size) == 0)
return 1; return 1;
return 0; return 0;
#endif # endif
} }
} // namespace } // namespace
#endif // _WIN32 #endif // _WIN32

View File

@ -28,11 +28,11 @@
#include "nghttp2_config.h" #include "nghttp2_config.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <getopt.h> #include <getopt.h>
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H
#include <netdb.h> # include <netdb.h>
#endif // HAVE_NETDB_H #endif // HAVE_NETDB_H
#include <cmath> #include <cmath>

View File

@ -26,7 +26,7 @@
#define UTIL_TEST_H #define UTIL_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
namespace shrpx { namespace shrpx {

View File

@ -26,11 +26,11 @@
/* Make sure that we get XSI-compliant version of strerror_r */ /* Make sure that we get XSI-compliant version of strerror_r */
#ifdef _POSIX_C_SOURCE #ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE # undef _POSIX_C_SOURCE
#endif /* _POSIX_C_SOURCE */ #endif /* _POSIX_C_SOURCE */
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
#undef _GNU_SOURCE # undef _GNU_SOURCE
#endif /* _GNU_SOURCE */ #endif /* _GNU_SOURCE */
#include <string.h> #include <string.h>

View File

@ -26,7 +26,7 @@
#define XSI_STRERROR_H #define XSI_STRERROR_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <stddef.h> #include <stddef.h>

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <stdio.h> #include <stdio.h>

View File

@ -26,7 +26,7 @@
#define FAILMALLOC_TEST_H #define FAILMALLOC_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
void test_nghttp2_session_send(void); void test_nghttp2_session_send(void);

View File

@ -23,7 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <stdio.h> #include <stdio.h>

View File

@ -26,7 +26,7 @@
#define MALLOC_WRAPPER_H #define MALLOC_WRAPPER_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <stdlib.h> #include <stdlib.h>

View File

@ -26,7 +26,7 @@
#define NGHTTP2_BUF_TEST_H #define NGHTTP2_BUF_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
void test_nghttp2_bufs_add(void); void test_nghttp2_bufs_add(void);

View File

@ -26,7 +26,7 @@
#define NGHTTP2_FRAME_TEST_H #define NGHTTP2_FRAME_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
void test_nghttp2_frame_pack_headers(void); void test_nghttp2_frame_pack_headers(void);

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HD_TEST_H #define NGHTTP2_HD_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
void test_nghttp2_hd_deflate(void); void test_nghttp2_hd_deflate(void);

View File

@ -26,7 +26,7 @@
#define NGHTTP2_HELPER_TEST_H #define NGHTTP2_HELPER_TEST_H
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
void test_nghttp2_adjust_local_window_size(void); void test_nghttp2_adjust_local_window_size(void);

Some files were not shown because too many files have changed in this diff Show More