Hello

I've been struggling a little with this change. I took the HEAD version 
including Gustaf's changes and compiled it. When I uploaded a file larger than 
the max, I could see that it was calling Gustaf's new function 
Ns_ConnReturnEntityToLarge (correctly triggered by the E_CRANGE) - however, the 
user still got the closed connection, so even though the function was running, 
it wasn't sending any message back to the user. So then I decided to do what 
Dossy/Enrique suggested: when the E_CRANGE condition was met, mark the socket 
state as SOCK_OVERFLOW, and then in driver.c in the "Process sockets ready to 
run" while loop, if socket state is SOCK_OVERFLOW then call 
Ns_ConnReturnEntityToLarge. However, this still isn't sending anything back to 
the user and the connection is still getting closed. 

To do a sanity check that the Ns_ConnReturnEntityToLarge function actually 
works, I created a TCL proc called ns_returntoolarge which mapped to 
Ns_ConnReturnEntityToLarge - and yes this works fine when called directly from 
a TCL program (correctly returning the "The request entity (e.g. file to be 
uploaded) is too large." message to the browser). So knowing that the C 
function works fine, my conclusion then was that I must be calling it from the 
wrong place (or passing in the wrong conn pointer or whatever).

So the question is - what's going on here and where is the right place to call 
Ns_ConnReturnEntityToLarge? I noticed that none of the similar Ns_ConnReturn* 
functions ever get called in driver.c, so I started to suspect that driver.c 
was the wrong place. The other Ns_ConnReturn* functions seem to mainly get 
called in op.c and queue.c, however neither of those seem to be involved in 
this particular situation. I don't see any other obvious place, so I'm a little 
bit stumped at the moment.

Any suggestions?

many thanks
Brian

________________________________________
From: AOLserver Discussion [[email protected]] On Behalf Of Gustaf 
Neumann [[email protected]]
Sent: 24 June 2011 08:00
To: [email protected]
Subject: Re: [AOLSERVER] Problem with file uploads larger than maxinput

Dear all,

As a small contribution, i added a patch to sourceforge cvs.
The patch returns the 413 error message via a new function
Ns_ConnReturnEntityToLarge(), which is written in the same
style as Ns_ConnReturnNotFound(). The patch is somewhat
minimal and handles this issue entirely in the driver (also,
forcing the log entry). I have paid no special attention to
the custom response page.

-gn


On 23.06.11 19:14, Dossy Shiobara wrote:
> That was what I was thinking -- driver marks the request
> as exceeding the limit, and setting the response status
> code to 413.  The benefits that I see (if implemented the
> way I'm imagining) --
>
> 1) access logging of requests w/ 413 status code
>
> 2) custom response page via ns/server/${server}/redirects.
>
> If you and Brian could work up a patch, that'd be wonderful!
>
> Does anyone see any problems with this approach?  Any
> reason not to do it?  I don't suppose it can possibly
> break any kind of backward compatibility, as no code right
> now can even be written to handle such a scenario, anyway.
>
> Of course, once we decide on a behavior, and folks code
> against the implementation ... changing/fixing it becomes
> more "expensive" for everyone, so if there's any kind of
> worry about how this is going to work, lets iron out the
> details now ;)
>
>
> On 6/23/11 12:29 PM, Enrique Catalan wrote:
>> IMHO, I agree with Dossy, to use the driver thread to
>> check the hard
>> limits and instead of dropping the connection, just mark
>> the HTTP
>> request and let the request handler to return the 413. I
>> also think
>> the template could be configured in the 'ns_section
>> ns/server/${server}/redirects' ,  isn't it ?
>>
>> If you all agree with this, Brian and I can help to get a
>> patch.
>


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to 
<[email protected]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to