Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Incorrect Content-Lenght after toolbar injection #119

Open
basz opened this issue Aug 13, 2013 · 1 comment
Open

Incorrect Content-Lenght after toolbar injection #119

basz opened this issue Aug 13, 2013 · 1 comment

Comments

@basz
Copy link
Contributor

basz commented Aug 13, 2013

When the Content-Lenght is set by some module for an text/html asset (think asset manager for static html files in a data directory served via standard resolver :-) ) the Content-Lenght header will be incorrect after the Toolbar is injected. This results pages in half loaded.

adding the following at https://github.com/zendframework/ZendDeveloperTools/blob/master/src/ZendDeveloperTools/Listener/ToolbarListener.php#L163 will solve this

    if (function_exists('mb_strlen')) {
        $contentLength = mb_strlen($injected, '8bit');
    } else {
        $contentLength = strlen($injected);
    }

    $response->getHeaders()
        ->addHeaderLine('Content-Transfer-Encoding',   'binary')
        ->addHeaderLine('Content-Length',              $contentLength);

I don't actually need the toolbar on static pages, and i realize this only affects development environments, still I though "lets create a record of this...".

I also wonder why the Response object does not do this automatically...

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-developer-tools; a new issue has been opened at laminas/laminas-developer-tools#18.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants