Reading from sockets C HTTP

前端 未结 3 1779
慢半拍i
慢半拍i 2021-01-25 08:19

I\'m wondering how I can tell if all the data has been received from a socket. It\'s a simple web proxy and right now I\'m handling the request part, so what\'s sent should term

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-25 08:39

    HTTP is not a trivial protocol, taking several RFCs. Just matching double linefeed/new line won't do. At the very minimum you will have to parse the request headers to figure out what encoding is there, and then, optionally, work through the request body.

    Look into libcurl or any of the available open-source web-servers to appreciate the complexity.

提交回复
热议问题