vweb: add test for 0 Content-Length hang (#9069)

pull/9078/head
Miccah 2021-03-02 13:31:57 -06:00 committed by GitHub
parent cd423251da
commit b3a31e7626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -83,6 +83,16 @@ fn test_a_simple_tcp_client_simple_route() {
assert received.ends_with('A simple result')
}
fn test_a_simple_tcp_client_zero_content_length() {
// tests that sending a content-length header of 0 doesn't hang on a read timeout
watch := time.new_stopwatch(auto_start: true)
simple_tcp_client(path: '/', headers: 'Content-Length: 0\r\n\r\n') or {
assert err.msg == ''
return
}
assert watch.elapsed() < 1 * time.second
}
fn test_a_simple_tcp_client_html_page() {
received := simple_tcp_client(path: '/html_page') or {
assert err.msg == ''