1

Basically, I am attempting to send a 2GB HTTP POST packet to my website to test it, as HTTP GET cannot go that high. However, I am not very experienced with this, and need advice/an explanation on how to actually attempt this. Thank you in advance.

None None
  • 147
  • 2
  • 3
  • 11
  • Implement what? The sending of a POST HTTP Request as opposed to a GET HTTP Request? Or is there some other implementation explanation you are looking for? Possible duplicate: http://stackoverflow.com/a/4206094/1195273 – crush Jan 23 '13 at 20:54
  • 1
    Start here - this is one of many issues that might occur while trying to do this - http://stackoverflow.com/questions/2364840/what-is-the-size-limit-of-a-post-request – Scott Jan 23 '13 at 20:58
  • @crush - This question is not a duplicate of the one you linked. The OP's use case requires POST'ing data that has a greater size than most proxies and servers will allow without chunking. – Perception Jan 23 '13 at 21:08
  • I read 2MB for some reason, and thought he was referring to how to send an HTTP POST request via Java. I see my mistake now. – crush Jan 23 '13 at 21:12

2 Answers2

3

There are many problems that will arise when trying to do this. I will try to go over them briefly -

1) Server settings - Many servers will prevent a 2GB POST by default for security reasons (having an unlimited or high post max would make it easier for a DoS). PHP has a default of 20M.

1-a) Server settings - Many servers also have timeout settings, that if request does not complete in a certain amount of time it will abandoned that request. 2GB could very well cause this setting to trigger.

2) Browser setting - I am not positive about this one, but your browser might also try to prevent this.

3) Hardware - There will be multiple hardware bottlenecks that could cause an issue. Physical Memory (Server and Client), Network bandwidth, HDD space available (write permissions on the server, depending on what you are doing with post).

4) 3rd Party Host - If your website is hosted by a third party, they might have implemented security measures to stop this.

This is probably not a complete list - but a 2GB post file could run into problems at many different stages during the transfer process.

If you want a way to send it - this is one way

<html>
    <body>
            <form method="post">
                    <input type="hidden"
                    <?php
                            echo " value='";
                            for($i=0;$i<2147483648;$i++)
                                    {
                                            echo "a";
                                    }
                            echo "'";
                    ?>
                    >
                    <input type="submit">
            </form>
<?php if(isset($_POST['test'])){
    echo $_POST['test'];
}
?>
    </body>
</html>

Although, I don't really recommend using this way. I havn't tested it, because I don't want to break my webserver right now. And my math, might be a little off - but assuming 1 character is 1 byte(basic ascii). This will work, if the page loads at all.

Scott
  • 12,077
  • 4
  • 27
  • 48
0

As the use of a HTTP request to transfer 2GB from point A to point B seems inappropriate (also in your case ?), you might want to look at FTP/Javascript at some point, so that the task of transferring the data runs in the background and does not freeze your browser, nor the server.

Assumptions :

  1. Your server can handle file transfers via FTP

  2. Your 2GB of data are stored somewhere on the client side, not generated on the fly.

  3. There are javascript libraries with which you can manage file transfers (connexion and actual transfer) using FTP

  4. With the above libraries, and some AJAX, you'd also need to synchronize your http POST request life cycle with the state of your file transfer. Then, in the request, you could stick to submitting only informations about the 2GB you're uploading.

I've engine searched something like "ftp javascript client" and only commercial browser-embedded FTP-clients were listed. (Feel free to correct me if I said bullshit).

ergo sum cogito
  • 158
  • 1
  • 7