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

Method appendQuery

plugins/cachekey/cachekey.cc:639–674  ·  view source on GitHub ↗

* @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). */

Source from the content-addressed store, hash-verified

637 * @note Keep the query parameters in the "query part" (RFC 3986).
638 */
639void
640CacheKey::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.

Callers 1

setCacheKeyFunction · 0.80

Calls 6

TSUrlHttpQueryGetFunction · 0.85
toBeRemovedMethod · 0.80
toBeSkippedMethod · 0.80
toBeSortedMethod · 0.80
appendMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected