gptel-curl: don't try converting CR-LF on Windows #456
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use curl's header size output to
goto-char
to the end of the response header (to parse the JSON that starts there).On Windows, however, processes we launch will typically output Windows-style line endings, with CR-LF; by default, Emacs tries to convert this to just CR, to avoid seeing ugly
^M
characters at the end of lines.curl
dumps what it gets from the server directly... but HTTP also specifiesCR-LF line endings, at least at the end of headers. On Windows, Emacs converts
these to CRs, removing the LFs, and thus causing our header size measurement to
be slightly off (the buffer now includes fewer characters of header vs. what
curl
told us we'd have). Sogoto-char
seeks too much ahead, missing thebeginning of the JSON; we get a JSON parse error.
This PR fixes this by forcing the process coding system to the UNIX variant (with no CR-LF conversion).
We gate this behind an "is this Windows" check so it shouldn't affect other systems.
Fixes #455.