示例#1
0
 /// <summary>
 /// Use if an error which can be isolated to a single stream has occurred.  If the <paramref name="id"/> is not
 /// <see cref="Http2CodecUtil.ConnectionStreamId"/> then a <see cref="StreamException"/> will be returned.
 /// Otherwise the error is considered a connection error and a <see cref="Http2Exception"/> is returned.
 /// </summary>
 /// <param name="id">The stream id for which the error is isolated to.</param>
 /// <param name="error">The type of error as defined by the HTTP/2 specification.</param>
 /// <param name="cause">The object which caused the error.</param>
 /// <param name="fmt">string with the content and format for the additional debug data.</param>
 /// <param name="args">Objects which fit into the format defined by <paramref name="fmt"/>.</param>
 /// <returns>If the <paramref name="id"/> is not
 /// <see cref="Http2CodecUtil.ConnectionStreamId"/> then a <see cref="StreamException"/> will be returned.
 /// Otherwise the error is considered a connection error and a <see cref="Http2Exception"/> is returned.</returns>
 public static Http2Exception StreamError(int id, Http2Error error, Exception cause, string fmt, params object[] args)
 {
     return(Http2CodecUtil.ConnectionStreamId == id?
            Http2Exception.ConnectionError(error, cause, fmt, args) :
                new StreamException(id, error, args is object && (uint)args.Length > 0u ? string.Format(fmt, args) : fmt, cause));
 }
示例#2
0
 /// <summary>
 /// A specific stream error resulting from failing to decode headers that exceeds the max header size list.
 /// If the <paramref name="id"/> is not <see cref="Http2CodecUtil.ConnectionStreamId"/> then a
 /// <see cref="StreamException"/> will be returned. Otherwise the error is considered a
 /// connection error and a <see cref="Http2Exception"/> is returned.
 /// </summary>
 /// <param name="id">The stream id for which the error is isolated to.</param>
 /// <param name="error">The type of error as defined by the HTTP/2 specification.</param>
 /// <param name="onDecode">Whether this error was caught while decoding headers</param>
 /// <param name="fmt">string with the content and format for the additional debug data.</param>
 /// <param name="args">Objects which fit into the format defined by <paramref name="fmt"/>.</param>
 /// <returns>If the <paramref name="id"/> is not
 /// <see cref="Http2CodecUtil.ConnectionStreamId"/> then a <see cref="HeaderListSizeException"/>
 /// will be returned. Otherwise the error is considered a connection error and a <see cref="Http2Exception"/> is
 /// returned.</returns>
 public static Http2Exception HeaderListSizeError(int id, Http2Error error, bool onDecode, string fmt, params object[] args)
 {
     return(Http2CodecUtil.ConnectionStreamId == id?
            Http2Exception.ConnectionError(error, fmt, args) :
                new HeaderListSizeException(id, error, args is object && (uint)args.Length > 0u ? string.Format(fmt, args) : fmt, onDecode));
 }
示例#3
0
 public static void HeaderListSizeExceeded(long maxHeaderListSize)
 {
     throw Http2Exception.ConnectionError(Http2Error.ProtocolError,
                                          "Header size exceeded max allowed size ({0})", maxHeaderListSize);
 }