New issue
Advanced search Search tips

Issue 660285 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: 2016-11-11
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

More than 100000 character string gets truncated while submitting the form

Reported by sata...@gmail.com, Oct 28 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36

Steps to reproduce the problem:
1. Create simple form
2. add input field and submit button
3. fill input filed with more than 100000 character
4. At server side you will receive truncated string.

What is the expected behavior?
It should not truncate the string while submitting

What went wrong?
Browser has truncated the string

Did this work before? No 

Chrome version: 54.0.2840.71  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 23.0 r0

Other browsers dosen't truncate the large string while submitting
 

Comment 1 by tkent@chromium.org, Oct 28 2016

Cc: tkent@chromium.org
Labels: Needs-Feedback
Can you provide a reproducible HTML?
Is the form method GET, or POST?  What's the <input> type?

NextAction: 2016-11-11

Comment 3 by sata...@gmail.com, Nov 5 2016

Its a post method and input type is hidden.

Comment 4 by tkent@chromium.org, Nov 7 2016

Components: -Blink Blink>Forms
satalaj@, would you provide a reproducible HTML please?

I confirmed 110,000 characters were sent successfully to a server with the following code.

<!DOCTYPE html>
<iframe name=f></iframe>
<form method="post" action="https://httpbin.org/post" target=f>
<input name=hidden type=hidden id=i>
</form>
<script>
var value = '';
for (var c = 0; c < 110000; c = value.length) {
  value += String(c) + ', ';
}
document.querySelector('input').value = value;
document.querySelector('form').submit();
</script>


The limit encountered wasn't 100,000 characters. It was 524,285 characters. The html is pretty much same as you have provided. Please try something like "c < 600000" in above code.

Comment 6 by tkent@chromium.org, Nov 7 2016

Comment 5,
Text fields has 524,288 characters limit.  It's  Issue 450544 .
Type=hidden doesn't have such length limitation.

Comment 7 by tkent@chromium.org, Nov 14 2016

Cc: -tkent@chromium.org
Owner: tkent@chromium.org
Status: WontFix (was: Unconfirmed)
We haven't received enough information to investigate this.

You are right, the limit is for text field. In our code, we were not setting the input type=hidden correctly (we were setting the type=hidden after setting the value, which was causing it to be treated like text field.)
Below is the erroneous code.

<!DOCTYPE html>
<input type="button" onclick="sub()" value="submit">
<script>
    var sub = function() {
        var form = document.createElement("form");
        form.name = "hiddenForm";
        form.id = "hiddenForm";
        form.method = "POST";
        form.action = 'http://localhost:56305/home/postdatatest';
        form.target = "_blank";

        var htmlPostHidden = document.createElement("input");
        var value = '';
        for (var c = 0; c < 600000; c = value.length) {
            value += String(c) + ', ';
        }

        htmlPostHidden.value = value;
        htmlPostHidden.type = "hidden";
        htmlPostHidden.name = "data";
        htmlPostHidden.id = "data";

        form.appendChild(htmlPostHidden);
        document.body.appendChild(form);
        form.submit();
        var child = document.getElementById("hiddenForm");
        child.parentNode.removeChild(child);
    };
</script>

Comment 9 by tkent@chromium.org, Nov 14 2016

I'm not sure relationship between satalaj@ and vharishchandre@.
Anyway, in Comment 8 code, swapping 'htmlPostHidden.value = value;' and |htmlPostHidden.type = "hidden";| would solve the problem.

Comment 10 by sata...@gmail.com, Nov 14 2016

yes, thanks for investigating me and  vharishchandre@ are colleague.

Sign in to add a comment