MCPcopy Create free account
hub / github.com/caddyserver/caddy / processQueryString

Method processQueryString

modules/logging/filters.go:408–434  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

406}
407
408func (m QueryFilter) processQueryString(s string) string {
409 u, err := url.Parse(s)
410 if err != nil {
411 return s
412 }
413
414 q := u.Query()
415 for _, a := range m.Actions {
416 switch a.Type {
417 case replaceAction:
418 for i := range q[a.Parameter] {
419 q[a.Parameter][i] = a.Value
420 }
421
422 case hashAction:
423 for i := range q[a.Parameter] {
424 q[a.Parameter][i] = hash(a.Value)
425 }
426
427 case deleteAction:
428 q.Del(a.Parameter)
429 }
430 }
431
432 u.RawQuery = q.Encode()
433 return u.String()
434}
435
436type cookieFilterAction struct {
437 // `replace` to replace the value of the cookie, `hash` to replace it with the 4 initial bytes of the SHA-256 of its content or `delete` to remove it entirely.

Callers 1

FilterMethod · 0.95

Calls 3

DelMethod · 0.80
hashFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected