I was unable to get my signature to validate after switching from Apache to IIS. The problem was traced down to the OAuth.php file at line 292 where the $_SERVER['QUERY_STRING'] parameter was added.

For some reason, the q parameter does not exist when in Apache and using the Drupal Services module but in IIS, the $_SERVER['QUERY_STRING'] contained the relative path of my Drupal service endpoint which resulted in an additional q parameter added to my signature base string.

This extra parameter resulted in a different signature generated by the OAuth module which did not match the signature I generated since it does not have the extra query parameter. Can anybody confirm if this is an IIS problem or am I doing something wrong? The only change I did was to move from Apache to IIS and updated my OAuth module from 3.0 to 3.1 then this problem cropped up in my IIS Drupal setup.

Comments

Hiller’s picture

To fix this i've added the following code to
mymodule_init():

if(isset($_SERVER['HTTP_X_ORIGINAL_URL']))
        $_SERVER['QUERY_STRING']=preg_replace('/^.+\\?/', '', $_SERVER['HTTP_X_ORIGINAL_URL']);

This is for microsoft url rewrite module. for others just use their variables to get original url string