summaryrefslogtreecommitdiff
path: root/src/mbgl/storage/http_request_base.cpp
blob: a1bb71714d0763bd1c75b9fe8a923b97206184da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <mbgl/storage/http_request_base.hpp>

#include <mbgl/util/http_header.hpp>
#include <mbgl/util/chrono.hpp>

namespace mbgl {

Seconds HTTPRequestBase::parseCacheControl(const char *value) {
    if (value) {
        const auto cacheControl = http::CacheControl::parse(value);
        if (cacheControl.maxAge) {
            return toSeconds(SystemClock::now()) + Seconds(*cacheControl.maxAge);
        }
    }

    return Seconds::zero();
}

}