From: gustafn <gne...@us...> - 2011-07-09 10:06:49
|
Update of /cvsroot/aolserver/aolserver/nsd In directory vz-cvs-4.sog:/tmp/cvs-serv14239/nsd Modified Files: driver.c op.c return.c Log Message: - move the handling of "Entity too large" to the connection threads - make sure to process the whole request from the client, even when the entity is too large - change spelling of error stub to Ns_ConnReturnEntityTooLarge - removed superflous newline in SockState Index: return.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/return.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** return.c 23 Jun 2011 18:15:16 -0000 1.51 --- return.c 9 Jul 2011 10:06:46 -0000 1.52 *************** *** 1062,1066 **** *---------------------------------------------------------------------- * ! * Ns_ConnReturnEntityToLarge -- * * Return a 414 Request Entity to large response. --- 1062,1066 ---- *---------------------------------------------------------------------- * ! * Ns_ConnReturnEntityTooLarge -- * * Return a 414 Request Entity to large response. *************** *** 1076,1080 **** int ! Ns_ConnReturnEntityToLarge(Ns_Conn *conn) { int result; --- 1076,1080 ---- int ! Ns_ConnReturnEntityTooLarge(Ns_Conn *conn) { int result; Index: op.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/op.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** op.c 7 Oct 2005 00:48:23 -0000 1.15 --- op.c 9 Jul 2011 10:06:46 -0000 1.16 *************** *** 231,234 **** --- 231,242 ---- /* + * Return entity too large error message + */ + + if (connPtr->flags & NS_CONN_ENTITYTOOLARGE) { + return Ns_ConnReturnEntityTooLarge(conn); + } + + /* * Prevent infinite internal redirect loops. */ Index: driver.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/driver.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** driver.c 24 Jun 2011 06:46:32 -0000 1.61 --- driver.c 9 Jul 2011 10:06:46 -0000 1.62 *************** *** 1482,1486 **** { if (sockPtr->drvPtr->flags & DRIVER_DEBUG) { ! Ns_Log(Notice, "%s[%d]: %s -> %s\n", sockPtr->drvPtr->name, sockPtr->sock, states[sockPtr->state], states[state]); } --- 1482,1486 ---- { if (sockPtr->drvPtr->flags & DRIVER_DEBUG) { ! Ns_Log(Notice, "%s[%d]: %s -> %s", sockPtr->drvPtr->name, sockPtr->sock, states[sockPtr->state], states[state]); } *************** *** 1750,1757 **** } LogReadError(connPtr, err); - if (err == E_CRANGE) { - Ns_ConnReturnEntityToLarge(connPtr); - NsRunTraces(connPtr); - } } } --- 1750,1753 ---- *************** *** 1973,1977 **** } if (len > (int) connPtr->limitsPtr->maxupload) { ! return E_CRANGE; } connPtr->contentLength = len; --- 1969,1989 ---- } if (len > (int) connPtr->limitsPtr->maxupload) { ! /* ! * Gustaf Neumann: The entity is too large and is not allowed to ! * be processed. In principle, we could stop processing the ! * request here and return immediately an error message to the ! * client. However, if the content to be sent from the client to ! * the server is large it is likely, that at the time we process ! * the header, the content is not fully sent yet. If the server ! * replies and closes the connection while the client is sending ! * the request, current browsers (e.g. Firefox, Chrome, ...) ! * will show the user their own error message ("server has ! * closed connection"). Therefore, in order to provide reliable ! * error messages, we have process the full request. We flag the ! * fact of the too large entity here and return the error ! * message from the connection thread. ! */ ! connPtr->flags |= NS_CONN_ENTITYTOOLARGE; ! LogReadError(connPtr, E_CRANGE); } connPtr->contentLength = len; |