Is 269KB HTTP Get Allowed?

I am debugging a test case. I am using Python OptionParser (from optparse) to do some testing, and one option is HTTP request.

The input in this particular case for the HTTP request was 269KB in size. So my python program failed with an "argument list too long" (I made sure no other arguments were passed, just a request and one more argument as expected by the parameter parser. When I throw away part of the request and reduce its size, I have good reason to believe the request size is causing my problems here.)

Is it possible for the HTTP request to be that big? If so, how can I fix the OptionParser to handle this input?

+3


source to share


3 answers


The typical limit is 8KB, but it can vary (for example, be even smaller).



0


source


Is it possible for the HTTP request to be that big?

Yes, it is possible, but it is not recommended and you may have compatibility issues depending on your web server configuration. If you need to transfer large amounts of data, you shouldn't use GET.

If so, how do I fix the OptionParser to handle this input?



It looks like OptionParser has set its own limit well above what is considered a practical implementation. I think the only way to fix this is to get the Python source code and modify it to suit your requirements. Alternatively, write your own parser.

UPDATE: I may have misinterpreted the question and the comment from Padreic below may be correct. If you've hit the OS limit for the size of command line arguments, it's not an OptionParser issue, but something much more fundamental to your system design, which means you might have to rethink your solution. This also explains why you are trying to use GET in your application (so you can pass it on the command line?)

+3


source


A GET request, unlike a POST request, contains all of its information in the URL itself. This means you have a 269KB url which is very long.

Although there is no theoretical size limit, many servers do not allow URLs more than a couple of kilobytes in length and should return a 414 response code in this case. The safe limit is 2KB, although most modern software tools will allow a little more.

But still, for 269KB, use POST

(or PUT

if that's semantically more correct) one that can contain larger chunks of data as the content of the request, not the URL.

+2


source







All Articles