unicorn 0.97.0 → 0.97.1

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.
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v0.97.0.GIT
4
+ DEF_VER=v0.97.1.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -108,8 +108,12 @@ static off_t parse_length(const char *value, size_t length)
108
108
  {
109
109
  off_t rv;
110
110
 
111
- for (rv = 0; length-- && rv >= 0; ++value)
112
- rv = step_incr(rv, *value, 10);
111
+ for (rv = 0; length-- && rv >= 0; ++value) {
112
+ if (*value >= '0' && *value <= '9')
113
+ rv = step_incr(rv, *value, 10);
114
+ else
115
+ return -1;
116
+ }
113
117
 
114
118
  return rv;
115
119
  }
@@ -7,7 +7,7 @@ module Unicorn
7
7
  # gave about a 3% to 10% performance improvement over using the strings directly.
8
8
  # Symbols did not really improve things much compared to constants.
9
9
  module Const
10
- UNICORN_VERSION="0.97.0"
10
+ UNICORN_VERSION="0.97.1"
11
11
 
12
12
  DEFAULT_HOST = "0.0.0.0" # default TCP listen host address
13
13
  DEFAULT_PORT = 8080 # default TCP listen port
@@ -416,4 +416,24 @@ class HttpParserNgTest < Test::Unit::TestCase
416
416
  end
417
417
  end
418
418
 
419
+ def test_negative_content_length
420
+ req = {}
421
+ str = "PUT / HTTP/1.1\r\n" \
422
+ "Content-Length: -1\r\n" \
423
+ "\r\n"
424
+ assert_raises(HttpParserError) do
425
+ @parser.headers(req, str)
426
+ end
427
+ end
428
+
429
+ def test_invalid_content_length
430
+ req = {}
431
+ str = "PUT / HTTP/1.1\r\n" \
432
+ "Content-Length: zzzzz\r\n" \
433
+ "\r\n"
434
+ assert_raises(HttpParserError) do
435
+ @parser.headers(req, str)
436
+ end
437
+ end
438
+
419
439
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.97.0
4
+ version: 0.97.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unicorn hackers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-01 00:00:00 +00:00
12
+ date: 2010-04-19 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency