You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 2.6.9 and several versions prior, There was a "Use Tls" setting that was added in response to #28. That setting is no longer present.
To Reproduce
upgrade Twinny to 2.6.13
try to use it with a server that is listening for https instead of plain http
Expected behavior
Twinny should send the request over https.
Actual behaviour
Twinny sends the request over plain http.
Here is a capture of the request sent by Twinny:
POST /api/generate HTTP/1.1
Content-Type: application/json
Authorization: Bearer xxxxxx-xxxxxxxx-xxxxxx-xxx-xxx
Host: my.domain.com:444
Connection: close
Transfer-Encoding: chunked
3f3d
{"model":"codellama:13b-code","prompt":"<PRE> \n\n// Language: Javascript (javascript) \n// File uri: file:///Users/someguy/.vscode/extensions/rjmacarthy.twinny-2.6.13/out/extension.js (javascript) \n getFileHeader(e, t) {\n const n = a.languages[e];\n return n\n ? `\\n${n.comment?.start || \"\"} Language: ${n.name} (${e}) ${\n n.comment?.end || \"\"\n }\\n${n.comment?.start || \"\"} File uri: ${t.toString()} (${e}) ${\n n.comment?.end || \"\"\n }\\n`\n : \"\";\n }\n calculateSimilarity(e, t) {\n const n = e.split(\"/\"),\n i = t.split(\"/\"),\n o = n[n.length - 1],\n s = i[i.length - 1];\n return (\n n.slice(0, -1).join(\"/\").score(i.slice(0, -1).join(\"/\"), 0.5) +\n o.score(s, 0.5)\n );\n }\n getFileContext(e) {\n const t = [],\n n = e.toString();\n for (const e of i.workspace.textDocuments) {\n if (\n
and here is the TLS-terminating proxy's response:
HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 22 Jan 2024 17:03:06 GMT
Content-Type: text/html
Content-Length: 248
Connection: close
Strict-Transport-Security: max-age=63072000
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>
Looking at the extension code, I could see the extension examining a URL to see if it started with "http" or "https", but setting the URL to "https://my.domain.com" resulted in "invalid URL" errors from the extension:
2024-01-22 11:56:58.476 [error] ProxyResolver#addCertificatesV1 TypeError: Invalid URL
at new NodeError (node:internal/errors:399:5)
at Url.parse (node:url:425:17)
at Object.urlParse (node:url:147:13)
at useProxySettings (/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/@vscode/proxy-agent/out/index.js:121:35)
at /Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/@vscode/proxy-agent/out/index.js:113:13
at /Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/@vscode/proxy-agent/out/index.js:459:13
Editing the extension code to always require('https') makes Twinny send the request over https.
The text was updated successfully, but these errors were encountered:
Describe the bug
In version 2.6.9 and several versions prior, There was a "Use Tls" setting that was added in response to #28. That setting is no longer present.
To Reproduce
Expected behavior
Twinny should send the request over https.
Actual behaviour
Twinny sends the request over plain http.
Here is a capture of the request sent by Twinny:
and here is the TLS-terminating proxy's response:
Looking at the extension code, I could see the extension examining a URL to see if it started with "http" or "https", but setting the URL to "https://my.domain.com" resulted in "invalid URL" errors from the extension:
Editing the extension code to always
require('https')
makes Twinny send the request over https.The text was updated successfully, but these errors were encountered: