Opened 10 years ago

Last modified 14 months ago

#1569 enhancement assigned

IRequest should have a uri object for accessing and mangling the requested uri

Reported by: dreid Owned by:
Priority: high Milestone:
Component: web Keywords:
Cc: dreid, jknight Branch:


Currently IRequest contains several attributes which are used to access the requested uri. These attributes should be replaced by a single uri attribute which is an instance of a class similar to [source:trunk/twisted/python/ twisted.python.urlpath.URLPath].

There are probably a couple of reasons not to just drop in URLPath most notably there is no method to modify query args and the netloc is stored as a host:port string

Change History (10)

comment:1 Changed 10 years ago by dreid

  • Owner changed from foom to dreid

comment:2 Changed 10 years ago by dreid

  • Cc dreid added
  • Owner changed from dreid to wsanchez
  • Priority changed from normal to high

From #1779

We should use URLPath everywhere we deal with URLs.

getHeader() on the Destination and Location headers should return URLPaths. We should be able to get rid of the web2.dav.util functions that deal with URL strings.

comment:3 follow-up: Changed 10 years ago by dreid

Things URLPath should be made to do. 1) Split host:port from netloc 2) Allow modification of query arguments. 3) Collapse empty segments (http://localhost:8080//////// see #1570)

comment:4 Changed 10 years ago by wsanchez

  • Cc wsanchez added

comment:5 Changed 10 years ago by wsanchez

  • Status changed from new to assigned

comment:6 in reply to: ↑ 3 Changed 10 years ago by jknight

  • Cc jknight added

Replying to dreid:

3) Collapse empty segments (http://localhost:8080//////// see #1570)

Boo hiss. Empty segments should not be removed. Just because they are empty doesn't mean they aren't there. http://localhost:8080//////// is a distinct url from http://localhost:8080/, don't get them confused with eachother.

comment:7 Changed 10 years ago by wsanchez

Agreed, '/' is not a special character in HTTP; collections and resource hierarchies are a WebDAV thing.  That web2 is using segments underneath the covers shouldn't be leaking into the protocol level.

For file systems, empty segments usually get collapsed (any cases where they aren't?) but that's specific to file systems; a dynamic resource is welcome to treat empty segments as significant.  So any such collapsing logic should live in static.File.

I'm in favor of static.File doing some file system-specific canonicalization via redirects; it makes sense to do so for case-insensitive filesystems as well, so that resources are canonically mapped to one URI rather than many (which is helpful for caches, etc.).

comment:8 Changed 5 years ago by exarkun

  • Component changed from web2 to web

We're not going to do this for web2 (see #4821) but we should fix the similar problem with twisted.web.iweb.IRequest.

comment:9 Changed 5 years ago by <automation>

  • Owner wsanchez deleted

comment:10 Changed 14 months ago by wsanchez

  • Cc wsanchez removed
Note: See TracTickets for help on using tickets.