简体   繁体   中英

HTTP request and response parameters

I have a situation here regarding POST HTTP request: (host and links used here are up and running)

    POST /inventory-check.cgi HTTP/1.1
    Host: www.joes-hardware.com
    Accept-Encoding: identity
    Content-Length: 7
    Content-Type: text/plain

    item=563

when I send the above request string to the Host, then server sends me weird stuffs (along with expected result)

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>

I checked the request with urllib module in python and that gives me only the expected output (Here i have omitted response details)

<HTML><BODY>
    <H1>Joe's Hardware Store Inventory Check</H1>
    Yes! Item number 56 is in stock!
    </BODY></HTML>

What am I missing?? Actully I am new to HTTP and have experience in c/c++/python...Any help will be appreciated.. thanks in advance

item = 563是8个字节,但是您声明的Content-Length为7。因此,服务器会看到两个请求,一个是对项目56的有效HTTP请求,另一个是仅由字符3组成的无效HTTP请求,并向您发送两个回复。

Your request lies about the content-length.

That said, it's still a bit odd what the server does with the additional character 3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM