diff options
author | Himbeer <himbeer@disroot.org> | 2025-03-24 11:48:00 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2025-03-24 11:48:00 +0100 |
commit | 446914763b2d09040ae163afcef4211c469d98c9 (patch) | |
tree | ddda883381a8088375ef130c9ce90919ff7e0736 | |
parent | 0446dfb3ce21629ab56a8916088e7b4f7d425ef1 (diff) |
Add missing double-linefeed to HTTP request
This is needed for the request to be processed correctly. Additionally,
errors no longer cause a crash.
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 98718f8..8475693 100644 --- a/src/main.rs +++ b/src/main.rs @@ -214,10 +214,11 @@ fn check_connectivity( }; if let Some(mut conn4) = conn4 { - conn4.write_all(b"GET / HTTP/1.1")?; conn4.set_read_timeout(Some(TCP_TIMEOUT))?; conn4.set_write_timeout(Some(TCP_TIMEOUT))?; + conn4.write_all(b"GET / HTTP/1.1\n\n").ok(); + loop { match conn4.read(&mut buf) { Ok(0) => { @@ -250,10 +251,11 @@ fn check_connectivity( }; if let Some(mut conn6) = conn6 { - conn6.write_all(b"GET / HTTP/1.1")?; conn6.set_read_timeout(Some(TCP_TIMEOUT))?; conn6.set_write_timeout(Some(TCP_TIMEOUT))?; + conn6.write_all(b"GET / HTTP/1.1\n\n").ok(); + loop { match conn6.read(&mut buf) { Ok(0) => { |