Closed Bug 1410063 Opened 8 years ago Closed 8 years ago

Implement MozURL::GetHost/SetHost

Categories

(Core :: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: baku, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

This is needed for the URL API: Host should be hostname:port. The getter is trivial. The setter is what I really need because it involves the parsing of the input string.
Flags: needinfo?(valentin.gosu)
Assignee: nobody → valentin.gosu
Flags: needinfo?(valentin.gosu)
Comment on attachment 8920717 [details] Bug 1410063 - Implement MozURL::GetHostPort/SetHostPort https://reviewboard.mozilla.org/r/191728/#review197716 ::: netwerk/base/MozURL.h:46 (Diff revision 1) > nsresult GetUsername(nsACString& aUser); > nsresult GetPassword(nsACString& aPassword); > // Will return the hostname of URL. If the hostname is an IPv6 address, > // it will be enclosed in square brackets, such as `[::1]` > nsresult GetHostname(nsACString& aHost); > // Will return the port number, if specified, or -1 stick this comment to the right method ::: netwerk/base/MozURL.h:47 (Diff revision 1) > nsresult GetPassword(nsACString& aPassword); > // Will return the hostname of URL. If the hostname is an IPv6 address, > // it will be enclosed in square brackets, such as `[::1]` > nsresult GetHostname(nsACString& aHost); > // Will return the port number, if specified, or -1 > + nsresult GetHostPort(nsACString& aHostPort); a comment how is the port returned (when default) is needed ::: netwerk/base/MozURL.cpp:70 (Diff revision 1) > + rv = GetPort(&port); > + if (NS_FAILED(rv)) { > + aHostPort.Truncate(); > + return rv; > + } > + if (port != -1) { is it ensured that port is -1 when it's default? if someone constructs the url exactly as [1] "http://foo.bar:80/path/" what is the port value then? is it -1 or 80? I don't think rust url impl has any notion internally of the protocol (and that is ever should have) or is the caller responsible (and always was even with xpcom standardurl) to handle the default port? (i.e. nsIURL returns -1 for uris constructed from [1].)
Attachment #8920717 - Flags: review?(honzab.moz) → review+
Comment on attachment 8920717 [details] Bug 1410063 - Implement MozURL::GetHostPort/SetHostPort https://reviewboard.mozilla.org/r/191728/#review197716 > is it ensured that port is -1 when it's default? > > if someone constructs the url exactly as [1] "http://foo.bar:80/path/" what is the port value then? is it -1 or 80? > > I don't think rust url impl has any notion internally of the protocol (and that is ever should have) > > or is the caller responsible (and always was even with xpcom standardurl) to handle the default port? (i.e. nsIURL returns -1 for uris constructed from [1].) rusturl_get_port explicitly returns -1 when the URL has a default port (i.e. url.port() == None)
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/44a8f978d208 Implement MozURL::GetHostPort/SetHostPort r=mayhemer
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Blocks: 1406933
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: