CreateResponseHeader() 공개 정적인 메소드

public static CreateResponseHeader ( HttpStatusCode code ) : string
code HttpStatusCode
리턴 string
예제 #1
0
        protected override async Task DoProcess(CancellationToken cancellationToken)
        {
            this.state = ConnectionState.Waiting;
            try {
                if (connection != null && !IsStopped)
                {
                    await Handshake(cancellationToken).ConfigureAwait(false);
                    await ReadContents(cancellationToken).ConfigureAwait(false);
                }
                this.state = ConnectionState.Closed;
            }
            catch (HTTPError e) {
                await connection.Stream.WriteUTF8Async(HTTPUtils.CreateResponseHeader(e.StatusCode)).ConfigureAwait(false);

                Stop(StopReason.BadAgentError);
                this.state = ConnectionState.Error;
            }
            catch (IOException e) {
                Logger.Error(e);
                Stop(StopReason.ConnectionError);
                this.state = ConnectionState.Error;
            }
            catch (ConnectionStoppedExcception) {
                this.state = ConnectionState.Closed;
            }
        }
예제 #2
0
        private async Task SendErrorResponse(HttpStatusCode code)
        {
            var response_header = HTTPUtils.CreateResponseHeader(code, new Dictionary <string, string>());
            await Connection.WriteAsync(System.Text.Encoding.UTF8.GetBytes(response_header)).ConfigureAwait(false);

            Logger.Debug("Header: {0}", response_header);
        }