server socket receives 2 http requests when I send from chrome and receives one when I send from firefox

前端 未结 7 2176

I wrote a simple server using socket API in C under linux which listens at port 80 on localhost. Now when I send a request from the browser google chrome to the program it r

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 19:06

    It does not send any data in the seconds socket. We have our Nginx webserver logs filled up with 400 errors because this second connection is closed before sending any data/actual_HTTP_request to the server. Opens the first connection, opens the second immediately then uses the first one and waits till the second one dies.

    Here is a non-verbose dump about the second connection

    No.     Time        Source                Destination           Protocol Length Info
    20227 38.688849   89.ZZZ.TTT.208        80.XX.YYY.186         TCP      66     1758 > 80     [SYN] Seq=0 Win=65535 Len=0 MSS=1440 WS=2 SACK_PERM=1
    20228 38.688870   80.XX.YYY.186         89.ZZZ.TTT.208        TCP      66     80 > 1758 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460 SACK_PERM=1 WS=128
    20256 38.752121   89.ZZZ.TTT.208        80.XX.YYY.186         TCP      60     1758 > 80 [ACK] Seq=1 Ack=1 Win=65536 Len=0
    26351 50.565758   89.ZZZ.TTT.208        80.XX.YYY.186         TCP      60     1758 > 80 [FIN, ACK] Seq=1 Ack=1 Win=65536 Len=0
    26352 50.565830   80.XX.YYY.186         89.ZZZ.TTT.208        TCP      54     80 > 1758 [FIN, ACK] Seq=1 Ack=2 Win=5888 Len=0
    26396 50.657612   89.ZZZ.TTT.208        80.XX.YYY.186         TCP      60     1758 > 80 [ACK] Seq=2 Ack=2 Win=65536 Len=0
    

提交回复
热议问题