以下是URL:
https://landfill.bugzilla.org/bugzilla-tip/
在我的代码中,我有这样的代码:
Server server = new Server(host, port, path);
从URL看,什么是host,什么是port,什么是path?方法的输入值是什么?
ubby3x7f1#
主持人landfill.bugzilla.org端口:443(默认)路径:bugzilla-提示https://www.rfc-editor.org/rfc/rfc1738
zour9fqk2#
不幸的是,此问题中的其他答案可能会有些许误导。在此特定示例中,将landfill.bugzilla.org称为host是正确的,但如果端口不是443,则将是不正确的。默认情况下,https://使用端口443,因此您可以在URL中省略它,否则它看起来会像https://landfill.bugzilla.org:443/bugzilla-tip:
landfill.bugzilla.org
host
443
https://
URL
https://landfill.bugzilla.org:443/bugzilla-tip
*协议:https://*主机名:landfill.bugzilla.org*连接埠:443*主机:landfill.bugzilla.org或landfill.bugzilla.org:443(具体取决于以下内容)*主机端口:landfill.bugzilla.org:443*路径:bugzilla-tip
landfill.bugzilla.org:443
bugzilla-tip
host和hostname在所有示例中并不相同。例如,在JavaScript中,location.host将返回www.geeksforgeeks.org:8080,而location.hostname将返回www.geeksforgeeks.org。因此,有时只有在使用协议上的默认端口时,才会“相同”。更多信息:https://www.rfc-editor.org/rfc/rfc1738看看这个:http://bl.ocks.org/abernier/3070589
hostname
location.host
www.geeksforgeeks.org:8080
location.hostname
www.geeksforgeeks.org
8ljdwjyq3#
/bugzilla-tip
更多详情请阅读this
3条答案
按热度按时间ubby3x7f1#
主持人landfill.bugzilla.org
端口:443(默认)
路径:bugzilla-提示
https://www.rfc-editor.org/rfc/rfc1738
zour9fqk2#
不幸的是,此问题中的其他答案可能会有些许误导。在此特定示例中,将
landfill.bugzilla.org
称为host
是正确的,但如果端口不是443
,则将是不正确的。默认情况下,
https://
使用端口443
,因此您可以在URL
中省略它,否则它看起来会像https://landfill.bugzilla.org:443/bugzilla-tip
:*协议:
https://
*主机名:
landfill.bugzilla.org
*连接埠:
443
*主机:
landfill.bugzilla.org
或landfill.bugzilla.org:443
(具体取决于以下内容)*主机端口:
landfill.bugzilla.org:443
*路径:
bugzilla-tip
host
和hostname
在所有示例中并不相同。例如,在JavaScript中,location.host
将返回www.geeksforgeeks.org:8080
,而location.hostname
将返回www.geeksforgeeks.org
。因此,有时只有在使用协议上的默认端口时,才会“相同”。更多信息:https://www.rfc-editor.org/rfc/rfc1738
看看这个:http://bl.ocks.org/abernier/3070589
8ljdwjyq3#
landfill.bugzilla.org
443
(HTTPS)/bugzilla-tip
更多详情请阅读this