httphere 1.1.1 → 1.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.
- data/VERSION +1 -1
- data/bin/httphere +3 -3
- data/httphere.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/bin/httphere
CHANGED
@@ -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
|
data/httphere.gemspec
CHANGED