Posting form params with httperf or using netcat for troubleshooting
Posted: June 17, 2009 Filed under: http, Mac OS X, Unix 1 Comment »Web apps including rails won’t parse parameters POSTed in an http request unless a specific header is present.
A curl command automatically adds this header for you, but other tools including httperf might not.
To ensure the header gets sent with httperf, add the following command line option:
--add-header 'Content-Type: application/x-www-form-urlencoded\n'
Note, I discovered the answer because curl worked, though httperf did not. So I ran the curl command against a simple netcat (nc) server and noticed the extra http header being received. Netcat was really handy for this. To run a netcat server simply enter nc -l 1234, where 1234 is the port you want to listen on. Then run your client app pointing to your netcat server ip and port. The netcat server will output the raw TCP it receives.
Yes! Thanks Kyle. I’m trying to see if I can test a SOAP-based webservice running in Apache Tomcat with httperf, and apparently Tomcat tosses out requests without that header.