Search Issue Tracker

Fixed in 2017.3.0f3

Votes

2

Found in

2017.3.0b5

Issue ID

960676

Regression

Yes

[Networking] UnityWebRequest.Post returns "Generic/unknown HTTP error"

Networking

-

Steps to reproduce:
1. Open attached project
2. Play the scene
3. Notice the WebRequest Error: Generic/unknown HTTP error

Expected result: console should print: Return data: post field is set instead

Reproduced in: 2018.1.0a1, 2017.3.0b5, 2017.3.0b1
Not reproduced in: 2017.3.0a7, 2017.2.0f3
Regression since: 2017.3.0b1

Comments (34)

  1. KenyAguilar

    Mar 31, 2018 09:05

    If you get 406 Not Acceptable I fixed it doing this.

    var headers = form.headers;

    Dictionary<string, string> ht = new Dictionary<string, string>();
    ht["Accept"] = "*/*";
    ht["Accept-Encoding"] = "gzip, deflate";
    ht["User-Agent"] = "runscope/0.1";
    ht["Content-Type"] = form.headers["Content-Type"].Replace("\"","");

    WWW www = new WWW(url, form.data, ht);

    This is also a workaround to Generic/unknown HTTP error using UnityWebRequest.

  2. black_coffee

    Mar 09, 2018 17:46

    Still happening in 2017.3.1f1

  3. MaxxRafen

    Feb 14, 2018 16:38

    The first thing to point out is that UnityWebRequest actually returns the response in

    request.downloadHandler.text

    While only returning the general error information in

    request.error
    _____________________________________

    Now if your case is like mine and you upgraded Unity only to have all your networking code break, the error you'll likely see is related to Content-Length

    This is because for both the WWW and UnityWebRequest class now have chunkedTransfer on by default. This appears to screw up how content length is sent over and causes the error.

    While chunkedTransfer can currently be disabled for UnityWebRequest, it cannot be disabled for the WWW class at the time of this writing. For me this meant rewriting all my old network code to use UnityWebRequest instead and set

    myUnityWebRequest.chunkedTransfer = false;

    Note: UnityWebRequest does not currently support POSTs with no data. You still need to use the WWW class for this.

  4. MaxxRafen

    Feb 12, 2018 23:46

    Still get this in 2017.3.0f3

  5. fdfdsgfdgdsg

    Feb 11, 2018 14:08

    I still get this in 2017.3.1f1

    This basically halts production for server based development for everyone concerened.

    Could not use WWW
    Could not use UnityWebRequest
    Both for POST and PUT

    Tried changing content type header.... nothing.

  6. thylaxene

    Jan 30, 2018 04:02

    This isn't fixed. Still getting it in 2017.3.0f3.

  7. avorobjev

    Jan 23, 2018 11:41

    i get same issue in 2017.3.0f3

  8. FaberVi

    Jan 23, 2018 11:17

    i still get this in 2017.3.0p3

  9. Tharis

    Jan 19, 2018 21:17

    I also still get this on 2017.3.0p2

  10. alto971

    Jan 17, 2018 12:55

    same for me here with Unity 2017.3 p2

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.