Skip to content

Commit

Permalink
Add "AblyHttpRequest" before all names
Browse files Browse the repository at this point in the history
To avoid clashes with the original version of this library.
  • Loading branch information
lawrence-forooghian committed Apr 26, 2024
1 parent 8cdafe0 commit 8e3ecd4
Show file tree
Hide file tree
Showing 41 changed files with 1,302 additions and 1,272 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Gem Version](https://badge.fury.io/rb/ably-em-http-request.svg)](http://rubygems.org/gems/ably-em-http-request)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ably-forks/em-http-request/ci.yml)](https://github.com/ably-forks/em-http-request/actions/workflows/ci.yml)

**Note:** This is Ably’s fork of https://github.com/igrigorik/em-http-request. We created it to fix a TLS-related issue in the original library, which seems to be no longer maintained. This fork exists to be used inside our [ably-ruby SDK](https://github.com/ably/ably-ruby). We have only made the changes required to be able to distribute this library as a separate gem; in particular, most of the documentation still refers to the original library.
**Note:** This is Ably’s fork of https://github.com/igrigorik/em-http-request. We created it to fix a TLS-related issue in the original library, which seems to be no longer maintained. This fork exists to be used inside our [ably-ruby SDK](https://github.com/ably/ably-ruby). We have only made the changes required to be able to distribute this library as a separate gem; in particular, most of the documentation still refers to the original library. The constant names used in this fork have been changed so as not to clash with the original library.

Async (EventMachine) HTTP client, with support for:

Expand Down
2 changes: 1 addition & 1 deletion ably-em-http-request.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'em-http/version'

Gem::Specification.new do |s|
s.name = 'ably-em-http-request'
s.version = EventMachine::HttpRequest::VERSION
s.version = EventMachine::AblyHttpRequest::HttpRequest::VERSION

s.platform = Gem::Platform::RUBY
s.authors = ["Ilya Grigorik"]
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/clients.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
error = 0

n.times do
http = EventMachine::HttpRequest.new(url).get
http = EventMachine::AblyHttpRequest::HttpRequest.new(url).get

http.callback {
count += 1
Expand All @@ -57,7 +57,7 @@
count = 0
error = 0

conn = EventMachine::HttpRequest.new(url)
conn = EventMachine::AblyHttpRequest::HttpRequest.new(url)

n.times do
http = conn.get :keepalive => true
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/em-excon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
error = 0
n.times do
EM.next_tick do
http = EventMachine::HttpRequest.new(url, :connect_timeout => 1).get
http = EventMachine::AblyHttpRequest::HttpRequest.new(url, :connect_timeout => 1).get

http.callback {
count += 1
Expand All @@ -48,7 +48,7 @@
EventMachine.run {
count = 0
error = 0
conn = EventMachine::HttpRequest.new(url)
conn = EventMachine::AblyHttpRequest::HttpRequest.new(url)

n.times do
http = conn.get :keepalive => true
Expand Down
6 changes: 3 additions & 3 deletions examples/digest_auth/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

EM.run do

conn_handshake = EM::HttpRequest.new('http://localhost:3000')
conn_handshake = EM::AblyHttpRequest::HttpRequest.new('http://localhost:3000')
http_handshake = conn_handshake.get

http_handshake.callback do
conn = EM::HttpRequest.new('http://localhost:3000')
conn.use EM::Middleware::DigestAuth, http_handshake.response_header['WWW_AUTHENTICATE'], digest_config
conn = EM::AblyHttpRequest::HttpRequest.new('http://localhost:3000')
conn.use EM::AblyHttpRequest::Middleware::DigestAuth, http_handshake.response_header['WWW_AUTHENTICATE'], digest_config
http = conn.get
http.callback do
puts http.response
Expand Down
2 changes: 1 addition & 1 deletion examples/fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

EM.run do
urls.each do |url|
http = EM::HttpRequest.new(url).get
http = EM::AblyHttpRequest::HttpRequest.new(url).get
http.callback {
puts "#{url}\n#{http.response_header.status} - #{http.response.length} bytes\n"
puts http.response
Expand Down
2 changes: 1 addition & 1 deletion examples/fibered-http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def async_fetch(url)
f = Fiber.current
http = EventMachine::HttpRequest.new(url, :connect_timeout => 10, :inactivity_timeout => 20).get
http = EventMachine::AblyHttpRequest::HttpRequest.new(url, :connect_timeout => 10, :inactivity_timeout => 20).get

http.callback { f.resume(http) }
http.errback { f.resume(http) }
Expand Down
4 changes: 2 additions & 2 deletions examples/multi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
require 'em-http'

EventMachine.run {
multi = EventMachine::MultiRequest.new
multi = EventMachine::AblyHttpRequest::MultiRequest.new

reqs = [
'http://google.com/',
'http://google.ca:81/'
]

reqs.each_with_index do |url, idx|
http = EventMachine::HttpRequest.new(url, :connect_timeout => 1)
http = EventMachine::AblyHttpRequest::HttpRequest.new(url, :connect_timeout => 1)
req = http.get
multi.add idx, req
end
Expand Down
6 changes: 3 additions & 3 deletions examples/oauth-tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

EM.run do
# automatically parse the JSON response into a Ruby object
EventMachine::HttpRequest.use EventMachine::Middleware::JSONResponse
EventMachine::AblyHttpRequest::HttpRequest.use EventMachine::AblyHttpRequest::Middleware::JSONResponse

# sign the request with OAuth credentials
conn = EventMachine::HttpRequest.new('http://api.twitter.com/1/statuses/home_timeline.json')
conn.use EventMachine::Middleware::OAuth, OAuthConfig
conn = EventMachine::AblyHttpRequest::HttpRequest.new('http://api.twitter.com/1/statuses/home_timeline.json')
conn.use EventMachine::AblyHttpRequest::Middleware::OAuth, OAuthConfig

http = conn.get
http.callback do
Expand Down
2 changes: 1 addition & 1 deletion examples/socks5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# ssh -D 8000 some_remote_machine

connection_options = {:proxy => {:host => '127.0.0.1', :port => 8000, :type => :socks5}}
http = EM::HttpRequest.new('http://igvita.com/', connection_options).get :redirects => 2
http = EM::AblyHttpRequest::HttpRequest.new('http://igvita.com/', connection_options).get :redirects => 2

http.callback {
puts "#{http.response_header.status} - #{http.response.length} bytes\n"
Expand Down
Loading

0 comments on commit 8e3ecd4

Please sign in to comment.