Closed Bug 212530 Opened 23 years ago Closed 23 years ago

view-source should drop almost all response headers

Categories

(Core Graveyard :: View Source, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.5beta

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file, 1 obsolete file)

At the moment, we drop the "refresh" header. But the "link" header can attach stylesheets and other headers may be introduced that do weird stuff. So we should, as suggested by hixie, clear all headers but the ones we know we want.
Attached patch Proposed fix (obsolete) — Splinter Review
Attachment #127634 - Flags: superreview?(darin)
Attachment #127634 - Flags: review?(timeless)
Attachment #127634 - Flags: review?(timeless) → review+
so nsViewSourceChannel implements nsIHttpChannel, which means that it implements GetResponseHeader. so, why can't it just block queries for any header other than "Content-Type"? of course then the NS_FORWARD_SAFE_NSIHTTPCHANNEL(mHttpChannel) could not be used :-/
Yeah, that was sort of the motivation... Taking bug; not sure why it wasn't assigned to me to start with.
Assignee: doron → bzbarsky
Priority: -- → P2
Target Milestone: --- → mozilla1.5beta
Oh, we'd have to block VisitResponseHeaders too, not just GetResponseHeader....
so codesighs-wise, it'd probably be better to drop the IMPL macro and just write the functions manually :-/ the visit method can just call the visitor once explicitly for the value of the content-type header. the only downside is having to explicitly write out more methods, but at least we won't ever need to modify those methods... nsIHttpChannel is frozen afterall ;-)
Attachment #127634 - Flags: superreview?(darin)
Attachment #127634 - Attachment is obsolete: true
Attachment #127759 - Flags: superreview?(darin)
Attachment #127759 - Flags: review?(timeless)
Comment on attachment 127759 [details] [diff] [review] Use darin's preferred approach >Index: netwerk/protocol/viewsource/src/nsViewSourceChannel.cpp >+nsViewSourceChannel::GetRequestMethod(nsACString & aRequestMethod) { >+ return !mHttpChannel ? NS_ERROR_NULL_POINTER : >+ mHttpChannel->GetRequestMethod(aRequestMethod); >+} nit: keep the bracket style consistent. hmm... QI to nsIHttpChannel is not possible if mHttpChannel == NULL, so do we even need to null check mHttpChannel? hmm... actually, it is probably wise in case the QI in OnStartRequest fails for some odd reason. >+NS_IMETHODIMP >+nsViewSourceChannel::VisitResponseHeaders(nsIHttpHeaderVisitor *aVisitor) { ... >+ aVisitor->VisitHeader(NS_LITERAL_CSTRING("content-type"), contentType); nit: NS_LITERAL_CSTRING("Content-Type") to be consistent with nsHttpChannel. yeah, i know the interface doesn't require this, but uhm... yeah 8) sr=darin with those changes
Attachment #127759 - Flags: superreview?(darin) → superreview+
Attachment #127759 - Flags: review?(timeless) → review+
Checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
Product: SeaMonkey → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: