17 #ifndef PAGESPEED_KERNEL_HTTP_RESPONSE_HEADERS_H_
18 #define PAGESPEED_KERNEL_HTTP_RESPONSE_HEADERS_H_
29 namespace net_instaweb {
32 class HttpResponseHeaders;
39 enum VaryOption { kRespectVaryOnResources, kIgnoreVaryOnResources };
40 enum ValidatorOption { kHasValidator, kNoValidator };
58 int64 start_date_ms, int64 expire_ms, int64 now_ms,
125 VaryOption respect_vary_on_resources,
126 ValidatorOption has_request_validator)
const;
128 static VaryOption GetVaryOption(
bool respect_vary) {
129 return respect_vary ? kRespectVaryOnResources : kIgnoreVaryOnResources;
166 const StringPiece& cache_control_suffix);
176 void SetTimeHeader(
const StringPiece& header, int64 time_ms);
178 void SetLastModified(int64 last_modified_ms) {
179 SetTimeHeader(HttpAttributes::kLastModified, last_modified_ms);
210 int status_code()
const;
211 bool has_status_code()
const;
212 void set_status_code(
const int code);
213 const char* reason_phrase()
const;
214 void set_reason_phrase(
const StringPiece& reason_phrase);
216 const HttpOptions& http_options()
const {
return http_options_; }
223 void set_implicit_cache_ttl_ms(
const int64 ttl) {
227 bool has_last_modified_time_ms()
const;
228 int64 last_modified_time_ms()
const;
230 bool has_date_ms()
const;
231 int64 cache_ttl_ms()
const;
232 bool is_implicitly_cacheable()
const;
239 void DebugPrint()
const;
242 static bool ParseTime(
const char* time_str, int64* time_ms);
246 int status = status_code();
247 return status >= 400 && status <= 599;
252 int status = status_code();
253 return status >= 500 && status <= 599;
258 int status = status_code();
259 return status >= 300 && status <= 399 && status != 304;
264 bool WasGzippedLast()
const;
300 const StringPiece& reason_phrase) {
301 set_major_version(major_version);
302 set_minor_version(minor_version);
303 set_status_code(status_code);
304 set_reason_phrase(reason_phrase);
350 bool HasCookie(StringPiece name, StringPieceVector* values,
351 StringPieceVector* attributes)
const;
357 StringPiece* attribute_value);
365 const StringPieceVector& to_exclude,
366 int64 expiration_time);
367 bool ClearOptionCookies(
const GoogleUrl& gurl, StringPiece option_cookies,
368 const StringPieceVector& to_exclude);
389 StringPiece existing_cache_control,
407 bool CombineContentTypes(
const StringPiece& orig,
const StringPiece& fresh);
409 friend class ResponseHeadersTest;
410 bool cache_fields_dirty_;
417 int64 force_cache_ttl_ms_;
class GoogleUrl
Definition: google_url.h:58
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Interface for writing bytes to an output stream.
Definition: writer.h:29
Definition: content_type.h:31
Definition: message_handler.h:39
int64 implicit_cache_ttl_ms
TTL assigned to resources with no explicit caching headers.
Definition: http_options.h:30
Any options which need to be accessed in http/ should be in here.
Definition: http_options.h:25
const HttpOptions kDeprecatedDefaultHttpOptions