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
feat: Support response headers in File protocol handler #16098
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Premise and tests LGTM. Thanks for the patch!
Once the deprecated API use is changed I'm 👍 on this
base::DictionaryValue* headersValue = nullptr; | ||
base::DictionaryValue* dict = | ||
static_cast<base::DictionaryValue*>(options.get()); | ||
dict->GetString("path", &file_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a minor regression of going back to deprecated API:
// DEPRECATED, use Value::FindPath(path) and Value::GetString() instead.
bool GetString(StringPiece path, std::string* out_value) const;
Could you keep the previous FindKeyOfType
implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, hadn't noticed that was deprecated. Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 following your latest changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Release Notes Persisted
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Description of Change
This adds support for response headers to
protocol.registerFileProtocol
to matchprotocol.registerStreamProtocol
.My specific use case for this is to set a CSP for pages served from local content rather than HTTPS: setting the header by intercepting the request with the
webRequest
module doesn't work becauseURLRequestAsarJob
doesn't call the network_delegate methods (see #16030). In any case, this seems like a more direct way of setting the header.I've also changed how this works a little to make it more consistent (hopefully) with the other handlers (ie. convert the dict to a
base::DictionaryValue
and usebase::DictionaryValue::GetFoo()
).Note that I've documented this in the text as the callback param in the list has
filePath
as a string. This could be changed so thecallback
taking an object is in the main docs: I'm happy to make this change.Stakeholders: @zcbenz & @paulcbetts appear to have last made major changes here. cc @MarshallOfSound as you kindly helped on the issue I filed.
Test failures don't appear to be related to my changes: one of them is:
(so, cc @MarshallOfSound)
Checklist
npm test
passes: failures appear unrelated to my changesRelease Notes
Notes: Add response header support to
protocol.registerFileProtocol
to matchprotocol.registerStreamProtocol
.