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.
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
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 > > >
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
"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().
"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