http_win.do: Reject URL without '://'

Before it would accept 'domain/path' but set host = 'ath'.
pull/1161/head
Nick Treleaven 2019-07-13 12:51:11 +01:00 committed by Alexander Medvednikov
parent 7058333f17
commit d8df8474bc
1 changed files with 3 additions and 2 deletions

View File

@ -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('/')