| 304 | } |
| 305 | |
| 306 | string |
| 307 | CacheControlHeader::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 |
| 330 | static int handleReadRequestHeader(TSCont contp, TSEvent event, void *edata); |
no test coverage detected