]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Enable libhtp 0.3.0 compilation and crash free UT run. Still see 5 failed tests.
authorVictor Julien <victor@inliniac.net>
Fri, 5 Oct 2012 09:46:05 +0000 (11:46 +0200)
committerAnoop Saldanha <anoopsaldanha@gmail.com>
Mon, 15 Jul 2013 07:15:45 +0000 (12:45 +0530)
src/app-layer-htp.c
src/suricata-common.h

index 7908806dea59568c9480b8e27c1500dc8b42fd43..6f5ce72d70395b259b9173820dadbbc082ced6c6 100644 (file)
@@ -633,14 +633,15 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
     if (!(hstate->flags & HTP_FLAG_STATE_OPEN)) {
         SCLogDebug("opening htp handle at %p", hstate->connp);
 
-        htp_connp_open(hstate->connp, NULL, f->sp, NULL, f->dp, 0);
+        htp_connp_open(hstate->connp, NULL, f->sp, NULL, f->dp, &f->startts);
         hstate->flags |= HTP_FLAG_STATE_OPEN;
     } else {
         SCLogDebug("using existing htp handle at %p", hstate->connp);
     }
 
+    htp_time_t ts = { f->lastts_sec, 0 };
     /* pass the new data to the htp parser */
-    r = htp_connp_req_data(hstate->connp, 0, input, input_len);
+    r = htp_connp_req_data(hstate->connp, &ts, input, input_len);
 
     switch(r) {
         case STREAM_STATE_ERROR:
@@ -669,7 +670,8 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
         hstate->connp->in_status = STREAM_STATE_CLOSED;
         // Call the parsers one last time, which will allow them
         // to process the events that depend on stream closure
-        htp_connp_req_data(hstate->connp, 0, NULL, 0);
+        htp_time_t ts = { f->lastts_sec, 0 };
+        htp_connp_req_data(hstate->connp, &ts, NULL, 0);
         hstate->flags |= HTP_FLAG_STATE_CLOSED_TS;
         SCLogDebug("stream eof encountered, closing htp handle for ts");
     }
@@ -723,7 +725,8 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
      * reactivate it if necessary) */
     hstate->flags &=~ HTP_FLAG_NEW_BODY_SET;
 
-    r = htp_connp_res_data(hstate->connp, 0, input, input_len);
+    htp_time_t ts = { f->lastts_sec, 0 };
+    r = htp_connp_res_data(hstate->connp, &ts, input, input_len);
     switch(r) {
         case STREAM_STATE_ERROR:
             HTPHandleError(hstate);
@@ -750,7 +753,8 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
         hstate->connp->out_status = STREAM_STATE_CLOSED;
         // Call the parsers one last time, which will allow them
         // to process the events that depend on stream closure
-        htp_connp_res_data(hstate->connp, 0, NULL, 0);
+        htp_time_t ts = { f->lastts_sec, 0 };
+        htp_connp_res_data(hstate->connp, &ts, NULL, 0);
         hstate->flags |= HTP_FLAG_STATE_CLOSED_TC;
     }
 
@@ -2375,7 +2379,10 @@ static FileContainer *HTPStateGetFiles(void *state, uint8_t direction) {
 
 static int HTPStateGetAlstateProgress(void *tx, uint8_t direction)
 {
-    return ((htp_tx_t *)tx)->progress[direction];
+    if (direction == 0)
+        return ((htp_tx_t *)tx)->request_progress;
+    else
+        return ((htp_tx_t *)tx)->response_progress;
 }
 
 static uint64_t HTPStateGetTxCnt(void *alstate)
@@ -3949,7 +3956,7 @@ libhtp:\n\
     }
 
     cfg_rec = cfg_rec->next;
-    if (cfg_rec->cfg->path_replacement_char != 'o' ||
+    if (cfg_rec->cfg->bestfit_replacement_char != 'o' ||
         cfg_rec->cfg->path_unicode_mapping != STATUS_400) {
         printf("failed 2\n");
         goto end;
index a7555ec80e2fcd291de71972530a499eb4fb6a47..54203b2f9cff3a35795c6f2fcf99697f91e3d375 100644 (file)
@@ -313,5 +313,9 @@ typedef enum PacketProfileDetectId_ {
 size_t strlcat(char *, const char *src, size_t siz);
 size_t strlcpy(char *dst, const char *src, size_t siz);
 
+#define table_getc(x, y) table_get_c(x, y)
+#define bstr_cmpc(x, y) bstr_cmp_c(x, y)
+#define bstr_tocstr(x) bstr_util_strdup_to_c(x)
+
 #endif /* __SURICATA_COMMON_H__ */