* @brief Append query parameters by following the rules specified in the query configuration object. * @param config query configuration containing information about which query parameters need to be appended to the key. * @note Keep the query parameters in the "query part" (RFC 3986). */
| 637 | * @note Keep the query parameters in the "query part" (RFC 3986). |
| 638 | */ |
| 639 | void |
| 640 | CacheKey::appendQuery(const ConfigQuery &config) |
| 641 | { |
| 642 | /* No query parameters in the cache key? */ |
| 643 | if (config.toBeRemoved()) { |
| 644 | return; |
| 645 | } |
| 646 | |
| 647 | const char *query; |
| 648 | int length; |
| 649 | |
| 650 | query = TSUrlHttpQueryGet(_buf, _url, &length); |
| 651 | if (query == nullptr || length == 0) { |
| 652 | return; |
| 653 | } |
| 654 | |
| 655 | /* If need to skip all other rules just append the whole query to the key. */ |
| 656 | if (config.toBeSkipped()) { |
| 657 | _key.append("?"); |
| 658 | _key.append(query, length); |
| 659 | return; |
| 660 | } |
| 661 | |
| 662 | /* Use the corresponding container based on whether we need |
| 663 | * to sort the parameters (set) or keep the order (list) */ |
| 664 | String keyQuery; |
| 665 | if (config.toBeSorted()) { |
| 666 | keyQuery = getKeyQuery<StringSet>(query, length, config); |
| 667 | } else { |
| 668 | keyQuery = getKeyQuery<StringList>(query, length, config); |
| 669 | } |
| 670 | |
| 671 | if (!keyQuery.empty()) { |
| 672 | _key.append(keyQuery); |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | /** |
| 677 | * @brief Append User-Agent header captures specified in the Pattern configuration object. |
no test coverage detected