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

前端 未结 7 2182

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 18:58

    I had empty tcp packet sent by Chrome to my simple server before normal html GET query and /favicon after. Favicon wasn`t a problem but empty tcp was since my server was waiting either for data or for connection to be finished. It had no data and wouldn't release connection for 2 minutes. So thread was hanging for 2 minutes.

    In related question I found a useful link saying it may be caused by "Predict network actions to improve page load performance" setting. I tried turning off prediction settings one by one and it worked. In chrome version 73.0.3683.86 (Official Build) (64-bit) this behavior was caused by chrome setting "Use a prediction service to load pages more quickly" turned on.

    So just go to setting -> advanced -> privacy and security -> Use a prediction service to load pages more quickly and turn it OFF.

提交回复
热议问题