New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException if redirect location is relative #80
Comments
From yan...@google.com on April 23, 2012 16:28:03 http://tools.ietf.org/html/rfc2616#section-14.30 According to the specification, the Location field points to an absolute URI, which indicates to me that a relative URL would be incompatible with the specification. However, note this comment in wikipedia.org: http://en.wikipedia.org/wiki/HTTP_location http://en.wikipedia.org/wiki/URL_redirection#Using_server-side_scripting_for_redirection "While the internet standard RFC 1945 (HTTP 1.0) requires a complete absolute URI for redirection,[2][3] the most popular web browsers tolerate the passing of a relative URL as the value for a Location header.[citation needed]" I tried it in Chrome and it works there. So it seems reasonable to try to tolerate it in the client library as well. Status: Accepted |
From yan...@google.com on October 24, 2012 10:39:57 Owner: ngmic...@google.com |
From yan...@google.com on December 13, 2012 06:38:11 Labels: -Milestone-Version1.13.0 Milestone-Version1.14.0 |
From yan...@google.com on January 09, 2013 12:50:08 Owner: yan...@google.com |
From yan...@google.com on January 09, 2013 14:08:09 https://codereview.appspot.com/7058067/ Status: Started |
From yan...@google.com on January 14, 2013 12:08:46 Status: Fixed |
From mingfai...@gmail.com on February 23, 2013 02:53:42 The fix cannot handle relative path redirect for empty path URL, @see https://code.google.com/p/google-http-java-client/issues/detail?id=201 |
From yan...@google.com on March 11, 2013 04:58:38 Issue 198 has been merged into this issue. |
From esch...@gmail.com on March 28, 2012 00:23:53
Version of google-http-java-client (e.g. 1.5.0-beta)? 1.7.0-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Java 6 Describe the problem. Retrieving URL which redirects to local page using relative links leads to NPE
Example URL: http://vkontakte.ru/share.php?url=http://habr.ru/p/140827/ Code:
HttpTransport transport = new NetHttpTransport();
GenericUrl url = new GenericUrl(" http://vkontakte.ru/share.php?url=http://habr.ru/p/140827/"); HttpRequest request = transport.createRequestFactory().buildGetRequest(url);
HttpResponse response = request.execute();
Exception:
Exception in thread "main" java.lang.NullPointerException
at com.google.api.client.http.GenericUrl.(GenericUrl.java:104)
at com.google.api.client.http.HttpRequest.handleRedirect(HttpRequest.java:864)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:827)
at Service.getPageContent(Service.java:64) How would you expect it to be fixed? I think redirect url should be constructed using current request
Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=80
The text was updated successfully, but these errors were encountered: