emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gptel b7ce74bcb7: gptel-curl: Don't convert CR-LF to CR on


From: ELPA Syncer
Subject: [nongnu] elpa/gptel b7ce74bcb7: gptel-curl: Don't convert CR-LF to CR on Windows (#456)
Date: Sun, 3 Nov 2024 03:59:56 -0500 (EST)

branch: elpa/gptel
commit b7ce74bcb777243bf21d20158e83efc889de7c8c
Author: Simon Sáfár <simon@simonsafar.com>
Commit: GitHub <noreply@github.com>

    gptel-curl: Don't convert CR-LF to CR on Windows (#456)
    
    gptel-curl.el (gptel-curl-get-response): Force
    process-coding-system on Windows to `utf-8-unix'.  This keeps
    Emacs from converting CR-LF line endings to CR and miscounting
    chars when parsing the HTTP response.  Fix #455.
---
 gptel-curl.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gptel-curl.el b/gptel-curl.el
index 2d4c8ee969..d428ee5296 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -113,6 +113,10 @@ the response is inserted into the current buffer after 
point."
          (backend (buffer-local-value 'gptel-backend (plist-get info :buffer)))
          (process (apply #'start-process "gptel-curl"
                          (generate-new-buffer "*gptel-curl*") "curl" args)))
+    (when (memq system-type '(windows-nt ms-dos))
+      ;; Don't try to convert cr-lf to cr on Windows so that curl's "header 
size
+      ;; in bytes" stays correct
+      (set-process-coding-system process 'utf-8-unix 'utf-8-unix))
     (when (eq gptel-log-level 'debug)
       (gptel--log (mapconcat #'shell-quote-argument (cons "curl" args) " \\\n")
                   "request Curl command" 'no-json))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]