Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add TransfomHeadersAgent #26
Add TransfomHeadersAgent #26
Changes from 11 commits
0a641d7
c4ccbf2
c99fd8b
ba8ce71
2be4f86
328c700
8ead6d3
8228e07
8bc624f
814d3de
7e79a8e
318ef1d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Oh, sorry for the confusion. The
x-something
was just an example. The header could bemy-header
as well or some other randomness. We've seen quite a few.Also I think there are some
X-
headers which are actually sent by the browsers likeX-Requested-With
.So the determination of the "custom headers" is a bit more complex.
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.
Lemme patch this real quick
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.
X-Requested-With
doesn't exist in the spec: https://www.iana.org/assignments/message-headers/message-headers.xhtml nor in the MDN docs: https://developer.mozilla.org/pl/docs/Web/HTTP/HeadersThere 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.
If the generator returns in the correct casing then it should be no problem I think?
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.
Yeah, the generator should always return correct casing. Unless we encounter some crap UA like the
applebot
.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.
And yeah, I might be wrong about the
X-Requested-With
. I've seen it multiple times so I thought it's sent by the browser but maybe it's just common among developers to include it.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.
Then this PR is good to go I think. I'm planning to optimize HTTP/2 related stuff next such as the ALPN negotiation. I think there's no need to manually store the cache anymore.
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.
I'm a bit torn whether this improves readability. I know it's shorter this way, but it made more sense to me when both the options were next to each other and not separated by the big comment. I don't have a strong opinion about this, but would like to learn why you think it's better this way.
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.
It's required. Otherwise it would fail if the user provided their own agents.
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.
It's because
http2.request
is used here.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.
Maybe I'm blind, but I don't see any difference in behavior between:
and
🤷♂️
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.
The
if (resolvedRequestProtocol === 'http2') {
is outsideif (proxyUrl) {
, previously it was inside. You're not blind, it just may not be obvious at first sight. Let me add appropriate comments in this regards :)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.
got-scraping/src/hooks/proxy.js
Lines 46 to 51 in 8ead6d3
Unless you mean something else 🤔