Search Unity

[Fixed] UnityWebRequest redirection related bugs

Discussion in 'Scripting' started by Novack, Dec 15, 2015.

  1. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    I was getting an issue using the UnityWebRequest.Post method, described on this thread.

    I finally found the root of the problem, that opens two clear issues on the new UnityWebRequest api, and a third problem related to insuficient resources on it.

    1) [Case 751794]

    UnityWebRequest.redirectLimit is not working as expected for -at least- the UnityWebRequest.Post() method.

    The docs read about redirectLimit:

    If you wish to disable redirects altogether, set this property to zero.

    However, doing a POST request using UnityWebRequest.Post(), will follow 302 redirects regardless of UnityWebRequest.redirectLimit = 0;

    2) [Case 751798]

    UnityWebRequest.Post() asumes redirections maintain the POST method, when it may not be the case.

    In my original issue the initial request was using POST, but the redirection was expecting a GET request. Ie, using POST, then the second hop in the redirection for the 302 expects a GET request. Im not sure this is compliant with the standard, but is the reality of the vast majority of 302 implementations out there (ie: in my case is a Google web service redirection).

    3) [Case 751799]


    There is no way of dumping or inspecting the complete (final) request that is being sent, and thus, issues are very tricky to track down. Also there is no way of knowing about the redirections that are happening. UnityWebRequest.responseCode only holds the latest. Even using the LLAPI it still feels like a blackbox.


    Final Notes:
    • In the bug reports, I included a web service for testing this issues. Its a Google webapp.
    • I originally raised a bug for my initial issue [Case 750104], yet it is outdated and should be ignored or linked to one of the issues described above.
     
  2. Justinas

    Justinas

    Unity Technologies

    Joined:
    Sep 25, 2013
    Posts:
    12
    Now that the festivities have ended, I will fix those bugs as soon as I can. Thank you for the reports.
     
    Novack likes this.
  3. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Thanks man!
     
  4. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    @Justinas two months have passed since last comment, any news regarding this issues?
     
  5. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    We are half a week from the Unity 5.4 release date, and still no answer, feedback, news or comments about this issues.

    Anyone can offer any info?
     
  6. iyc

    iyc

    Joined:
    Jul 29, 2014
    Posts:
    11
    @Justinas I'm having same trouble that redirectLimit is not working when set to zero!
    It's long since this issue was posted and still not fixed at 5.3.4.

    Also I found that redirectLimit = 1 is working properly, and redirectLimit = 0 ended up with infinite redirecting.
    Document says that negative value will redirect infinitely, so I think the problem is that Unity is mistakenly treating zero same as negative value.

    I'm hoping for fix ASAP because I wan't to get intermediate state of redirecting.
     
  7. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Today Unity beta 5.4.0b12 is out, and the release notes read:

    Web: WebRequest interface was promoted from UnityEngine.Experimental.Networking to UnityEngine.Networking. Unity 5.2 and 5.3 projects that use UnityWebRequest will have to be updated.

    But three and a half months after reporting the issues described on this thread, there is no feedback or comments on what is going on.

    Once more, I ask: anyone from Unity could give us some comments on progress on this issues?
     
  8. Chris-HG

    Chris-HG

    Joined:
    Aug 10, 2012
    Posts:
    63
    I also continue to have issues with UnityWebRequest in 5.3.4.
    I will have to try 5.4 and either report a bug.
     
  9. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    Today Patch Release 5.3.4p5 is out.

    The changelog reads:

    (751798) - UnityWebRequest: Downgrade to HTTP GET on 302 and 303 redirect codes
    (751794) - UnityWebRequest: Honor negative redirectLimit.

    So after updating to the patch release and testing I can confirm at least 751798 is fixed and working. I have not tested the redirectLimit issue (751794) so if anyone have the time please give it a try.

    Edit: tested 751794, and the redirectLimit parameter is also working as expected.
     
    Last edited: Apr 29, 2016
    devon_b likes this.