#1 2022-04-29 22:25:10

ttomas
Member
Registered: 2013-03-08
Posts: 117

TSimpleHttpClient extra CRLF before data

Hi @ab, can you check line 1505/1508 in mormot.net.client.pas
I solve my problem with  SockSend(ctxt.header) ->  SockSend(ctxt.header, True)
Making simple POST request with data '1234', client receive #10#13'12'. '34' is also send but Content length is 4
Monitoring with wireshark I notice extra CRLF before data.

Hypertext Transfer Protocol
    POST /api/v3/pin HTTP/1.1\r\n
    Host: 10.0.12.108:8086\r\n
    Accept: */*\r\n
    User-Agent: Mozilla/5.0 (Win; mORMot 2.0.1 HCS)\r\n
    Content-Length: 4\r\n
    Accept: application/json\r\n
    Content-Type: application/json\r\n
    \r\n
    [Full request URI: http://10.0.12.108:8086/api/v3/pin]
    [HTTP request 1/1]
    [Response in frame: 32]
    File Data: 4 bytes
JavaScript Object Notation: application/json
Line-based text data: application/json (2 lines)
    \r\n
    12

Last edited by ttomas (2022-04-29 22:29:46)

Offline

#2 2022-04-30 14:36:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TSimpleHttpClient extra CRLF before data

Your headers should NOT have trailing CRLF when transmitted to THttpClientSocket.Request().

It should be trimmed now: https://github.com/synopse/mORMot2/commit/9e781b45

Offline

#3 2022-05-01 11:17:26

ttomas
Member
Registered: 2013-03-08
Posts: 117

Re: TSimpleHttpClient extra CRLF before data

Thanks @ab. Yes, problem is in my code in my descended class I use TStringList to AddHeaders and send StringList.Text as Header.
Have a nice holiday

Offline

Board footer

Powered by FluxBB