Re: file upload size problem
Yes Tom, thanks. That makes sense. And yes it works like a charm on Opera. On Mar 17, 2:47 pm, Tom Evans wrote: > On Thu, Mar 17, 2011 at 6:51 AM, vamsy krishna wrote: > > That is true Michal. My understanding is that the server does send > > back a 413 response as soon as it finds the huge mismatch in the > > upload limit and the actual upload size. Also I think the server > > immediately terminates the connection for the request. The problem > > however is that the browser instead of reading the response from the > > server shows the connection interrupted message. Ideally I would like > > to configure it in a way the 413 error page is shown instead. Or do > > you think it is not feasible in such a case? > > > Regards, > > Vamsy > > Think for a moment about how this works. You've set the upload limit > to 500k. If you start uploading more than this, then the web server > can really only do one thing, it can send you a 413 response and close > the connection. > > If your browser then tries to continue to upload the file, it will try > to write data to a closed socket connection, and fail. If it's smart, > it will then see if there is a response to read from the socket, > otherwise it will display a cryptic 'connection interrupted' message. > Try the same test in a bunch of browsers; I bet Opera will handle it > correctly. > > You've asked for the connection to be interrupted, by setting > LimitRequestBody. It can't both limit the request body size, and wait > for a client to be ready to read the error response. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
On Thu, Mar 17, 2011 at 6:51 AM, vamsy krishna wrote: > That is true Michal. My understanding is that the server does send > back a 413 response as soon as it finds the huge mismatch in the > upload limit and the actual upload size. Also I think the server > immediately terminates the connection for the request. The problem > however is that the browser instead of reading the response from the > server shows the connection interrupted message. Ideally I would like > to configure it in a way the 413 error page is shown instead. Or do > you think it is not feasible in such a case? > > Regards, > Vamsy > Think for a moment about how this works. You've set the upload limit to 500k. If you start uploading more than this, then the web server can really only do one thing, it can send you a 413 response and close the connection. If your browser then tries to continue to upload the file, it will try to write data to a closed socket connection, and fail. If it's smart, it will then see if there is a response to read from the socket, otherwise it will display a cryptic 'connection interrupted' message. Try the same test in a bunch of browsers; I bet Opera will handle it correctly. You've asked for the connection to be interrupted, by setting LimitRequestBody. It can't both limit the request body size, and wait for a client to be ready to read the error response. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
That is true Michal. My understanding is that the server does send back a 413 response as soon as it finds the huge mismatch in the upload limit and the actual upload size. Also I think the server immediately terminates the connection for the request. The problem however is that the browser instead of reading the response from the server shows the connection interrupted message. Ideally I would like to configure it in a way the 413 error page is shown instead. Or do you think it is not feasible in such a case? Regards, Vamsy On Mar 16, 9:36 pm, Michal Petrucha wrote: > > > I've set a custom error page for the 413 error when the upload file > > > size exceeds the maximum set in apache LimitRequestBody directive (500 > > > KB). > > > This is working fine for all files upto 3 MB. However when the size > > > exceeds this limit, the browser is showing the below message instead > > > of my custom error page. Can someone point me in the right direction? > > > > Connection Interrupted > > > > The connection to the server was reset while the page was > > > loading. > > > > The network link was interrupted while negotiating a connection. > > > Please try again. > > My guess is that the webserver hangs up as soon as it sees the > request size exceeds some multiple of the limit. > > I think this is reasonable, just imagine that somebody would try to > upload for example /dev/urandom or /dev/zero (i. e. an infinite amount > of data). Would you want the server to suck it all in and then give an > error message saying that the limit has been exceeded? > > Michal Petrucha > > signature.asc > < 1KViewDownload -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
> > I've set a custom error page for the 413 error when the upload file > > size exceeds the maximum set in apache LimitRequestBody directive (500 > > KB). > > This is working fine for all files upto 3 MB. However when the size > > exceeds this limit, the browser is showing the below message instead > > of my custom error page. Can someone point me in the right direction? > > > > Connection Interrupted > > > > The connection to the server was reset while the page was > > loading. > > > > The network link was interrupted while negotiating a connection. > > Please try again. My guess is that the webserver hangs up as soon as it sees the request size exceeds some multiple of the limit. I think this is reasonable, just imagine that somebody would try to upload for example /dev/urandom or /dev/zero (i. e. an infinite amount of data). Would you want the server to suck it all in and then give an error message saying that the limit has been exceeded? Michal Petrucha signature.asc Description: Digital signature
Re: file upload size problem
Any suggestions please? On Mar 15, 12:18 pm, vamsy krishna wrote: > Hi All, > > I've set a custom error page for the 413 error when the upload file > size exceeds the maximum set in apache LimitRequestBody directive (500 > KB). > This is working fine for all files upto 3 MB. However when the size > exceeds this limit, the browser is showing the below message instead > of my custom error page. Can someone point me in the right direction? > > Connection Interrupted > > The connection to the server was reset while the page was > loading. > > The network link was interrupted while negotiating a connection. > Please try again. > > Thanks, > Vamsy > > On Mar 15, 11:21 am, vamsy krishna wrote: > > > Thanks Tom. I also looked up the Django code and realised there is no > > handler413 defined. I'm now doing it in apache the way you mentioned. > > > On Mar 14, 4:38 pm, Tom Evans wrote: > > > > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna > > > wrote: > > > > I'm facing a new problem now. I have a defined a custom error page and > > > > using the handler413 in my urls file to load this template. However > > > > this is not getting picked up. I would like to handle this at django > > > > level instead of apache. The ErrorDocument definition in apache works > > > > fine. > > > > > Also the handler404 and handler500 are working without any issue. Can > > > > someone point me in the right direction? > > > > > Thanks, > > > > Vamsy > > > > handler404 and handler500 get called if django tries to serve a page > > > that doesn't exist or a page that errors. Your 413 is generated from > > > apache, and so does not ever call django, therefore django cannot > > > handle this error. > > > > To get around this, set > > > > ErrorHandler 413 /some/django/url > > > > Apache will use an internal redirect to fetch this URL, so it should > > > be transparent to your users. > > > > Cheers > > > > Tom > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
Hi All, I've set a custom error page for the 413 error when the upload file size exceeds the maximum set in apache LimitRequestBody directive (500 KB). This is working fine for all files upto 3 MB. However when the size exceeds this limit, the browser is showing the below message instead of my custom error page. Can someone point me in the right direction? Connection Interrupted The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection. Please try again. Thanks, Vamsy On Mar 15, 11:21 am, vamsy krishna wrote: > Thanks Tom. I also looked up the Django code and realised there is no > handler413 defined. I'm now doing it in apache the way you mentioned. > > On Mar 14, 4:38 pm, Tom Evans wrote: > > > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna > > wrote: > > > I'm facing a new problem now. I have a defined a custom error page and > > > using the handler413 in my urls file to load this template. However > > > this is not getting picked up. I would like to handle this at django > > > level instead of apache. The ErrorDocument definition in apache works > > > fine. > > > > Also the handler404 and handler500 are working without any issue. Can > > > someone point me in the right direction? > > > > Thanks, > > > Vamsy > > > handler404 and handler500 get called if django tries to serve a page > > that doesn't exist or a page that errors. Your 413 is generated from > > apache, and so does not ever call django, therefore django cannot > > handle this error. > > > To get around this, set > > > ErrorHandler 413 /some/django/url > > > Apache will use an internal redirect to fetch this URL, so it should > > be transparent to your users. > > > Cheers > > > Tom > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
Thanks Tom. I also looked up the Django code and realised there is no handler413 defined. I'm now doing it in apache the way you mentioned. On Mar 14, 4:38 pm, Tom Evans wrote: > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna wrote: > > I'm facing a new problem now. I have a defined a custom error page and > > using the handler413 in my urls file to load this template. However > > this is not getting picked up. I would like to handle this at django > > level instead of apache. The ErrorDocument definition in apache works > > fine. > > > Also the handler404 and handler500 are working without any issue. Can > > someone point me in the right direction? > > > Thanks, > > Vamsy > > handler404 and handler500 get called if django tries to serve a page > that doesn't exist or a page that errors. Your 413 is generated from > apache, and so does not ever call django, therefore django cannot > handle this error. > > To get around this, set > > ErrorHandler 413 /some/django/url > > Apache will use an internal redirect to fetch this URL, so it should > be transparent to your users. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna wrote: > I'm facing a new problem now. I have a defined a custom error page and > using the handler413 in my urls file to load this template. However > this is not getting picked up. I would like to handle this at django > level instead of apache. The ErrorDocument definition in apache works > fine. > > Also the handler404 and handler500 are working without any issue. Can > someone point me in the right direction? > > Thanks, > Vamsy > handler404 and handler500 get called if django tries to serve a page that doesn't exist or a page that errors. Your 413 is generated from apache, and so does not ever call django, therefore django cannot handle this error. To get around this, set ErrorHandler 413 /some/django/url Apache will use an internal redirect to fetch this URL, so it should be transparent to your users. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
I'm facing a new problem now. I have a defined a custom error page and using the handler413 in my urls file to load this template. However this is not getting picked up. I would like to handle this at django level instead of apache. The ErrorDocument definition in apache works fine. Also the handler404 and handler500 are working without any issue. Can someone point me in the right direction? Thanks, Vamsy On Mar 14, 11:07 am, vamsy krishna wrote: > Oh yes. Thanks Karen. > > On Mar 12, 7:06 pm, Karen Tracey wrote: > > > On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna > > wrote: > > > > I'm doing a file upload from one of my forms and writing the content > > > to a temp file on the server. The problem is any file of size more > > > than 250 KB is throwing the below error: > > > > Request Entity Too Large > > > The requested resource > > > /tera/tera_upload/ > > > does not allow request data with POST requests, or the amount of data > > > provided in the request exceeds the capacity limit. > > > > I read through the django file uploads documentation and it says the > > > default file upload size in memory is about 2.5 MB. Can anyone tell me > > > what I'm overlooking? Also how do I set a maximum file size limit and > > > handle it? > > > This error isn't coming from Django, it's coming from your web server which > > has apparently been configured to limit request body size. How to change the > > limit will depend on what server you are using. If Apache, see for example > > LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html > > > Karen > > --http://tracey.org/kmt/ > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
Oh yes. Thanks Karen. On Mar 12, 7:06 pm, Karen Tracey wrote: > On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna wrote: > > > I'm doing a file upload from one of my forms and writing the content > > to a temp file on the server. The problem is any file of size more > > than 250 KB is throwing the below error: > > > Request Entity Too Large > > The requested resource > > /tera/tera_upload/ > > does not allow request data with POST requests, or the amount of data > > provided in the request exceeds the capacity limit. > > > I read through the django file uploads documentation and it says the > > default file upload size in memory is about 2.5 MB. Can anyone tell me > > what I'm overlooking? Also how do I set a maximum file size limit and > > handle it? > > This error isn't coming from Django, it's coming from your web server which > has apparently been configured to limit request body size. How to change the > limit will depend on what server you are using. If Apache, see for example > LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: file upload size problem
On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna wrote: > I'm doing a file upload from one of my forms and writing the content > to a temp file on the server. The problem is any file of size more > than 250 KB is throwing the below error: > > Request Entity Too Large > The requested resource > /tera/tera_upload/ > does not allow request data with POST requests, or the amount of data > provided in the request exceeds the capacity limit. > > I read through the django file uploads documentation and it says the > default file upload size in memory is about 2.5 MB. Can anyone tell me > what I'm overlooking? Also how do I set a maximum file size limit and > handle it? > This error isn't coming from Django, it's coming from your web server which has apparently been configured to limit request body size. How to change the limit will depend on what server you are using. If Apache, see for example LimitRequestBody here: http://httpd.apache.org/docs/2.0/mod/core.html Karen -- http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
file upload size problem
Hi, I'm doing a file upload from one of my forms and writing the content to a temp file on the server. The problem is any file of size more than 250 KB is throwing the below error: Request Entity Too Large The requested resource /tera/tera_upload/ does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. I read through the django file uploads documentation and it says the default file upload size in memory is about 2.5 MB. Can anyone tell me what I'm overlooking? Also how do I set a maximum file size limit and handle it? Thanks, Vamsy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.