Skip to content

Commit 8e792a9

Browse files
committed
Set back the default size of http method
1 parent e561fa7 commit 8e792a9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

process/http.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,14 +534,18 @@ bool HTTPPlugin::valid_http_method(const char *method) const
534534
*/
535535
bool HTTPPlugin::invalid_http_method(const char *data, int payload_len) const
536536
{
537+
// arbitrary value, if the method is longer it propably isnt http request
538+
// so don't look further
539+
const int MAX_METHOD_LENGTH = 32;
540+
537541
// METHOD URI HTTP/VERSION
538542
// | | |
539543
// | | +---- uri_end
540544
// | +---- method_end
541545
// +---- data
542546

543547
// check if there is space in the first HTTP_MAX_METHOD_LENGTH chars
544-
int len = std::min(payload_len, HTTP_MAX_METHOD_LENGTH);
548+
int len = std::min(payload_len, MAX_METHOD_LENGTH);
545549
auto method_end = static_cast<const char *>(memchr(data, ' ', len));
546550
if (method_end == nullptr)
547551
return false;

process/http.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ namespace ipxp {
6565

6666
#define HTTP_UNIREC_TEMPLATE "HTTP_REQUEST_METHOD,HTTP_REQUEST_HOST,HTTP_REQUEST_URL,HTTP_REQUEST_AGENT,HTTP_REQUEST_REFERER,HTTP_RESPONSE_STATUS_CODE,HTTP_RESPONSE_CONTENT_TYPE"
6767

68-
// maximum supported length for http method (includes the null terminating char)
69-
#define HTTP_MAX_METHOD_LENGTH 16
70-
7168
UR_FIELDS (
7269
string HTTP_REQUEST_METHOD,
7370
string HTTP_REQUEST_HOST,
@@ -90,7 +87,7 @@ struct RecordExtHTTP : public RecordExt {
9087
bool req;
9188
bool resp;
9289

93-
char method[HTTP_MAX_METHOD_LENGTH];
90+
char method[10];
9491
char host[64];
9592
char uri[128];
9693
char user_agent[128];

0 commit comments

Comments
 (0)