

Ask HN: Sunday HTML Puzzler - DanielBMarkham

I have a small website. It's just a lark. I probably make five bucks a year on it. So this isn't a critical question, just more of a puzzler.<p>Here's the site.<p>http://project-management-methodologies.net/<p>The thing is, just after I posted a link to it here on HN (when else?) suddenly the text in the HTML is not showing up.<p>Viewing the page source, the material is in there. I loaded in Firebug but it says it's not in there! Yet I can see it in page source. The HTML is not corrupted, all the tags close.<p>Best I can figure it's the Google AdSense code somehow corrupting the rest of the html.<p>Anybody care to take a look and share your thoughts?<p>Not important, like I said, but interesting, especially if it involves Google.<p>UPDATE: Now it's working again. @#$#@$!<p>Very interesting bug. I hope it repeats itself so I can track it down. I'm almost certain it was Google though.<p>You guys are awesome! All I do is ask the question on HN and five minutes later the site is working! :)
======
chasingsparks
When I commented that it was not working on the other thread, I had used Live
HTTP Headers to see that it was responding with "Content-length: 0".

The following seems to replicate everything you described.

    
    
      require 'gserver'
    
      class PuzzlerServer < GServer
        def initialize(port=10001, *args)
          super(port, *args)
        end
        def serve(io)
          data = io.readpartial(4096)
          io.puts "HTTP1/x 200 OK"
          io.puts "Content-Length: #{(data =~ /good/i) ? data.length : 0}"
          io.puts "Content-Type: text/html"
          io.puts 
          io.puts(data)
        end
      end
    
      server = PuzzlerServer.new
      server.start
      server.join

~~~
chasingsparks
Interestingly, the view source behavior is intermittent for me in Firefox on
OSX. I had merely assumed Content-length: 0 would stop recv()ing. However,
sometimes the page will render nothing for /bad while still having the source;
other times it will render nothing with no source. Combination of load orders
for /good and /bad seems non-deterministic.

Firefox issue, maybe?

