From dab639662f847596418e64922cca95ef0b6f682d Mon Sep 17 00:00:00 2001 From: Sandro Martini Date: Mon, 17 Aug 2020 20:17:17 +0200 Subject: [PATCH] http: fix new warnings (#6153) --- vlib/net/http/backend_nix.c.v | 2 +- vlib/net/http/backend_windows.c.v | 2 +- vlib/net/http/http.v | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/net/http/backend_nix.c.v b/vlib/net/http/backend_nix.c.v index 78bf68f1c8..dc615f8206 100644 --- a/vlib/net/http/backend_nix.c.v +++ b/vlib/net/http/backend_nix.c.v @@ -41,7 +41,7 @@ fn (req &Request) ssl_do(port int, method Method, host_name, path string) ?Respo //println(req_headers) C.BIO_puts(web, req_headers.str) mut content := strings.new_builder(100) - mut buff := [bufsize]byte + mut buff := [bufsize]byte{} mut readcounter := 0 for { readcounter++ diff --git a/vlib/net/http/backend_windows.c.v b/vlib/net/http/backend_windows.c.v index e8da3d1701..e6f7ef4288 100644 --- a/vlib/net/http/backend_windows.c.v +++ b/vlib/net/http/backend_windows.c.v @@ -21,5 +21,5 @@ fn (req &Request) ssl_do(port int, method Method, host_name, path string) ?Respo length := int(C.request(&ctx, port, addr.to_wide(), sdata.str, &buff)) C.vschannel_cleanup(&ctx) - return parse_response(string(buff, length)) + return parse_response(buff.vstring_with_len(length)) } diff --git a/vlib/net/http/http.v b/vlib/net/http/http.v index b5a749d52a..56854b053b 100644 --- a/vlib/net/http/http.v +++ b/vlib/net/http/http.v @@ -410,7 +410,7 @@ pub fn escape(s string) string { } fn (req &Request) http_do(port int, method Method, host_name, path string) ?Response { - rbuffer := [bufsize]byte + rbuffer := [bufsize]byte{} mut sb := strings.new_builder(100) s := req.build_request_headers(method, host_name, path) client := net.dial(host_name, port) or {