From f116d741ff46fac5785ac3760b23bbefd9267d12 Mon Sep 17 00:00:00 2001 From: Evgenii Sokolov Date: Tue, 21 Jan 2020 00:04:25 +0100 Subject: [PATCH] Fix http server example - parsing request path and query --- examples/http-server/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/http-server/main.go b/examples/http-server/main.go index cdb1638..ef5de95 100644 --- a/examples/http-server/main.go +++ b/examples/http-server/main.go @@ -167,11 +167,11 @@ func parsereq(data []byte, req *request) (leftover []byte, err error) { req.method = sdata[s:i] for i, s = i+1, i+1; i < len(sdata); i++ { if sdata[i] == '?' && q == -1 { - q = i - s + q = i } else if sdata[i] == ' ' { if q != -1 { req.path = sdata[s:q] - req.query = req.path[q+1 : i] + req.query = sdata[q+1 : i] } else { req.path = sdata[s:i] }