Commit 02af2cc
committed
squash! remote-curl: unbreak http.extraHeader with custom allocators
remote-curl: unbreak http.extraHeader with custom allocators
In 93b980e (http: use xmalloc with cURL, 2019-08-15), we started to
ask cURL to use `xmalloc()`, and if compiled with nedmalloc, that means
implicitly a different allocator than the system one.
Which means that all of cURL's allocations and releases now _need_ to
use that allocator.
However, the `http_options()` function used `slist_append()` to add any
configured extra HTTP header(s) _before_ asking cURL to use `xmalloc()`,
and `http_cleanup()` would release them _afterwards_, i.e. in the
presence of custom allocators, cURL would attempt to use the wrong
allocator to release the memory.
A naïve attempt at fixing this would move the call to
`curl_global_init()` _before_ the config is parsed (i.e. before that
call to `slist_append()`).
However, that does work, as we _also_ parse the config setting
`http.sslbackend` and if found, call `curl_global_sslset()` which *must*
be called before `curl_global_init()`, for details see:
https://curl.haxx.se/libcurl/c/curl_global_sslset.html
So let's instead make the config parsing entirely independent from
cURL's data structures. Incidentally, this deletes two more lines than
it introduces, which is nice.
Signed-off-by: Johannes Schindelin <[email protected]>1 parent ffb6f1c commit 02af2cc
1 file changed
+11
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
418 | | - | |
| 417 | + | |
419 | 418 | | |
420 | | - | |
421 | | - | |
| 419 | + | |
422 | 420 | | |
423 | 421 | | |
424 | 422 | | |
| |||
1064 | 1062 | | |
1065 | 1063 | | |
1066 | 1064 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | 1065 | | |
1071 | 1066 | | |
1072 | 1067 | | |
| |||
1107 | 1102 | | |
1108 | 1103 | | |
1109 | 1104 | | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1110 | 1108 | | |
1111 | 1109 | | |
1112 | 1110 | | |
| |||
1202 | 1200 | | |
1203 | 1201 | | |
1204 | 1202 | | |
1205 | | - | |
1206 | | - | |
| 1203 | + | |
1207 | 1204 | | |
1208 | 1205 | | |
1209 | 1206 | | |
| |||
1627 | 1624 | | |
1628 | 1625 | | |
1629 | 1626 | | |
1630 | | - | |
| 1627 | + | |
| 1628 | + | |
1631 | 1629 | | |
1632 | | - | |
1633 | | - | |
| 1630 | + | |
| 1631 | + | |
1634 | 1632 | | |
1635 | 1633 | | |
1636 | 1634 | | |
| |||
0 commit comments