From f81aa02448b615c4d5fc4f6544c53289dae9d2ec Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 4 May 2011 16:41:36 -0700 Subject: return 414 for URI length violations There's an HTTP status code allocated for it in , so return that instead of 400. --- lib/unicorn/const.rb | 1 + lib/unicorn/http_server.rb | 2 ++ 2 files changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 717a61f..fe49e1b 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -31,6 +31,7 @@ module Unicorn::Const # :stopdoc: # common errors we'll send back ERROR_400_RESPONSE = "HTTP/1.1 400 Bad Request\r\n\r\n" + ERROR_414_RESPONSE = "HTTP/1.1 414 Request-URI Too Long\r\n\r\n" ERROR_500_RESPONSE = "HTTP/1.1 500 Internal Server Error\r\n\r\n" EXPECT_100_RESPONSE = "HTTP/1.1 100 Continue\r\n\r\n" diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index 3077b95..994de67 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -527,6 +527,8 @@ class Unicorn::HttpServer msg = case e when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF Unicorn::Const::ERROR_500_RESPONSE + when Unicorn::RequestURITooLongError + Unicorn::Const::ERROR_414_RESPONSE when Unicorn::HttpParserError # try to tell the client they're bad Unicorn::Const::ERROR_400_RESPONSE else -- cgit v1.2.3-24-ge0c7