You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
This only occurs when enabling https.
As a quick fix, I made the following changes to htp__create_reply_
static struct evbuffer *
htp__create_reply_(evhtp_request_t * request, evhtp_res code)
{
struct evbuffer * buf;
...
evhtp_headers_for_each(request->headers_out, htp__create_headers_, buf);
evbuffer_add(buf, "\r\n", 2);
/* -ajf -- Apparently SSL and evbuffer combined don't like evbuffer_add_buffer.
Performance jumps by a factor of 40 with this solution.
Also tried evbuffer_add_reference() and evbuffer_remove_buffer()
to avoid a copy, but no joy.
Data is copied at least 3 times making this a horrible hack.
*/
size_t len=evbuffer_get_length(request->buffer_out);
if(len)
{
char *add;
add=htp__malloc_(len);
evhtp_alloc_assert(add);
evbuffer_copyout(request->buffer_out, add, len);
evbuffer_add(buf, add, len);
free(add);
}
return buf;
/*
if (evbuffer_get_length(request->buffer_out)) {
evbuffer_add_buffer(buf, request->buffer_out);
}
return buf;
*/
} /* htp__create_reply_ */
Maybe I'm doing something wrong? If not, I'm guessing the problem is in libevent.
However, since I'm only tracking down the problem this far, I'm reporting it here. Hoping you can come up with a better solution than the multiple copies I'm doing.
The text was updated successfully, but these errors were encountered:
Actually the problem doesn't go away with the above edit when buffer_out size is more than about 800 bytes. My guess is that performance is degraded when the buffer is fragmented and ssl is on. This is a simpler fix and seems to work with larger buffer_out sizes:
First: Thanks for the library!
Details
Steps or code to reproduce the problem.
In the examples/https/example_https_server.c I added a call to evbuffer_add:
Benchmarking the difference:
Before adding the body text:
After adding the body text:
This only occurs when enabling https.
As a quick fix, I made the following changes to htp__create_reply_
Maybe I'm doing something wrong? If not, I'm guessing the problem is in libevent.
However, since I'm only tracking down the problem this far, I'm reporting it here. Hoping you can come up with a better solution than the multiple copies I'm doing.
The text was updated successfully, but these errors were encountered: