Separate out generic HTTP writer code from http_client