em-eventsource 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/em-eventsource.rb +8 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 461c9ac878e1f325156439b1d51c298db29fbcc9c23e769fdf0c480baeb83f57
4
- data.tar.gz: 1b9077e69942f41ce43c304116bb7923b66cb398935e3da578b76e03176b60ec
3
+ metadata.gz: 89ba2ccd10bc74a1358dbc581503f338095e9a653ad51865d1a04dbbde1bcac1
4
+ data.tar.gz: 7b67016f8017555f640117a8c01d4119a1797a2e23061cdd0298ddf30cada596
5
5
  SHA512:
6
- metadata.gz: b689983d0970f0f072d1f34ea79c47948b084072ce94b014ef4da1b340cc9c6673a00a1eece3fbe2585e56425090fb7d4186275d6d2f097abafcf1bcacc1e455
7
- data.tar.gz: 65d3b2e2f93416796ec3f958cc9d64253fd24db69c944b5f08aeb6f964efec3715330c9dbc2de3f095273d647358e304465d812c7a1e03918eaa2270c8254ae7
6
+ metadata.gz: b2331561a1cf7f49640c02927d727cf60316155dcbf99fa911dad0b284175690ff8f7641349ff02d597df500830260a96058cd476708eea8821dfb8a826d6185
7
+ data.tar.gz: f5473e5136b46be8d7abc45124ebcce0261ecc429d16c8139f01828dfb6a18e81d1c7dff9c4ba19d8af4125ff5ae5ca3796ec660e7f734510568dec522350b49
@@ -21,6 +21,8 @@ module EventMachine
21
21
  attr_reader :inactivity_timeout
22
22
  # Set the inactivity timeout
23
23
  attr_writer :inactivity_timeout
24
+ # Set the max_redirects
25
+ attr_writer :max_redirects
24
26
  # Ready state
25
27
  # The connection has not yet been established, or it was closed and the user agent is reconnecting.
26
28
  CONNECTING = 0
@@ -43,6 +45,7 @@ module EventMachine
43
45
  @last_event_id = nil
44
46
  @retry = 3 # seconds
45
47
  @inactivity_timeout = 60 # seconds
48
+ @max_redirects = 5
46
49
 
47
50
  @opens = []
48
51
  @errors = []
@@ -135,6 +138,9 @@ module EventMachine
135
138
  end
136
139
 
137
140
  def handle_headers(headers)
141
+ if headers.redirection?
142
+ return
143
+ end
138
144
  if headers.status != 200
139
145
  close
140
146
  @errors.each { |error| error.call("Unexpected response status #{headers.status}") }
@@ -190,8 +196,9 @@ module EventMachine
190
196
  headers = @headers.merge({'Cache-Control' => 'no-cache', 'Accept' => 'text/event-stream'})
191
197
  headers.merge!({'Last-Event-Id' => @last_event_id }) if not @last_event_id.nil?
192
198
  [conn, conn.get({ query: @query,
199
+ redirects: @max_redirects,
193
200
  head: headers,
194
- keepalive: true })]
201
+ keepalive: true})]
195
202
  end
196
203
  end
197
204
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-eventsource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - François de Metz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2018-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine