Skip to content
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

Support blob data with CefRequest PostDataElement #3843

Open
LeadAssimilator opened this issue Nov 26, 2024 · 2 comments
Open

Support blob data with CefRequest PostDataElement #3843

LeadAssimilator opened this issue Nov 26, 2024 · 2 comments
Labels
enhancement Enhancement request

Comments

@LeadAssimilator
Copy link

LeadAssimilator commented Nov 26, 2024

Describe the bug
When sending a XHR/fetch request using a Blob, PostDataElement ends up with PDE_TYPE_EMPTY, but the post data isn't actually empty. Blobs have a DataElement type of network::DataElementDataPipe with tag type network::DataElement::Tag::kDataPipe but that apparently isn't being checked here https://github.com/chromiumembedded/cef/blob/6778/libcef/common/request_impl.cc#L1154-L1161 and the unhandled type winds up as PDE_TYPE_EMPTY. There are in fact two tag types, kDataPipe and kChunkedDataPipe that are unhandled.

Supporting DataPipe should be fairly straightforward and this arguably could be a feature request, but returning PDE_TYPE_EMPTY for unhandled tag types just seems wrong which is why I reported this as a bug. A new type such as PDE_TYPE_DATA_PIPE should be returned instead with the data probably just read into a byte array so it overall acts like PDE_TYPE_BYTES.

Supporting ChunkedDataPipe is more problematic however because it can be flagged as being readable only once. I suggest giving it a separate type such as PDE_TYPE_CHUNKED_DATA_PIPE_UNSUPPORTED and just not supporting it. This way it is at least distinct from PDE_TYPE_EMPTY to avoid any confusion and it can be documented as unsupported much easier.
 
To Reproduce
Steps to reproduce the behavior:

  1. Send an XHR or fetch request using a Blob.
  2. Observe DevTools's Network tab shows the request has post body.
  3. Inspect the CefRequest PostData via any one of the handler methods that are passed a CefRequest and observe PDE_TYPE_EMPTY.

Expected behavior
CefRequest PostData's first PostDataElement should have a type other than PDE_TYPE_EMPTY and the payload should be retrievable.

Screenshots
N/A

Versions (please complete the following information):

  • OS: ALL
  • CEF Version: 131.2.7, ALL

Additional context
Does the problem reproduce with the cefclient or cefsimple sample application at the same version?
Yes

Does the problem reproduce with Google Chrome at the same version?
No

@LeadAssimilator LeadAssimilator added the bug Bug report label Nov 26, 2024
@magreenblatt
Copy link
Collaborator

magreenblatt commented Nov 26, 2024 via email

@LeadAssimilator
Copy link
Author

Same use case as getting the post data at all really. Blob is unfortunately used by some devs and libs for everything, even for json or simple form encoded data, presumably because it keeps their interfaces cleaner when dealing with different types of data.

@magreenblatt magreenblatt changed the title XHR/fetch Blob requests yield a single CefRequest PostDataElement with type PDE_TYPE_EMPTY. Support blob data with CefRequest PostDataElement Nov 26, 2024
@magreenblatt magreenblatt added enhancement Enhancement request and removed bug Bug report labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants