Hi everybody,
I''m making a plugin to limit the maximum request size (for file
uploads). Instead of canceling the request after it''s completely
in (with the method ''process''). I would like to cancel it
based
on the CONTENT_LENGTH in the method request_begins. Usability
thingie ;-)
how can i cancel the running request and send a response, instead
of waiting? currently i have these 2 methods:
def request_begins(params)
return unless params[Mongrel::Const::REQUEST_METHOD]
=''POST''
req_size = params[Mongrel::Const::CONTENT_LENGTH].to_i || 0
if req_size > MAX_REQUEST_SIZE
@request_too_big = true
else
@request_too_big = false
end
end
def process(request, response)
if @request_too_big
response.start(413, true) do |head,out|
out << "Request too big, probably you are trying to
upload a file that is too big"
end
end
end
tnx,
Tim
____________________________________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos'' Green
Center.
http://autos.yahoo.com/green_center/