Skip to content

Commit

Permalink
Return STREAM_STATE_TUNNEL after entering a tunnel.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Ristic committed Apr 6, 2010
1 parent d9ff582 commit 4de9f4f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
18 changes: 15 additions & 3 deletions htp/htp_request.c
Expand Up @@ -793,6 +793,7 @@ int htp_connp_req_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_DATA (previous error)\n");
#endif

return STREAM_STATE_ERROR;
}

Expand All @@ -806,6 +807,7 @@ int htp_connp_req_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_DATA (zero-length chunk)\n");
#endif

return STREAM_STATE_ERROR;
}

Expand All @@ -822,9 +824,10 @@ int htp_connp_req_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
// mode (which it would be after an initial CONNECT transaction).
if (connp->in_status == STREAM_STATE_TUNNEL) {
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_DATA (tunnel)\n");
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_TUNNEL\n");
#endif
return STREAM_STATE_DATA;

return STREAM_STATE_TUNNEL;
}

// Invoke a processor, in a loop, until an error
Expand All @@ -843,12 +846,21 @@ int htp_connp_req_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
// on processors to add error messages, so we'll
// keep quiet here.
int rc = connp->in_state(connp);
if (rc != HTP_OK) {
if (rc == HTP_OK) {
if (connp->in_status == STREAM_STATE_TUNNEL) {
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_TUNNEL\n");
#endif

return STREAM_STATE_TUNNEL;
}
} else {
// Do we need more data?
if (rc == HTP_DATA) {
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_req_data: returning STREAM_STATE_DATA\n");
#endif

return STREAM_STATE_DATA;
}

Expand Down
17 changes: 14 additions & 3 deletions htp/htp_response.c
Expand Up @@ -754,6 +754,7 @@ int htp_connp_res_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_res_data: returning STREAM_STATE_DATA (previous error)\n");
#endif

return STREAM_STATE_ERROR;
}

Expand All @@ -767,6 +768,7 @@ int htp_connp_res_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_res_data: returning STREAM_STATE_DATA (zero-length chunk)\n");
#endif

return STREAM_STATE_ERROR;
}

Expand All @@ -782,9 +784,10 @@ int htp_connp_res_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
// mode (which it would be after an initial CONNECT transaction.
if (connp->out_status == STREAM_STATE_TUNNEL) {
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_res_data: returning STREAM_STATE_DATA (tunnel)\n");
fprintf(stderr, "htp_connp_res_data: returning STREAM_STATE_TUNNEL\n");
#endif
return STREAM_STATE_DATA;

return STREAM_STATE_TUNNEL;
}

// Invoke a processor, in a loop, until an error
Expand All @@ -803,7 +806,15 @@ int htp_connp_res_data(htp_connp_t *connp, htp_time_t timestamp, unsigned char *
// on processors to add error messages, so we'll
// keep quiet here.
int rc = connp->out_state(connp);
if (rc != HTP_OK) {
if (rc == HTP_OK) {
if (connp->out_status == STREAM_STATE_TUNNEL) {
#ifdef HTP_DEBUG
fprintf(stderr, "htp_connp_res_data: returning STREAM_STATE_TUNNEL\n");
#endif

return STREAM_STATE_TUNNEL;
}
} else {
// Do we need more data?
if (rc == HTP_DATA) {
#ifdef HTP_DEBUG
Expand Down

0 comments on commit 4de9f4f

Please sign in to comment.