/* finalize cached headers before dumping them */
if (lws_finalize_http_header(wsi,
(unsigned char **)&wsi->cgi->headers_pos,
- (unsigned char *)wsi->cgi->headers_end))
+ (unsigned char *)wsi->cgi->headers_end)) {
+
+ lwsl_notice("finalize failed\n");
return -1;
+ }
wsi->hdr_state = LHCS_DUMP_HEADERS;
+ wsi->reason_bf |= 8;
+ lws_callback_on_writable(wsi);
/* back to the loop for writeability again */
return 0;
if (wsi->cgi->headers_dumped == wsi->cgi->headers_pos) {
wsi->hdr_state = LHCS_PAYLOAD;
lws_free_set_NULL(wsi->cgi->headers_buf);
+ } else {
+ wsi->reason_bf |= 8;
+ lws_callback_on_writable(wsi);
}
/* writeability becomes uncertain now we wrote
if (cgi->pid <= 0)
continue;
+ /* finish sending cached headers */
+ if (cgi->headers_buf)
+ continue;
+
/* wait for stdout to be drained */
if (cgi->content_length > cgi->content_length_seen)
continue;
goto finish_him;
}
+ /* finish sending cached headers */
+ if (cgi->headers_buf)
+ continue;
+
/* wait for stdout to be drained */
if (cgi->content_length > cgi->content_length_seen)
continue;