• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • See Raw Headers with Netcat

    October 5th, 2015
    tech  [html]
    Getting response headers is easy: run curl -D- -o/dev/null -sS [url] or load the site in a browser with the networking tab open. Getting request headers is harder, because webservers don't have a way to dump this exactly as they received it. Yes, you can set them to log specific headers, but logging all headers exactly as they came over the wire isn't something I see in nginx or apache. Netcat can help here. Start it up on some unused port:
        nc -lp 8070
    
    Now make the thing you're debugging visit yoursite:8070. Netcat will print out what headers you got:
        GET / HTTP/1.1
        Host: www.jefftk.com:8070
        Referer: http://www.jefftk.com/...
        Accept-Encoding: gzip,deflate
        Cache-Control: no-store, no-cache
        Accept-Language: en-US
        Connection: Keep-alive
        Accept: */*
        Accept-Encoding: gzip,deflate
        ...
    
    See the duplicate Accept-Encoding header? It turned out that A was adding an extra encoding header which then made B disable gzip. [1] Once I had the raw headers as sent it was pretty clear what the problem was.

    (Because the problem was a duplicated header I'm glad I didn't go with a higher level tool that might have masked that problem by storing headers in hashtable or something.)


    [1] Sniffing the traffic would have been ideal, but I wasn't in a position to get in between them.

    Comment via: google plus, facebook

    Recent posts on blogs I like:

    Best Practices Civil Service

    I propose that transportation agencies hire people whose job is to keep abreast of global developments in the field and report on best practices. Which agencies should do it? Ideally, all urban ones. Very small ones should piggyback on large ones, or part…

    via Pedestrian Observations June 14, 2021

    Collections: The Queen’s Latin or Who Were the Romans? Part I: Beginnings and Legends

    Who were the Romans? How did they understand themselves as a people and ‘Roman’ as an identity? And what were the implications of that understanding – and perhaps more importantly the underlying reality – for Roman society and the success of the Roman Emp…

    via A Collection of Unmitigated Pedantry June 11, 2021

    It's ok to feed stray cats

    Before we had kids, Jeff and I fostered a couple of cats. One had feline AIDS and was very skinny. Despite our frugal grocery budget of the time, I put olive oil on her food, determined to get her healthier. I knew that stray cats were not a top global pr…

    via Giving Gladly May 15, 2021

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact