Skip to content

https support for proxy relay#564

Merged
jirimoravcik merged 9 commits into
apify:masterfrom
arenevier:master
Dec 2, 2024
Merged

https support for proxy relay#564
jirimoravcik merged 9 commits into
apify:masterfrom
arenevier:master

Conversation

@arenevier

Copy link
Copy Markdown
Contributor

Fix for issue #563

@jancurn jancurn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the improvement, it looks like a reasonable change. Any chance you could also update the tests?

@arenevier

Copy link
Copy Markdown
Contributor Author

Would be happy to modify the tests. But I'm not sure what to modify. Also, running the tests hang on my laptop, after the following output:


% npm test

> proxy-chain@2.5.5 test
> nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha --bail



(node:232095) Warning: Using insecure HTTP parsing
(Use `node --trace-warnings ...` to show where the warning was created)
  ✔ supports localAddress
  ✔ supports custom CONNECT server handler
  ✔ supports pre-response CONNECT payload
  utils.anonymizeProxy
    ✔ throws for invalid args
    ✔ throws for unsupported https: protocol
    ✔ throws for invalid ports
    ✔ throws for invalid URLs
    ✔ keeps already anonymous proxies (both with callbacks and promises)
    1) anonymizes authenticated upstream proxy (both with callbacks and promises)


  8 passing (63ms)
  1 failing

  1) utils.anonymizeProxy
       anonymizes authenticated upstream proxy (both with callbacks and promises):
     AssertionError: expected 'socket hang up' to include 'ECONNREFUSED'
      at /home/arno/src/proxy-chain/test/anonymize_proxy.js:236:48
      at processTicksAndRejections (node:internal/process/task_queues:95:5)

@jancurn jancurn requested a review from jirimoravcik November 20, 2024 21:50
@jirimoravcik

jirimoravcik commented Nov 21, 2024

Copy link
Copy Markdown
Member

Would be happy to modify the tests. But I'm not sure what to modify. Also, running the tests hang on my laptop, after the following output:


% npm test

> proxy-chain@2.5.5 test
> nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha --bail



(node:232095) Warning: Using insecure HTTP parsing
(Use `node --trace-warnings ...` to show where the warning was created)
  ✔ supports localAddress
  ✔ supports custom CONNECT server handler
  ✔ supports pre-response CONNECT payload
  utils.anonymizeProxy
    ✔ throws for invalid args
    ✔ throws for unsupported https: protocol
    ✔ throws for invalid ports
    ✔ throws for invalid URLs
    ✔ keeps already anonymous proxies (both with callbacks and promises)
    1) anonymizes authenticated upstream proxy (both with callbacks and promises)


  8 passing (63ms)
  1 failing

  1) utils.anonymizeProxy
       anonymizes authenticated upstream proxy (both with callbacks and promises):
     AssertionError: expected 'socket hang up' to include 'ECONNREFUSED'
      at /home/arno/src/proxy-chain/test/anonymize_proxy.js:236:48
      at processTicksAndRejections (node:internal/process/task_queues:95:5)

Hey, for the tests, you can just see them run here in GitHub actions.
If you're adding a test locally, you can just run the test you've added and will (hopefully) work in CI as well.

@arenevier

Copy link
Copy Markdown
Contributor Author

I added a test. I was not able to connect to a https server in the test. But in the test, I can check that proxyServer does not consider the relay url as invalid. The code snippet will fail without the PR, and pass with it.

Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
Comment thread test/server.js Outdated
arenevier and others added 7 commits December 2, 2024 10:24
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Co-authored-by: Jiří Moravčík <jiri.moravcik@gmail.com>
@jirimoravcik jirimoravcik merged commit be4bf40 into apify:master Dec 2, 2024
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.

3 participants