Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

A normal HTTP request may look something like this:

GET / HTTP/1.1
Host: example.com

I would like to change the first line of this request, with a custom one, e.g.:

FOOBAR NOT REALLY HTTP
Host: example.com

Is it possible to do this using curl or this there another tool, capable of doing this?

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

You can do this by using tool netcat(also called as nc).

Just from command line, do the following steps to send the modified request.

$ nc <ip-address-of-webserver> 80
  FOOBAR NOT REALLY HTTP
  Host: example.com
share|improve this answer
add comment

There are 2 options: telnet example.com 80 and nc example.com 80

share|improve this answer
add comment

curl is only able to speak a couple of well defined protocols. What you are trying to do is no valid http nor any valid other protocol.

If you really want to do it this way you can simply send your text for example using netcat.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.