Skip to content

Instantly share code, notes, and snippets.

@bherrmann7
Created February 4, 2009 15:38
Show Gist options
  • Save bherrmann7/58150 to your computer and use it in GitHub Desktop.
Save bherrmann7/58150 to your computer and use it in GitHub Desktop.
// Groovy script to dump the browser's headers
ServerSocket ss = new ServerSocket();
ss.bind(null)
println "listening on "+ss.getLocalPort();
Socket s = ss.accept()
s.getInputStream().eachLine { line ->
println line
}
/** Firefox 3.0 output
listening on 42104
GET / HTTP/1.1
Host: localhost:42104
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment