我有一个关于 POST HTTP 请求的情况:(此处使用的主机和链接已启动并正在运行)
POST /inventory-check.cgi HTTP/1.1
Host: www.joes-hardware.com
Accept-Encoding: identity
Content-Length: 7
Content-Type: text/plain
item=563
当我将上述请求字符串发送到主机时,服务器会向我发送奇怪的东西(以及预期的结果)
HTTP/1.1 200 OK
Date: Thu, 31 Oct 2013 12:07:48 GMT
Server: Apache/2.2.22 (Unix) DAV/2 FrontPage/5.0.2.2635 mod_ssl/2.2.22 OpenSSL/1.0.1c
Transfer-Encoding: chunked
Content-Type: text/html
6b
<HTML><BODY>
<H1>Joe's Hardware Store Inventory Check</H1>
Yes! Item number 56 is in stock!
</BODY></HTML>
0
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>501 Method Not Implemented</title>
</head><body>
<h1>Method Not Implemented</h1>
<p>3 to /index.html not supported.<br />
</p>
<hr>
<address>Apache/2.2.22 (Unix) DAV/2 FrontPage/5.0.2.2635 mod_ssl/2.2.22 OpenSSL/1.0.1c Server at totty.temp.veriohosting.com Port 80</address>
</body></html>
我在 python 中使用 urllib 模块检查了请求,它只给了我预期的输出(这里我省略了响应细节)
<HTML><BODY>
<H1>Joe's Hardware Store Inventory Check</H1>
Yes! Item number 56 is in stock!
</BODY></HTML>
我错过了什么??实际上,我是 HTTP 的新手,并且在 c/c++/python 方面有经验...任何帮助将不胜感激.. 提前致谢