Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't send last HTTP header and first sendfile chunks at the same time

  • Loading branch information...
commit e88527b33146ffb4961c54c83df14c404356e1b6 1 parent be6396a
@jonashaag authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 bjoern/server.c
View
12 bjoern/server.c
@@ -193,10 +193,14 @@ ev_io_on_write(struct ev_loop* mainloop, ev_io* watcher, const int events)
if(request->state.use_sendfile) {
/* sendfile */
- if(request->current_chunk && send_chunk(request))
- goto out;
- /* abuse current_chunk_p to store the file fd */
- request->current_chunk_p = PyObject_AsFileDescriptor(request->iterable);
+ if(request->current_chunk) {
+ /* current_chunk contains the HTTP headers */
+ if(send_chunk(request))
+ goto out;
+ assert(!request->current_chunk_p);
+ /* abuse current_chunk_p to store the file fd */
+ request->current_chunk_p = PyObject_AsFileDescriptor(request->iterable);
+ }
if(do_sendfile(request))
goto out;
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.