diff --git a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
index f977de5..01b2135 100644
--- a/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
+++ b/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
@@ -264,6 +264,33 @@ class OpenIDFunctionalTest extends OpenIDTestBase {
   }
 
   /**
+   * Test that both GET and POST requests from the provider is accepted.
+   */
+  function testResponse() {
+    $this->web_user = $this->drupalCreateUser();
+    $this->drupalLogin($this->web_user);
+
+    // Use a User-supplied Identity that is the URL of an XRDS document.
+    $identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
+    $this->addIdentity($identity);
+    $this->drupalLogout();
+ 
+    $this->submitLoginForm($identity);
+    $this->assertLink(t('Log out'), 0, t('User was logged in.'));
+    $this->drupalLogout();
+
+    variable_set('openid_test_redirect_method', 'post');
+    $this->submitLoginForm($identity);
+    $this->assertTrue(1);
+    // Check we are on the OpenID redirect form.
+    $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
+    // Submit form to the OpenID Provider Endpoint.
+    $this->drupalPost(NULL, array(), t('Send'));
+    $this->assertLink(t('Log out'), 0, t('User was logged in.'));
+    $this->drupalLogout();
+  }
+
+  /**
    * Add OpenID identity to user's profile.
    *
    * @param $identity
diff --git a/core/modules/openid/openid.inc b/core/modules/openid/openid.inc
index 20fffac..13ea391 100644
--- a/core/modules/openid/openid.inc
+++ b/core/modules/openid/openid.inc
@@ -92,7 +92,13 @@ function openid_redirect($url, $message) {
   $output .= "<title>" . t('OpenID redirect') . "</title>\n";
   $output .= "</head>\n";
   $output .= "<body>\n";
+
   $elements = drupal_get_form('openid_redirect_form', $url, $message);
+  // We only use Form API to build the form. It is submitted against the OpenID
+  // Provider, so we remove these hidden fields that are internal to Form API.
+  unset($elements['form_id']);
+  unset($elements['form_build_id']);
+
   $output .= drupal_render($elements);
   $output .= '<script>document.getElementById("openid-redirect-form").submit();</script>' . "\n";
   $output .= "</body>\n";
@@ -550,20 +556,16 @@ function _openid_get_bytes($num_bytes) {
 function _openid_response($str = NULL) {
   $data = array();
 
-  if (isset($_SERVER['REQUEST_METHOD'])) {
-    $data = _openid_get_params($_SERVER['QUERY_STRING']);
-
-    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-      $str = file_get_contents('php://input');
+  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+    $str = file_get_contents('php://input');
 
-      $post = array();
-      if ($str !== FALSE) {
-        $post = _openid_get_params($str);
-      }
-
-      $data = array_merge($data, $post);
+    if ($str !== FALSE) {
+      $data = _openid_get_params($str);
     }
   }
+  elseif (isset($_SERVER['QUERY_STRING'])) {
+    $data = _openid_get_params($_SERVER['QUERY_STRING']);
+  }
 
   return $data;
 }
diff --git a/core/modules/openid/tests/openid_test.module b/core/modules/openid/tests/openid_test.module
index 89f3ddf..8333c35 100644
--- a/core/modules/openid/tests/openid_test.module
+++ b/core/modules/openid/tests/openid_test.module
@@ -344,9 +344,14 @@ function _openid_test_endpoint_authenticate() {
     $response['openid.sig'] = _openid_signature($association, $response, $keys_to_sign);
   }
 
-  // Put the signed message into the query string of a URL supplied by the
-  // Relying Party, and redirect the user.
-  return new RedirectResponse(url($_REQUEST['openid_return_to'], array('query' => $response, 'external', TRUE)));
+  // Redirect the user back to the Relying Party using an HTTP redirect or a
+  // POST form submission.
+  if (variable_get('openid_test_redirect_method', 'get') == 'get') {
+    openid_redirect_http($_REQUEST['openid_return_to'], $response);
+  }
+  else {
+    openid_redirect($_REQUEST['openid_return_to'], $response);
+  }
 }
 
 /**
