httphere 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/bin/httphere +3 -3
  3. data/httphere.gemspec +1 -1
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.1.2
@@ -617,7 +617,7 @@ class FileServer < EventParsers::Http11Parser::Request
617
617
  filename, query = resource_uri.split('?',2)
618
618
  @filename = filename.sub(/^\//,'')
619
619
  # Default to any file named index.*
620
- @filename = Dir["index.*"].first if filename.to_s == '' && Dir["index.*"].length > 0
620
+ @filename = Dir["index.*"].first if @filename.to_s == '' && Dir["index.*"].length > 0
621
621
  file_extension = (filename.match(/\.([^\.]+)$/) || [])[1]
622
622
 
623
623
  if File.exists?(@filename) && !File.directory?(@filename)
@@ -668,8 +668,8 @@ class FileServer < EventParsers::Http11Parser::Request
668
668
  body = StringIO.new(body.to_s) if !body.is_a?(IO) && body.respond_to?(:to_s)
669
669
 
670
670
  # Convert to UTF-8 if possible
671
- chardet = UniversalDetector::chardet(body.read(512)); body.rewind # Detect charset only from the first 512 bytes
672
- if chardet['confidence'] > 0.7 && ['utf-8', 'ascii'].include?(chardet['encoding'])
671
+ chardet = UniversalDetector::chardet(body.read(512)) rescue {'confidence' => 0.8, 'encoding' => 'utf-8'}; body.rewind # Detect charset only from the first 512 bytes
672
+ if chardet['confidence'] > 0.7 && !['utf-8', 'ascii'].include?(chardet['encoding'])
673
673
  if $DEBUG
674
674
  Benchmark.bm do |x|
675
675
  x.report("Converting from #{chardet['encoding']} to UTF-8") do
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{httphere}
8
- s.version = "1.1.1"
8
+ s.version = "1.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Parker"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 1
9
- version: 1.1.1
8
+ - 2
9
+ version: 1.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Parker