Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Thu, 19 Jun 2008 08:43:01 -0700,    group: microsoft.public.inetsdk.programming.webbrowser_ctl        back       


OnBeforeNavigate2() PostData content truncated   
Hi,

IE 6 is calling OnBeforeNavigate2() in my bho with truncated post data for 
multipart/form-data posts. In my case I have some hidden input tags in the 
submit form. Some of the hidden tag parts don't make it into the PostData 
byte array and neither does the file data. Is there a length limit on the 
PostData content? Anyone know how to get all the parts of a multipart form 
post?

Example PostData content passed in OnBeforeNavigate2():

-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="__HIDDEN1"

0x4E59367874B1E448B88DC
-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="__HIDDEN2"

-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="__HIDDEN3"

0x4E593FA6CC2EEFB37423070674B1E448B88DC

-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="__HIDDEN4"

/wEPDwULLTEyMDUxODcwNTgPZBYCZg9kFgJmD2QWAgIDDxYCHgdlbmN0e
-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="__HIDDEN5"

/joe/user
-----------------------------7d81b228170e3a
Content-Disposition: form-data; name="FILEINPUT"; filename="C:\junk\BSC.CPP"
Content-Type: text/plain


 ...that's it, end of PostData -- no file data, and the parts that follow 
the file part are missing.


Thanks,

Bruce.
date: Thu, 19 Jun 2008 08:43:01 -0700   author:   Bruce.McHaffie

Re: OnBeforeNavigate2() PostData content truncated   
Bruce.McHaffie  wrote:
> IE 6 is calling OnBeforeNavigate2() in my bho with truncated post
> data for multipart/form-data posts. In my case I have some hidden
> input tags in the submit form. Some of the hidden tag parts don't
> make it into the PostData byte array and neither does the file data.

Known problem: if you have <input type="file"> in your form, post data 
passed to BeforeNavigate2 is chopped off where the file contents should 
begin. There is a good reason for this: the file may be large, and you 
don't want the whole thing loaded into memory just to pass it to an 
event handler.

Can't you read the fields from the page DOM?
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Thu, 19 Jun 2008 12:51:24 -0400   author:   Igor Tandetnik

Re: OnBeforeNavigate2() PostData content truncated   
Thanks for replying Igor. Yes I could iterate through the input elements to 
get the missing values. Eventually I'd like to encrypt the posted file data 
before it goes to the server. Looks like I can't do that directly in this 
callback. Would it be feasible here to cancel the post and programmatically 
submit a new one with modified data?

Bruce.
   

"Igor Tandetnik" wrote:

> Bruce.McHaffie  wrote:
> > IE 6 is calling OnBeforeNavigate2() in my bho with truncated post
> > data for multipart/form-data posts. In my case I have some hidden
> > input tags in the submit form. Some of the hidden tag parts don't
> > make it into the PostData byte array and neither does the file data.
> 
> Known problem: if you have <input type="file"> in your form, post data 
> passed to BeforeNavigate2 is chopped off where the file contents should 
> begin. There is a good reason for this: the file may be large, and you 
> don't want the whole thing loaded into memory just to pass it to an 
> event handler.
> 
> Can't you read the fields from the page DOM?
> -- 
> With best wishes,
>     Igor Tandetnik
> 
> With sufficient thrust, pigs fly just fine. However, this is not 
> necessarily a good idea. It is hard to be sure where they are going to 
> land, and it could be dangerous sitting under them as they fly 
> overhead. -- RFC 1925
> 
> 
>
date: Thu, 19 Jun 2008 11:37:01 -0700   author:   Bruce.McHaffie

Re: OnBeforeNavigate2() PostData content truncated   
Bruce.McHaffie  wrote:
> Thanks for replying Igor. Yes I could iterate through the input
> elements to get the missing values. Eventually I'd like to encrypt
> the posted file data before it goes to the server.

Wouldn't simply posting to HTTPS URL do that?

> Would it be feasible here to
> cancel the post and programmatically submit a new one with modified
> data?

Yes, though perhaps impractical for large files (as you need to supply 
complete post data as a single in-memory buffer).
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Thu, 19 Jun 2008 15:06:24 -0400   author:   Igor Tandetnik

Re: OnBeforeNavigate2() PostData content truncated   
"Igor Tandetnik" wrote:

> Bruce.McHaffie  wrote:
> > Thanks for replying Igor. Yes I could iterate through the input
> > elements to get the missing values. Eventually I'd like to encrypt
> > the posted file data before it goes to the server.
> 
> Wouldn't simply posting to HTTPS URL do that?
> 

Yes, but the data would be plaintext at the other end of the pipe.

> > Would it be feasible here to
> > cancel the post and programmatically submit a new one with modified
> > data?
> 
> Yes, though perhaps impractical for large files (as you need to supply 
> complete post data as a single in-memory buffer).

Yes there'd have to be a size limit I guess. Too bad I can't supply a 
multipart object with streamed parts.

Oddly the file referred to in the post data does not appear to have been 
read from disk yet when OnBeforeNavigate2() is called. Any idea if I can 
depend on that behaviour? Or I suppose I could just replace the post data 
directly in OnBeforeNavigate2().
date: Fri, 20 Jun 2008 08:20:00 -0700   author:   Bruce.McHaffie

Re: OnBeforeNavigate2() PostData content truncated   
"Bruce.McHaffie"  wrote in
message news:C38AEB93-F284-4269-91B6-93238278BEE7@microsoft.com
> "Igor Tandetnik" wrote:
>
>> Bruce.McHaffie  wrote:
>>> Would it be feasible here to
>>> cancel the post and programmatically submit a new one with modified
>>> data?
>>
>> Yes, though perhaps impractical for large files (as you need to
>> supply complete post data as a single in-memory buffer).
>
> Yes there'd have to be a size limit I guess. Too bad I can't supply a
> multipart object with streamed parts.

You can't with the browser. You can if you use UrlMon or WinInet 
directly.

> Oddly the file referred to in the post data does not appear to have
> been read from disk yet when OnBeforeNavigate2() is called.

That's why it's not included in the post data.

> Or I suppose I could just replace
> the post data directly in OnBeforeNavigate2().

You can't. All parameters except Cancel are read-only. Even if you 
change them, your change won't have any effect.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Fri, 20 Jun 2008 23:38:22 -0400   author:   Igor Tandetnik

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us