Lost Get request by race condition


I have the problem that a HTTP-Get ist lost under special circumstance. My web page request the stylesheet first and a logo.png as second. With slow browsers the logo is displayed, with a fast PC not. Wireshark showed a funny point. The answer to the shylesheet is shown as one transfer in wireshark and the following GET for the logo is comming with the same source port of the browser (Chromium). This second request is not answered - neither with a 200 Ok nor any other HTTP reply.
Looking to the source code I think this is a problem of httpServer_run procedure. Serving a GET with http_process_handler and transfering all data in one reply the HTTP_Sock_Status is set to STATE_HTTP_RES_DONE and httpServer_run for this socket is finished. This leads to proceed to the for-Loop in main where all other sockets are processed. If other requests are received in the meantime the previously used socket receives a new request but is not in idle state. The time it takes for the loop depends on other activities processed in the main loop such as ftp or dhcp or application logic.
To avoid this race condition the socket should be closed immediately when transmission is finished and the state should change straight to STATE_HTTP_IDLE. An alternative is to skip http_disconnect
if data is received in “case STATE_HTTP_RES_DONE:” .


here is my modification that works httpServer.c:

            case STATE_HTTP_RES_DONE:
                // Socket file info structure re-initialize
                HTTPSock_Status[seqnum].file_len = 0;
                HTTPSock_Status[seqnum].file_offset = 0;
                HTTPSock_Status[seqnum].file_start = 0;
                HTTPSock_Status[seqnum].sock_status = STATE_HTTP_IDLE;

		len = getSn_RX_RSR(s);
		if (len == 0) {

Please update your source accordingly.