Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Status: Active » Needs review
FileSize
10.92 KB

This one is a bit more interesting.

Was able to remove the @todo about #1096890: drupal_http_request should return error if reaches max allowed redirects, Guzzle throws an exception here. Speaking of exceptions, not sure what to do with them. openid.module currently doesn't do any kind of logging on errors.

Status: Needs review » Needs work

The last submitted patch, openid-guzzle-1866124-1.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

#1: openid-guzzle-1866124-1.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, openid-guzzle-1866124-1.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

#1: openid-guzzle-1866124-1.patch queued for re-testing.

YesCT’s picture

#1: openid-guzzle-1866124-1.patch queued for re-testing.

Sutharsan’s picture

Status: Needs review » Needs work
+++ b/core/modules/openid/openid.moduleundefined
@@ -595,54 +597,43 @@ function _openid_xrds_discovery($claimed_id) {
+      $client = drupal_container()->get('http_default_client');
...
       // Replace the user-entered claimed_id if we received a redirect.
-      if (!empty($result->redirect_url)) {
-        $claimed_id = openid_normalize($result->redirect_url);
+      if ($location = $response->getLocation()) {
+        $claimed_id = openid_normalize($location);

$response->getLocation() returns the requested location. Only $response->getPreviousResponse()->getLocation() returns the redirection location.

+++ b/core/modules/openid/openid.moduleundefined
@@ -653,14 +644,16 @@ function _openid_xrds_discovery($claimed_id) {
+    } catch (BadResponseException $exception) {
+      // @todo: What to do with the exception here?
+    }

Without any knowledge of the process, we should ignore the notification and open a follow-up issue to evaluate the exception handling.

+++ b/core/modules/openid/openid.moduleundefined
@@ -967,6 +952,9 @@ function openid_verify_assertion($service, $response) {
+    } catch (BadResponseException $exception) {
+      // @todo: What to do with this exception?
+      $valid = FALSE;

See above.

Berdir’s picture

Status: Needs work » Needs review
FileSize
3.42 KB
10.83 KB

Re-roll for the improved exceptions and using Drupal::httpClient()

YesCT’s picture

+++ b/core/modules/openid/openid.moduleundefined
@@ -653,14 +645,16 @@ function _openid_xrds_discovery($claimed_id) {
+    } catch (RequestException $exception) {
+      return;

@@ -706,39 +700,37 @@ function openid_association($op_endpoint) {
+    } catch (RequestException $exception) {
       return FALSE;
     }

#576248: [policy] Coding Standards Update for PHP5

And, #1862538-10: Convert drupal_http_request usage in update.fetch.inc to Guzzle

ParisLiakos’s picture

besides the two following minors seems good

+++ b/core/modules/openid/openid.moduleundefined
@@ -5,6 +5,9 @@
+use Guzzle\Http\Exception\BadResponseException;

we are only catching RequestExceptions so this use is not needed

+++ b/core/modules/openid/openid.moduleundefined
@@ -967,6 +958,8 @@ function openid_verify_assertion($service, $response) {
+    } catch (RequestException $exception) {

missed this catch

Berdir’s picture

Thanks, fixed that.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

if testbot disagrees it ll let us know:)
thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, openid-guzzle-1866124-11.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

#11: openid-guzzle-1866124-11.patch queued for re-testing.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

That was a weird already-installed random fail. Let's try that again. Back to RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
+++ b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.phpundefined
@@ -119,16 +119,14 @@ function testDiscovery() {
+    // Exactly 5 redirects (default value for the max redirects setting).
...
+    $this->addRedirectedIdentity($identity, 2, 'http://example.com/xrds', $expected_claimed_id, 4);
...
+    // Fails because there are more than 5 redirects.
...
+    $this->addRedirectedIdentity($identity, 2, 'http://example.com/xrds', $expected_claimed_id, 5);

This is perhaps the most confusing set of comment/test pairs I've ever seen, since it *looks* like the comments are +1 what the code is doing. However, this is a pre-existing issue, so I guess they must be zero-based?

However, overall, this is eliminating tons of detailed-ly commented code in favour of pretty standard stuff. Looks good here, thanks!

Committed and pushed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.