From acd249286826a8cda4f6fed2db59f90e3161487c Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Wed, 29 Jul 2020 02:33:16 -0700 Subject: [PATCH] Remove newline when writing http post/put data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When writing post data, adding an extra newline may cause some web servers to close the connection before sending a response because the extra newline isn’t accounted for in the post/put data’s content length. Removing the newline seems to fix the problem. This was encountered posting a capabilities document to `chromedriver`’s /session endpoint. An alternate fix is to include the new line in the content-length calculation. --- src/std/net/request.ss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/std/net/request.ss b/src/std/net/request.ss index 95383182b..3dbaaa1b5 100644 --- a/src/std/net/request.ss +++ b/src/std/net/request.ss @@ -246,8 +246,7 @@ headers) (newline port) (when body - (write-subu8vector body 0 (u8vector-length body) port) - (newline port)) + (write-subu8vector body 0 (u8vector-length body) port)) (force-output port)) (def status-line-rx