From 2bea92342d3c58ba197c00fff237f0e202f671c6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 7 Feb 2021 01:54:46 +1300 Subject: Use CRLF line endings in GET request The HTTP::Request->as_string() method uses \n as an end-of-line token default. Apache HTTPD and Lua's http_server don't tolerate these as line endings, and throw 400 errors promptly. Providing CRLF explicitly as the end-of-line character makes the request palatable to these servers, and probably others with the same strictness. --- lib/POE/Component/Client/WebSocket.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/POE/Component/Client/WebSocket.pm b/lib/POE/Component/Client/WebSocket.pm index a78ba2e..e428672 100644 --- a/lib/POE/Component/Client/WebSocket.pm +++ b/lib/POE/Component/Client/WebSocket.pm @@ -467,7 +467,7 @@ sub _socket_birth { $heap->{httpresp} = 1; # Send the request to the server - $heap->{wheel}->put($request->as_string()); + $heap->{wheel}->put($request->as_string("\r\n")); # Incase we want to investigate what we sent later. $heap->{_state}->{req} = $request; -- cgit v1.2.3