httpextract reads a HTTP response from standard input and extracts a part of it, be it the head, the status line, a header...
The examples below assume a response has been saved in a file with this command
> httpforge -s "Host: www.aspyct.org" | httpsend > response
For readability reasons, httpextract always adds a newline at the end of the output. Don’t forget to remove it when required.
Prints the head, i.e. the satus line and the headers.
> httpextract head < response
HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.17
Set-Cookie: 60gp=R1864208712; path=/; expires=Fri, 04-Feb-2011 07:15:11 GMT
Vary: Accept-Encoding
Server: Apache/2.2.X (OVH)
Connection: close
Date: Tue, 01 Feb 2011 19:16:18 GMT
Content-Type: text/html; charset=UTF-8
X-Pingback: http://www.aspyct.org/xmlrpc.php
Removes the head of the message, leaving only the body.
> httpextract body < response
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
[etc...]
Prints the requested header if it exists, nothing otherwise.
> httpextract header Server < response
Apache/2.2.X (OVH)