clone of http://code.stapelberg.de/git/AnyEvent-HTTP-Stream/