From 66d00954a59f47b46ff3906fc33684f644c8e6af Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 7 Mar 2015 03:17:13 +0900 Subject: [PATCH] asio: Quote ServeMux documents in http2::handle() --- src/includes/nghttp2/asio_http2_server.h | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/includes/nghttp2/asio_http2_server.h b/src/includes/nghttp2/asio_http2_server.h index 311e65a7..267d1dfc 100644 --- a/src/includes/nghttp2/asio_http2_server.h +++ b/src/includes/nghttp2/asio_http2_server.h @@ -146,7 +146,31 @@ public: // function will fail and returns false if same pattern has been // already registered or |pattern| is empty string. Otherwise // returns true. The pattern match rule is the same as - // net/http/ServeMux in golang. + // net/http/ServeMux in golang. Quoted from golang manual + // (http://golang.org/pkg/net/http/#ServeMux): + // + // Patterns name fixed, rooted paths, like "/favicon.ico", or + // rooted subtrees, like "/images/" (note the trailing + // slash). Longer patterns take precedence over shorter ones, so + // that if there are handlers registered for both "/images/" and + // "/images/thumbnails/", the latter handler will be called for + // paths beginning "/images/thumbnails/" and the former will + // receive requests for any other paths in the "/images/" subtree. + // + // Note that since a pattern ending in a slash names a rooted + // subtree, the pattern "/" matches all paths not matched by other + // registered patterns, not just the URL with Path == "/". + // + // Patterns may optionally begin with a host name, restricting + // matches to URLs on that host only. Host-specific patterns take + // precedence over general patterns, so that a handler might + // register for the two patterns "/codesearch" and + // "codesearch.google.com/" without also taking over requests for + // "http://www.google.com/". + // + // Just like ServeMux in golang, URL request path is sanitized and + // if they contains . or .. elements, they are redirected to an + // equivalent .- and ..-free URL. bool handle(std::string pattern, request_cb cb); // Sets number of native threads to handle incoming HTTP request.