jeremycw / httpserver.h

Single header library for writing non-blocking HTTP servers in C
MIT License
1.78k stars 143 forks source link

Allow to listen on specific interface #38

Closed ioppermann closed 4 years ago

ioppermann commented 4 years ago

The http_server_listen() and http_server_listen_poll() function listen by default on all available interfaces. In order to be able to listen only on a specific interface, the functions http_server_listen_addr() and http_server_listen_addr_poll() allow to pass the IP address if the interface to listen on as second parameter.

ioppermann commented 4 years ago

Strange, the tests on macOS do not fail on my Mac

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
jeremycw commented 4 years ago

Yeah, I've seen the tests be flakey in the past. I reran in on travis and it's passing. Not sure why this happens sometimes but I'll have to spend a little more time digging into why.