Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
[#38] I'm an idiot, fix for parser_init.
Browse files Browse the repository at this point in the history
Dear everyone,

I am an idiot.

This fixes #38

Yours,
Nathan
  • Loading branch information
NathanFrench committed Sep 29, 2017
1 parent 9db2231 commit 7c13a57
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions evhtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ htp__connection_readcb_(struct bufferevent * bev, void * arg)
} else if (htparser_get_error(c->parser) != htparse_error_none)
{
log_debug("error %d, freeing connection",
htparser_get_error(c->parser));
htparser_get_error(c->parser));

evhtp_connection_free(c);
} else if (nread < avail)
Expand Down Expand Up @@ -2200,6 +2200,8 @@ htp__connection_writecb_(struct bufferevent * bev, void * arg)

if (c->request->flags & EVHTP_REQ_FLAG_KEEPALIVE)
{
htp_type type;

htp__request_free_(c->request);

HTP_FLAG_ON(c, EVHTP_CONN_FLAG_KEEPALIVE);
Expand All @@ -2219,7 +2221,19 @@ htp__connection_writecb_(struct bufferevent * bev, void * arg)
c->htp = orig_htp;
}

htparser_init(c->parser, c->type);
switch (c->type) {
case evhtp_type_client:
type = htp_type_response;
break;
case evhtp_type_server:
type = htp_type_request;
break;
default:
evhtp_connection_free(c);
return;
}

htparser_init(c->parser, type);
htparser_set_userdata(c->parser, c);

return;
Expand Down

0 comments on commit 7c13a57

Please sign in to comment.