Malformed HTTP version "a POST request from svc_aPOST /proxy HTTP/1.1"

(1) I have an http client, which sends the following request to an http server:
http.NewRequest(“POST”, “http://localhost:9090/proxy”, strings.NewReader(“This is a POST request from svc_a”))

(2) http server sends the request object to a function (tcp client) over a go channel, tcp client sends http request as its payload to a tcp server.

(3) tcp server reads the tcp payload and creates http request out of it, using http.ReadRequest(x *bufio.Reader)
(4) send the response to the tcp client

(5) When I am sending two requests from tcp client to tcp server, over the same socket connection, sometimes the response is received successfully at the tcp client but sometimes tcp server throws error like malformed HTTP version “{some part of the original http request}” or malformed HTTP request “{”
at line http.ReadRequest().

What could be the reason here? Is it being caused due to tcp segmentation?

It seems the HTTP server misunderstand the boundary of the two consecutive HTTP request. Do you mind to capture and post the pcap file? There are several online tools to share and view pcap file (e.g. CS Enterprise on cloudshark.org, online version of WireShark)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.