Permalink
Browse files

Re-Introduce Mechanism for Compressors to Set Their Own Headers

Summary:
We will need this for more advanced / negotiated compression protocols.

Depends on D10111296.

Reviewed By: terrelln

Differential Revision: D10478090

fbshipit-source-id: 803babd070fd694ed85f6d5246c5833d127d1e8e
  • Loading branch information...
felixhandte authored and hhvm-bot committed Oct 21, 2018
1 parent 80f2ed1 commit 2a77cdce200bc334372692ed71313430aad06f01
Showing with 10 additions and 0 deletions.
  1. +3 −0 hphp/runtime/server/compression.cpp
  2. +7 −0 hphp/runtime/server/compression.h
@@ -503,6 +503,9 @@ void ResponseCompressorManager::setResponseHeaders() {
m_headers->addHeader("Vary", "Accept-Encoding");
}
}
if (m_selectedImpl) {
m_selectedImpl->setResponseHeaders();
}
}
///////////////////////////////////////////////////////////////////////////////
@@ -84,6 +84,13 @@ struct ResponseCompressor {
*/
virtual StringHolder compressResponse(const char *data, int len, bool last) = 0;
/**
* When the manager knows it will use this compressor, it will call this
* method so that the compressor has an opportunity to set any additional
* response headers needed (the manager sets "Vary" and "Content-Encoding").
*/
virtual void setResponseHeaders() {}
protected:
ITransportHeaders * const m_headers;
int8_t m_accepted{-1}; // cached value: -1 unknown, 0 false, 1 true.

0 comments on commit 2a77cdc

Please sign in to comment.