Skip to content
Snippets Groups Projects
Commit 4912f02a authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

Merge branch 'bugs-2671' into 'master'

hang-up fix no 1

See merge request !7
parents c1341143 739046a7
No related branches found
No related tags found
1 merge request!7hang-up fix no 1
......@@ -315,7 +315,7 @@ static inline void ReportErrorAndRestart( dap_client_remote_t *cl, dap_http_clie
*/
void dap_http_client_read( dap_client_remote_t *cl, void *arg )
{
char buf_line[4096];
char buf_line[4096] = {'\0'};
dap_http_client_t *cl_ht = DAP_HTTP_CLIENT( cl );
// log_it( L_DEBUG, "dap_http_client_read..." );
......@@ -329,12 +329,18 @@ void dap_http_client_read( dap_client_remote_t *cl, void *arg )
char *peol;
uint32_t eol;
if ( !(peol = (char *)memchr(cl->buf_in, 10, cl->buf_in_size)) ) { /// search LF
break;
if (!(peol = (char*)memchr(cl->buf_in, 10, cl->buf_in_size))) { /// search LF
peol = (char*)memchr(cl->buf_in, 13, cl->buf_in_size));
}
if ( !(eol = peol - cl->buf_in) ) {
break;
if (peol) {
eol = peol - cl->buf_in;
if (eol <= 0) {
eol = cl->buf_in_size - 2;
}
} else {
log_it( L_WARNING, "Single-line, possibly trash, input detected");
eol = cl->buf_in_size - 2;
}
if ( eol + 3 >= sizeof(buf_line) ) {
......@@ -423,6 +429,7 @@ void dap_http_client_read( dap_client_remote_t *cl, void *arg )
if ( !(peol = (char *)memchr(cl->buf_in, 10, cl->buf_in_size)) ) { /// search LF
log_it( L_WARNING, "DAP_HTTP_CLIENT_STATE_HEADERS: no LF" );
ReportErrorAndRestart( cl, cl_ht );
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment