}
if (HttpTestManager::use_test_input(type))
{
- if (ret_val == StreamSplitter::ABORT)
- return StreamSplitter::ABORT;
return StreamSplitter::FLUSH;
}
- else
#endif
return ret_val;
}
SectionType type = session_data->type_expected[source_id];
- if (type == SEC_ABORT)
- return status_value(StreamSplitter::ABORT);
-
#ifdef REG_TEST
if (HttpTestManager::use_test_input(HttpTestManager::IN_HTTP))
{
return StreamSplitter::FLUSH;
data = test_data;
}
- else if (HttpTestManager::use_test_output(HttpTestManager::IN_HTTP))
+#endif
+
+ if (type == SEC_ABORT)
+ return status_value(StreamSplitter::ABORT);
+
+#ifdef REG_TEST
+ if (HttpTestManager::use_test_output(HttpTestManager::IN_HTTP) &&
+ !HttpTestManager::use_test_input(HttpTestManager::IN_HTTP))
{
printf("Scan from flow data %" PRIu64
" direction %d length %u client port %hu server port %hu\n", session_data->seq_num,
// function is to read dev_notes.txt.
void HttpTestInput::scan(uint8_t*& data, uint32_t& length, SourceId source_id, uint64_t seq_num)
{
- bool skip_to_break = false;
if (seq_num != curr_seq_num)
{
assert(source_id == SRC_CLIENT);
curr_seq_num = seq_num;
- // If we have not yet found the break command we need to skim past everything and not
- // return any data until we find it.
- skip_to_break = !need_break;
reset();
}
strlen("request")))
{
last_source_id = SRC_CLIENT;
- if (!skip_to_break)
- {
- length = 0;
- return;
- }
+ length = 0;
+ return;
}
else if ((command_length == strlen("response")) && !memcmp(command_value,
"response", strlen("response")))
{
last_source_id = SRC_SERVER;
- if (!skip_to_break)
- {
- length = 0;
- return;
- }
+ length = 0;
+ return;
}
else if ((command_length == strlen("break")) && !memcmp(command_value, "break",
strlen("break")))
{
reset();
- if (!skip_to_break)
- need_break = true;
+ need_break = true;
length = 0;
return;
}
"tcpclose", strlen("tcpclose")))
{
tcp_closed = true;
- if (!skip_to_break)
- {
- length = 0;
- return;
- }
+ length = 0;
+ return;
}
else if ((command_length > strlen("fill")) && !memcmp(command_value, "fill",
strlen("fill")))
// auto-fill ABCDEFGHIJABCD ...
msg_buf[last_source_id][end_offset[last_source_id]++] = 'A' + k%10;
}
- if (skip_to_break)
- end_offset[last_source_id] = 0;
- else
- {
- length = end_offset[last_source_id] - previous_offset[last_source_id];
- return;
- }
+ length = end_offset[last_source_id] - previous_offset[last_source_id];
+ return;
}
else if ((command_length == strlen("partial")) && !memcmp(command_value,
"partial", strlen("partial")))
assert(new_octet != EOF);
msg_buf[last_source_id][end_offset[last_source_id]++] = new_octet;
}
- if (skip_to_break)
- end_offset[last_source_id] = 0;
- else
- {
- length = end_offset[last_source_id] - previous_offset[last_source_id];
- return;
- }
+ length = end_offset[last_source_id] - previous_offset[last_source_id];
+ return;
}
else if ((command_length > strlen("fileskip")) && !memcmp(command_value,
"fileskip", strlen("fileskip")))
ending = true;
}
// Found the second consecutive blank line that ends the paragraph.
- else if (skip_to_break)
- {
- end_offset[last_source_id] = 0;
- ending = false;
- state = WAITING;
- }
else
{
length = end_offset[last_source_id] - previous_offset[last_source_id];
assert(end_offset[last_source_id] < sizeof(msg_buf[last_source_id]));
}
// End-of-file. Return everything we have so far.
- if (skip_to_break)
- end_offset[last_source_id] = 0;
length = end_offset[last_source_id] - previous_offset[last_source_id];
}