1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/http/backend_win.v
2019-08-10 08:21:32 +02:00

32 lines
604 B
Go

// Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module http
import strings
#flag windows -I @VROOT/thirdparty/vschannel
#flag -lws2_32 -lcrypt32
#include "vschannel.c"
fn init_module() {}
fn ssl_do(method, host_name, path string) string {
mut buff := malloc(10000)
req := '$method $path HTTP/1.0\r\nUser-Agent: v\r\nAccept:*/*\r\n\r\n'
length := int(C.request(host_name.str, req.str, buff))
if length == 0 {
return ''
}
resp := tos(buff, length)
return resp
}