Skip to content

Commit

Permalink
Merge pull request #1 from ably-forks/create-ably-fork
Browse files Browse the repository at this point in the history
Create an Ably fork of the library
  • Loading branch information
lawrence-forooghian authored Apr 26, 2024
2 parents a94d6ed + 8e3ecd4 commit c0362b0
Show file tree
Hide file tree
Showing 43 changed files with 1,336 additions and 1,291 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@ jobs:
name: "RSpec / Ruby ${{ matrix.ruby }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
[
"2.3",
"2.4",
"2.5",
"2.6",
"2.7",
"3.0",
"3.1",
"3.2"
]
ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
steps:
- run: sudo apt-get install libcurl4-openssl-dev
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
Expand All @@ -32,8 +24,9 @@ jobs:
name: "RSpec / Ruby 2.2"
runs-on: ubuntu-20.04
steps:
- run: sudo apt-get install libcurl4-openssl-dev
- uses: actions/checkout@v4
uses: ruby/setup-ruby@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.2
bundler-cache: true
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2011 Ilya Grigorik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# EM-HTTP-Request

[![Gem Version](https://badge.fury.io/rb/em-http-request.svg)](http://rubygems.org/gems/em-http-request)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/igrigorik/em-http-request/ci.yml)](https://github.com/igrigorik/em-http-request/actions/workflows/ci.yml)
[![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. 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 All @@ -19,7 +21,7 @@ Async (EventMachine) HTTP client, with support for:

## Getting started

gem install em-http-request
gem install ably-em-http-request

- Introductory [screencast](http://everburning.com/news/eventmachine-screencast-em-http-request)
- [Issuing GET/POST/etc requests](https://github.com/igrigorik/em-http-request/wiki/Issuing-Requests)
Expand Down
9 changes: 4 additions & 5 deletions em-http-request.gemspec → ably-em-http-request.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ $:.push File.expand_path('../lib', __FILE__)
require 'em-http/version'

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

s.platform = Gem::Platform::RUBY
s.authors = ["Ilya Grigorik"]
s.email = ['ilya@igvita.com']
s.homepage = 'http://github.com/igrigorik/em-http-request'
s.email = ['lawrence.forooghian@ably.com', 'lewis@lmars.net', 'matt@ably.io']
s.homepage = 'https://github.com/ably-forks/em-http-request'
s.summary = 'EventMachine based, async HTTP Request client'
s.description = s.summary
s.license = 'MIT'
s.rubyforge_project = 'em-http-request'

s.add_dependency 'addressable', '>= 2.3.4'
s.add_dependency 'cookiejar', '!= 0.3.1'
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 c0362b0

Please sign in to comment.