From 6586b7646585d34b878bda18155a37e5eec729cb Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 5 Sep 2009 13:05:31 +0000 Subject: =?UTF-8?q?-=20Patch=20by=20#1577=20by=20chx,=20boombatower,=20B?= =?UTF-8?q?=C3=A8r=20Kessels,=20kkaefer:=20made=20SSL=20support=20a=20bit?= =?UTF-8?q?=20easier=20by=20providing=20two=20cookies=20and=20...=20hook?= =?UTF-8?q?=5Fgoto=5Falter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/simpletest/drupal_web_test_case.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'modules/simpletest/drupal_web_test_case.php') diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 41abb195c..f9789fe2f 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1310,13 +1310,19 @@ class DrupalWebTestCase extends DrupalTestCase { call_user_func_array(array(&$this, 'error'), unserialize(urldecode($matches[1]))); } - // Save the session cookie, if set. - if (preg_match('/^Set-Cookie: ' . preg_quote($this->session_name) . '=([a-z90-9]+)/', $header, $matches)) { - if ($matches[1] != 'deleted') { - $this->session_id = $matches[1]; - } - else { - $this->session_id = NULL; + // Save cookies. + if (preg_match('/^Set-Cookie: ([^=]+)=(.+)/', $header, $matches)) { + $name = $matches[1]; + $parts = array_map('trim', explode(';', $matches[2])); + $value = array_shift($parts); + $this->cookies[$name] = array('value' => $value, 'secure' => in_array('secure', $parts)); + if ($name == $this->session_name) { + if ($value != 'deleted') { + $this->session_id = $value; + } + else { + $this->session_id = NULL; + } } } -- cgit v1.2.3