#18314: request.build_absolute_uri() functions incorrectly when the path starts with // -------------------------------+------------------------------------ Reporter: anonymous | Owner: yoyoma Type: Bug | Status: reopened Component: HTTP handling | Version: 1.4 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 1 | UI/UX: 0 -------------------------------+------------------------------------
Comment (by yoyoma): Replying to [comment:6 abhaga]: > Since the original function as well as your patch is using {{{self.path}}} to construct the {{{base_uri}}}, query parameters are not preserved anyway. So branching doesn't serve any purpose. > One simpler way is to strip out the additional slashes in the beginning of {{{self.path}}} in this function. It may be better to do that where the request is initialized. That is incorrect. {{{location}}}, if provided or not is joined with the {{{base_uri}}}, and when not provided is built using [https://docs.djangoproject.com/en/dev/ref/request- response/#django.http.HttpRequest.get_full_path request.get_full_path()]. This happens in both my patch and the original. {{{ >>> from urlparse import urljoin >>> urljoin('http://www.example.com/foo/', 'http://www.example.com/foo/?bar=baz') 'http://www.example.com/foo/?bar=baz' }}} Regarding the usage of {{{basestring.format()}}}, I'll provide an updated patch which uses string interpolation. -- Ticket URL: <https://code.djangoproject.com/ticket/18314#comment:8> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.