Why do some query strings work even if parameters are not URL-encoded?

前端 未结 3 982
盖世英雄少女心
盖世英雄少女心 2020-12-03 16:54

Here\'s an example:

https://drive.google.com/viewerng/viewer?embedded=true&url=http://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_

3条回答
  •  一生所求
    2020-12-03 17:06

    This is from the relevant RFC, 1738:

    https://www.ietf.org/rfc/rfc1738.txt

    3.3. HTTP

    The HTTP URL scheme is used to designate Internet resources
    accessible using HTTP (HyperText Transfer Protocol).

    The HTTP protocol is specified elsewhere. This specification only
    describes the syntax of HTTP URLs.

    An HTTP URL takes the form:

      http://:/?
    

    where and are as described in Section 3.1. If : is omitted, the port defaults to 80. No user name or password is
    allowed. is an HTTP selector, and is a query
    string. The is optional, as is the and its
    preceding "?". If neither nor is present, the "/" may also be omitted.

    Within the and components, "/", ";", "?" are
    reserved. The "/" character may be used within HTTP to designate a
    hierarchical structure.

    The special characters in "http://" only apply to the "protocol" specification at the start of the URL. It's optional in most browsers (implicitly "http://").

    The first "?" separates the "path" from the "searchpart". Each "&" separates different arguments in the "searchpart".

    Your browser should differentiate between ?embedded=true and &url=http://www.pdf995.com/samples/pdf.pdf.

    'Hope that helps

提交回复
热议问题