Opened 11 years ago

Last modified 22 months ago

#1569 enhancement assigned

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

Reported by: David Reid Owned by:
Priority: high Milestone:
Component: web Keywords:
Cc: David Reid, 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 11 years ago by David Reid

Owner: changed from foom to David Reid

comment:2 Changed 11 years ago by David Reid

Cc: David Reid added
Owner: changed from David Reid to Wilfredo Sánchez Vega
Priority: normalhigh

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 Changed 11 years ago by David Reid

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 11 years ago by Wilfredo Sánchez Vega

Cc: Wilfredo Sánchez Vega added

comment:5 Changed 10 years ago by Wilfredo Sánchez Vega

Status: newassigned

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 Wilfredo Sánchez Vega

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 6 years ago by Jean-Paul Calderone

Component: web2web

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 6 years ago by <automation>

Owner: Wilfredo Sánchez Vega deleted

comment:10 Changed 22 months ago by Wilfredo Sánchez Vega

Cc: Wilfredo Sánchez Vega removed
Note: See TracTickets for help on using tickets.