Ticket #272 (closed defect: duplicate)

Opened 3 months ago

Last modified 3 months ago

Auth_Yadis_Yadis.discovery() fails in the case of 206 response code

Reported by: =hdknr Assigned to:
Priority: major Milestone: Bugfix Release
Keywords: Range Cc:
Project: php-openid OpenID Protocol:
Series: 2.x.x Web Browser:

Description

With ParanoidHTTPFetcher.php, it receives 206 Partial Content because the curl library uses Range request header. I'm not quite sure if PHP runtime is bad or apache httpd server does on my CentOS 5.1.

I fixed following code to Yadis.php and works file so far.

--- Yadis.php   2008-06-30 17:42:16.000000000 +0900
+++ Yadis.php.modify    2008-06-30 17:35:41.000000000 +0900
@@ -317,6 +317,11 @@
      * Auth_Yadis_Yadis, depending on whether the discovery
      * succeeded.
      */
+    function is_valid_response_code($code)
+    {
+       return in_array($code,array(200,201,202,203,204,205,206));
+    }
+
     function discover($uri, &$fetcher,
                       $extra_ns_map = null, $timeout = 20)
     {
@@ -332,7 +337,8 @@

         $response = $fetcher->get($uri, $headers);

-        if (!$response || ($response->status != 200)) {
+        if (!$response &&
+               $result->is_valid_response_code($response->status )){
             $result->fail();
             return $result;
         }
@@ -361,7 +367,8 @@

                 $response = $fetcher->get($yadis_location);

-                if ((!$response) || ($response->status != 200)) {
+                if (!$response &&
+                       $result->is_valid_response_code($response->status )){
                     $result->fail();
                     return $result;
                 }
@@ -378,4 +385,3 @@
 }

 ?>
-

Change History

06/30/08 10:58:53 changed by http://keturn.myopenid.com/

  • status changed from new to closed.
  • resolution set to duplicate.

Fixed in version 2.1.1, released 2008-06-27.