Flush headers before potentially blocking
Merge pull request #545 from AudriusButkevicius/flush

Flush headers before potentially blocking