void CacheControlRecord::UpdateMatch(CacheControlResult* result, RequestData* rdata) Updates the parameters in result if the this element appears later in the file
| 350 | // appears later in the file |
| 351 | // |
| 352 | void |
| 353 | CacheControlRecord::UpdateMatch(CacheControlResult *result, RequestData *rdata) |
| 354 | { |
| 355 | bool match = false; |
| 356 | HttpRequestData *h_rdata = static_cast<HttpRequestData *>(rdata); |
| 357 | |
| 358 | switch (this->directive) { |
| 359 | case CC_REVALIDATE_AFTER: |
| 360 | if (this->CheckForMatch(h_rdata, result->reval_line) == true) { |
| 361 | result->revalidate_after = time_arg; |
| 362 | result->reval_line = this->line_num; |
| 363 | match = true; |
| 364 | } |
| 365 | break; |
| 366 | case CC_NEVER_CACHE: |
| 367 | if (this->CheckForMatch(h_rdata, result->never_line) == true) { |
| 368 | // ttl-in-cache overrides never-cache |
| 369 | if (result->ttl_line == -1) { |
| 370 | result->never_cache = true; |
| 371 | result->never_line = this->line_num; |
| 372 | match = true; |
| 373 | } |
| 374 | } |
| 375 | break; |
| 376 | case CC_STANDARD_CACHE: |
| 377 | // Standard cache just overrides never-cache |
| 378 | if (this->CheckForMatch(h_rdata, result->never_line) == true) { |
| 379 | result->never_cache = false; |
| 380 | result->never_line = this->line_num; |
| 381 | match = true; |
| 382 | } |
| 383 | break; |
| 384 | case CC_IGNORE_NO_CACHE: |
| 385 | // We cover both client & server cases for this directive |
| 386 | // FALLTHROUGH |
| 387 | case CC_IGNORE_CLIENT_NO_CACHE: |
| 388 | if (this->CheckForMatch(h_rdata, result->ignore_client_line) == true) { |
| 389 | result->ignore_client_no_cache = true; |
| 390 | result->ignore_client_line = this->line_num; |
| 391 | match = true; |
| 392 | } |
| 393 | if (this->directive != CC_IGNORE_NO_CACHE) { |
| 394 | break; |
| 395 | } |
| 396 | // FALLTHROUGH |
| 397 | case CC_IGNORE_SERVER_NO_CACHE: |
| 398 | if (this->CheckForMatch(h_rdata, result->ignore_server_line) == true) { |
| 399 | result->ignore_server_no_cache = true; |
| 400 | result->ignore_server_line = this->line_num; |
| 401 | match = true; |
| 402 | } |
| 403 | break; |
| 404 | case CC_PIN_IN_CACHE: |
| 405 | if (this->CheckForMatch(h_rdata, result->pin_line) == true) { |
| 406 | result->pin_in_cache_for = time_arg; |
| 407 | result->pin_line = this->line_num; |
| 408 | match = true; |
| 409 | } |