Soren Harward on 29 Jan 2019 10:35:32 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] raw GET requests

On Tue, Jan 29, 2019 at 12:54 PM Michael Lazin <> wrote:
> I think the site is just hanging because wget, lynx-dump and my script hangs, but I was wondering how to make a raw GET request in bash?  what is the syntax?

In descending order of personal preference:

#1: use curl

$ curl -I [URL you're testing]


$ curl -s [URL you're testing] &> /dev/null

and check the return code.

I prefer curl because it does SSL and gives you the most diagnostic
information about what's going wrong with the server: the hostname
doesn't exist, nothing's listening on port 80, SSL/TLS is screwed up,
it took too long to connect, etc.

#2: use netcat

$ echo -e 'GET / HTTP/1.0\r\n\r\n' | nc [webserver's hostname] 80

#3: if you really, really, really have to do it with nothing but bash,
you can create a named redirect to a tcp port:

$ exec 5<>/dev/tcp/[hostname]/80
$ echo -e 'GET / HTTP/1.0\r\n\r\n' >&5
$ cat <&5
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --