(二)HTTP URI

2018-03-29  本文已影响14人  捞小虾

Author: Xu FC

URL


scheme:[//[user[:password]@]host[:port]][[/path][;params]][?query][#fragment]

HTTP URI


http-URI = "http:" "//" authority path-abempty [ "?" query ][ "#" fragment ]

示例:

http://example.com/path/to/myfile.html?key1=value1&key2=value2#chapter1
https://192.168.1.100:8080/path;id=1234567890
http://[2018:5::17]:8080/mypath;/path/to
request-target = origin-form
                    / absolute-form
                    / authority-form
                    / asterisk-form
origin-form    = absolute-path [ "?" query ]

示例: http://www.test.com/path?query=value

GET /path?query=value HTTP/1.1
Host: www.test.com

URI 不能为空,如果请求为 http://www.test.com,请求的 URI 为 / ,即:

GET / HTTP/1.1
Host: www.test.com

absolute-form  = absolute-URI

示例:http://www.test.com/path?query=value

GET http://www.test.com/path?query=value HTTP/1.1
Host: www.test.com

authority-form = authority

示例:

CONNECT www.test.com:80 HTTP/1.1
Host: www.test.com:80

asterisk-form = "*"

型号 URI 只支持 OPTIONS method, 表示请求服务器支持的 methods。

root@ads_test_client_1:/home/test/test_scripts# telnet 192.168.1.100 80
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
OPTIONS * HTTP/1.1
Host: 192.168.1.100


P.S.

一些厂家并不严格遵守RFC规范,设计出各种各样的URL,比如以下为微软产品支持的URL:

微软的报表服务器:
http://myrshost/reportserver?/Sales/YearlySalesByCategory&rs:Command=Render
微软的SharePoint:
http://myspsite/subsite/_vti_bin/reportserver?http://myspsite/subsite/Sales/YearlySalesByCategory&rs:Command=Render
上一篇下一篇

猜你喜欢

热点阅读