39 static int HTTP2RegisterPatternsForProtocolDetection(
void)
45 IPPROTO_TCP,
ALPROTO_HTTP2,
"PRI * HTTP/2.0\r\n", 16, 0, STREAM_TOSERVER) < 0) {
56 const char *proto_name =
"http2";
60 if (HTTP2RegisterPatternsForProtocolDetection() < 0)
64 SCRegisterHttp2Parser();
75 if (h2s == NULL || h1tx == NULL) {
78 if (htp_tx_request_method(h1tx) == NULL) {
83 SCHttp2TxSetMethod(h2s, bstr_ptr(htp_tx_request_method(h1tx)),
84 (uint32_t)bstr_len(htp_tx_request_method(h1tx)));
85 if (htp_tx_request_uri(h1tx) != NULL) {
88 SCHttp2TxSetUri(h2s, bstr_ptr(htp_tx_request_uri(h1tx)),
89 (uint32_t)bstr_len(htp_tx_request_uri(h1tx)));
91 size_t nbheaders = htp_tx_request_headers_size(h1tx);
92 for (
size_t i = 0; i < nbheaders; i++) {
93 const htp_header_t *h = htp_tx_request_header_index(h1tx, i);
94 SCHttp2TxAddHeader(h2s, htp_header_name_ptr(h), (uint32_t)htp_header_name_len(h),
95 htp_header_value_ptr(h), (uint32_t)htp_header_value_len(h));