Last active
June 25, 2022 08:47
-
-
Save ziyan-junaideen/4fe8e8937caada5d9e35a11884d7cb37 to your computer and use it in GitHub Desktop.
Error trying to sign get Net::HTTP to POST to a HTTPS URL through a proxy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdeen@iMac:/Volumes/Dev/Work/Edge/edge|ziyan/edg-158-transaction-authorisations-through-vgs⚡ | |
⇒ curl https://eoftqqzi7ii7mmn.m.pipedream.net -vvv --cacert lib/vgs/certs/sandbox.pem \ | |
-x https://$HTTPS_PROXY_USERNAME:[email protected]:8443 \ | |
-H "Content-type: application/json" \ | |
-d '{ | |
"card_cvc": "tok_sandbox_sXTRFEQqsidYhF6uwW1w9r", | |
"card_exp": "10/25", | |
"card_number": "tok_sandbox_uQPorT8AJ5g4e3727Q93bm" | |
}' | |
* Trying 3.215.240.222:8443... | |
* Connected to tnttla0t7dc.sandbox.verygoodproxy.com (3.215.240.222) port 8443 (#0) | |
* ALPN, offering http/1.1 | |
* successfully set certificate verify locations: | |
* CAfile: /Volumes/Dev/Applications/anaconda3/ssl/cacert.pem | |
* CApath: none | |
* TLSv1.3 (OUT), TLS handshake, Client hello (1): | |
* TLSv1.3 (IN), TLS handshake, Server hello (2): | |
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): | |
* TLSv1.3 (IN), TLS handshake, Certificate (11): | |
* TLSv1.3 (IN), TLS handshake, CERT verify (15): | |
* TLSv1.3 (IN), TLS handshake, Finished (20): | |
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): | |
* TLSv1.3 (OUT), TLS handshake, Finished (20): | |
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 | |
* ALPN, server did not agree to a protocol | |
* Proxy certificate: | |
* subject: CN=*.reverse.sandbox.verygoodproxy.com | |
* start date: Jun 3 10:07:08 2022 GMT | |
* expire date: Sep 1 10:07:07 2022 GMT | |
* subjectAltName: host "tnttla0t7dc.sandbox.verygoodproxy.com" matched cert's "*.sandbox.verygoodproxy.com" | |
* issuer: C=US; O=Let's Encrypt; CN=R3 | |
* SSL certificate verify ok. | |
* allocate connect buffer! | |
* Establish HTTP proxy tunnel to eoftqqzi7ii7mmn.m.pipedream.net:443 | |
* Proxy auth using Basic with user 'USw9hbQ1PRht6Qu3aYGzgdNj' | |
> CONNECT eoftqqzi7ii7mmn.m.pipedream.net:443 HTTP/1.1 | |
> Host: eoftqqzi7ii7mmn.m.pipedream.net:443 | |
> Proxy-Authorization: Basic VVN3OWhiUTFQUmh0NlF1M2FZR3pnZE5qOmYxZjRmY2RmLTFhN2ItNDdhZS1iMDU1LTNhOGRhNWYwNmQyMA== | |
> User-Agent: curl/7.78.0 | |
> Proxy-Connection: Keep-Alive | |
> | |
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): | |
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): | |
< HTTP/1.1 200 Connection established | |
< Connection: keep-alive | |
< Via: 1.1 forward-proxy-02-58557d979c-r4bmk | |
< | |
* Proxy replied 200 to CONNECT request | |
* CONNECT phase completed! | |
* ALPN, offering h2 | |
* ALPN, offering http/1.1 | |
* successfully set certificate verify locations: | |
* CAfile: lib/vgs/certs/sandbox.pem | |
* CApath: none | |
* TLSv1.3 (OUT), TLS handshake, Client hello (1): | |
* TLSv1.3 (IN), TLS handshake, Server hello (2): | |
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): | |
* TLSv1.3 (OUT), TLS handshake, Client hello (1): | |
* TLSv1.3 (IN), TLS handshake, Server hello (2): | |
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): | |
* TLSv1.3 (IN), TLS handshake, Certificate (11): | |
* TLSv1.3 (IN), TLS handshake, CERT verify (15): | |
* TLSv1.3 (IN), TLS handshake, Finished (20): | |
* TLSv1.3 (OUT), TLS handshake, Finished (20): | |
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 | |
* ALPN, server did not agree to a protocol | |
* Server certificate: | |
* subject: CN=*.m.pipedream.net; O=Very Good Security, Inc.; OU=Very Good Security SecOps Team | |
* start date: Jun 2 09:36:08 2021 GMT | |
* expire date: Jun 7 19:43:56 2022 GMT | |
* subjectAltName: host "eoftqqzi7ii7mmn.m.pipedream.net" matched cert's "*.m.pipedream.net" | |
* issuer: CN=*.sandbox.verygoodproxy.com; O=Very Good Security, Inc.; OU=Very Good Security - Engineering Team | |
* SSL certificate verify ok. | |
> POST / HTTP/1.1 | |
> Host: eoftqqzi7ii7mmn.m.pipedream.net | |
> User-Agent: curl/7.78.0 | |
> Accept: */* | |
> Content-type: application/json | |
> Content-Length: 140 | |
> | |
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): | |
* Mark bundle as not supporting multiuse | |
< HTTP/1.1 200 OK | |
< Date: Mon, 06 Jun 2022 19:44:00 GMT | |
< Content-Type: application/json; charset=utf-8 | |
< X-Powered-By: Express | |
< Access-Control-Allow-Origin: * | |
< Via: 1.1 forward-proxy-02-58557d979c-r4bmk | |
< content-length: 407 | |
< VGS-Request-Id: 3720b1bc04b71ed270195fbfcb215996 | |
< | |
* Connection #0 to host tnttla0t7dc.sandbox.verygoodproxy.com left intact | |
{"about":"Pipedream is the fastest way to connects APIs. Build and run workflows with code-level control when you need it — and no code when you don't.","event_id":"2ADWSa5wwoYR8a0eurqnV2CQ56N","workflow_id":"p_k2CaPGL","owner_id":"u_1jh7vQ","deployment_id":"d_b4semqvy","timestamp":"2022-06-06T19:43:56.911Z","inspect":"https://pipedream.com/@/p_k2CaPGL","quickstart":"https://pipedream.com/quickstart/"}% | |
jdeen@iMac:/Volumes/Dev/Work/Edge/edge|ziyan/edg-158-transaction-authorisations-through-vgs⚡ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
require 'json' | |
uri = URI.parse('https://eoftqqzi7ii7mmn.m.pipedream.net') | |
http = Net::HTTP.new( | |
uri.host, | |
uri.port, | |
'tnttla0t7dc.sandbox.verygoodproxy.com', | |
'8443', | |
'[USERNAME]', | |
'[PASSWORD]' | |
) | |
http.use_ssl = true | |
http.ssl_version = :TLSv1_2 | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
http.ca_file = '/Volumes/Dev/Work/Edge/edge/lib/vgs/certs/sandbox.pem' | |
http.set_debug_output $stderr | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.body = { | |
card_number: 'tok_sandbox_sS27yztTZjuznHD1hmtgCS', | |
card_cvc: 'tok_sandbox_241N1r8hxoYDyqrUSmZ4ih', | |
card_expiration_date: '2212', | |
transaction_amount: 84.0 | |
}.to_json | |
response = http.request(request) | |
pp response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opening connection to tnttla0t7dc.sandbox.verygoodproxy.com:8443... | |
opened | |
<- "CONNECT eoftqqzi7ii7mmn.m.pipedream.net:443 HTTP/1.1\r\nHost: eoftqqzi7ii7mmn.m.pipedream.net:443\r\nProxy-Authorization: Basic VVN3OWhiUTFQUmh0NlF1M2FZR3pnZE5qOmYxZjRmY2RmLTFhN2ItNDdhZS1iMDU1LTNhOGRhNWYwNmQyMA==\r\n\r\n" | |
Conn close because of connect error end of file reached | |
Uncaught exception: end of file reached | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/gems/net-protocol-0.1.3/lib/net/protocol.rb:227:in `rbuf_fill' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/gems/net-protocol-0.1.3/lib/net/protocol.rb:193:in `readuntil' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/gems/net-protocol-0.1.3/lib/net/protocol.rb:203:in `readline' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http/response.rb:42:in `read_status_line' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http/response.rb:31:in `read_new' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http.rb:1020:in `connect' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http.rb:976:in `do_start' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http.rb:965:in `start' | |
/Users/jdeen/.rvm/rubies/ruby-3.1.1/lib/ruby/3.1.0/net/http.rb:1530:in `request' | |
/Volumes/Dev/Work/Edge/edge/test.rb:31:in `<top (required)>' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/bin/rdebug-ide:25:in `load' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/bin/rdebug-ide:25:in `<main>' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `eval' | |
/Users/jdeen/.rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment