Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1011
diff -u -p -r1.1011 common.inc
--- includes/common.inc	9 Oct 2009 16:33:13 -0000	1.1011
+++ includes/common.inc	10 Oct 2009 04:10:26 -0000
@@ -552,6 +552,14 @@ function drupal_parse_url($url) {
       $options['fragment'] = $parts['fragment'];
     }
   }
+  // If Clean URLs are disabled, then we may parse a URL generated by url(),
+  // which means we need to move the path in the query parameter 'q' into the
+  // 'path' key.
+  // @todo Add a Clean URL check?
+  if (isset($options['query']['q'])) {
+    $options['path'] = $options['query']['q'];
+    unset($options['query']['q']);
+  }
 
   return $options;
 }
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.82
diff -u -p -r1.82 common.test
--- modules/simpletest/tests/common.test	9 Oct 2009 08:08:56 -0000	1.82
+++ modules/simpletest/tests/common.test	10 Oct 2009 04:05:15 -0000
@@ -120,6 +120,17 @@ class CommonURLUnitTest extends DrupalUn
       'fragment' => 'foo',
     );
     $this->assertEqual(drupal_parse_url($url), $result, t('External URL parsed correctly.'));
+
+    // The tricky part: Absolute URL with clean URLs disabled.
+    // A URL like this must be properly handled, but can also appear as
+    // 'destination' query parameter. Especially, due to dynamic HTTPS support.
+    $url = $GLOBALS['base_url'] . '/?q=foo/bar&bar=baz#foo';
+    $result = array(
+      'path' => 'foo/bar',
+      'query' => array('bar' => 'baz'),
+      'fragment' => 'foo',
+    );
+    $this->assertEqual(drupal_parse_url($url), $result, t('Absolute URL with clean URLs disabled parsed correctly.'));
   }
 
   /**
