1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

http_win : fix buf length

Line 157 : buf[nr_read] = 0 
set the null character '\0'
This commit is contained in:
unknown-v 2019-07-13 06:14:54 +02:00 committed by Alexander Medvednikov
parent 2811145437
commit 3281e44e84

View File

@ -107,9 +107,9 @@ fn (req &Request) do() Response {
} }
// println('LEN BEFORE SEND=$headers.len ; $headers') // println('LEN BEFORE SEND=$headers.len ; $headers')
# bool ret =HttpSendRequest(request, headers.str, -1, data.str, data.len); # bool ret =HttpSendRequest(request, headers.str, -1, data.str, data.len);
# printf("RET=%d\n", ret); // # printf("RET=%d\n", ret);
# int e = GetLastError(); // # int e = GetLastError();
# printf("e=%d\n", e); // # printf("e=%d\n", e);
// Get response headers // Get response headers
// Todo call twice to get len // Todo call twice to get len
# LPSTR h_buf = malloc(1024); # LPSTR h_buf = malloc(1024);
@ -157,7 +157,7 @@ fn (req &Request) do() Response {
buf[nr_read] = 0 buf[nr_read] = 0
//C.printf('buf="%s"\n', buf) //C.printf('buf="%s"\n', buf)
s += tos(buf, nr_read + 1) // TODO perf s += tos(buf, nr_read) // TODO perf
nr_read = 0 nr_read = 0
} }
C.InternetCloseHandle(request) C.InternetCloseHandle(request)