Search Issue Tracker
Duplicate
Votes
57
Found in
Issue ID
672251
Regression
Yes
WWW POST request on WebPlayer built by Unity 5.0.0f2 creates an invalid request
WWW POST request on WebPlayer built by Unity 5.0.0f2 creates an invalid request, therefore servers cannot read the body properly and they receive missing headers.
-
Reza-AUS
Jun 30, 2015 01:48
Hi,
By the look of things I gather that there is a bug in unity on WWWForm post. is that right?
For the last 3 days, I have been trying to figure out why i can't receive FORM POST data when using Firefox and Chrome but Safari works perfectly. I have tried everything I could think of and I don't know what else I can test.
I'm currently using Unity 5.1.1p2 and WebGL build.
-
PeanutPiek
Jun 28, 2015 13:26
Similar here.
I send a Post Request from Unity and read it with a Java Server but got no Request Body Data in Unity 5.1.1f1 (64bit).
Searched for any Error in the Server for hours.I've changed to Unity 5 in the dev process. With Unity 4 the Post Request was successfully send and read by the same Server.
-
insmo
May 22, 2015 07:59
It's still an issue in 5.0.1f1
-
pp713
Apr 29, 2015 21:19
Was this issue fixed with an update?
-
usecode
Apr 24, 2015 09:25
Unity developers -> please fix this ASAP
same problem:
Connection: keep-alive
Content-length: 218Content-Length: 85
Content-Type: application/x-www-form-urlencoded
X-Unity-Version: 5.0.1f1
hash: e0f6741b1c9273b0e5513cf50e6d4092data="Hello world"
-
harleywinks
Apr 22, 2015 02:19
Unity, I love you but at this point in the game, you should be embarrassed to have bugs in your HTTP implementation. Getting this fixed should be treated as a fire drill.
If it helps, the problem seems to be that WWW is generating too copies of the Content-Length header with a space in between, e.g.
POST /accounts HTTP/1.1
...
Content-length: 147Content-Length: 53
Content-Type: application/x-www-form-urlencoded
X-Unity-Version: 5.0.1f1name=foo&value=bar
-
iluha.obinsk
Apr 20, 2015 11:39
when will this bug fixe?
-
MariuszKowalczyk
Apr 02, 2015 22:54
Workaround:
Add one binary field to your WWWForm:
wwwForm.AddBinaryData("binary", new byte[1]);Now everything will work.
-
fcordoba
Mar 27, 2015 19:18
While the bug is fixed, manually fill the $_POST array work for me:
<?php
if (empty($_POST))
{
$data = file_get_contents('php://input');
$data = substr($data,strrpos($data,"\n"));
$vars = explode("&",$data);
$_POST = array();
for ($i = 0; $i < count($vars); $i++)
{
list($key, $value) = split("=", $vars[$i],2);
if(strlen(trim($key))>0)
{
$key=preg_replace('/[\n\r]/', '', $key);
$value=preg_replace('/[\n\r]/', '', $value);
$_POST[$key]=$value;
}
}
}
?> -
MrDude
Mar 25, 2015 09:38
I had this same issue since U4... Worked in Chrome and Safari but not FF or IE... so I switched my code to use GET instead of POST and everything worked just fine... Instead of saying
for( int i = 0;i < array_length; i++) myform.AddField(field_name[i], field_value[i]);
WWW w = new WWW(myurl, myform);I just do this instead:
for( int i = 0; i < array_length; i++) get_string += string.Format("&{0}={1}",field_name[i], field_value[i]);
WWW w = new WWW myurl + "?" + get_string.SubString(1));...and that was that. Works on all platforms.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Spot Light with 'Box' Shape stops working when it collides with Mesh
- Accepting Asset Store EULA endless loop in Package Manager window
- “InvalidOperationException: Sequence contains no matching element“ error when reenabling a custom Debug Draw Mode
- Prefab that contains a layout group is marked as changed by the Editor when opened
- Emission animation does not appear when the "Emission Map" parameter is set to black in a Lit material
This is a duplicate of issue #679397