diff --git a/internal/nginx_log/indexer/parallel_indexer_optimized.go b/internal/nginx_log/indexer/parallel_indexer_optimized.go index 0cb96057..e994e80d 100644 --- a/internal/nginx_log/indexer/parallel_indexer_optimized.go +++ b/internal/nginx_log/indexer/parallel_indexer_optimized.go @@ -289,8 +289,12 @@ func isValidLogEntry(doc *LogDocument) bool { // Check HTTP method if present if doc.Method != "" { validMethods := map[string]bool{ + // Standard HTTP methods "GET": true, "POST": true, "PUT": true, "DELETE": true, "HEAD": true, "OPTIONS": true, "PATCH": true, "CONNECT": true, "TRACE": true, + // WebDAV methods (RFC 4918) + "PROPFIND": true, "PROPPATCH": true, "MKCOL": true, + "COPY": true, "MOVE": true, "LOCK": true, "UNLOCK": true, } if !validMethods[doc.Method] { return false diff --git a/internal/nginx_log/parser/parser_test.go b/internal/nginx_log/parser/parser_test.go index 4d6a99b8..82cac0af 100644 --- a/internal/nginx_log/parser/parser_test.go +++ b/internal/nginx_log/parser/parser_test.go @@ -80,6 +80,37 @@ func TestParser_ParseLine(t *testing.T) { entry.BytesSent == 0 }, }, + { + name: "WebDAV PROPFIND method", + line: `192.168.1.100 - - [25/Dec/2023:10:00:00 +0000] "PROPFIND /webdav/ HTTP/1.1" 207 1234 "-" "davfs2/1.5.4"`, + validate: func(entry *AccessLogEntry) bool { + return entry.IP == "192.168.1.100" && + entry.Method == "PROPFIND" && + entry.Path == "/webdav/" && + entry.Status == 207 && + entry.BytesSent == 1234 + }, + }, + { + name: "WebDAV MKCOL method", + line: `10.0.0.5 - - [25/Dec/2023:10:00:00 +0000] "MKCOL /webdav/newdir/ HTTP/1.1" 201 0 "-" "WebDAVClient/1.0"`, + validate: func(entry *AccessLogEntry) bool { + return entry.IP == "10.0.0.5" && + entry.Method == "MKCOL" && + entry.Path == "/webdav/newdir/" && + entry.Status == 201 + }, + }, + { + name: "WebDAV LOCK method", + line: `172.16.0.1 - - [25/Dec/2023:10:00:00 +0000] "LOCK /webdav/file.txt HTTP/1.1" 200 512 "-" "Microsoft-WebDAV"`, + validate: func(entry *AccessLogEntry) bool { + return entry.IP == "172.16.0.1" && + entry.Method == "LOCK" && + entry.Path == "/webdav/file.txt" && + entry.Status == 200 + }, + }, } config := DefaultParserConfig() diff --git a/internal/nginx_log/parser/types.go b/internal/nginx_log/parser/types.go index c92e0a4e..dada71e7 100644 --- a/internal/nginx_log/parser/types.go +++ b/internal/nginx_log/parser/types.go @@ -100,8 +100,9 @@ func DefaultParserConfig() *Config { } } -// ValidHTTPMethods Valid HTTP methods +// ValidHTTPMethods Valid HTTP methods including WebDAV methods var ValidHTTPMethods = map[string]bool{ + // Standard HTTP methods "GET": true, "POST": true, "PUT": true, @@ -111,6 +112,14 @@ var ValidHTTPMethods = map[string]bool{ "PATCH": true, "TRACE": true, "CONNECT": true, + // WebDAV methods (RFC 4918) + "PROPFIND": true, + "PROPPATCH": true, + "MKCOL": true, + "COPY": true, + "MOVE": true, + "LOCK": true, + "UNLOCK": true, } // Parser errors (moved to errors.go as Cosy Errors)