From 82e34f1683f67b8394306b1569260508a213b99e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 17 Jun 2015 14:41:28 -0700 Subject: https://jira.secondlife.com/browse/MAINT-5283 The default behavior in the HTTP layer changed to follow redirects automatically. This was causing a problem with connecting to the SL share service which was attempting to riderect to the login page at the CURL level. Connections to SL Share will no longer redirect, corrected for Facebook, Flickr and Twitter. --- indra/newview/llfacebookconnect.cpp | 18 +++++++++++++++--- indra/newview/llflickrconnect.cpp | 23 ++++++++++++++++------- indra/newview/lltwitterconnect.cpp | 23 ++++++++++++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index a295910379..29c5d0c673 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,6 +144,7 @@ void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string aut } httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); @@ -220,6 +221,7 @@ void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLFacebookConnect::FB_POSTING); @@ -243,6 +245,7 @@ void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); std::string imageFormat; if (dynamic_cast(image.get())) @@ -307,10 +310,12 @@ void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFacebookConnect::FB_DISCONNECTING); + httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection")); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -340,10 +345,13 @@ void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool aut LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true)); + httpOpts->setFollowRedirects(false); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -389,6 +397,7 @@ void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts); @@ -429,8 +438,11 @@ void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FacebookConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + + httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true)); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index b3c89b9798..4ec3344b48 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -73,9 +73,10 @@ void LLFlickrConnect::flickrConnectCoro(LLCoros::self& self, std::string request LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FlickrConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD body; if (!requestToken.empty()) @@ -162,9 +163,10 @@ void LLFlickrConnect::flickrShareCoro(LLCoros::self& self, LLSD share) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FlickrConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLFlickrConnect::FLICKR_POSTING); @@ -185,10 +187,11 @@ void LLFlickrConnect::flickrShareImageCoro(LLCoros::self& self, LLPointersetWantHeaders(true); + httpOpts->setFollowRedirects(false); std::string imageFormat; if (dynamic_cast(image.get())) @@ -263,10 +266,12 @@ void LLFlickrConnect::flickrDisconnectCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FlickrConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFlickrConnect::FLICKR_DISCONNECTING); + httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFlickrConnectURL("/connection")); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFlickrConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -295,10 +300,13 @@ void LLFlickrConnect::flickrConnectedCoro(LLCoros::self& self, bool autoConnect) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FlickrConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); setConnectionState(LLFlickrConnect::FLICKR_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/connection", true)); + httpOpts->setFollowRedirects(false); + + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/connection", true), false); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -342,9 +350,10 @@ void LLFlickrConnect::flickrInfoCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("FlickrConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/info", true), httpOpts); diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index 24555b007a..3ad7a58bdc 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -73,9 +73,10 @@ void LLTwitterConnect::twitterConnectCoro(LLCoros::self& self, std::string reque LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD body; if (!requestToken.empty()) @@ -162,9 +163,10 @@ void LLTwitterConnect::twitterShareCoro(LLCoros::self& self, std::string route, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); setConnectionState(LLTwitterConnect::TWITTER_POSTING); @@ -184,10 +186,11 @@ void LLTwitterConnect::twitterShareImageCoro(LLCoros::self& self, LLPointersetWantHeaders(true); + httpOpts->setFollowRedirects(false); std::string imageFormat; if (dynamic_cast(image.get())) @@ -250,10 +253,13 @@ void LLTwitterConnect::twitterDisconnectCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + + httpOpts->setFollowRedirects(false); setConnectionState(LLTwitterConnect::TWITTER_DISCONNECTING); - LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getTwitterConnectURL("/connection")); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getTwitterConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -282,10 +288,12 @@ void LLTwitterConnect::twitterConnectedCoro(LLCoros::self& self, bool autoConnec LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); + httpOpts->setFollowRedirects(false); setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/connection", true)); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/connection", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -329,9 +337,10 @@ void LLTwitterConnect::twitterInfoCoro(LLCoros::self& self) LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TwitterConnect", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions, false); httpOpts->setWantHeaders(true); + httpOpts->setFollowRedirects(false); LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/info", true), httpOpts); -- cgit v1.2.3