Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion httpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ void hs_server_init(struct http_server_s* serv);
void hs_delete_events(struct http_request_s* request);
void hs_add_events(struct http_request_s* request);
void hs_add_write_event(struct http_request_s* request);
void hs_add_read_event(struct http_request_s* request);
void hs_process_tokens(http_request_t* request);

#ifdef KQUEUE
Expand Down Expand Up @@ -1093,6 +1094,7 @@ void hs_write_response(http_request_t* request) {
request->state = HTTP_SESSION_INIT;
hs_free_buffer(request);
hs_reset_timeout(request, HTTP_KEEP_ALIVE_TIMEOUT);
hs_add_read_event(request);
} else {
HTTP_FLAG_SET(request->flags, HTTP_END_SESSION);
}
Expand Down Expand Up @@ -1457,7 +1459,7 @@ void grwprintf(grwprintf_t* ctx, char const * fmt, ...) {
*ctx->memused += ctx->capacity;
ctx->buf = (char*)realloc(ctx->buf, ctx->capacity);
assert(ctx->buf != NULL);
bytes += vsnprintf(ctx->buf + ctx->size, ctx->capacity - ctx->size, fmt, args);
bytes = vsnprintf(ctx->buf + ctx->size, ctx->capacity - ctx->size, fmt, args);
}
ctx->size += bytes;

Expand Down Expand Up @@ -1754,6 +1756,13 @@ void hs_add_write_event(http_request_t* request) {
epoll_ctl(request->server->loop, EPOLL_CTL_MOD, request->socket, &ev);
}

void hs_add_read_event(http_request_t* request) {
struct epoll_event ev;
ev.events = EPOLLIN | EPOLLET;
ev.data.ptr = request;
epoll_ctl(request->server->loop, EPOLL_CTL_MOD, request->socket, &ev);
}

#endif

#endif
Expand Down