Help getting HTTPS to work in Command Line in Windows 10 (please note that HTTP is working)

  • Thread starter Thread starter AcidSlide
  • Start date Start date
A

AcidSlide

Guest
Hi there,


I have been searching on the net for a couple of hours already and haven't found a solution. I've even tried disabling the Windows Firewall and Windows Defender to see if it is blocking the outgoing HTTPS requests from the command line.


I have Node/Npm installed in my Win10 machine and I was trying to install some node modules, but I keep on getting ECONNRESET error. I also have a curl.exe in my System32 folder which is also not working for any HTTPS links I've tried.


>curl.exe --version​

curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL​

Release-Date: [unreleased]​

Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp​

Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL​



>node --version​

v10.16.3​


>npm --version​

6.12.0​

(NOTE: NPM version was originally 6.3.x, details later)​


When I try the following, I get handshake errors:

>curl.exe -vvv Google

* Rebuilt URL to: Google

* Trying 172.217.25.4...​

* TCP_NODELAY set​

* Connected to www.google.com (172.217.25.4) port 443 (#0)​

* schannel: SSL/TLS connection with www.google.com port 443 (step 1/3)​

* schannel: checking server certificate revocation​

* schannel: sending initial handshake data: sending 179 bytes...​

* schannel: sent initial handshake data: sent 179 bytes​

* schannel: SSL/TLS connection with www.google.com port 443 (step 2/3)​

* schannel: failed to receive handshake, need more data​

* schannel: SSL/TLS connection with www.google.com port 443 (step 2/3)​

* schannel: encrypted data got 2536​

* schannel: encrypted data buffer: offset 2536 length 4096​

* schannel: sending next handshake data: sending 93 bytes...​

* schannel: SSL/TLS connection with www.google.com port 443 (step 2/3)​

* schannel: failed to receive handshake, SSL/TLS connection failed​

* Closing connection 0​

* schannel: shutting down SSL/TLS connection with www.google.com port 443​

* schannel: clear security context handle​

curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed​



>curl.exe -vvv https://registry.npmjs.org

* Rebuilt URL to: https://registry.npmjs.org/

* Trying 104.16.27.35...​

* TCP_NODELAY set​

* Connected to registry.npmjs.org (104.16.27.35) port 443 (#0)​

* schannel: SSL/TLS connection with registry.npmjs.org port 443 (step 1/3)​

* schannel: checking server certificate revocation​

* schannel: sending initial handshake data: sending 183 bytes...​

* schannel: sent initial handshake data: sent 183 bytes​

* schannel: SSL/TLS connection with registry.npmjs.org port 443 (step 2/3)​

* schannel: failed to receive handshake, need more data​

* schannel: SSL/TLS connection with registry.npmjs.org port 443 (step 2/3)​

* schannel: encrypted data got 3706​

* schannel: encrypted data buffer: offset 3706 length 4096​

* schannel: sending next handshake data: sending 93 bytes...​

* schannel: SSL/TLS connection with registry.npmjs.org port 443 (step 2/3)​

* schannel: failed to receive handshake, SSL/TLS connection failed​

* Closing connection 0​

* schannel: shutting down SSL/TLS connection with registry.npmjs.org port 443​

* schannel: clear security context handle​

curl: (35) schannel: failed to receive handshake, SSL/TLS connection failed​





But changing HTTPS to HTTP works...


>curl.exe -vvv Google

* Rebuilt URL to: Google

* Trying 172.217.24.68...​

* TCP_NODELAY set​

* Connected to www.google.com (172.217.24.68) port 80 (#0)​

> GET / HTTP/1.1​

> Host: www.google.com

> User-Agent: curl/7.55.1​

> Accept: */*​

>​

< HTTP/1.1 200 OK​

< Date: Sat, 19 Oct 2019 01:20:34 GMT​

< Expires: -1​

< Cache-Control: private, max-age=0​

< Content-Type: text/html; charset=ISO-8859-1​

< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."​

< Server: gws​

< X-XSS-Protection: 0​

< X-Frame-Options: SAMEORIGIN​

< Set-Cookie: 1P_JAR=2019-10-19-01; expires=Mon, 18-Nov-2019 01:20:34 GMT; path=/; domain=.google.com; SameSite=none​

< Set-Cookie: NID=189=PxPsuD1n4LsfC77Baaf3PAPMp50XQ3bUIpUFoM8ydmSPTioeM7aMlArlMJz_OhXwuU4cfwd5ybtYMBYO7Y7Ayvhxm9tbCKDNallkAoLUGLkvayCd0u3SEMBv2aJ3m-BorrQGi5YOrIwBmLNaS-KlY8EIpvLeOwMjOsEcPPqduTY; expires=Sun, 19-Apr-2020 01:20:34 GMT; path=/; domain=.google.com; HttpOnly​

< Accept-Ranges: none​

< Vary: Accept-Encoding​

< Transfer-Encoding: chunked​

<​

<!doctype html><html itemscope="" itemtype="WebPage - schema.org Type"​

[RESPOSNE WAS TOO LONG TO INCLUDE IN POST, NO SENSE IN PASTING THE WHOLE THING]​



>curl.exe -vvv http://registry.npmjs.org

* Rebuilt URL to: http://registry.npmjs.org/

* Trying 104.16.16.35...​

* TCP_NODELAY set​

* Connected to registry.npmjs.org (104.16.16.35) port 80 (#0)​

> GET / HTTP/1.1​

> Host: registry.npmjs.org​

> User-Agent: curl/7.55.1​

> Accept: */*​

>​

< HTTP/1.1 200 OK​

< Date: Sat, 19 Oct 2019 01:21:30 GMT​

< Content-Type: application/json​

< Transfer-Encoding: chunked​

< Connection: keep-alive​

< Set-Cookie: __cfduid=d983a8f1b249904e9da683121a42717f21571448090; expires=Sun, 18-Oct-20 01:21:30 GMT; path=/; domain=.npmjs.org; HttpOnly​

< CF-Cache-Status: DYNAMIC​

< Cache-Control: must-revalidate​

< CF-Ray: 527eef83eec56076-MNL​

< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"​

< Server: cloudflare​

<​

{"db_name":"registry","doc_count":1423204,"doc_del_count":340,"update_seq":13888173,"purge_seq":0,"compact_running":false,"disk_size":27631710439,"other":{"data_size":62800564597},"data_size":27006746374,"sizes":{"file":27631710439,"active":27006746374,"external":62800564597},"instance_start_time":"1569513360816858"****st registry.npmjs.org left intact​



So as you can see, HTTPS is giving errors, but not HTTP. I don't have any proxy configured, I don't have limitations in my network, and I even tried disabling Windows Firewall and Windows Defender. I have an Ubuntu WSL, an Ubuntu VM (via vmware), and there is no problem with HTTPS in them.


To test this, I change the npm registry from https://registry.npmjs.org/ to http://registry.npmjs.org/


WITH NPM REGISTRY SET TO HTTPS

>npm install --global --production npm-windows-upgrade --verbose​

npm info it worked if it ends with ok​

npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',​

npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',​

npm verb cli 'install',​

npm verb cli '--global',​

npm verb cli '--production',​

npm verb cli 'npm-windows-upgrade',​

npm verb cli '--verbose' ]​

npm info using npm@6.12.0​

npm info using node@v10.16.3​

npm verb npm-session 8f54e2561f964acb​

npm timing stage:rollbackFailedOptional Completed in 0ms​

npm timing stage:runTopLevelLifecycles Completed in 115092ms​

npm verb type system​

npm verb stack FetchError: request to https://registry.npmjs.org/npm-windows-upgrade failed, reason: Client network socket disconnected before secure TLS connection was established​

npm verb stack at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)​

npm verb stack at ClientRequest.emit (events.js:198:13)​

npm verb stack at TLSSocket.socketErrorListener (_http_client.js:392:9)​

npm verb stack at TLSSocket.emit (events.js:198:13)​

npm verb stack at emitErrorNT (internal/streams/destroy.js:91:8)​

npm verb stack at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)​

npm verb stack at process._tickCallback (internal/process/next_tick.js:63:19)​

npm verb cwd C:\WINDOWS\system32​

npm verb Windows_NT 10.0.18362​

npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--production" "npm-windows-upgrade" "--verbose"​

npm verb node v10.16.3​

npm verb npm v6.12.0​

npm ERR! code ECONNRESET​

npm ERR! errno ECONNRESET​

npm ERR! network request to https://registry.npmjs.org/npm-windows-upgrade failed, reason: Client network socket disconnected before secure TLS connection was established​

npm ERR! network This is a problem related to network connectivity.​

npm ERR! network In most cases you are behind a proxy or have bad network settings.​

npm ERR! network​

npm ERR! network If you are behind a proxy, please make sure that the​

npm ERR! network 'proxy' config is set properly. See: 'npm help config'​

npm verb exit [ 1, true ]​

npm timing npm Completed in 116077ms​


WITH NPM REGISTRY SET TO HTTP

>npm install --global --production npm-windows-upgrade --verbose

npm info it worked if it ends with ok​

npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',​

npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',​

npm verb cli 'install',​

npm verb cli '--global',​

npm verb cli '--production',​

npm verb cli 'npm-windows-upgrade',​

npm verb cli '--verbose' ]​

npm info using npm@6.12.0​

npm info using node@v10.16.3​

npm verb npm-session 4cde14186baae336​

npm http fetch GET 304 http://registry.npmjs.org/npm-windows-upgrade 451ms (from cache)​

npm timing stage:loadCurrentTree Completed in 1439ms​

npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms​

npm timing stage:loadIdealTree:loadShrinkwrap Completed in 20ms​

npm http fetch GET 304 http://registry.npmjs.org/chalk 137ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/debug 139ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/commander 146ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/cli-spinner 154ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/inquirer 155ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/prompt 446ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/escape-string-regexp 36ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/supports-color 117ms (from cache)​

npm http fetch GET 304 http://registry.npmjs.org/ansi-styles 139ms (from cache)​


As you can see from above, no issue if its HTTP. I remember specifically, HTTPS used to work a few months back, so I am not sure what was changed in Windows 10 with the latest update. Below is my Win10 version.


Edition: Windows 10 Home Single License

Version: 1903

OS Build: 18362.418


I hope somebody can help, or at least have a solution!

Continue reading...
 
Back
Top