: asd(asd)
{
http_matchers = HttpPatternMatchers::get_instance();
- http_fields.reserve(MAX_HTTP_FIELD_ID);
- ptype_req_counts.assign(MAX_HTTP_FIELD_ID, 0);
- ptype_scan_counts.assign(MAX_HTTP_FIELD_ID, 0);
}
AppIdHttpSession::~AppIdHttpSession()
}
cmd.free_rewrite_buffers();
- ptype_scan_counts.assign(MAX_HTTP_FIELD_ID, 0);
+ memset(ptype_scan_counts, 0, sizeof(ptype_scan_counts));
// Make it possible for other detectors to run.
skip_simple_detect = false;
asd.scan_flags &= ~SCAN_HTTP_VIA_FLAG;
asd.scan_flags &= ~SCAN_HTTP_USER_AGENT_FLAG;
asd.scan_flags &= ~SCAN_HTTP_HOST_URL_FLAG;
- ptype_scan_counts.assign(MAX_HTTP_FIELD_ID, 0);
+ memset(ptype_scan_counts, 0, sizeof(ptype_scan_counts));
}
else /* if we have a candidate, but we're not finished */
{
void AppIdHttpSession::reset_ptype_scan_counts()
{
- ptype_scan_counts.assign(MAX_HTTP_FIELD_ID, 0);
+ memset(ptype_scan_counts, 0, sizeof(ptype_scan_counts));
}
#define APPID_HTTP_SESSION_H
#include <string>
-#include <vector>
#include "flow/flow.h"
#include "sfip/sf_ip.h"
+
#include "appid_types.h"
#include "application_ids.h"
+#include "detector_plugins/http_url_patterns.h"
#include "http_xff_fields.h"
class AppIdSession;
std::string req_body;
std::string server;
std::string x_working_with;
- std::vector<HttpField> http_fields;
bool is_webdav = false;
bool chp_finished = false;
AppId chp_candidate = APP_ID_NONE;
snort::SfIp* xff_addr = nullptr;
const char** xffPrecedence = nullptr;
unsigned numXffFields = 0;
- std::vector<int> ptype_req_counts;
- std::vector<int> ptype_scan_counts;
+ HttpField http_fields[MAX_HTTP_FIELD_ID];
+ int ptype_req_counts[MAX_HTTP_FIELD_ID] = {0};
+ int ptype_scan_counts[MAX_HTTP_FIELD_ID] = {0};
#if RESPONSE_CODE_PACKET_THRESHHOLD
unsigned response_code_packets = 0;
#endif
snort_free(temp_host);
/* if referred_id feature id disabled, referer will be null */
- if ( referer && (!payload_found ||
+ if ( referer and (referer[0] != '\0') and (!payload_found or
AppInfoManager::get_instance().get_app_info_flags(data->payload_id,
APPINFO_FLAG_REFERRED)) )
{
(const uint8_t*)URL_SCHEME_END_PATTERN, sizeof(URL_SCHEME_END_PATTERN)-1);
if ( !referer_offset )
- return false;
+ return payload_found;
referer_offset += sizeof(URL_SCHEME_END_PATTERN)-1;
referer_start = referer_offset;
AppIdHttpSession::AppIdHttpSession(AppIdSession& session)
: asd(session)
{
- http_fields.reserve(MAX_HTTP_FIELD_ID);
- ptype_req_counts.assign(MAX_HTTP_FIELD_ID, 0);
- ptype_scan_counts.assign(MAX_HTTP_FIELD_ID, 0);
}
AppIdHttpSession::~AppIdHttpSession()
hsession->set_field_offset(REQ_HOST_FID, attribute_data.http_request_host_begin());
hsession->set_field_end_offset(REQ_HOST_FID, attribute_data.http_request_host_end());
if (appidDebug->is_active())
- LogMessage("AppIdDbg %s HTTP host is %s\n",
- appidDebug->get_debug_session(), field->c_str());
+ LogMessage("AppIdDbg %s HTTP host (%u-%u) is %s\n",
+ appidDebug->get_debug_session(), hsession->get_field_offset(REQ_HOST_FID),
+ hsession->get_field_end_offset(REQ_HOST_FID), field->c_str());
asd.scan_flags |= SCAN_HTTP_HOST_URL_FLAG;
}
hsession->set_field_offset(REQ_URI_FID, attribute_data.http_request_uri_begin());
hsession->set_field_end_offset(REQ_URI_FID, attribute_data.http_request_uri_end());
if (appidDebug->is_active())
- LogMessage("AppIdDbg %s uri (%u-%u) is %s\n", appidDebug->get_debug_session(),
+ LogMessage("AppIdDbg %s URI (%u-%u) is %s\n", appidDebug->get_debug_session(),
hsession->get_field_offset(REQ_URI_FID),
hsession->get_field_end_offset(REQ_URI_FID), hsession->get_uri());
}
if ( contains(proto_list, APP_ID_HTTP) )
{
if (appidDebug->is_active())
- LogMessage("AppIdDbg %s flow is HTTP\n", appidDebug->get_debug_session());
+ LogMessage("AppIdDbg %s Flow is HTTP\n", appidDebug->get_debug_session());
asd.set_session_flags(APPID_SESSION_HTTP_SESSION);
}
if ( contains(proto_list, APP_ID_SPDY) )
{
if (appidDebug->is_active())
- LogMessage("AppIdDbg %s flow is SPDY\n", appidDebug->get_debug_session());
+ LogMessage("AppIdDbg %s Flow is SPDY\n", appidDebug->get_debug_session());
asd.set_session_flags(APPID_SESSION_HTTP_SESSION | APPID_SESSION_SPDY_SESSION);
}