0

I am making a webserver with RTOS on a MCU. The network library uses HTTP 1.0 and closes the TCP socket and re-listens after each request.

The web page I am serving has multiple .js files that it needs to load after the html has fully loaded.

Once the html content is sent, immediately afterwards the web browser sends a "GET /file.js HTTP/1.1" message. This message is then retransmitted 3 or 4 times with TCP Retransmission before the web server is finally able to handle it.

Question 1: Is this fast transmission due to the web browser still attempting HTTP 1.1 protocol of not closing the connection? The content status reply message from our server is HTTP 1.0, but the web browser keeps requesting GET with HTTP 1.1.

Question 2: Is there a way to tell the web browser to slow down so it doesn't congest the network with TCP Retransmissions?

Any suggestions are helpful.

StackJ
  • 3
  • 1

2 Answers2

0

It is perfectly find to do a HTTP/1.1 request but get a HTTP/1.0 response back. There is no way for the server to say the client to slow down: since each new request is done over a new TCP connection there is no TCP flow control which might be used for this.

The problem is that your server obviously is not able to handle multiple requests at the same time. This means that the content served should be designed in a way that such requests are not needed in the first place: instead of embedding multiple resources in the same page the site should be constructed to retrieve only a few resources. This can for example be done by merging multiple Javascript files into a single one and by making excessive use of client side caching (i.e. set the right Cache-Control headers).

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • Thank you. I will look into "Cache-Control" header. Perhaps I can pre-load the content with the HTML data. – StackJ Feb 05 '21 at 19:51
0

That retransmission is normal. Especially with low round trip times the little bit extra server delay after a HTTP request triggers TCP retransmission. It is the not the web browser but TCP stack that triggers retransmission. Linux has a minimum retransmission timeout setting that might help. I don't think something similar exists for windows.

Jaco
  • 27
  • 5