mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add support for Expect: 100-continue. Fixes #519
This commit is contained in:
parent
88cc1b5721
commit
b705348d31
2 changed files with 20 additions and 0 deletions
|
@ -403,6 +403,11 @@ module Puma
|
|||
#
|
||||
def process_client(client, buffer)
|
||||
begin
|
||||
|
||||
if client.env['HTTP_EXPECT'] == "100-continue"
|
||||
client.io << "HTTP/1.1 100 Continue\r\n\r\n"
|
||||
end
|
||||
|
||||
clean_thread_locals = @options[:clean_thread_locals]
|
||||
close_socket = true
|
||||
|
||||
|
|
|
@ -467,4 +467,19 @@ class TestPumaServer < Test::Unit::TestCase
|
|||
|
||||
assert_equal "HTTP/1.0 204 No Content\r\n\r\n", data
|
||||
end
|
||||
|
||||
def test_Expect_100
|
||||
@server.app = proc { |env| [200, {}, [""]] }
|
||||
|
||||
@server.add_tcp_listener @host, @port
|
||||
@server.run
|
||||
|
||||
sock = TCPSocket.new @host, @server.connected_port
|
||||
sock << "GET / HTTP/1.1\r\nConnection: close\r\nExpect: 100-continue\r\n\r\n"
|
||||
|
||||
data = sock.read
|
||||
|
||||
assert_equal "HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\n\r\n", data
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue