@@ -19,7 +19,7 @@ function M.get_editor_info()
1919 },
2020 editorPluginInfo = {
2121 name = " copilot.vim" ,
22- version = " 1.7 .0" ,
22+ version = " 1.8 .0" ,
2323 },
2424 }
2525 return info
@@ -124,12 +124,6 @@ function M.is_attached(client)
124124 return client and vim .lsp .buf_is_attached (0 , client .id ) or false
125125end
126126
127- local eol_by_fileformat = {
128- unix = " \n " ,
129- dos = " \r\n " ,
130- mac = " \r " ,
131- }
132-
133127local language_normalization_map = {
134128 bash = " shellscript" ,
135129 bst = " bibtex" ,
@@ -179,12 +173,6 @@ function M.get_doc()
179173 position = params .position ,
180174 }
181175
182- local lines = vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false )
183- if vim .bo .endofline and vim .bo .fixendofline then
184- table.insert (lines , " " )
185- end
186- doc .source = table.concat (lines , eol_by_fileformat [vim .bo .fileformat ] or " \n " )
187-
188176 return doc
189177end
190178
@@ -255,6 +243,28 @@ function M.get_network_proxy()
255243 user_pass = nil
256244 end
257245
246+ local query_string
247+ host_port , query_string = unpack (vim .split (host_port , " ?" , { plain = true , trimempty = true }))
248+
249+ local rejectUnauthorized = vim .g .copilot_proxy_strict_ssl
250+
251+ if query_string then
252+ local query_params = vim .split (query_string , ' &' , { plain = true , trimempty = true })
253+ for _ , query_param in ipairs (query_params ) do
254+ local strict_ssl = string.match (query_param , ' strict_?ssl=(.*)' )
255+
256+ if string.find (strict_ssl , ' ^[1t]' ) then
257+ rejectUnauthorized = true
258+ break
259+ end
260+
261+ if string.find (strict_ssl , ' ^[0f]' ) then
262+ rejectUnauthorized = false
263+ break
264+ end
265+ end
266+ end
267+
258268 local host , port = unpack (vim .split (host_port , " :" , { plain = true , trimempty = true }))
259269 local username , password
260270
@@ -268,6 +278,7 @@ function M.get_network_proxy()
268278 port = tonumber (port or 80 ),
269279 username = username ,
270280 password = password ,
281+ rejectUnauthorized = rejectUnauthorized ,
271282 }
272283end
273284
0 commit comments