Merge branch 'master' into fix-intermittent-crash-due-to-GC-finalisation

This commit is contained in:
abraunegg 2025-12-27 14:39:51 +11:00 committed by GitHub
commit 70b08abf73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View file

@ -383,6 +383,8 @@ pkolmann
podman
pollfd
pollfds
postfields
postfieldsize
postun
prefork
preinit

View file

@ -503,6 +503,20 @@ class CurlEngine {
http.onSend = data => uploadFile.rawRead(data).length;
http.contentLength = offsetSize;
}
void setZeroContentLength() {
// Explicit HTTP semantics
http.contentLength = 0;
addRequestHeader("Content-Length", to!string(0));
// Force libcurl POST-with-empty-body semantics
// This prevents libcurl from attempting to read from stdin when performing a POST with no payload.
http.handle.set(CurlOption.postfields, "");
http.handle.set(CurlOption.postfieldsize, 0L);
// Defensive: ensure we are NOT in upload/read-callback mode
http.handle.set(CurlOption.upload, 0);
}
CurlResponse execute() {
scope(exit) {

View file

@ -1474,6 +1474,7 @@ class OneDriveApi {
bool validateJSONResponse = false;
oneDriveErrorHandlerWrapper((CurlResponse response) {
connect(HTTP.Method.post, url, false, response, requestHeaders);
curlEngine.setZeroContentLength();
return curlEngine.execute();
}, validateJSONResponse, callingFunction, lineno);
}