Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can any path segments of a URI have a query component?

According to the Section 3.3, Path Component of RFC2396 - Uniform Resource Identifiers,

The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved. Each path segment may include a sequence of parameters, indicated by the semicolon ";" character. The parameters are not significant to the parsing of relative references.

However, I have never seen a URL with a query parameters in any segment other than the final one. So, I am not sure if I am reading this correctly.

Is http://www.url.com/segment1?seg1param1=val1/page.html?pageparam1=val2 a valid URL?

like image 775
smartcaveman Avatar asked Jun 22 '11 18:06

smartcaveman


People also ask

What is URI path segment?

What are URL segments? URL segments are the parts of a URL or path delimited by slashes. So if you had the path /path/to/page/ then "path", "to", and "page" would each be a URL segment. But ProcessWire actually uses the term "URL segments" to refer to the extra parts of that URL/path that did not resolve to a page.

What is path segments?

A Path Segment is defined to uniquely identify an SR path in an SR-MPLS network in the context of the egress node. It is normally used by the egress nodes for path identification hence to support various use-cases including SR path PM, end-to-end 1+1 SR path protection, and bidirectional SR paths correlation. 1.1.


1 Answers

What the RFC is referring to is something like this:

http://www.example.com/foo/bar;param=value/baz.html

That could be interpreted as the path /foo/bar/baz.html with the parameter param=value to the bar segment. No question marks are used.

Note that RFC 2396 has been obsoleted by RFC 3986, which omits specification of segment-specific parameters in favor of a general note that implementations can (and do) do different things to embed segment-specific parameters:

Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax. URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents. For example, the semicolon (";") and equals ("=") reserved characters are often used to delimit parameters and parameter values applicable to that segment. The comma (",") reserved character is often used for similar purposes. For example, one URI producer might use a segment such as "name;v=1.1" to indicate a reference to version 1.1 of "name", whereas another might use a segment such as "name,1.1" to indicate the same. Parameter types may be defined by scheme-specific semantics, but in most cases the syntax of a parameter is specific to the implementation of the URI's dereferencing algorithm.

like image 198
Anomie Avatar answered Oct 07 '22 01:10

Anomie