Domanda

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

È stato utile?

Soluzione 2

Your request lies about the content-length.

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

Altri suggerimenti

item=563 is 8 bytes, but you declare a Content-Length of 7. Therefore, the server sees two requests, one which is a valid HTTP request for item 56 and one which is an invalid HTTP request consisting of the character 3 only, and sends you two responses.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top