1.20.x bootstrap.inc backdrop_set_length_headers($content_length)

Set headers for content-length and content-range.

These headers allow the browser to deliver the page to the user without waiting for PHP to finish execution.

File

includes/bootstrap.inc, line 1933
Functions that need to be loaded on every Backdrop request.

Code

function backdrop_set_length_headers($content_length) {
  // Set the total content length.
  backdrop_add_http_header('Content-Length', $content_length);

  // If using chunked content (enabled with Apache mod_deflate), then specifying
  // the content range is required. This delivers the entire page in one chunk.
  backdrop_add_http_header('Content-Range', '0-' . ($content_length - 1) . '/' . $content_length);
}