Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the URL parameters? (element at position #3 in urlparse result)

I've taken a look to urlparse.urlparse method documentation and I'm a little bit confused about what is the parameters part (not to be confused with the more familiar query part, that is what goes after the question mark and before the fragment part).

Wikipedia entry on URL's structure doesn't say anything about that, so could please anybody elaborate a little bit on this and possibly give some examples?

like image 292
fortran Avatar asked Jun 11 '12 23:06

fortran


People also ask

What are the parameters used in the URL?

What Are URL Parameters? Also known by the aliases of query strings or URL variables, parameters are the portion of a URL that follows a question mark. They are comprised of a key and a value pair, separated by an equal sign. Multiple parameters can be added to a single page by using an ampersand.

How many parameters does a URL have?

1000 parameters is the maximum by default. This default can be customized in the HTTP Protocol Validation Policy. An attacker would use exceptionally long parameter names or values for three different purposes: To launch an overflow attack against the data structure that stores the parameters as name-value pairs.

What is URL parameters HTML?

URL parameters (also called query string parameters or URL variables) are used to send small amounts of data from page to page, or from client to server via a URL. They can contain all kinds of useful information, such as search queries, link referrals, product information, user preferences, and more.

How do I find the parameters in a URL?

To identify a URL parameter, refer to the portion of the URL that comes after a question mark (?). URL parameters are made of a key and a value, separated by an equal sign (=). Multiple parameters are each then separated by an ampersand (&).


2 Answers

Wow... I was not aware of that, see example:

>>> urlparse.urlparse("http://some.page.pl/nothing.py;someparam=some;otherparam=other?query1=val1&query2=val2#frag") ParseResult(scheme='http', netloc='some.page.pl', path='/nothing.py', params='someparam=some;otherparam=other', query='query1=val1&query2=val2', fragment='frag') 

And help(urlparse.urlparse):

Help on function urlparse in module urlparse:  urlparse(url, scheme='', allow_fragments=True)     Parse a URL into 6 components:     <scheme>://<netloc>/<path>;<params>?<query>#<fragment>     Return a 6-tuple: (scheme, netloc, path, params, query, fragment).     Note that we don't break the components up in smaller bits     (e.g. netloc is a single string) and we don't expand % escapes. 
like image 102
ddzialak Avatar answered Sep 24 '22 06:09

ddzialak


fascinating, this is the first time I've encounter them, found this
http://doriantaylor.com/policy/http-url-path-parameter-syntax I also found this https://www.rfc-editor.org/rfc/rfc3986#section-3.3 (last paragraph before query) and this http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/

their rarely used, I think their meant to attach certain properties to paths .. maybe even control which version of segment you want to use, but this is just a hunch ... either way thank you, for bringing it up.

like image 36
Samy Vilar Avatar answered Sep 22 '22 06:09

Samy Vilar