Closed
Bug 110500
Opened 23 years ago
Closed 23 years ago
nsStandardURL should implement SetFilePath
Categories
(Core :: Networking, defect, P2)
Core
Networking
Tracking
()
VERIFIED
FIXED
mozilla0.9.7
People
(Reporter: Biesinger, Assigned: darin.moz)
References
Details
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Currently, nsStandardURL::SetFilePath returns NS_ERROR_NOT_IMPLEMENTED
This function should be implemented.
Bug 100944 depends on this function to work.
Assignee | ||
Comment 1•23 years ago
|
||
should be a quick fix... didn't mean to leave this out of the patch!
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla0.9.7
Comment 4•23 years ago
|
||
Reporter | ||
Comment 5•23 years ago
|
||
Andreas: Doing this also removes the query and hash. In my opinion, SetFilePath
should keep them; because if you'd not want them, you would use SetPath.
Comment 6•23 years ago
|
||
Are you sure? It was implemented this way in good old nsStdURL too and as far as
I know SetPath does not remove query and ref. If SetPath does this, it's a bug.
Reporter | ||
Comment 7•23 years ago
|
||
I tried your patch, and query and ref are removed.
Also, documentation for nsIURI suggests that SetPath should remove query and
ref, because for nsIURI, they're part of the path.
http://lxr.mozilla.org/mozilla/source/netwerk/base/public/nsIURI.idl#51
So I think that SetFilePath should not remove query and ref, because it would
then be redundant with SetPath.
Assignee | ||
Comment 8•23 years ago
|
||
i agree with christian on this... path is everything after the authority,
whereas filepath is only that containing the directory and filename.
Status: NEW → ASSIGNED
Comment 9•23 years ago
|
||
Hmmm ... If I remember correctly just calling SetPath inside SetFilePath was a
quick hack in nsStdURL and that status I wanted to get back with this patch.
This could not have worked prior to darins work too.
You are right, SetFilePath *should* leave param, query and ref untouched in the
base url.
Comment 10•23 years ago
|
||
A first cut on a real SetFilePath implementation. It still has problems with
the leading slash in the directory and other stuff. One thing for sure: This
implementation of nsIURL maybe faster but it is a lot more complicated to
change than the old one.
Attachment #58212 -
Attachment is obsolete: true
Assignee | ||
Comment 11•23 years ago
|
||
andreas... yeah... the new impl complicates the url part setters for sure, but i
think we can simplify your patch by checking if the param, query, and ref are
all absent. then SetPath can simply be called.
andreas: at the time when i was working on these standard url changes, i
considered keeping an array of the URL parts and only recombining them on demand.
this would have probably resulted in a less complex implementation.
Comment 12•23 years ago
|
||
If SetFilePath is called we explicitly state that there are no param, query or
ref present in the string, so everthing gets folded into directory, filebasename
and fileextension. When getting them back in the spec ; ? and # will all get
escaped as part of the filebasename for example to mask them.
Comment 13•23 years ago
|
||
This version now can deal with a missing leading /. However I still see an
assertion when both directory and filebasename are present in the string given
to SetFilePath:
###!!! ASSERTION: nsDependentCString must wrap only null-terminated strings:
'!*aEndPtr', file ../../dist/include/string/nsDependentString.h, line 160
###!!! Break: at file ../../dist/include/string/nsDependentString.h, line 160
Reagarding my prior comment, I hoped # ; and ? would get escaped, but that does
not happen, still investigating.
Updated•23 years ago
|
Attachment #58278 -
Attachment is obsolete: true
Assignee | ||
Comment 14•23 years ago
|
||
andreas: yeah, good point.
Comment 15•23 years ago
|
||
Hmmm ... all setters except SetSpec are missing the escaping step, the
normalized url contained in mSpec can only be escaped. This is serious ...
Assignee | ||
Comment 16•23 years ago
|
||
andreas: you're right... i've filed bug 110846 to cover that issue.
Assignee | ||
Comment 17•23 years ago
|
||
andreas: i think it might be better to just call build up a new url and call
SetSpec on the resulting url. i don't think we need to worry about making
SetFilePath so efficient. i'll attach a patch that does this.
Assignee | ||
Comment 18•23 years ago
|
||
this one just calls SetSpec... see my patch for bug 110846 to see why i'm not
calling SetPath.
Comment 19•23 years ago
|
||
If you call SetFilePath on
http://www.mozilla.org/path/path2/filebase.extension;xxxx?gggg#hhhh
with "aaaaa/file#fffff" you get
http,,,www.mozilla.org,-1,/aaaaa/,file,,,,fffff;xxxx?gggg#hhhh,http://www.mozilla.org/aaaaa/file#fffff;xxxx?gggg#hhhh
which is wrong, because SetSpec which you use finds the first # that is part of
the filename (and using SetFilePath we said it is!). Instead it should have been
escaped by the setter. So using SetSpec is wrong as was using SetPath in old
nsStdURL and in my first patch.
Comment 20•23 years ago
|
||
For the same reason calling SetPreHost in SetUsername is wrong.
Assignee | ||
Comment 21•23 years ago
|
||
your right... i need to parse the filepath before building up the new candidate
spec. new patch en route.
Assignee | ||
Comment 22•23 years ago
|
||
i don't see any problem with SetUsername... it only calls SetPreHost when the
given username is NULL or zero length. in other words, it only calls SetPreHost
to remove the prehost, because without a username there's no point having a
password in the URL. so, i don't think the same problem exists with SetUsername.
Assignee | ||
Comment 23•23 years ago
|
||
nevermind... ic the problem with SetUsername now :P
Assignee | ||
Comment 24•23 years ago
|
||
marking this bug as dependent on bug 110846... actually, that bug will contain
the fix for this bug. the patch for this bug is going to need some of the
changes in the patch for bug 110846, so they might as well be combined.
Depends on: 110846
Assignee | ||
Updated•23 years ago
|
Attachment #58473 -
Attachment is obsolete: true
Assignee | ||
Comment 25•23 years ago
|
||
FIXED now that the patch for bug 110846 has landed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•