diff options
author | Valery Piashchynski <[email protected]> | 2021-06-16 15:53:40 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-16 15:53:40 +0300 |
commit | 25e0841c6aa5e2686da5b9f74e3d77d3814ff592 (patch) | |
tree | 5b7c5259375d53b0685bf838555118d5ad93f149 /plugins/websockets/wildcard.go | |
parent | 9dc98d43b0c0de3e1e1bd8fdc97c122c7c7c594f (diff) | |
parent | b1aa5d0ea3617710aec6476bdae956e16b946281 (diff) |
#730 bug(websockets): not properly checked request originv2.3.1-beta.3
#730 bug(websockets): not properly checked request origin
Diffstat (limited to 'plugins/websockets/wildcard.go')
-rw-r--r-- | plugins/websockets/wildcard.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/websockets/wildcard.go b/plugins/websockets/wildcard.go new file mode 100644 index 00000000..2f1c6601 --- /dev/null +++ b/plugins/websockets/wildcard.go @@ -0,0 +1,12 @@ +package websockets + +import "strings" + +type wildcard struct { + prefix string + suffix string +} + +func (w wildcard) match(s string) bool { + return len(s) >= len(w.prefix)+len(w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix) +} |