diff --git a/backends/networking/curl/sessionrequest.cpp b/backends/networking/curl/sessionrequest.cpp index 2520d12b0d1..3213c2dab91 100644 --- a/backends/networking/curl/sessionrequest.cpp +++ b/backends/networking/curl/sessionrequest.cpp @@ -62,6 +62,8 @@ void SessionRequest::openLocalFile(Common::String localFile) { return; } + debug(5, "SessionRequest: opened localfile %s", localFile.c_str()); + _binary = true; // Enforce binary } @@ -105,6 +107,11 @@ void SessionRequest::finishSuccess() { _complete = true; _success = true; + if (_localFile) { + _localFile->close(); + _localFile = nullptr; + } + if (_callback) { // If localfile is present, contentStream is empty, so it is fine _response.buffer = _contentsStream.getData(); _response.len = _contentsStream.size(); @@ -112,11 +119,6 @@ void SessionRequest::finishSuccess() { (*_callback)(DataResponse(this, &_response)); } - - if (_localFile) { - _localFile->close(); - _localFile = nullptr; - } } void SessionRequest::start() {