MCPcopy Index your code
hub / github.com/apache/httpd / cache_control_remove

Function cache_control_remove

modules/cache/cache_util.c:1139–1188  ·  view source on GitHub ↗

* Parse the Cache-Control, identifying and removing headers that * exist as tokens after the no-cache and private tokens. */

Source from the content-addressed store, hash-verified

1137 * exist as tokens after the no-cache and private tokens.
1138 */
1139static int cache_control_remove(request_rec *r, const char *cc_header,
1140 apr_table_t *headers)
1141{
1142 char *last, *slast;
1143 int found = 0;
1144
1145 if (cc_header) {
1146 char *header = apr_pstrdup(r->pool, cc_header);
1147 char *token = cache_strqtok(header, CACHE_SEPARATOR, &last);
1148 while (token) {
1149 switch (token[0]) {
1150 case 'n':
1151 case 'N': {
1152 if (!ap_cstr_casecmpn(token, "no-cache", 8)) {
1153 if (token[8] == '=') {
1154 const char *header = cache_strqtok(token + 9,
1155 CACHE_SEPARATOR "\"", &slast);
1156 while (header) {
1157 apr_table_unset(headers, header);
1158 header = cache_strqtok(NULL, CACHE_SEPARATOR "\"",
1159 &slast);
1160 }
1161 found = 1;
1162 }
1163 }
1164 break;
1165 }
1166 case 'p':
1167 case 'P': {
1168 if (!ap_cstr_casecmpn(token, "private", 7)) {
1169 if (token[7] == '=') {
1170 const char *header = cache_strqtok(token + 8,
1171 CACHE_SEPARATOR "\"", &slast);
1172 while (header) {
1173 apr_table_unset(headers, header);
1174 header = cache_strqtok(NULL, CACHE_SEPARATOR "\"",
1175 &slast);
1176 }
1177 found = 1;
1178 }
1179 }
1180 break;
1181 }
1182 }
1183 token = cache_strqtok(NULL, CACHE_SEPARATOR, &last);
1184 }
1185 }
1186
1187 return found;
1188}
1189
1190/*
1191 * Create a new table consisting of those elements from an

Callers 1

Calls 2

cache_strqtokFunction · 0.85
ap_cstr_casecmpnFunction · 0.85

Tested by

no test coverage detected