Take some from jarred

This commit is contained in:
Alex Hultman
2022-10-23 03:41:03 +02:00
parent f762ede7d1
commit f0586366da
4 changed files with 44 additions and 11 deletions
+9 -2
View File
@@ -401,8 +401,8 @@ public:
/* Try and end the response. Returns [true, true] on success.
* Starts a timeout in some cases. Returns [ok, hasResponded] */
std::pair<bool, bool> tryEnd(std::string_view data, uintmax_t totalSize = 0) {
return {internalEnd(data, totalSize, true), hasResponded()};
std::pair<bool, bool> tryEnd(std::string_view data, uintmax_t totalSize = 0, bool closeConnection = false) {
return {internalEnd(data, totalSize, true, true, closeConnection), hasResponded()};
}
/* Write parts of the response in chunking fashion. Starts timeout if failed. */
@@ -445,6 +445,13 @@ public:
return httpResponseData->offset;
}
/* If you are messing around with sendfile you might want to override the offset. */
void overrideWriteOffset(uintmax_t offset) {
HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
httpResponseData->offset = offset;
}
/* Checking if we have fully responded and are ready for another request */
bool hasResponded() {
HttpResponseData<SSL> *httpResponseData = getHttpResponseData();