The Several Million Dollar Bug by Jacques Mattheij claims that while HTTP is designed to be synchronous, it is actually possible to send the response before the request has been made. I wanted to try that out. Here's a proof of concept in ruby:
#! /usr/bin/env ruby
require "socket"
server = TCPServer.new 3999
client = server.accept
client.puts <<-HEREDOC
HTTP/1.1 200 OK
Content-Length: 7
HI YOU
HEREDOC
client.puts <<-HEREDOC
HTTP/1.1 200 OK
Content-Length: 11
HI YOU TWO
HEREDOC
client.close
Then I point the browser at http://localhost:3999, and the result is dissapointing:
It looks like chrome totally ignored the second request. What am I doing wrong?
curl's output may be illuminating?