Sha256: 67cd3d72d93d0c91eaad3998a8e977f01beabfa74bae65680f48a35f02465999

Contents?: true

Size: 829 Bytes

Versions: 3

Compression:

Stored size: 829 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Server, 'robustness' do
  before do
    start_server do |env|
      body = 'hello!'
      [200, { 'Content-Type' => 'text/html', 'Content-Length' => body.size.to_s }, body]
    end
  end
  
  it "should not crash when header too large" do
    100.times do
      begin
        socket = TCPSocket.new(DEFAULT_TEST_ADDRESS, DEFAULT_TEST_PORT)
        socket.write("GET / HTTP/1.1\r\n")
        socket.write("Host: localhost\r\n")
        socket.write("Connection: close\r\n")
        10000.times do
        	socket.write("X-Foo: #{'x' * 100}\r\n")
        	socket.flush
        end
        socket.write("\r\n")
        socket.read
        socket.close
      rescue Errno::EPIPE, Errno::ECONNRESET
				# Ignore.
			end
    end
  end
  
  after do
    stop_server
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thin-0.8.0 spec/server/robustness_spec.rb
thin-0.8.2 spec/server/robustness_spec.rb
thin-0.8.1 spec/server/robustness_spec.rb