@@ -4319,6 +4319,78 @@ public void SetProxy (string url, string username, string password)
43194319 }
43204320 }
43214321
4322+ /// <summary>
4323+ /// Sets a user header to send with the handshake request or response.
4324+ /// </summary>
4325+ /// <param name="name">
4326+ /// A <see cref="string"/> that specifies the name of the header to set.
4327+ /// </param>
4328+ /// <param name="value">
4329+ /// A <see cref="string"/> that specifies the value of the header to set.
4330+ /// </param>
4331+ /// <exception cref="ArgumentException">
4332+ /// <para>
4333+ /// <paramref name="name"/> is an empty string.
4334+ /// </para>
4335+ /// <para>
4336+ /// -or-
4337+ /// </para>
4338+ /// <para>
4339+ /// <paramref name="name"/> is a string of spaces.
4340+ /// </para>
4341+ /// <para>
4342+ /// -or-
4343+ /// </para>
4344+ /// <para>
4345+ /// <paramref name="name"/> contains an invalid character.
4346+ /// </para>
4347+ /// <para>
4348+ /// -or-
4349+ /// </para>
4350+ /// <para>
4351+ /// <paramref name="value"/> contains an invalid character.
4352+ /// </para>
4353+ /// <para>
4354+ /// -or-
4355+ /// </para>
4356+ /// <para>
4357+ /// <paramref name="name"/> is a restricted header name.
4358+ /// </para>
4359+ /// </exception>
4360+ /// <exception cref="ArgumentNullException">
4361+ /// <paramref name="name"/> is <see langword="null"/>.
4362+ /// </exception>
4363+ /// <exception cref="ArgumentOutOfRangeException">
4364+ /// The length of <paramref name="value"/> is greater than 65,535
4365+ /// characters.
4366+ /// </exception>
4367+ /// <exception cref="InvalidOperationException">
4368+ /// This instance does not allow the header.
4369+ /// <para>
4370+ /// The SetUserHeader method is not available when the current state of
4371+ /// the interface is neither New nor Closed.
4372+ /// </para>
4373+ /// <para>
4374+ /// -or-
4375+ /// </para>
4376+ /// <para>
4377+ /// The SetUserHeader method is not available if the interface does not
4378+ /// allow the header type.
4379+ /// </para>
4380+ /// </exception>
4381+ public void SetUserHeader ( string name , string value )
4382+ {
4383+ lock ( _forState ) {
4384+ if ( ! canSet ( ) ) {
4385+ var msg = "The SetUserHeader method is not available." ;
4386+
4387+ throw new InvalidOperationException ( msg ) ;
4388+ }
4389+
4390+ UserHeaders . Set ( name , value ) ;
4391+ }
4392+ }
4393+
43224394 #endregion
43234395
43244396 #region Explicit Interface Implementations
0 commit comments