From 22eaceb17cbd7e87bf222f851d674dc290c5f3f4 Mon Sep 17 00:00:00 2001 From: unknown-v <52547845+unknown-v@users.noreply.github.com> Date: Mon, 5 Aug 2019 09:59:07 +0200 Subject: [PATCH] http_win: set status_code ,remove unused var --- vlib/http/http_win.v | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vlib/http/http_win.v b/vlib/http/http_win.v index 7a87898fa2..40e0340ef2 100644 --- a/vlib/http/http_win.v +++ b/vlib/http/http_win.v @@ -105,7 +105,7 @@ pub fn (req &Request) do() Response { // Todo call twice to get len size := 1024 h_buf := malloc(size) - + C.HttpQueryInfo(request, HTTP_QUERY_RAW_HEADERS_CRLF, h_buf, &size, 0) // Get response body mut buf := [1025]byte @@ -137,9 +137,13 @@ pub fn (req &Request) do() Response { text: s headers: map[string]string{} // headers: resp_headers + + //hard coded http version 'HTTP/1.1' + space - 9 + //3-digit HTTP status codes - 9+3 + //HTTP/1.1 200 OK + status_code: resp_headers.substr(9,12).int() } for h in hh { - vals := h.split(':') hpos := h.index(':') if hpos == -1 { continue @@ -177,4 +181,3 @@ pub fn escape(s string) string { } fn C.InternetReadFile(voidptr, voidptr, int, intptr) bool -