MCPcopy
hub / github.com/nats-io/nats.go / wsPMCExtensionSupport

Function wsPMCExtensionSupport

ws.go:792–821  ·  view source on GitHub ↗
(header http.Header)

Source from the content-addressed store, hash-verified

790}
791
792func wsPMCExtensionSupport(header http.Header) (bool, bool) {
793 for _, extensionList := range header["Sec-Websocket-Extensions"] {
794 extensions := strings.Split(extensionList, ",")
795 for _, extension := range extensions {
796 extension = strings.Trim(extension, " \t")
797 params := strings.Split(extension, ";")
798 for i, p := range params {
799 p = strings.Trim(p, " \t")
800 if strings.EqualFold(p, wsPMCExtension) {
801 var snc bool
802 var cnc bool
803 for j := i + 1; j < len(params); j++ {
804 p = params[j]
805 p = strings.Trim(p, " \t")
806 if strings.EqualFold(p, wsPMCSrvNoCtx) {
807 snc = true
808 } else if strings.EqualFold(p, wsPMCCliNoCtx) {
809 cnc = true
810 }
811 if snc && cnc {
812 return true, true
813 }
814 }
815 return true, false
816 }
817 }
818 }
819 }
820 return false, false
821}
822
823func wsMakeChallengeKey() (string, error) {
824 p := make([]byte, 16)

Callers 1

wsInitHandshakeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected