Maximum amount of elements sent by a form?

Asked

Viewed 1,799 times

7

I would like to know if there is a maximum amount of elements that I can send from one form to another POST as I saw GET.

I know if I pass my data via GET, there is a maximum length of URL, varying according to the navigator, but via POST It seems kind of obscure...

An excerpt from w3schools:

POST requests have no Restrictions on data length

Is that an absolute truth? There is no maximum restriction?

  • 1

    That’s not W3C is w3schools

  • It is that they are very different, and known for very different reasons. W3C is reliable. w3schools not so much.

  • If it is in PHP, the php.ini directive defines this. N case, it is defined by the directive max_post_size the limit of data sent in the post (in Megabites)

  • In this case, as there is no php tag in your post, I preferred to generalize the answer :)

  • 1

    The question idea is even generic.... how data is passed by the header of a request Cliente-Servidor, there should probably be a maximum size of POST information for the transfer, in each source I seek I find a different information.

  • Like I said: It’s good to have a limit. In php, for example, POST is converted into an array. A giant array generates a memory overflow. You can overhead in some cases, rsrsrsrs

  • @Marceloboni no good or forgot this? If I can improve something just say.

  • @mustache I had completely forgotten about her =]

Show 3 more comments

4 answers

7

There is no limit, but both the language interpreter and the server can restrict.

In the case of PHP POST, there is a line in php.ini that determines this.

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

By default it is 8 mega usually, but each hosting treats in a different way, so it is worth paying attention to it if there is need in your project.

However, the server can restrict this too. In the case of apache, for example, stay here: LimitRequestBody and LimitRequestFieldSize. On other servers, settings vary.

  • 1

    The problem is if the guy is not talking about PHP, but all languages in general (there is no tag php in his post)

  • 1

    True, Wallace.

5

Technically there is a constraint per package sent to execute a request.

The network shall be divided into layers listed below:

  1. Application layer
  2. Transport layer
  3. Network layer
  4. Link layer
  5. Physical layer

While in the application layer there are no limits to the amount of information sent, this does not prevent it from being fragmented to be sent over the internet.

In short: nay there is a data limit to be sent, but exists a data limit to be sent per package to respond to your request. And this is done automatically by the machines that send the request, such as routers and modems.

4


What you really should note is the limit of the weakest, which is the lowest limit among all the components involved in the process.

For the URL, even if other components accept a limit higher than 2048 bytes, Internet Explorer cannot send more, so you should work with this limit unless you are ensuring that no user will use IE, which is very unlikely. Still, I’d still have that limit to make sure. For both GET and POST, this is the limit that the URL should have, but with POST it is possible to send data beyond the URL, GET, only send by URL.

The HTTP protocol does not impose any limit on sending data via POST. But the HTTP server may be set to some limit.

In theory none browser imposes some limit.

PHP usually has a relatively low limit that works most of the time. Other languages may have some limitations.

Even if you decide to change this limit of PHP or HTTP server, think about it, it can cause problems. It is not easy to manipulate large data shipments. Apart from the fact that sending may have problems in the middle, so both the server and the client need to know how to handle it. It may be better to split the shipment if the data to be sent is too large, and obviously needs to manage forwards.

So the element limit is not what matters. If you already have several elements and summed they are very large, it is better to send separately if possible.

3

POST has no data limit to be sent. However, your server may have set a data limit that you can receive via POST. For example, in PHP the default limit is 2Mb.

  • It’s good to have a limit. For I have already managed to make a "small attack" using a form "giant" (64 arrays inside the other multiplied by 2000 times, Rsrsrsrsrs)

  • 1

    A server with a large limit for sending data via POST is an invitation to Ddos attacks =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.