bedis9

a little bit of anything

Category Archives: www

curl: dump header to stdout

By default, curl can only dump headers sent by the server in a file.
Sometimes, it makes sense to read them directly on stdout.

To do that, simply use the dash:

$ curl -D - www.google.fr
HTTP/1.1 200 OK
Date: Sat, 06 Aug 2011 08:48:39 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=f308a4d07ea555b0:FF=0:TM=1312620519:LM=1312620519:S=Yoejo_SrbhFqsIkh; expires=Mon, 05-Aug-2013 08:48:39 GMT; path=/; domain=.google.fr
Set-Cookie: NID=49=tf-3o-m2n7R06k7ayk66jNgRzpPXsZ66mKuUogAKdDlYeN3drftxKZ5WeIhsYKNP2SEelOKHroIfDFsG5P3jaW7nJf4HkLR3Qa_tYUCtWD6fS8mKKVxNom6kodN4Wjbi; expires=Sun, 05-Feb-2012 08:48:39 GMT; path=/; domain=.google.fr; HttpOnly
Server: gws
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked

[...]
then comes the HTML content