wrong hostname is passed to the proxy resolver. remove realhostname?
Categories
(MailNews Core :: Networking, defect)
Tracking
(Not tracked)
People
(Reporter: basinilya, Unassigned)
References
Details
Attachments
(2 files)
1.61 KB,
patch
|
Details | Diff | Splinter Review | |
10.51 KB,
image/png
|
Details |
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Reporter | ||
Comment 10•6 years ago
|
||
Reporter | ||
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Reporter | ||
Comment 14•6 years ago
|
||
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Comment 17•6 years ago
|
||
Reporter | ||
Comment 18•6 years ago
|
||
Reporter | ||
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
Reporter | ||
Comment 21•6 years ago
|
||
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
Comment 24•6 years ago
|
||
Reporter | ||
Comment 25•6 years ago
|
||
Comment 26•6 years ago
|
||
Comment 27•6 years ago
|
||
Comment 28•6 years ago
|
||
Comment 29•6 years ago
|
||
Comment 30•6 years ago
|
||
Comment 31•6 years ago
|
||
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
I tripped over a similar issue several years ago in bug 381708, comment 3 has the clearest explanation. Although the way in which things went wrong was different, the underlying cause was the same: the system does a proxy lookup on hostname before doing a network connection on realhostname. In my case, the proxy lookup on the wrong hostname caused a delay, but the proxy configuration coincidentally returned a value which worked for the network connection to realhostname. If my skimming of this bug is correct, the problem here is that the proxy lookup on hostname returns information which is not correct for a network connection to realhostname.
I agree with previous comments that the hostname/realhostname distinction is confusing. I can easily imagine how the code evolved into this state and the separation does serve a real purpose. However, the net result is that there's this juicy API containing the words "HostName" which shouts out to any users of the code as "this is the name of the host for the purpose you're currently thinking of".
In fact there are two purposes: a "stable" name that will be constant forever (and is therefore safe to use as a reference, for example, in an IMAP URL to to specify a target account or folder); and the "network" name to be used on the network layer which may change whenever a corporate IT department needs to commission a new server and/or otherwise change its name (including changing the domain). The use of the hostname to specify the directory name for caching has already been separated out into another variable.
This is not just a corporate network issue. When one of the domain name providers I use outsourced their email to Office365 this left my preferences set up as (companyname is the name of the domain name provider):
mail.server.server4.directory C:\Users\…\ImapMail\imap.companyname.co.uk
mail.server.server4.directory-rel [ProfD]ImapMail/imap.companyname.co.uk
mail.server.server4.hostname imap.companyname.co.uk
mail.server.server4.realhostname outlook.office365.com
mail.server.server4.spamActionTargetAccount imap://myusername%40mydomainname@imap.companyname.co.uk
mail.server.server4.spamActionTargetFolder imap://myusername%40mydomainname@imap.companyname.co.uk/Junk Email
mail.identity.id5.archive_folder imap://myusername%40mydomainname@imap.companyname.co.uk/Archives
mail.identity.id5.draft_folder imap://myusername%40mydomainname@imap.companyname.co.uk/Drafts
mail.identity.id5.fcc_folder imap://myusername%40mydomainname@imap.companyname.co.uk/Sent Items
mail.identity.id5.stationery_folder imap://myusername%40mydomainname@imap.companyname.co.uk/Templates
Using realhostname for the first purpose would cause serious problems as it will break IMAP URLs stored elsewhere in preferences (remember, folder references for one ID can refer to IMAP folders for different accounts).
Actually, this begs an interesting question. IMAP URLs always refer to the original name. So, if we (as I believe would be correct) switch to passing realhostname to the proxy configuration, the hostname passed to the proxy configuration will not be the hostname from the URL. I don't know if this is likely to lead to confusion. Is this a unique case? Are there other URL schemes where the hostname use for network connections is not the hostname used in the URL?
I don't know enough about the internals of the Mozilla to make concrete suggestions. Whenever I've come across this sort of API design problem in the past, I've updated the API so every caller has to specify explicitly which variant they want and I've retired the bare name as it's an accident waiting to happen.
So, in this case, if this were a codebase I had complete control over, I'd make hostname and realhostname private to the class maintaining them and expose public APIs that returned stable and network names (where GetStableHostName always returns hostname whereas GetNetworkHostName returns realhostname if set, otherwise it returns hostname). This would then allow the internals to be refactored later.
A review of the codebase might let us know whether hostname is used for anything other than URLs. If not then we could mark URLs as the special case (and make the two APIs GetUrlHostName and GetNetworkHostName; I'd still retire the bare name).
I appreciate this may be a change that's too disruptive for a mature codebase.
There might be a solution that makes the IMAP URLs the place where the aliasing occurs but I can't see a neat solution that doesn't also risk codebase disruption.
Updated•6 years ago
|
Comment 37•5 years ago
|
||
I had this problem today. I added a gmail account several days ago in Thunderbird 68.4.2 (32-bit) which for some reason showed the hostname of .gmail.com and I had to change it to imap.gmail.com. I ended up with:
mail.server.serverN.hostname = .gmail.com
mail.server.serverN.realhostname = imap.gmail.com
I needed to access gmail without the proxy so I put imap.gmail.com on the proxy list. I tried 'Get Messages' and saw could not connect to .gmail.com which made no sense to me (at the time I didn't know about the settings). By searching for gmail in the config editor I was able to track down the problem.
Updated•2 years ago
|
Description
•