From 0e469ed221deff669155011acd5d8e954715b1d2 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 11 Feb 2016 16:41:11 +0100 Subject: [PATCH 1/4] Fix typo in HAVE_CONFIG_H name Only used by lib/nghttp2_npn.c where the presence of config.h does not seem to make a difference though. --- lib/nghttp2_npn.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nghttp2_npn.h b/lib/nghttp2_npn.h index c4bdedb3..a481bde3 100644 --- a/lib/nghttp2_npn.h +++ b/lib/nghttp2_npn.h @@ -25,9 +25,9 @@ #ifndef NGHTTP2_NPN_H #define NGHTTP2_NPN_H -#ifdef HAVE_CONFIG +#ifdef HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG */ +#endif /* HAVE_CONFIG_H */ #include From 17215002a16dafe48c4f8536c046839d56eabc86 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 12 Feb 2016 14:23:16 +0100 Subject: [PATCH 2/4] examples: fix compile warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following two warnings: examples/client.c:292:0: error: macro "MAX_OUTLEN" is not used [-Werror=unused-macros] examples/tiny-nghttpd.c:298:13: error: function declaration isn’t a prototype [-Werror=strict-prototypes] Caught using cmake as the autoconf check fails due to unused macros (HAVE_xxx in conftest.c) and a main function without parameters respectively. --- examples/client.c | 2 -- examples/tiny-nghttpd.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/client.c b/examples/client.c index 4280dd52..1976fa41 100644 --- a/examples/client.c +++ b/examples/client.c @@ -289,8 +289,6 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, return 0; } -#define MAX_OUTLEN 4096 - /* * The implementation of nghttp2_on_data_chunk_recv_callback type. We * use this function to print the received response body. diff --git a/examples/tiny-nghttpd.c b/examples/tiny-nghttpd.c index 6cb95694..0141663d 100644 --- a/examples/tiny-nghttpd.c +++ b/examples/tiny-nghttpd.c @@ -295,7 +295,7 @@ static size_t http_date(char *buf, time_t t) { static char date[29]; static size_t datelen; -static void update_date() { datelen = http_date(date, time(NULL)); } +static void update_date(void) { datelen = http_date(date, time(NULL)); } static size_t utos(char *buf, size_t len, uint64_t n) { size_t nwrite = 0; From a6effb4d23137be7204bbaeff159344f51a04649 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 13 Feb 2016 14:36:12 +0100 Subject: [PATCH 3/4] doc: fix out-of-tree doc builds Fixes multiple errors while making docs: Could not import extension sphinxcontrib.rubydomain (exception: No module named 'sphinxcontrib') and ../../doc/sources/index.rst:15: WARNING: toctree contains reference to nonexisting document 'nghttp.1' ../../doc/sources/index.rst:15: WARNING: toctree contains reference to nonexisting document 'nghttpd.1' ../../doc/sources/index.rst:15: WARNING: toctree contains reference to nonexisting document 'nghttpx.1' ../../doc/sources/index.rst:15: WARNING: toctree contains reference to nonexisting document 'h2load.1' ../../doc/sources/index.rst:15: WARNING: toctree contains reference to nonexisting document 'programmers-guide' --- doc/Makefile.am | 14 +++++++++----- doc/conf.py.in | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 0e6a9abc..a9ea4349 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -145,15 +145,18 @@ APIDOCS= \ nghttp2_submit_window_update.rst \ nghttp2_version.rst -EXTRA_DIST = \ - mkapiref.py \ +RST_FILES = \ README.rst \ programmers-guide.rst \ - $(APIDOCS) \ nghttp.1.rst \ nghttpd.1.rst \ nghttpx.1.rst \ - h2load.1.rst \ + h2load.1.rst + +EXTRA_DIST = \ + mkapiref.py \ + $(RST_FILES) \ + $(APIDOCS) \ sources/index.rst \ sources/tutorial-client.rst \ sources/tutorial-server.rst \ @@ -227,7 +230,8 @@ help: apiref.rst: \ $(top_builddir)/lib/includes/nghttp2/nghttp2ver.h \ - $(top_builddir)/lib/includes/nghttp2/nghttp2.h + $(top_srcdir)/lib/includes/nghttp2/nghttp2.h + for i in $(RST_FILES); do [ -e $(builddir)/$$i ] || cp $(srcdir)/$$i $(builddir); done $(PYTHON) $(top_srcdir)/doc/mkapiref.py \ apiref.rst macros.rst enums.rst types.rst . $^ diff --git a/doc/conf.py.in b/doc/conf.py.in index 9c192827..0cc5a5a9 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -41,7 +41,7 @@ import sys, os # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) -sys.path.append(os.path.abspath('_exts')) +sys.path.append(os.path.abspath('@top_srcdir@/doc/_exts')) # -- General configuration ----------------------------------------------------- From 25930360537a201674fa6aa5b3ff93a948f11237 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 13 Feb 2016 20:03:00 +0100 Subject: [PATCH 4/4] integration-tests: support out-of-tree tests `go test` requires both config.go and the test files in the same directory. For out-of-tree builds, config.go is normally not placed next to the source files, so copy the tests to the build directory as a workaround. --- integration-tests/Makefile.am | 8 ++++++-- integration-tests/config.go.in | 1 + integration-tests/server_tester.go | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/integration-tests/Makefile.am b/integration-tests/Makefile.am index 8f2cfabd..aab50096 100644 --- a/integration-tests/Makefile.am +++ b/integration-tests/Makefile.am @@ -21,11 +21,14 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -EXTRA_DIST = \ +GO_FILES = \ nghttpx_http1_test.go \ nghttpx_http2_test.go \ nghttpx_spdy_test.go \ - server_tester.go \ + server_tester.go + +EXTRA_DIST = \ + $(GO_FILES) \ server.key \ server.crt \ alt-server.key \ @@ -43,4 +46,5 @@ itprep-local: go get -d -v golang.org/x/net/websocket it-local: + for i in $(GO_FILES); do [ -e $(builddir)/$$i ] || cp $(srcdir)/$$i $(builddir); done sh setenv go test -v diff --git a/integration-tests/config.go.in b/integration-tests/config.go.in index 0a6fd6b7..3cc4766c 100644 --- a/integration-tests/config.go.in +++ b/integration-tests/config.go.in @@ -2,4 +2,5 @@ package nghttp2 const ( buildDir = "@top_builddir@" + sourceDir = "@top_srcdir@" ) diff --git a/integration-tests/server_tester.go b/integration-tests/server_tester.go index 0a544eb8..8226c899 100644 --- a/integration-tests/server_tester.go +++ b/integration-tests/server_tester.go @@ -29,7 +29,8 @@ import ( const ( serverBin = buildDir + "/src/nghttpx" serverPort = 3009 - testDir = buildDir + "/integration-tests" + testDir = sourceDir + "/integration-tests" + logDir = buildDir + "/integration-tests" ) func pair(name, value string) hpack.HeaderField { @@ -124,7 +125,7 @@ func newServerTesterInternal(args []string, t *testing.T, handler http.Handler, // "127.0.0.1,8080" b := "-b" + strings.Replace(backendURL.Host, ":", ",", -1) args = append(args, fmt.Sprintf("-f127.0.0.1,%v", serverPort), b, - "--errorlog-file="+testDir+"/log.txt", "-LINFO") + "--errorlog-file="+logDir+"/log.txt", "-LINFO") authority := fmt.Sprintf("127.0.0.1:%v", serverPort)