30

Here is the URL:

https://landfill.bugzilla.org/bugzilla-tip/

In my code I have this:

Server server = new Server(host, port, path);

From the URL, what is host, what is port and what is path? What are the input values of the method?

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
petko_stankoski
  • 10,459
  • 41
  • 127
  • 231

4 Answers4

31

Host: landfill.bugzilla.org

Port: 443 (default)

Path: bugzilla-tip

https://www.rfc-editor.org/rfc/rfc1738

Community
  • 1
  • 1
user996142
  • 2,753
  • 3
  • 29
  • 48
18

Unfortunately the other answers in this question can be slightly misleading. Referring landfill.bugzilla.org to as host is correct in this specific example, but if the port was other than 443 then it would be incorrect.

https:// by default uses port 443, so you may omit it in the URL, otherwise it would of looked like this https://landfill.bugzilla.org:443/bugzilla-tip:

  • Protocol: https://
  • Hostname: landfill.bugzilla.org
  • Port: 443
  • Host: landfill.bugzilla.org or landfill.bugzilla.org:443 (depending, read below)
  • Hostport: landfill.bugzilla.org:443
  • Path: bugzilla-tip

host and hostname are not the same in all instances. For example in JavaScript location.host will return www.geeksforgeeks.org:8080 while location.hostname returns www.geeksforgeeks.org. So sometimes it's only the "same" when the default ports on the protocol are being used depending.

More info: https://www.rfc-editor.org/rfc/rfc1738

Have a look at this: http://bl.ocks.org/abernier/3070589

basickarl
  • 37,187
  • 64
  • 214
  • 335
  • The link you gave states: hostport = host [ ":" port ], host = hostname | hostnumber. So port is not a part of the host. – Daniil Lantukhov Dec 29 '21 at 18:28
  • @DaniilLantukhov You are correct, I've updated. Weirdly though is that not all things seem to conform to the RFC standard. – basickarl Jan 03 '22 at 10:02
12
  • Host: landfill.bugzilla.org
  • Port: 443 (HTTPS)
  • Path: /bugzilla-tip

for more details please read this

Community
  • 1
  • 1
Chuck R
  • 731
  • 1
  • 7
  • 15
  • Thanks, usr996142. I'm new to this, so I'm not yet used to formatting. – Chuck R Feb 13 '12 at 12:10
  • Thanks. From the link that you referenced: *Note that the "/" between the `host` (or `port`) and the `url-path` **is NOT** part of the `url-path`.* – Mir-Ismaili Jul 04 '18 at 09:05
0

In your case with Host the code is referring to: landfill.bugzilla.org *

Port: By default the https port is 443, but you should check this.

Path: /bugzilla-tip

*Although this is theoretically not quite correct, just put it that way for simplicity.

landfill.bugzilla.org is the URL that indicates to which DNS servers it has to go to resolve the Host name, which is "landfill".

The correct answer at the configuration level is that the host is "landfill" and "landfill.bugzilla.org" is the full URL that tells you what the host is and what server you have to go to in order to find it.

Translated with www.DeepL.com/Translator (free version)

Zeta
  • 1
  • 3