(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?