Closed
Bug 227057
Opened 21 years ago
Closed 20 years ago
nsIResumableChannel and nsIResumableEntityID cleanup
Categories
(Core :: Networking, enhancement, P5)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha4
People
(Reporter: Biesinger, Assigned: Biesinger)
References
()
Details
(Whiteboard: [patch])
Attachments
(1 file, 2 obsolete files)
47.58 KB,
patch
|
Details | Diff | Splinter Review |
51 * OnStartRequest wil have a status of NS_ERROR_NOT_RESUMABLE if the file 52 * cannot be resumed, eg because the server doesn't support this, or the 53 * nsIFileInfo doesn't match. This error may be occur even if startPos 54 * is 0, so that the front end can warn the user. 1. "this error may be occur" isn't english, it should be "This error may occur" 2. nsIFileInfo doesn't exist, this should be nsIResumableEntityID I presume 3. OnStartRequest has no status argument!? (this interface also falls flat on its face for files >4 gb, but that's a separate issue...)
Assignee | ||
Comment 1•21 years ago
|
||
also: 49 * @param info [...] there is no param called info
Assignee | ||
Comment 2•21 years ago
|
||
and one more thing: 56 * The request given to the nsIStreamListener will be QIable to 57 * nsIResumableInfo There is no nsIResumableInfo interface
Comment 3•21 years ago
|
||
morphing into general cleanup bug... there's much more work to be done in this area.
Status: NEW → ASSIGNED
Summary: nsIResumableChannel docs could be improved → nsIResumableChannel and nsIResumableEntityID cleanup
Target Milestone: --- → mozilla1.7alpha
Assignee | ||
Comment 4•21 years ago
|
||
please don't bitrot the bug 219556 patch too much though, if possible ;)
Comment 6•21 years ago
|
||
Hmm. I think I changed the names several times while developing this... Has anyone ever written a user for this stuff, BTW?
Assignee | ||
Comment 7•21 years ago
|
||
bbaetz: I'm planning to write one, hopefully for 1.7alpha (in the download manager) also darin tells me beng wants to write one for firebird
Updated•21 years ago
|
Priority: -- → P5
Target Milestone: mozilla1.7alpha → mozilla1.7beta
Updated•20 years ago
|
Severity: normal → enhancement
Target Milestone: mozilla1.7beta → mozilla1.8alpha
Assignee | ||
Comment 8•20 years ago
|
||
most of the issues w/ this interface were resolved with bug 243974, I'd say... especially nsIResumableChannel now has a resumeAt function that does not open the channel itself. this patch now removes nsIResumableEntityID, and uses strings instead. this is not necessarily ready for review yet; just attaching it so I don't loose it. I'm unsure whether the entityID attribute should return NS_ERROR_NOT_RESUMABLE or just return an empty string, when resuming is not possible.
Comment 9•20 years ago
|
||
thanks for the patch christian
Whiteboard: [patch]
Target Milestone: mozilla1.8alpha1 → mozilla1.8beta
Comment 10•20 years ago
|
||
Comment on attachment 152733 [details] [diff] [review] use strings instead of nsIResumableEntityID christian: are you interested in owning this bug?
Attachment #152733 -
Flags: review?(darin)
Comment 12•20 years ago
|
||
Comment on attachment 152733 [details] [diff] [review] use strings instead of nsIResumableEntityID >Index: base/public/nsIResumableChannel.idl > void resumeAt(in unsigned long long startPos, >- in nsIResumableEntityID entityID); >+ in ACString entityID); don't forget to rev the interface's uuid! ;-) >Index: protocol/http/src/nsHttpChannel.cpp >+ if (!mEntityID.IsEmpty()) { > // Also, we want an error if this resource changed in the meantime >+ // Format of the entity id is: escaped_etag/size/lastmod >+ nsCString::const_iterator start = mEntityID.BeginReading(start), >+ end = mEntityID.EndReading(end), >+ slash = mEntityID.BeginReading(slash); nit: hmm... double assignment to iterators doesn't make much sense. >+ FindCharInReadable('/', slash, end); >+ >+ nsCAutoString entityTag(Substring(start, slash)); >+ if (!entityTag.IsEmpty()) { >+ NS_UnescapeURL(entityTag); > mRequestHead.SetHeader(nsHttp::If_Match, entityTag); > } how about this instead: if (FindCharInReadable('/', slash, end)) { nsCAutoString buf; mRequestHead.SetHeader(nsHttp::If_Match, NS_UnescapeURL(Substring(start, slash), 0, buf)); } >+ if (slash != end) >+ ++slash; >+ FindCharInReadable('/', slash, end); >+ >+ const nsDependentCSubstring& lastMod = Substring(slash, end); >+ if (!lastMod.IsEmpty()) { > mRequestHead.SetHeader(nsHttp::If_Unmodified_Since, lastMod); don't you need to increment |slash| before generating the substring? you might want to utilize the boolean return value of FindCharInReadable here as well. >+nsHttpChannel::GetEntityID(nsACString& aEntityID) ... >+ nsCString entityID; >+ NS_EscapeURL(etag.BeginReading(), etag.Length(), esc_AlwaysCopy | esc_Directory, entityID); wait... esc_Directory does not escape forward slashes. what if the ETag has a forward slash in it? also, what if there is already a %xy sequence in the ETag? You probably want to use esc_Forced to make sure that any existing '%' is escaped ;-)
Attachment #152733 -
Flags: review?(darin) → review-
Assignee | ||
Comment 13•20 years ago
|
||
Attachment #152733 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #155512 -
Flags: review?(darin)
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Comment 14•20 years ago
|
||
Comment on attachment 155512 [details] [diff] [review] patch v2 r=darin
Attachment #155512 -
Flags: review?(darin) → review+
Assignee | ||
Updated•20 years ago
|
Attachment #155512 -
Flags: superreview?(bzbarsky)
Comment 15•20 years ago
|
||
Comment on attachment 155512 [details] [diff] [review] patch v2 >Index: netwerk/base/public/nsIResumableChannel.idl > * The nsIResumableEntityID for this URI. Available after s/nsIResumableEntityID/entity ID/ >Index: netwerk/protocol/ftp/src/nsFTPChannel.cpp >+ if (resumable) { >+ resumable->GetEntityID(mEntityID); >+ } Don't you need an mEntityID.Truncate() if that fails? The old code nulled out in the case when GetEntityID returned null... Or is mEntityID guaranteed empty here? Alternately, should GetEntityID truncate in the failure case? >Index: netwerk/protocol/http/src/nsHttpChannel.cpp >+ nsCString::const_iterator start, end, slash; >+ mEntityID.BeginReading(start); >+ mEntityID.EndReading(end); >+ mEntityID.BeginReading(slash); How about slash = mEntityID.BeginReading(start); to init them both at once? >@@ -815,23 +823,21 @@ nsHttpChannel::ProcessNormal() >+ nsCString id; Why not nsCAutoString? sr=bzbarsky with these issues addressed.
Attachment #155512 -
Flags: superreview?(bzbarsky) → superreview+
Assignee | ||
Comment 16•20 years ago
|
||
(In reply to comment #15) > Or is mEntityID guaranteed empty here? AsyncOpen truncated mEntityID. So, it should be empty by the time onstartr is called. > slash = mEntityID.BeginReading(start); hm... I don't think that's particularly readable...
Assignee | ||
Comment 17•20 years ago
|
||
Attachment #155512 -
Attachment is obsolete: true
Assignee | ||
Comment 18•20 years ago
|
||
checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•20 years ago
|
Target Milestone: mozilla1.8beta → mozilla1.8alpha4
You need to log in
before you can comment on or make changes to this bug.
Description
•