Open Ddiidev opened 1 year ago
I just tried your example, and it works fine on Linux:
$ v run http_error.v
Start
13011 file ok!
[http_error.v:31] resp: http.Response{
body: '{"status":true,"data":{"file":{"url":{"full":"https://anonfiles.me/qnX/file","short":"https://anonfiles.me/qnX"},"metadata":{"id":"qnX","name":"file","size":{"bytes":13011,"readable":"12.71 KB"}}}}}'
header: Server: nginx
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Cache-Control: no-cache, private
Date: Sun, 03 Sep 2023 02:35:59 GMT
Access-Control-Allow-Origin: *
Set-Cookie: XSRF-TOKEN=eyJpdiI6ImtRVU9sTkZZM2haS0tlWkVTT2U5VkE9PSIsInZhbHVlIjoiSjBnZGp2UmpZbDFMUUlubWQ4dFFwUUxlNVBxaXVhVFNSblpRaGc3eWQ5ZUI0a3N2ZlJlYTdhUDhWTzFYK1FZOTdsQkhWZHNNbnNSLzBmaitIOWlpQ1M2Q1hhV0liaVQrQjdoenZkTUtEMUVVdDBjcWhRUUJiVlBSNDYzVU1aWXYiLCJtYWMiOiI4YWRlZmUxZGYwNGNkYTkyN2ZlNDcyYWFhNzliNmZlMGM1MWU0YzE5NTdiMTU2YTBmNGE2MjhmNzU4OTYxMGJhIiwidGFnIjoiIn0%3D; expires=Sun, 03-Sep-2023 04:35:59 GMT; Max-Age=7200; path=/; samesite=lax
Set-Cookie: anonfiles_session=eyJpdiI6IisrQXhMVC8xQ2hlUDFXWG12VFdQMVE9PSIsInZhbHVlIjoia1pvQ08rWFA5TTF5Z2dNRUM0emR6bjZaTWtRVWc4cERKMVM1MElzczFSN2FjUWtvZHozMmhoMlF0Wk9YZmZneksyek5Fenl4UXNtZ0JlNXh1Tm8wNWtwRTNIYTBaeVBnbXVwandsL2hxbUQ0aFIzU29CQXBvYXdyUFVpQlJML2oiLCJtYWMiOiJjOTBjOGVkN2JlNmE5NTgxYjgyMmZlNGQwMzE5ODdkMmI4YzdiZGFlYjQwYWYyMDFkZmMyMDYxOGU1YjRjNGQyIiwidGFnIjoiIn0%3D; expires=Sun, 03-Sep-2023 04:35:59 GMT; Max-Age=7200; path=/; httponly; samesite=lax
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
status_code: 200
status_msg: 'OK'
http_version: '1.1'
}
$
I ran it here in wsl and it really worked for me.
I believe it's only on windows
this bug is in the https_make_request function of file vschannel.c
line 760: sprintf(pbMessage, "%s", req);
the binary data contains \0 will be truncated
Update to latest V. The problem should be fixed on Windows.
The error continues.
TCC
Start
227463 file ok!
Unhandled Exception 0xC0000005
Unhandled Exception 0xC0000005C
:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:11998: at print_backtrace_skipping_top_frames_tcc: Backtrace
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:11965: by print_backtrace_skipping_top_frames
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:11998: at print_backtrace_skipping_top_frames_tcc: Backtrace
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:12023: by unhandled_exception_handler
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:11965: by print_backtrace_skipping_top_frames
7ffa3b020a6b : by ???
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:12023: by unhandled_exception_handler
7ffa39628ee2 : at ???: RUNTIME ERROR: invalid memory access
C:/v/thirdparty/vschannel/vschannel.c:152: by request
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30997: by net__http__Request_method_and_url_to_response
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:29246: by net__http__Request_ssl_do
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30925: by net__http__Request_do
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30997: by net__http__Request_method_and_url_to_response
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30637: by net__http__fetch
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30579: by net__http__post_multipart_form
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30925: by net__http__Request_do
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:32272: by main__mainC:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30637: by net__http__fetch
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:30579: by net__http__post_multipart_form
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:32612: by wmain
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:32272: by main__main
0050c968 : by ???
C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.3706575999369906727.tmp.c:32612: by wmain
0050cacb : by ???
0050c968 : by ???
7ffa39381f87 : by ???
0Unhandled Exception 0xC00003740
50cacb : by ???
And here running with GCC
Start
227463 file ok!
Unhandled Exception 0xC0000005
print_backtrace_skipping_top_frames is not implementedUnhandled Exception 0xC0000005
print_backtrace_skipping_top_frames is not implementedsignal 11: segmentation fault
print_backtrace_skipping_top_frames is not implemented
Unhandled Exception 0xC0000374
print_backtrace_skipping_top_frames is not implemented
Actually, that's a different error, now. Perhaps uncovered by fixing the previous.
What do you think is better, mark this as resolved and then open a new issue similar to this one, with this new report?
Error 0x80090329 returned by EncryptMessage
Unhandled Exception 0xC0000374
C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:12014: at print_backtrace_skipping_top_frames_tcc: Backtrace
C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:11981: by print_backtrace_skipping_top_frames
C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:12039: by unhandled_exception_handler
7ff805c08b1c : by ???
I get an error when sending a file
The error is on windows
on linux everything works
a temporary crutch is to use the system curl
example in my code:
fn upload_file(file_path string, cookie http.Cookie) string {
println("upload_file: ${file_path}")
file := os.read_file(file_path) or { panic(err) }
filename := md5.hexhash(file)
curl := os.find_abs_path_of_executable('curl') or { panic(err) }
mut proc := os.new_process(curl)
proc.set_args([
'-H "cookie: PHPSESSID=${cookie.value}" -F "filename=${filename}" -F "content=@${file_path}" https://domain.com/admin/include/uploader.php',
])
proc.wait()
return filename // as hash
}
¯\(ツ)/¯
Error 0x80090329 returned by EncryptMessage Unhandled Exception 0xC0000374 C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:12014: at print_backtrace_skipping_top_frames_tcc: Backtrace C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:11981: by print_backtrace_skipping_top_frames C:/Users/koplenov/AppData/Local/Temp/v_0/filer.1399143888674181344.tmp.c:12039: by unhandled_exception_handler 7ff805c08b1c : by ???
I get an error when sending a file
The error is on windows
on linux everything works
yeah, it happens sometimes on files larger than 15kb. just pass -d no_vschannel
and it will work
Describe the bug
When trying to upload a file with content type: multipart/form-data it breaks. And it works fine with postman/hoppscotch/thunder client etc... you can test here: hoppscotch example
Reproduction Steps
Expected Behavior
Something like...
Current Behavior
V panic: result not set (response does not start with HTTP/, line: ``) v hash: e414b54 C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.1827955018892112456.tmp.c:11311: at _v_panic: Backtrace C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.1827955018892112456.tmp.c:11281: by panic_result_not_set C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.1827955018892112456.tmp.c:32085: by main__main C:/Users/AndreLuiz/AppData/Local/Temp/v_0/http_error.1827955018892112456.tmp.c:32423: by wmain 0050bb78 : by ??? 0050bcdb : by ??? 7ffd90fe1f88 : by ???
Possible Solution
I have no idea
Additional Information/Context
I used TCC, GCC, Clang and MSVC but it didn't work independently.
I need this to make a module for the subbase storage, but this is stopping me. Here is the documentation supabase doc storage
V version
V 0.4.0 0450a93
Environment details (OS name and version, etc.)
V full version: V 0.4.0 bfaa3de.0450a93 OS: windows, Microsoft Windows 11 Pro Insider Preview v25936 64-bit Processor: 8 cpus, 64bit, little endian,
getwd: C:\Users\AndreLuiz vexe: C:\v\v.exe vexe mtime: 2023-09-01 13:41:06
vroot: OK, value: C:\v VMODULES: OK, value: C:\Users\AndreLuiz.vmodules VTMP: OK, value: C:\Users\AndreLuiz\AppData\Local\Temp\v_0
Git version: git version 2.41.0.windows.3 Git vroot status: weekly.2023.35-21-g0450a933-dirty .git/config present: true
CC version: cc (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 12.2.0 thirdparty/tcc status: thirdparty-windows-amd64 e90c2620