简体   繁体   中英

ColdFusion HTTP POST large strings

Has anyone noticed that if you try to post a string that exceeds 1,000,000 characters, it simply does not include the field with the request?

...and doesn't throw()!

eg.

<cfscript>
var h = new http( url = "http://...", method = "post" );
h.addParam( type = "formField", name = "a", value = repeatString("a",5000) );
h.addParam( type = "formField", name = "b", value = repeatString("b",1000000) );
h.addParam( type = "formField", name = "c", value = repeatString("c",1000001) );
var p = h.send().getPrefix();
writeDump( var = p, abort = true );
</cfscript>

The "a" and "b" fields are present in the form scope of the recipient page.

The "c" field is missing!

ColdFusion 9,0,1,274733 + chf9010002.jar, Mac OS X 10.6.8, Java 1.6.0_31

Edit: It now works as expected!

Not sure what has changed? My cf admin configuration remains the same. The only possible candidate I can come up with is a recent Apple Java update. Could that be it?

This is a setting within CF administrator.

In Coldfusion 9 (this setting has existed for a while, but may exist elsewhere in other versions):

Click on "server settings" group to expand, click on "settings" link (top link). On the settings page:

Maximum size of post data 100 MB (default) Limits the amount of data that can be posted to the server in a single request. ColdFusion rejects requests larger than the specified limit.

It's interesting that you're hitting a limit right at 100,000 ; sounds like someone got a little lazy with the "bytes" computation. :) At any rate, I'd try tinkering with this setting.

Just an FYI: You'll encounter a similar issue with data truncation on data inserts/updates unless you set your datasource to allow "Long Text Buffer (chr)" greater than the 64,000 default limit.

You may need to specify

enctype="multipart/form-data"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM