public static void ValidateHeaderNameCharacters(string headerCharacters) { var invalid = ProtoCharacters.IndexOfInvalidTokenChar(headerCharacters); if (invalid >= 0) { ThrowInvalidHeaderCharacter(headerCharacters[invalid]); } }
private bool TryValidateMethod() { // :method _methodText = RequestHeaders[HeaderNames.Method].ToString(); Method = ProtoUtilities.GetKnownMethod(_methodText); if (Method == ProtoMethod.None) { ResetAndAbort(new ConnectionAbortedException(CoreStrings.FormatProto2ErrorMethodInvalid(_methodText)), Proto2ErrorCode.PROTOCOL_ERROR); return(false); } if (Method == ProtoMethod.Custom) { if (ProtoCharacters.IndexOfInvalidTokenChar(_methodText) >= 0) { ResetAndAbort(new ConnectionAbortedException(CoreStrings.FormatProto2ErrorMethodInvalid(_methodText)), Proto2ErrorCode.PROTOCOL_ERROR); return(false); } } return(true); }