Forum

POST request returns BAD request

Samuel
11 January 2012, 19:22
Hi,

When I send the following:
POST /query.fcgi HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 63

form_state=3&form_name=system_sw_upgrade&field_name=http_upload

I get
HTTP/1.1 400 Bad Request
Date: Wed, 11 Jan 2012 21:26:15 GMT
Server: Hiawatha v7.4.1
Accept-Ranges: bytes
Connection: close
Content-Length: 402
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>400 - Bad Request</title>
<style type="text/css">BODY { color:#ffffff ; background-color:#00000a }
DIV { font-family:sans-serif ; font-size:30px ; letter-spacing:20px ; text-align:center ; position:relative ; top:250px }
</style>
</head>
<body>
<div>400 - Bad Request</div>
</body>
</html>


What's wrong with the request?


Hiawatha version: 7.4.1
Operating System: Debian-Linux (kernel: 2.6.32)
Hugo Leisink
11 January 2012, 19:24
You sent a HTTP 1.1 request. HTTP 1.1 requires a Host HTTP header. Add this header to your request and it should work fine.
POST /query.fcgi HTTP/1.1
Host: some.hostname.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 63
Samuel
15 January 2012, 15:58
Thanks it works
This topic has been closed.