Closed
Bug 99081
Opened 24 years ago
Closed 24 years ago
ExtractPortFrom sometimes finds ports that are not there
Categories
(Core :: Networking, defect, P3)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla0.9.5
People
(Reporter: andreas.otte, Assigned: andreas.otte)
References
(Blocks 1 open bug, )
Details
Attachments
(5 files)
1.11 KB,
patch
|
Details | Diff | Splinter Review | |
1.25 KB,
patch
|
Details | Diff | Splinter Review | |
1.02 KB,
patch
|
Details | Diff | Splinter Review | |
616 bytes,
patch
|
Details | Diff | Splinter Review | |
628 bytes,
patch
|
darin.moz
:
review+
dougt
:
superreview+
|
Details | Diff | Splinter Review |
ExtractPortFrom sometimes finds ports that are not there.
Parsing news:3B5C133C.2080505@foobar.net ends up with news as host and 3 as
port! That is clearly wrong. Test it with the given url and urltest as testprogram.
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Priority: -- → P3
Target Milestone: --- → mozilla0.9.5
being somewhat ignorant about the internals of what is going on, I'd like to ask:
Is this problem related to the fact that some URL schemes do not use "://"
("Common Internet Scheme Syntax")?
So this would be a problem with finger: and mailto:, and the fix would apply as
well?
Assignee | ||
Comment 3•24 years ago
|
||
Yes and No :-)
All these simple urltypes (like news, finger, about, ...) should use nsSimpleURI
or something similar implementing nsIURI. Usually there are no ports involved
and ExtractPortFrom is not used.
The other more complex urls use nsStdURL or something home grown as
implementation of nsIURL.
The real bug here is visible in bug 91908, where we subject a simple uri (news)
to an nsIURL implementation. Really strange things can and do happen then. But
aside from the invalid use of nsStdURL in bug 91908 it demonstrated a bug in the
urlparser when going after ports.
Fixing this bug *may* help fixing bug 91908 (so I marked it a blocker).
Assignee | ||
Comment 4•24 years ago
|
||
I'm a little bit confused now. According to RFCs I found news urls look like
simple urls (news.xxxxx) but if I look into the sources I see all kinds of
news:// type urls. There are however nntp urls in the RFCs which look like some
of the news urls seen in mozilla. If news urls in mozilla are all like news://
the fix in this bug should fix the assertions on attached news urls in mails.
Hopefully the result of the parsing process is still readable to mailnews ...
Comment 5•24 years ago
|
||
Andreas is right - according to rfc1738, a news URL takes one of 2 forms,
news:<newsgroup-name> and news:<message-id>, whereas a nntp URL takes the form
nntp://<host>:<port>/<newsgroup-name>. As far as I can see, Moz does not support
the latter two forms, but incorrectly supports URLs of the form news:// which
appear to be invalid. Please change summary to reflect this.
Assignee | ||
Comment 7•24 years ago
|
||
That should be another bug.
Comment 8•24 years ago
|
||
jeez.. I hate the name of this function. Can you change at least the comment
above the function to state:
/* extracts first number from a string and assumes that this is the port number*/
or something similar?
with that, r=me
Assignee | ||
Comment 9•24 years ago
|
||
Comment 10•24 years ago
|
||
it seems like you could eliminate the "error" flag by using an early "return -1;"
i think the resulting code would be a bit simpler.
fix that and sr=darin.
Assignee | ||
Comment 11•24 years ago
|
||
Assignee | ||
Comment 12•24 years ago
|
||
fix checked in
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 13•24 years ago
|
||
This patch caused a regression, see bug 99657 for details. That was fixed by
making the pop3 url canonial. However, that does not fix the real problem, we
need to make the new port detector sensible to ? as well. Moving the first
proposed patch from bug 99657 over to here.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 14•24 years ago
|
||
Comment 15•24 years ago
|
||
r=dougt?
Are there any other cases that we need to check for?
Assignee | ||
Comment 16•24 years ago
|
||
Assignee | ||
Comment 17•24 years ago
|
||
I haven't seen any url structured like this but there is a theoretical
possibility, so I also included the # case in the latest patch. That should do
it, that are the characters we are looking for in the urlparser (ParseAtPort
from nsStdURLParser.cpp). Thanks for the "heads up" Doug, can you r= again?
Updated•24 years ago
|
Attachment #50885 -
Flags: superreview+
Comment 18•24 years ago
|
||
Comment on attachment 50885 [details] [diff] [review]
updated patch including # case
r/sr=darin
Attachment #50885 -
Flags: review+
Assignee | ||
Comment 19•24 years ago
|
||
fix checked in
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
Comment 20•24 years ago
|
||
Can someone give me pointers on urltest so I can learn it and verify this?
Andreas: as a side note, do we need new bugs about the fact that most internal
news URLs implement ("Common Internet Scheme Syntax") rather than being local
references to the default news server?
Assignee | ||
Comment 21•24 years ago
|
||
I described some of the workings of urltest in bug 95677. If you need more
please tell me.
In this case just do:
urltest news:3B5C133C.2080505@foobar.net
It will return something like:
news:3B5C133C.2080505@foobar.net
news,3B5C133C.2080505,,foobar.net,-1,/,,,,,,news://3B5C133C.2080505@foobar.net/
where the comma separated list gives the following:
scheme,username,password,host,port,directory,filename,fileextension,param,query,href,escaped
spec
If you want other checks, just verify with:
urltest http://www.mozilla.org:80?query
or urltest http://www.mozilla.org:80#href
On the other stuff: No, I think there is already a bug about that, bug 49157 I
think.
![]() |
||
Comment 22•24 years ago
|
||
*** Bug 104187 has been marked as a duplicate of this bug. ***
Comment 23•24 years ago
|
||
is this bug really fixed ? (-> bug 104156)
Assignee | ||
Comment 24•24 years ago
|
||
This bug was about sometimes finding a port when there is no one. An example was
the news url where I spotted it. That part is fixed. I didn't say we are able
to parse news urls correctly, we just don't do *this* error in parsing them any
more. See my comments about nsSimpleURL versus nsStdURL.
The dup is wrong I think, there is bug 89939 on the same issue as bug 104156,
but the information on bug 104156 is much better.
You need to log in
before you can comment on or make changes to this bug.
Description
•