EVENT_SETTINGS_FRAME_UNKN_PARAM = 12,
EVENT_FRAME_SEQUENCE = 13,
EVENT_DYNAMIC_TABLE_OVERFLOW = 14,
+ EVENT_INVALID_STARTLINE = 15,
EVENT__MAX_VALUE
};
INF_DYNAMIC_TABLE_OVERFLOW = 22,
INF_TABLE_SIZE_UPDATE_WITHIN_HEADER = 23,
INF_TOO_MANY_TABLE_SIZE_UPDATES = 24,
+ INF_INVALID_STARTLINE = 25,
+ INF_INVALID_HEADER = 26,
INF__MAX_VALUE
};
#include "http2_headers_frame.h"
#include "protocols/packet.h"
-
+#include "service_inspectors/http_inspect/http_enum.h"
+#include "service_inspectors/http_inspect/http_flow_data.h"
#include "service_inspectors/http_inspect/http_inspect.h"
#include "service_inspectors/http_inspect/http_stream_splitter.h"
assert(copied == (unsigned)start_line->length());
}
+ HttpFlowData* http_flow = session_data->get_current_stream(source_id)->get_hi_flow_data();
// http_inspect eval() and clear() of start line
{
Http2DummyPacket dummy_pkt;
dummy_pkt.dsize = stream_buf.length;
dummy_pkt.data = stream_buf.data;
session_data->hi->eval(&dummy_pkt);
+ if (http_flow->get_type_expected(source_id) != HttpEnums::SEC_HEADER)
+ {
+ *session_data->infractions[source_id] += INF_INVALID_STARTLINE;
+ session_data->events[source_id]->create_event(EVENT_INVALID_STARTLINE);
+ hi_abort = true;
+ return;
+ }
session_data->hi->clear(&dummy_pkt);
}
const StreamSplitter::Status header_scan_result =
session_data->hi_ss[source_id]->scan(&dummy_pkt, http1_header->start(),
http1_header->length(), unused, &flush_offset);
- if (header_scan_result == StreamSplitter::ABORT)
- {
- // eval() aborted the start line?
- hi_abort = true;
- return;
- }
assert(header_scan_result == StreamSplitter::FLUSH);
+ UNUSED(header_scan_result);
assert((int64_t)flush_offset == http1_header->length());
}
dummy_pkt.data = stream_buf.data;
dummy_pkt.xtradata_mask = 0;
session_data->hi->eval(&dummy_pkt);
+ //Following if condition won't get exercised until finish() is
+ //implemented for H2I. Without finish() H2I will only flush
+ //complete header blocks. Below ABORT is only possible if
+ //tcp connection closes unexpectedly in middle of a header.
+ if (http_flow->get_type_expected(source_id) == HttpEnums::SEC_ABORT)
+ {
+ *session_data->infractions[source_id] += INF_INVALID_HEADER;
+ session_data->events[source_id]->create_event(EVENT_INVALID_HEADER);
+ hi_abort = true;
+ return;
+ }
detection_required = dummy_pkt.is_detection_required();
xtradata_mask = dummy_pkt.xtradata_mask;
}