FIXME: some things are potentially compressible. those responses
| 337 | |
| 338 | // FIXME: some things are potentially compressible. those responses |
| 339 | static void |
| 340 | compress_transform_init(TSCont contp, Data *data) |
| 341 | { |
| 342 | // update the vary, content-encoding, and etag response headers |
| 343 | // prepare the downstream for transforming |
| 344 | |
| 345 | TSVConn downstream_conn; |
| 346 | TSMBuffer bufp; |
| 347 | TSMLoc hdr_loc; |
| 348 | |
| 349 | data->state = transform_state_output; |
| 350 | |
| 351 | if (TSHttpTxnTransformRespGet(data->txn, &bufp, &hdr_loc) != TS_SUCCESS) { |
| 352 | error("Error TSHttpTxnTransformRespGet"); |
| 353 | return; |
| 354 | } |
| 355 | |
| 356 | if (content_encoding_header(bufp, hdr_loc, data->compression_type, data->compression_algorithms) == TS_SUCCESS && |
| 357 | etag_header(bufp, hdr_loc) == TS_SUCCESS) { |
| 358 | downstream_conn = TSTransformOutputVConnGet(contp); |
| 359 | data->downstream_buffer = TSIOBufferCreate(); |
| 360 | data->downstream_reader = TSIOBufferReaderAlloc(data->downstream_buffer); |
| 361 | data->downstream_vio = TSVConnWrite(downstream_conn, contp, data->downstream_reader, INT64_MAX); |
| 362 | } |
| 363 | |
| 364 | TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc); |
| 365 | } |
| 366 | |
| 367 | static void |
| 368 | gzip_transform_one(Data *data, const char *upstream_buffer, int64_t upstream_length) |
no test coverage detected