手动分离协议头和主体
Manually separating protocol header from body
我正在尝试手工制作 HTTP 请求。我的问题是,协议头应该如何与主体分开?是否使用了特殊字节或 \r\n
是否足够?
谢谢
您用双 crlf 将 header 与 body 分开。
来自维基百科的示例:
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
ETag: "3f80f-1b6-3e1cb03b"
Content-Type: text/html; charset=UTF-8
Content-Length: 138
Accept-Ranges: bytes
Connection: close
<html>
<head>
<title>An Example Page</title>
</head>
<body>
Hello World, this is a very simple HTML document.
</body>
</html>
我正在尝试手工制作 HTTP 请求。我的问题是,协议头应该如何与主体分开?是否使用了特殊字节或 \r\n
是否足够?
谢谢
您用双 crlf 将 header 与 body 分开。
来自维基百科的示例:
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
ETag: "3f80f-1b6-3e1cb03b"
Content-Type: text/html; charset=UTF-8
Content-Length: 138
Accept-Ranges: bytes
Connection: close
<html>
<head>
<title>An Example Page</title>
</head>
<body>
Hello World, this is a very simple HTML document.
</body>
</html>