• 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:

    What should we do about network-effect monopolies?

    Many large companies today are software monopolies that give their product away for free to get monopoly status, then do horrible things. Can we do anything about this?

    via benkuhn.net July 5, 2020

    More on the Deutschlandtakt

    The Deutschlandtakt plans are out now. They cover investment through 2040, but even beforehand, there’s a plan for something like a national integrated timetable by 2030, with trains connecting the major cities every 30 minutes rather than hourly. But the…

    via Pedestrian Observations July 1, 2020

    How do cars fare in crash tests they're not specifically optimized for?

    Any time you have a benchmark that gets taken seriously, some people will start gaming the benchmark. Some famous examples in computing are the CPU benchmark specfp and video game benchmarks. With specfp, Sun managed to increase its score on 179.art (a su…

    via Posts on Dan Luu June 30, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact