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

Function etag_header

plugins/compress/compress.cc:305–336  ·  view source on GitHub ↗

FIXME: the etag alteration isn't proper. it should modify the value inside quotes specify a very header..

Source from the content-addressed store, hash-verified

303// FIXME: the etag alteration isn't proper. it should modify the value inside quotes
304// specify a very header..
305static TSReturnCode
306etag_header(TSMBuffer bufp, TSMLoc hdr_loc)
307{
308 TSReturnCode ret = TS_SUCCESS;
309 TSMLoc ce_loc;
310
311 ce_loc = TSMimeHdrFieldFind(bufp, hdr_loc, TS_MIME_FIELD_ETAG, TS_MIME_LEN_ETAG);
312
313 if (ce_loc) {
314 int strl;
315 const char *strv = TSMimeHdrFieldValueStringGet(bufp, hdr_loc, ce_loc, -1, &strl);
316
317 // do not alter weak etags.
318 // FIXME: consider just making the etag weak for compressed content
319 if (strl >= 2) {
320 int changetag = 1;
321 if ((strv[0] == 'w' || strv[0] == 'W') && strv[1] == '/') {
322 changetag = 0;
323 }
324 if (changetag) {
325 ret = TSMimeHdrFieldValueAppend(bufp, hdr_loc, ce_loc, 0, "-df", 3);
326 }
327 }
328 TSHandleMLocRelease(bufp, hdr_loc, ce_loc);
329 }
330
331 if (ret != TS_SUCCESS) {
332 error("cannot handle the %s header", TS_MIME_FIELD_ETAG);
333 }
334
335 return ret;
336}
337
338// FIXME: some things are potentially compressible. those responses
339static void

Callers 1

compress_transform_initFunction · 0.85

Calls 5

TSMimeHdrFieldFindFunction · 0.85
TSHandleMLocReleaseFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected