4 ms·
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 followin
by chasingsparks 17y ago
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 17y agoInterestingly, 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?