Skip to content

Instantly share code, notes, and snippets.

@joshkoenig
Created April 13, 2015 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshkoenig/5bca8bfb8a4996941398 to your computer and use it in GitHub Desktop.
Save joshkoenig/5bca8bfb8a4996941398 to your computer and use it in GitHub Desktop.
Background Process module tweakage
# ADDED AN "X-.*" TO THE END TO AVOID RE-SENDING CUSTOM HEADERS.
/**
* Remove headers we do not wish to pass on to the next request.
*
* @param $headers
* Headers to filter
* @return array
* Filtered headers
*/
function _background_process_filter_headers($headers) {
$result = array();
if (empty($headers)) {
return $result;
}
foreach ($headers as $key => $value) {
if (!preg_match('/^(Connection|Keep-Alive|Proxy-Authenticate|Proxy-Authorization|TE|Trailers|Transfer-Encoding|Upgrade|Set-Cookie|Content-Length|Host|Accept-Encoding|X-.*)$/i', $key)) {
$result[$key] = $value;
}
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment