问题原文
原帖链接 · abdul rashid · CC BY-SA 4.0
Why every browsers/internet clients defaults to :80 when you just type http://example.com
I mean It took time for me to know browsers internally always add port :80
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 4.0
The HTTP specification says so in section 3.2.2:
If the port is empty or not given, port 80 is assumed.
This is something that has been a part of HTTP since it was invented by Tim Berners-Lee. He chose the default port and allowed URLs to omit :80 to let it be the default. This was done presumably to make URLs cleaner.
HTTPS has a similar default port: port 443.
These kinds of technical details are useful to know if you are a webmaster. You might need to know them to configure a webserver or router. If you are at the level where this matters to you, you would probably find many other tidbits in the HTTP spec that would interest you. You should read it.
However, it is good that these details are typically hidden from users. URLs are confusing enough as it is. Users don't even need to know what a port is, let alone which one any particular URL is using.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
