angelo 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2628a86b9264d55fc6451251c051b64c6740a841
4
- data.tar.gz: c8a82e5c2d5a4c770192fa43a7164fc32e0ce55c
3
+ metadata.gz: 7e0c3ba39f8e1f28399b3302508e5607e184306c
4
+ data.tar.gz: 80a96668a3b52d38d10128f849115f5a9ffc639c
5
5
  SHA512:
6
- metadata.gz: 33b0be0bce186d529744010e69eeb36b01423f5fad7d351bf9a5800fac02a560253b77e4e1d0c413a17dea299ad4a9cc100b60c580cbb1dd9583550b1d028fe8
7
- data.tar.gz: 615af33b3c6498f497744a7238e88bfe35a7011ff1c0c1def9ae437eba7d76d9ecb6a7f922d18ebd9e7afb2a42817ee9989d334ad64ee41051c959dcc00a8d7e
6
+ metadata.gz: 8692b30501f977877aca3f79246f66dcf046e9d40100577ff79afe8235e5212081c6cda1545e9dc8a78272cc1a98e9a16ce436891bc2735713f4aaac1227b068
7
+ data.tar.gz: 1a0a3c79e9bb12a5c49bc3af8913c4099c7b281dbd429ba2fcdbc9f32c5a606b4fcf21fd5925d25d6a678b783fcaa2152c71251c77141556553510e0bbea1430
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ ### 0.1.22 9 sep 2014
5
+
6
+ * handle bad/malformed requests better
7
+
4
8
  ### 0.1.21 10 aug 2014
5
9
 
6
10
  * add forward for SSE stash from Server for tasks
data/lib/angelo/server.rb CHANGED
@@ -41,6 +41,9 @@ module Angelo
41
41
  else
42
42
  route! meth, connection, request
43
43
  end
44
+ rescue URI::InvalidURIError => e
45
+ Angelo.log connection, request, nil, :bad_request
46
+ connection.respond :bad_request, DEFAULT_RESPONSE_HEADERS, e.message
44
47
  end
45
48
 
46
49
  def route! meth, connection, request
@@ -1,3 +1,3 @@
1
1
  module Angelo
2
- VERSION = '0.1.21'
2
+ VERSION = '0.1.22'
3
3
  end
data/lib/angelo.rb CHANGED
@@ -48,7 +48,7 @@ module Angelo
48
48
 
49
49
  NOT_FOUND = 'Not Found'
50
50
 
51
- LOG_FORMAT = '%s - - "%s %s%s HTTP/%s" %d %s'
51
+ LOG_FORMAT = '%s - - "%s %s HTTP/%s" %d %s'
52
52
 
53
53
  DEFAULT_PING_TIME = 30
54
54
 
@@ -84,8 +84,7 @@ module Angelo
84
84
  Celluloid::Logger.__send__ Angelo.response_log_level, LOG_FORMAT % [
85
85
  remote_ip[],
86
86
  request.method,
87
- request.path,
88
- request.query_string.nil? ? nil : '?'+request.query_string,
87
+ request.url,
89
88
  request.version,
90
89
  Symbol === status ? HTTP::Response::SYMBOL_TO_STATUS_CODE[status] : status,
91
90
  body_size
data/test/angelo_spec.rb CHANGED
@@ -97,6 +97,15 @@ describe Angelo::Base do
97
97
  r.status.must_equal 404
98
98
  end
99
99
 
100
+ it 'does not crash when receiving invalid uri' do
101
+ s = TCPSocket.new Angelo::DEFAULT_ADDR, Angelo::DEFAULT_PORT
102
+ s.write 'GET /?file=<SCRIPT>window.alert</SCRIPT>' + "\n\n"
103
+ r = s.read
104
+ s.close
105
+ assert @server.alive?
106
+ r.must_match /400 Bad Request/
107
+ end
108
+
100
109
  end
101
110
 
102
111
  describe 'before filter' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angelo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-10 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reel