-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoreWebView2_WebResourceRequested not providing binary multi-part POST Data in Request.Content #2162
Comments
Thanks for the bug report @RickStrahl! I've added this to our backlog. |
Is there any word on whether this will be addressed? Tested today with latest version and found this still doesn't work. Confirmed that:
|
@champnic Ping! Any progress or at least confirmation that this is a bug and will get addressed in the future? Or a workaround? |
Thanks for the ping Rick. @yildirimcagri do you have any info on this issue? |
I also ran into exactly this issue. Ran into it when using WebView2 from C++ but also reproduced it in C# WinForms. This can be reproduced with the following JavaScript code:
And the following C# code:
The attached solution contains a running sample: |
Thanks for the sample code for this. I missed the earlier ping about this, but I will prioritize this issue now. |
Seeing the same behaviour in a Wails application. |
Any update on this @yildirimcagri? @champnic? |
Are there any plans to address this issue @yildirimcagri-msft? |
Same for me. The WebResourceRequested handler is the only way to intercept/filter requests and this bug makes this impossible. @yildirimcagri-msft , you say you will prioritize this issue for the last year or so and still nothing. Will it be possible finally this issue to be solved ? |
I am also the same. This issue has caused my solution to be unable to proceed due to this bug. Will this issue be resolved? Looking forward to your reply |
@champnic @yildirimcagri-msft Is there any status update on this? Is there a workaround? Thanks. |
We are in the same situation, any updates? Is there a workaround to avoid this problem? |
Is there any updates? Or some alternatives? |
Here is a temporary solution: const formData= new FormData();
formData.append("val1", "val1");
formData.append("blob", blob);
const req = new Request(uploadUrl, {
method: "POST",
body: formData,
});
const buffer = await req.arrayBuffer();
const headers = req.headers;
const response = await fetch(uploadUrl,{
method:"POST",
body:buffer,
headers
}); By transmut multi-part data into arrayBuffer, we can access the request body though |
Seems this workaround works, but not in my scenario, I'm appending to the body not a blob but a file from an input type file for upload it. Using arrayBuffer() the file is loaded in memory, and for upload of large files that's not good... |
Any updates? This bug caused a complete reengineering of our solution. It's not possible do a multi-part POST request for uploading file! |
From what I can see, this is being worked on. We will post any updates here. |
Been watching this bug for a long time too. But this bug is not in Webview2, it is Chromium itself that has this problem. It can be seen in Devtools. Even if you connect via DevTools Protocol FetchRequestPaused, the Post request will be empty. BUT! I found a workaround. The full Post request can be seen through: DevTools Protocol Network.requestWillBeSent It's a miracle! Next is a simple code:
And now you can use this dictionary to work and check if Content == null in CoreWebView2WebResourceResponseReceived, then take data from the dictionary at the URL |
I tried leonidukg's comment. It works, but when the post data include file, the file values will omit. So, it still need to fix. |
You are right because Network.requestWillBeSent is executed BEFORE it sends all the data. And most likely the file download is not included in this check. p.s. I have corrected my code to prevent requests from hanging by accident. |
I mean file upload. you can't get upload file content. |
Once again encountered this problem and even my workaround won't help. So I had to look for another one, but I already had a function to modify HTML code and I was surprised to see PostData perfectly through this function.
|
Hello, this should be working now. Please reactivate if it is not. |
As of which release? |
So I'm looking at this in the latest release build and I'm not sure what I'm looking at or how I'm supposed to get at this data. It looks like Request content returns some sort of stream, but the stream is way too small - it doesn't contain the upload data: and indeed when I try to read the actual file content it's always empty. I do get the headers now. Here's what I do:
That works to give me the variables - content type, length of content, filename. But the data is always 0 length which makes sense since the incoming data does not reflect the full body that includes the full binary file size. From the looks of it the payload captured is only the non-binary header data. Using latest release SDK 1.0.2849.39 |
Your handling of this issue seriously is terrible people at MSFT. Nearly 3 years since this was opened and since then no real discussion from the team contributors here, only some vague reference to things happening behind closed doors. Then a note that it's fixed without any context of exactly what was fixed or even what build it was fixed in - and it certainly DID NOT FIX the issue in the original bug report, which is easy enough to verify. You offer to reopen if not fixed. but there's no actual option to do just that. Clearly this issue touches on a use case that a lot of people have run into, so this isn't an edge case scenario. Bottom line the bug is NOT FIXED. Maybe @yildirimcagri-msft is talking about something else, but who knows... it doesn't get more minimal than the response given which would be fine if it had actually worked! Maybe there's a workaround? The people on this team presumably are somewhat expert at Chromium and DevTools development and should at least have something to contribute on workarounds or other solutions or at least some knowledge on what's possible and what's not? Instead we get nothing... If this is an issue in Chromium itself - this might be a good feature suggestion or perhaps something to help fix in Chromium? Wasn't there all this talk of the Edge/WebView folks contributing to Chromium specifically for Windows features for example? So there's some involvement. But even beyond that you're making it hard for any of use complaining providing more useful feedback or possibly help in getting this to work by your deafening non-involvement. Please do better. If you're not going to take a serious stab at this because there are no resources or it can't be done to some limitation in Chromium or the Runtime - that's fair enough, but at least come out and say so! Thanks for listening! |
Hello @RickStrahl , First of, I appreciate your feedback and apologies for leaving you in the dark for a while, unfortunately, I just saw your reply when you mentioned me as the issue had remained closed. I just reopened the issue. We have been actively looking at fixing this issue by directly obtaining this information from network stack, which has proven to be challenging. However, we also discovered that Chromium had recently made a change in the CDP event, which is where we originally obtain the information to fire the WebResourceRequested event, that allows multi-part POST data to be observed now. That's why I thought this would have been fixed now. However, it does only work for blob or byte types and potentially not for files. For files, unless Chromium also makes a change to get it working in CDP, we would need to fix this on our side. One thing I want to ask is, can you tell from the filename, that should be available in the multi part post data, which file to read? If you could do that, at least you could read the same file from your app via Windows APIs? |
@yildirimcagri-msft Thanks for getting back so quickly - that is much appreciated. This response is what I was hoping we could get from this 'forum' in general. It's a good example as it provides some insight into what the issues are and also what the obstacles are on your end, so we as consumers of the API can set our own expectations without speculation on what's possible and what to expect. So, again thank you for that! ... and it would be nice to see more of this for many issues posted here. |
The data that we receive from the event API provides all the data except the file attachment data. Variable names come in just fine it's just the The data from the stream on a single file file upload field comes in like this:
As you can see the actual file content is not there but everything else is.
I believe this is an issue in Chromium, but it's seems like this is an arbitrary limitation - ie. content had to be explicitly stripped from the outgoing HTTP data. Perhaps there's some other mechanism that allows intercepting the files that are being sent as attachments, but I have not been able to dig up any information to that effect. That would have to come from someone more knowledgeable of Chromium APIs. |
Thanks, Cagri for following up and reactivating the issue. Assigning it to myself while I find a new owner for this. |
I have an application that captures Web Request data for later playback (WebSurge). This works great for standard text based content be it API requests or captured form data - the data gets captured into the Request stream and I can grab it out of there. Works great.
However, if the data is multi-part form data with binary data, the
Request.Content
is always null:In contrast, here is a POST request with standard form data which does work and returns a
Request.Content
stream:So for some reason it looks if the data is multi-part or contains binary data the request content is not provided.
AB#38186390
The text was updated successfully, but these errors were encountered: