Closed Bug 649338 Opened 13 years ago Closed 13 years ago

Expose mUploadStreamHasHeaders on the HttpBaseChannel to allow removing appended headers to nsIUploadChannel

Categories

(Core :: Networking, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla7
Tracking Status
firefox7 --- fixed

People

(Reporter: Honza, Assigned: mayhemer)

Details

(Whiteboard: [firebug-p2][qa-])

Attachments

(1 file)

This bug has been originally created for Firebug here:
http://code.google.com/p/fbug/issues/detail?id=4327

Firebug is using (nsIUploadChannel) request.uploadStream to read data
posted with an HTTP request.

STR:
The problem appears if you load following page:
http://getfirebug.com/tests/issues/4327/

Check the action.php requests (note that Flash is used to post that data). When Firebug reads posted data from the upload channel it looks as follows:

Content-type: application/x-www-form-urlencoded
Content-length: 26

data=%7Bfoo%3A%27foo%27%7D

But WireShark shows only:

data=%7Bfoo%3A%27foo%27%7D

===

There is no way how to safely clear away these headers so, Firebug
shows the same as Wireshark.

Boris is proposing:
Firebug could check the value of mUploadStreamHasHeaders on the HttpBaseChannel, but it's not exposed anywhere. 

You can also read related discussion:
http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/1faabb0d0a8d26f7?hl=en#

Honza
Whiteboard: [firebug-p2]
Honza (mayhemer), does that make sense?  Want to write a patch?
Version: 1.9.1 Branch → Trunk
Yes, it perfectly makes sense for me.  It is a very simple solution.
What about the second question?  ;)
(In reply to comment #3)
> What about the second question?  ;)

I can do that :)
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Can we target Firefox 6? What flag should I set (if any)?

Honza
There is no flag.  If it gets done in time, it gets in.  If if doesn't, it doesn't.
My plan is to put readonly attribute bool uploadStreamHasHeaders to one of nsIUploadChannel or nsIUploadChannel2 or (and it is the question) new nsIUploadChannel3 interface.

What is a desired option?  I believe Honza prefers to modify nsIUploadChannel2.  Me probably too.
(In reply to comment #7)
> I believe Honza prefers to modify nsIUploadChannel2
Yes

Honza
Attachment #532691 - Flags: review?(bzbarsky)
Comment on attachment 532691 [details] [diff] [review]
v1 [Check in comment 11]

Please use "boolean" in the IDL, not PRBool.  r=me with that.
Attachment #532691 - Flags: review?(bzbarsky) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Hello. 

Could anyone provide some simple STRs for verifying this issue?
If firebug now uses this feature, I'd consider that verification enough.
I can see that a new attribute: nsIUploadChannel2.uploadStreamHasHeaders
has been created.

So, how am I suppose to clear the headers so, Firebug shows the same post-data as Wireshark? (see comment #0)

Honza
You read from the stream until you get to a CRLF CRLF.  Everything before then is headers.  Everything after that is data.  Basically, when uploadStreamHasHeaders the stream contains the end of the HTTP request headers and the blank line and then the request body.
(In reply to Boris Zbarsky (:bz) from comment #15)
> You read from the stream until you get to a CRLF CRLF.  Everything before
> then is headers.  Everything after that is data.  Basically, when
> uploadStreamHasHeaders the stream contains the end of the HTTP request
> headers and the blank line and then the request body.

Thanks Boris!
Honza
qa-: fix verification unnecessary
Whiteboard: [firebug-p2] → [firebug-p2][qa-]
Note that the original Firebug bug
http://code.google.com/p/fbug/issues/detail?id=4327

is fixed and verified by the reporter.

Honza
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: