当前位置: 首页 > 后端技术 > Python

Pythonsocket编程模拟HTTPGET请求和响应

时间:2023-03-25 19:22:32 Python

前言GET请求报文由三部分组成:startlinestart-linerequestheaderHTTPheadersemptylineempty-line因为是GET请求,所以没有请求体GETResponse的message由:statuslinestart-lineresponseheadersHTTPheadersemptylineempty-lineresponsebody正文由四部分组成每部分由\r\n分隔参考文章:mozilladoc:HTTPmessageHttpheaderandpayloadsegmentation是否characteris"\r\n"or"\n\n"HTTPResponseHeaders中Date字段时间格式详解:参考文章:mozilladoc:TimeformatinDatehttp