0

今日、それが有効な URL であるかどうかについて同僚と議論しましたhttp://domain.com?some_param=1。URL 構造を定義する RFC は、それが無効な構造であることを明示的に述べていません。RFC 1738のパート 3.3によると

If neither <path> nor <searchpart> is present, the "/" may also be omitted.

ただし、同じドキュメントのパート 3.1 の最後に、

Note that the "/" between the host (or port) and the url-path is  NOT part of the url-path.

curl を調べてみると、興味深いことがわかりました

$ curl -v -I http://stackoverflow.com?test
* Rebuilt URL to: http://stackoverflow.com/?test
...

それで、質問は

これは有効な URL ですか?http://domain.com?some_param=1

4

1 に答える 1