Skip to content

Commit

Permalink
Add spec for last fix and actually fix it for real this time. TDD fai…
Browse files Browse the repository at this point in the history
…l...
  • Loading branch information
macournoyer committed Oct 29, 2009
1 parent 1cc3b6b commit e896895
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/thin/request.rb
Expand Up @@ -16,7 +16,7 @@ class Request

INITIAL_BODY = ''
# Force external_encoding of request's body to ASCII_8BIT
INITIAL_BODY.encode(Encoding::ASCII_8BIT) if INITIAL_BODY.respond_to?(:encode)
INITIAL_BODY.encode!(Encoding::ASCII_8BIT) if INITIAL_BODY.respond_to?(:encode)

# Freeze some HTTP header names & values
SERVER_SOFTWARE = 'SERVER_SOFTWARE'.freeze
Expand Down
4 changes: 4 additions & 0 deletions spec/request/processing_spec.rb
Expand Up @@ -42,4 +42,8 @@
big_headers = "X-Test: X\r\n" * (1024 * (80 + 32))
proc { R("GET / HTTP/1.1\r\n#{big_headers}\r\n") }.should raise_error(InvalidRequest)
end

it "should set body external encoding to ASCII_8BIT" do
Request.new.body.external_encoding.should == Encoding::ASCII_8BIT
end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -4,7 +4,6 @@
require 'benchmark'
require 'timeout'
require 'fileutils'
require 'benchmark_unit'
require 'net/http'
require 'socket'

Expand All @@ -23,6 +22,7 @@
module Matchers
class BeFasterThen
def initialize(max_time)
require 'benchmark_unit'
@max_time = max_time
end

Expand Down

0 comments on commit e896895

Please sign in to comment.