MCPcopy Create free account
hub / github.com/apache/trafficserver / generate

Method generate

plugins/esi/combo_handler.cc:306–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306string
307CacheControlHeader::generate() const
308{
309 unsigned int max_age;
310 char line_buf[256];
311 const char *publicity;
312 const char *immutable;
313
314 // Previously, all combo_cache documents were public. However, that's a bug. If any requested document is private the combo_cache
315 // document should private as well.
316 if (_publicity == Publicity::PUBLIC || _publicity == Publicity::DEFAULT) {
317 publicity = TS_HTTP_VALUE_PUBLIC;
318 } else {
319 publicity = TS_HTTP_VALUE_PRIVATE;
320 }
321
322 immutable = (_immutable ? ", " HTTP_IMMUTABLE : "");
323 max_age = (_max_age == numeric_limits<unsigned int>::max() ? 315360000 : _max_age); // default is 10 years
324
325 snprintf(line_buf, sizeof(line_buf), "Cache-Control: max-age=%u, %s%s\r\n", max_age, publicity, immutable);
326 return string(line_buf);
327}
328
329// forward declarations
330static int handleReadRequestHeader(TSCont contp, TSEvent event, void *edata);

Callers 1

prepareResponseFunction · 0.80

Calls 1

stringClass · 0.85

Tested by

no test coverage detected