Last Comment Bug 649338 - Expose mUploadStreamHasHeaders on the HttpBaseChannel to allow removing appended headers to nsIUploadChannel
: Expose mUploadStreamHasHeaders on the HttpBaseChannel to allow removing appen...
Status: RESOLVED FIXED
[firebug-p2][qa-]
:
Product: Core
Classification: Components
Component: Networking (show other bugs)
: Trunk
: x86 Windows Vista
: -- normal (vote)
: mozilla7
Assigned To: Honza Bambas (:mayhemer)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-12 07:54 PDT by Jan Honza Odvarko [:Honza]
Modified: 2011-09-23 00:24 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed


Attachments
v1 [Check in comment 11] (2.28 KB, patch)
2011-05-16 11:21 PDT, Honza Bambas (:mayhemer)
bzbarsky: review+
Details | Diff | Splinter Review

Description Jan Honza Odvarko [:Honza] 2011-04-12 07:54:54 PDT
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
Comment 1 Boris Zbarsky [:bz] (still a bit busy) 2011-04-12 09:20:59 PDT
Honza (mayhemer), does that make sense?  Want to write a patch?
Comment 2 Honza Bambas (:mayhemer) 2011-04-13 10:56:29 PDT
Yes, it perfectly makes sense for me.  It is a very simple solution.
Comment 3 Boris Zbarsky [:bz] (still a bit busy) 2011-04-14 11:42:05 PDT
What about the second question?  ;)
Comment 4 Honza Bambas (:mayhemer) 2011-04-22 07:38:15 PDT
(In reply to comment #3)
> What about the second question?  ;)

I can do that :)
Comment 5 Jan Honza Odvarko [:Honza] 2011-04-22 07:46:08 PDT
Can we target Firefox 6? What flag should I set (if any)?

Honza
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2011-04-22 10:49:33 PDT
There is no flag.  If it gets done in time, it gets in.  If if doesn't, it doesn't.
Comment 7 Honza Bambas (:mayhemer) 2011-05-11 07:14:15 PDT
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.
Comment 8 Jan Honza Odvarko [:Honza] 2011-05-11 23:20:02 PDT
(In reply to comment #7)
> I believe Honza prefers to modify nsIUploadChannel2
Yes

Honza
Comment 9 Honza Bambas (:mayhemer) 2011-05-16 11:21:30 PDT
Created attachment 532691 [details] [diff] [review]
v1 [Check in comment 11]
Comment 10 Boris Zbarsky [:bz] (still a bit busy) 2011-05-18 22:06:05 PDT
Comment on attachment 532691 [details] [diff] [review]
v1 [Check in comment 11]

Please use "boolean" in the IDL, not PRBool.  r=me with that.
Comment 12 Virgil Dicu [:virgil] [QA] 2011-08-25 06:08:28 PDT
Hello. 

Could anyone provide some simple STRs for verifying this issue?
Comment 13 Jason Duell [:jduell] (needinfo me) 2011-08-25 11:01:09 PDT
If firebug now uses this feature, I'd consider that verification enough.
Comment 14 Jan Honza Odvarko [:Honza] 2011-08-26 00:33:26 PDT
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
Comment 15 Boris Zbarsky [:bz] (still a bit busy) 2011-08-26 08:03:30 PDT
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.
Comment 16 Jan Honza Odvarko [:Honza] 2011-08-29 09:45:10 PDT
(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
Comment 17 Anthony Hughes (:ashughes) [GFX][QA][Mentor] 2011-09-22 13:30:02 PDT
qa-: fix verification unnecessary
Comment 18 Jan Honza Odvarko [:Honza] 2011-09-23 00:24:19 PDT
Note that the original Firebug bug
http://code.google.com/p/fbug/issues/detail?id=4327

is fixed and verified by the reporter.

Honza

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