Closed Bug 220672 Opened 21 years ago Closed 21 years ago

consider nsIUTF8StringEnumerator for nsIEncodedChannel

Categories

(Core :: Networking, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: Biesinger, Assigned: Biesinger)

References

()

Details

Attachments

(1 file)

As nsIEncodedChannel::contentEncodings is really just a list of strings, using
nsIUTF8StringEnumerator would be more friendly for callers of this interface.

http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsIStringEnumerator.idl#52
agreed.  patches welcome :)
Target Milestone: --- → Future
ok, taking... but I don't know when I'll get to this...
Assignee: darin → cbiesinger
Target Milestone: Future → mozilla1.6alpha
Attached patch patchSplinter Review
(not tested yet)
Comment on attachment 132648 [details] [diff] [review]
patch

ok, tested the only caller (Save link target as), and it works
Attachment #132648 - Flags: superreview?(bzbarsky)
Attachment #132648 - Flags: review?(darin)
Status: NEW → ASSIGNED
Comment on attachment 132648 [details] [diff] [review]
patch

>Index: netwerk/protocol/http/src/nsHttpChannel.cpp

>+nsHttpChannel::nsContentEncodings::GetNext(nsACString& aNextEncoding)
...
>     PRBool haveType = PR_FALSE;
>     if (CaseInsensitiveFindInReadable(NS_LITERAL_CSTRING("gzip"),
>                                       start,
>                                       end)) {
>+        aNextEncoding = NS_LITERAL_CSTRING(APPLICATION_GZIP);
>         haveType = PR_TRUE;
>     }
> 
>     if (!haveType) {
>         encoding.BeginReading(start);
>         if (CaseInsensitiveFindInReadable(NS_LITERAL_CSTRING("compress"),
>                                           start,
>                                           end)) {
>+            aNextEncoding = NS_LITERAL_CSTRING(APPLICATION_COMPRESS);
>                                            
>             haveType = PR_TRUE;
>         }
>     }
>     
>     if (! haveType) {
>         encoding.BeginReading(start);
>         if (CaseInsensitiveFindInReadable(NS_LITERAL_CSTRING("deflate"),
>                                           start,
>                                           end)) {
>+            aNextEncoding = NS_LITERAL_CSTRING(APPLICATION_ZIP);
>             haveType = PR_TRUE;
>         }
>     }

seems like this code could be compacted into a loop to save footprint.
something for later perhaps.

r=darin
Attachment #132648 - Flags: review?(darin) → review+
Comment on attachment 132648 [details] [diff] [review]
patch

sr=bzbarsky
Attachment #132648 - Flags: superreview?(bzbarsky) → superreview+
checked in
filed Bug 221290 for that loop suggestion
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: