[core] Add an explicit "not modified" indicator to Response
This commit is contained in:
@@ -206,17 +206,20 @@ void HTTPAndroidRequest::onResponse(int code, std::string message, std::string e
|
||||
if (code == 200) {
|
||||
// Nothing to do; this is what we want
|
||||
} else if (code == 304) {
|
||||
response->notModified = true;
|
||||
|
||||
if (existingResponse) {
|
||||
if (existingResponse->error) {
|
||||
response->error = std::make_unique<Error>(*existingResponse->error);
|
||||
if (response->expires == Seconds::zero()) {
|
||||
response->expires = existingResponse->expires;
|
||||
}
|
||||
|
||||
if (response->modified == Seconds::zero()) {
|
||||
response->modified = existingResponse->modified;
|
||||
}
|
||||
|
||||
if (response->etag.empty()) {
|
||||
response->etag = existingResponse->etag;
|
||||
}
|
||||
response->data = existingResponse->data;
|
||||
response->modified = existingResponse->modified;
|
||||
// We're not updating `expired`, it was probably set during the request.
|
||||
response->etag = existingResponse->etag;
|
||||
} else {
|
||||
// This is an unsolicited 304 response and should only happen on malfunctioning
|
||||
// HTTP servers. It likely doesn't include any data, but we don't have much options.
|
||||
}
|
||||
} else if (code == 404) {
|
||||
response->error = std::make_unique<Error>(Error::Reason::NotFound, "HTTP status code 404");
|
||||
|
||||
Reference in New Issue
Block a user