Skip to content

Instantly share code, notes, and snippets.

@bongole
Created September 20, 2017 10:21
Show Gist options
  • Save bongole/e052f11924601d0d5c4de349d48e1e7a to your computer and use it in GitHub Desktop.
Save bongole/e052f11924601d0d5c4de349d48e1e7a to your computer and use it in GitHub Desktop.
test http tcp packets
require 'ethon'
require 'httpclient'
require 'net/http'
require 'uri'
url = 'http://example.com/'
dummy = 'a' * 2000
# ethon
easy = Ethon::Easy.new
easy.headers = {'Expect' => nil}
easy.http_request(url, :post, body: 'ethon' + dummy)
easy.perform
# net/http
Net::HTTP.post URI(url), 'nethttp' + dummy
# httpclient
client = HTTPClient.new
client.post url, 'httpclient' + dummy
@bongole
Copy link
Author

bongole commented Sep 20, 2017

net/httpだけ、ヘッダーと本文が別れたパケットで送られる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment