board-linuxfr 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45fb7bf7f0b8caa661d7cc14ab11a46695cbe0be
4
- data.tar.gz: dcc0bddb958842a0ffa7d7143b6c9fde5224e28b
3
+ metadata.gz: b458d7b60416a78b3e52643ad504e4862f79978a
4
+ data.tar.gz: 055d6440ab4b22a08875aa1b472900e094a23c2f
5
5
  SHA512:
6
- metadata.gz: d83dc70539a9aed9ab5efd42be1636e43395a904ef743f42486f3611f04da1966b71ca148641bc57098abc938ef86d0d690e51afdb6f3c15b8a025d2a8c7452d
7
- data.tar.gz: 2690fd8ec454d8568cb531f6d4e07bad44206113ee15f1d6147740390ce4421c843befe33fd637fd471967cebd5ab9be1a37c8934349d751d79de77e079749e1
6
+ metadata.gz: b7935740cbe3770d22131bf73eb2b937276b4ed121b8e949096dad83c2ccde8703d430907fe85985e5fc5b86a33b2ea06929df7bbea3f8a5dcc21887098617cc
7
+ data.tar.gz: ace459a709aa80f09544a371939d00304399bab28601441df1e67d6dbe1a424cb3be50d31d63746a8d77e94bd29984699f33407ea738434e8a2f2fbe33436178
@@ -1,4 +1,5 @@
1
1
  require "goliath"
2
+ require "board-linuxfr/monkeypatch"
2
3
  require "yajl"
3
4
 
4
5
 
@@ -0,0 +1,48 @@
1
+ # Monkeypatch Goliath to avoid it to crash on invalid parser.
2
+ # It's the backport of a commit, waiting for a release. This commit:
3
+ # https://github.com/postrank-labs/goliath/commit/79d43b80c9c1345034c6f40a60b1be064e493af3
4
+
5
+ class Goliath::Request
6
+
7
+ # Invoked by connection when header parsing is complete.
8
+ # This method is invoked only once per request.
9
+ #
10
+ # @param h [Hash] Request headers
11
+ # @param parser [Http::Parser] The parser used to parse the request
12
+ # @return [Nil]
13
+ def parse_header(h, parser)
14
+ h.each do |k, v|
15
+ @env[HTTP_PREFIX + k.gsub('-','_').upcase] = v
16
+ end
17
+
18
+ %w(CONTENT_TYPE CONTENT_LENGTH).each do |name|
19
+ @env[name] = @env.delete("HTTP_#{name}") if @env["HTTP_#{name}"]
20
+ end
21
+
22
+ if @env['HTTP_HOST']
23
+ name, port = @env['HTTP_HOST'].split(':')
24
+ @env[SERVER_NAME] = name if name
25
+ @env[SERVER_PORT] = port if port
26
+ end
27
+
28
+ begin
29
+ uri = URI(parser.request_url)
30
+
31
+ @env[REQUEST_METHOD] = parser.http_method
32
+ @env[REQUEST_URI] = parser.request_url
33
+ @env[QUERY_STRING] = uri.query
34
+ @env[HTTP_VERSION] = parser.http_version.join('.')
35
+ @env[SCRIPT_NAME] = uri.path
36
+ @env[REQUEST_PATH] = uri.path
37
+ @env[PATH_INFO] = uri.path
38
+ @env[FRAGMENT] = uri.fragment
39
+
40
+ yield if block_given?
41
+
42
+ @env[ASYNC_HEADERS].call(@env, h) if @env[ASYNC_HEADERS]
43
+ rescue Exception => e
44
+ server_exception(e)
45
+ end
46
+ end
47
+
48
+ end
@@ -7,7 +7,7 @@ require "board-linuxfr/cache"
7
7
 
8
8
  class BoardLinuxfr
9
9
  class RedisPlugin
10
- def initialize(port, config, status, logger)
10
+ def initialize(address, port, config, status, logger)
11
11
  logger.info "Initializing the Redis plugin"
12
12
  @logger = logger
13
13
  @chans = status[:channels] = Hash.new { |h,k| h[k] = EM::Channel.new }
@@ -1,3 +1,3 @@
1
1
  class BoardLinuxfr
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: board-linuxfr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Michel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-12 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: goliath
@@ -90,6 +90,7 @@ files:
90
90
  - bin/board-linuxfr
91
91
  - lib/board-linuxfr.rb
92
92
  - lib/board-linuxfr/cache.rb
93
+ - lib/board-linuxfr/monkeypatch.rb
93
94
  - lib/board-linuxfr/redis_plugin.rb
94
95
  - lib/board-linuxfr/version.rb
95
96
  homepage: https://github.com/nono/board-sse-linuxfr.org