diff --git a/django/http/__init__.py b/django/http/__init__.py
index 2bad146..0c752e6 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -10,7 +10,7 @@ import warnings
 from io import BytesIO
 from pprint import pformat
 from urllib import urlencode, quote
-from urlparse import urljoin, parse_qsl
+from urlparse import urljoin, urlsplit, parse_qsl
 
 import Cookie
 # Some versions of Python 2.7 and later won't need this encoding bug fix:
@@ -86,8 +86,6 @@ from django.utils import timezone
 
 RESERVED_CHARS="!*'();:@&=+$,/?%#[]"
 
-absolute_http_url_re = re.compile(r"^https?://", re.I)
-
 class Http404(Exception):
     pass
 
@@ -205,15 +203,30 @@ class HttpRequest(object):
 
     def build_absolute_uri(self, location=None):
         """
-        Builds an absolute URI from the location and the variables available in
-        this request. If no location is specified, the absolute URI is built on
-        ``request.get_full_path()``.
+        Builds an absolute URI, using location and/or variables available in
+        the request, and returns it.
+
+        If ``location`` is provided and is absolute, it is simply converted to
+        an RFC 3987 compliant URI and returned.
+
+        If ``location`` is provided but is does not provide both a scheme and
+        domain, it is urljoined to a base URL constructed from the request
+        variables.
         """
         if not location:
-            location = self.get_full_path()
-        if not absolute_http_url_re.match(location):
-            current_uri = '%s://%s%s' % (self.is_secure() and 'https' or 'http',
-                                         self.get_host(), self.path)
+            # Make it an absolute url (but schemeless and domainless) for the
+            # edge case that the path starts with '//'.
+            location = '//%s' % self.get_full_path()
+        bits = urlsplit(location)
+        if not bits.scheme or not bits.netloc:
+            current_uri = '%(scheme)s://%(host)s%(path)s' % {
+                'scheme': 'https' if self.is_secure() else 'http',
+                'host': self.get_host(),
+                'path': self.path
+            }
+            # Join the constructed URL with the provided location, which will
+            # allow the provided ``location`` to apply query strings to the
+            # base path as well as override the host, if it begins with //
             location = urljoin(current_uri, location)
         return iri_to_uri(location)
 
@@ -750,4 +763,3 @@ def str_to_unicode(s, encoding):
         return unicode(s, encoding, 'replace')
     else:
         return s
-
diff --git a/tests/regressiontests/http/__init__.py b/tests/regressiontests/http/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/regressiontests/http/models.py b/tests/regressiontests/http/models.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/regressiontests/http/tests.py b/tests/regressiontests/http/tests.py
new file mode 100644
index 0000000..8da954a
--- /dev/null
+++ b/tests/regressiontests/http/tests.py
@@ -0,0 +1,65 @@
+from django.utils import unittest
+from django.test.client import RequestFactory
+
+
+class HttpRequestTestCase(unittest.TestCase):
+    """
+    Regression tests for ticket #18314.
+    """
+    def setUp(self):
+        """
+        Attaches a request factory.
+        """
+        self.factory = RequestFactory()
+
+    def test_build_absolute_uri_no_location(self):
+        """
+        Ensures that ``request.build_absolute_uri()`` returns the proper value
+        when the ``location`` argument is not provided, and ``request.path``
+        begins with //.
+        """
+        # //// is needed to create a request with a path beginning with //
+        request = self.factory.get('////django-ate-my-baby')
+        self.assertEqual(
+            request.build_absolute_uri(),
+            'http://testserver//django-ate-my-baby'
+        )
+
+    def test_build_absolute_uri_absolute_location(self):
+        """
+        Ensures that ``request.build_absolute_uri()`` returns the proper value
+        when an absolute URL ``location`` argument is provided, and
+        ``request.path`` begins with //.
+        """
+        # //// is needed to create a request with a path beginning with //
+        request = self.factory.get('////django-ate-my-baby')
+        self.assertEqual(
+            request.build_absolute_uri(location='http://example.com/?foo=bar'),
+            'http://example.com/?foo=bar'
+        )
+
+    def test_build_absolute_uri_schema_relative_location(self):
+        """
+        Ensures that ``request.build_absolute_uri()`` returns the proper value
+        when a schema-relative URL ``location`` argument is provided, and
+        ``request.path`` begins with //.
+        """
+        # //// is needed to create a request with a path beginning with //
+        request = self.factory.get('////django-ate-my-baby')
+        self.assertEqual(
+            request.build_absolute_uri(location='//example.com/?foo=bar'),
+            'http://example.com/?foo=bar'
+        )
+
+    def test_build_absolute_uri_relative_location(self):
+        """
+        Ensures that ``request.build_absolute_uri()`` returns the proper value
+        when a relative URL ``location`` argument is provided, and
+        ``request.path`` begins with //.
+        """
+        # //// is needed to create a request with a path beginning with //
+        request = self.factory.get('////django-ate-my-baby')
+        self.assertEqual(
+            request.build_absolute_uri(location='/foo/bar/'),
+            'http://testserver/foo/bar/'
+        )
