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

feat(corporate proxy #1188): support in verifier #1199

Merged
merged 1 commit into from Mar 25, 2024

Conversation

zac-poe-vg
Copy link
Contributor

Add native support of HTTPS_PROXY and HTTP_PROXY for verifier for #1188

This change adds two pieces of behavior:

  • The verifier's 2 step parse body behavior now uses a proxy request buffer (instead of the 'proxyReq' rewrite behavior) to ensure the request stream is accessible for intermediary agent behavior
  • The verifier natively supports HTTP_PROXY/HTTPS_PROXY config and assigns a proxy http Agent where those values are present

This results in out-of-the-box support for corporate proxies in the js verifier

Add native support of HTTPS_PROXY and HTTP_PROXY for verifier
}

if (bodyData) {
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is one piece of behavior that did go away - I didn't see any tests around content length header specifically, so I thought this might have just been a best practice with the rewrite that was used here

if this creates a gap, let me know and I can see about doing something similar with the proxy request options

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I believe this was required given the way the previous body was parsed and then re-written into the subsequent request. Given that you're now using the buffer option on the HttpProxy itself, perhaps it's no longer needed.

The main behaviour we'll need to check is if we can intercept and modify the incoming body using the hooks/filters. I'll pull this in locally and do some testing, I don't think it's an area with great test coverage if I'm honest.

Copy link
Member

@mefellows mefellows left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. i'm going to test locally with a few scenarios and if they work, will bring this in asap!

}

if (bodyData) {
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I believe this was required given the way the previous body was parsed and then re-written into the subsequent request. Given that you're now using the buffer option on the HttpProxy itself, perhaps it's no longer needed.

The main behaviour we'll need to check is if we can intercept and modify the incoming body using the hooks/filters. I'll pull this in locally and do some testing, I don't think it's an area with great test coverage if I'm honest.

@mefellows mefellows merged commit c00acd4 into pact-foundation:master Mar 25, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants