Experimental port of Python HTTP_Session code to Ruby