FIXME: the etag alteration isn't proper. it should modify the value inside quotes specify a very header..
| 303 | // FIXME: the etag alteration isn't proper. it should modify the value inside quotes |
| 304 | // specify a very header.. |
| 305 | static TSReturnCode |
| 306 | etag_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 |
| 339 | static void |
no test coverage detected