From d8df8474bc618376924e35cdde8433ed2551809c Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Sat, 13 Jul 2019 12:51:11 +0100 Subject: [PATCH] http_win.do: Reject URL without '://' Before it would accept 'domain/path' but set host = 'ath'. --- vlib/http/http_win.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vlib/http/http_win.v b/vlib/http/http_win.v index a4669f7966..877b613e95 100644 --- a/vlib/http/http_win.v +++ b/vlib/http/http_win.v @@ -27,8 +27,9 @@ fn (req &Request) do() Response { //println(req.headers) is_ssl := req.url.starts_with('https://') //println('is ssl=$is_ssl') - mut pos := url.index('/') - url = url.right(pos + 2) + mut pos := url.index('://') + if pos == -1 {return emptyresp} + url = url.right(pos + 3) mut host := url mut path := '/' pos = url.index('/')