Critical -Unity 2017.3 - WWW with WWWForm not working - Wrong network request (header/body) created

Hi,

This issue happened for the first time on 2017.3, works on previous version.

When I call the simple code below or for any other url the yield takes long time and returns always HTTP/1.1 500 Internal Server Error. I can assure that there is no server error, works on any other Unity version and works on any POST tool. The network flow from Fiddler shows some weird content from Unity WWW with form:

WWWForm wwwForm = new WWWForm();
            wwwForm.AddField("data", enc);          

            using (www = new WWW(url, wwwForm))
            {
              
                yield return www;
            }

I have used Fiddler to check what is being sent and as shown below it has invalid data on the body and no Content-Length (I have ommited part of the url):

POST http://tacticalpad.com/… HTTP/1.1
Host: tacticalpad.com
User-Agent: UnityPlayer/2017.3.0f3 (UnityWebRequest/1.0, libcurl/7.51.0-DEV)
Accept: /
Accept-Encoding: identity
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
X-Unity-Version: 2017.3.0f3

cf
data=nc1y1puzQHPBriIuFxCIiGnzS5L%2b6Cu1l4yBbpLQCHRjcEGbzSvTqD3dhTnyhbIa4Y6BaMerD3Dacm8zAYGyVPCpCA2nCM66RKkoNsEGeeXY30lWat7bmrYyLhsubLD9DjhShYBt%2beX5H109q5meqNFDgLhuPaQK6oAigdxdMDtXng%2bI%2fvTJg%2bwQprWYhlud
0

This request is invalid and causes the server Internal Error, on previous versions everything works as expected and the network request is created successfully.

It is to me a critical issue as i have several dependencies with network that are not running.

Thanks in advance,

Fernando

@Tautvydas-Zilys any chance you could look at it? I haven’t filed the case yet. If you want me to, just let me know.

same here, i have an undefined index error trying contacting my sql table. did you solve it?

No, I believe the only way right now would be to avoid WWWForm but I have too much code with it already =(

This is a known bug, fix is upcoming.
For now the workaround is to use UnityWebRequest instead of WWW and set chunkedTransfer property to false.

1 Like

Any estimate for the patch? We have too much code and plugins using WWWForm, so waiting for the patch is the only solution for us.

Thanks!

It’s an issue with WWW class, not WWWForm, the later can be used with UnityWebRequest too.
It will take at least a couple of weeks to release a fix, can’t really promise though, it depends on QA etc.

Ok. We will check if we can update all the codes to WebRequest. @Pavo93 , here is the current possible solution.

We have the same problem! 2017.3 is a mess… completely unusable

1 Like

works, thanks!

Do you know if it is Windows only or all platforms? I have some plugins for iOs and Mac using WWW and wouldn’t like to update all of them because that get updated all the time and I would have to modify again.

It’s cross-platform issue. Chunked transfer was accidentally enabled in WWW class and now we started to see how many servers don’t support that yet.

Yes, unfortunately there are many yet. Mine is on Azure and by default disabled, to enable it we need a complete new release, what is not so nice on Azure.

If you guys add the parameter to enable chunked transfer as on WebRequest, with a default false value, WWW will be perfect =).

Thanks

I’m having a similar issue. I’m submitting a request initialized with WWW and WWWForm to a server I’m hosting locally with Django. The server isn’t receiving any of my POST variables. It was working fine before I upgraded to 2017.3. I think the version I was using before was 2017.1.

Hi,
Just stumbled across this thread after posting a very similar question in the HelpRoom forum.
I’ve now changed my code in the appropriate places from using the WWW class to use the UnityWebRequest class. However it still doesn’t work. Why: Because in Unity 2017.3.0, I can’t change the UnityWebRequest.chunkedTransfer property! Meaning I can’t set it to false.
Going back to Unity 2017.2.1 I can set the chunkedTransfer property to false without any problems and the UnityWebRequest then works like a charm.

Can you please escalate these bugs to be fixed asap? This bug is critical, as in this current state Unity 2017.3.0 is completely useless to me.

Hi, I am setting chunkedTransfer to false on the UnityWebRequest object on Unity 2017.3.0f3. It works as expected:

UnityWebRequest www = UnityWebRequest.Post(url,wwwForm);
www.chunkedTransfer = false;

Really? That’s strange. It hasn’t been working for me all day. I can set the properties UnityWebRequest.url, UnityWebRequest.timeout and UnityWebRequest.method etc.etc.

But with UnityWebRequest.chunkedTransfer and UnityWebRequest.useHttpContinue to true the value in the my debugger (Visual Studio 2017) remains false.

Here’s a code snippet from my source code:

UnityWebRequest uwr = new UnityWebRequest();
uwr.url = m_strURL;
UploadHandler uploader = new UploadHandlerRaw(aRequest);
uploader.contentType = "custom/content-type";
uwr.uploadHandler = uploader;
uwr.downloadHandler = new DownloadHandlerBuffer();
uwr.method = UnityWebRequest.kHttpVerbPOST;
uwr.useHttpContinue = false;
uwr.timeout = 120;

uwr.chunkedTransfer = false;
bool isChunked = uwr.chunkedTransfer;

if (isChunked)
    uwr.chunkedTransfer = !isChunked;
.....

Guess what happens: Even after explicitly setting it to false I pass into the if statement. In the debugger the value is still depicted as being true and the code behaves that way as well.
In Unity 2017.2.1 however everything behaves as expected.

I haven’t used the debugger, I just replaced WWW to UnityWebRequest, set chunked to false and ran, and the POST worked. Then i haven’t needed to debug.

Sadly it didn’t work for me. So I’ve had to revert to Unity 2017.2.1.
This version seems to work fine for me. But I did want to take advantage of the latest Windows Mixed Reality features and native VR support.
(Currently I’m porting one of our older apps from Unity 5.6.0 to the latest Unity 2017 version. That’s why I’m refactoring all the code that used the WWW class to using the UnityWebRequest class.)

If you still see the issue, can we get a bug report on it?