diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-07-01 12:24:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-01 12:24:26 -0400 |
| commit | ff3713153ad2317e1c196f33ac2cba61b449a00e (patch) | |
| tree | 84d2e6ed5bcb556a2395603b6403c8e992535e6b /SocketHttpListener/Net/HttpConnection.cs | |
| parent | fad71a6c7d12c8b207cdf473c7dd7daafa53c174 (diff) | |
| parent | 2dcad6b5977f5c5be81b18c42506ed8ad3fb73b6 (diff) | |
Merge pull request #2739 from MediaBrowser/beta
Beta
Diffstat (limited to 'SocketHttpListener/Net/HttpConnection.cs')
| -rw-r--r-- | SocketHttpListener/Net/HttpConnection.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs index 9c87ff076..e66443c59 100644 --- a/SocketHttpListener/Net/HttpConnection.cs +++ b/SocketHttpListener/Net/HttpConnection.cs @@ -25,7 +25,7 @@ namespace SocketHttpListener.Net StringBuilder _currentLine; ListenerPrefix _prefix; HttpRequestStream _requestStream; - Stream _responseStream; + HttpResponseStream _responseStream; bool _chunked; int _reuses; bool _contextBound; @@ -202,7 +202,7 @@ namespace SocketHttpListener.Net return _requestStream; } - public Stream GetResponseStream(bool isExpect100Continue = false) + public HttpResponseStream GetResponseStream(bool isExpect100Continue = false) { // TODO: can we get this _stream before reading the input? if (_responseStream == null) @@ -268,7 +268,8 @@ namespace SocketHttpListener.Net if (!_epl.BindContext(_context)) { - SendError("Invalid host", 400); + const int NotFoundErrorCode = 404; + SendError(HttpStatusDescription.Get(NotFoundErrorCode), NotFoundErrorCode); Close(true); return; } @@ -423,14 +424,14 @@ namespace SocketHttpListener.Net HttpListenerResponse response = _context.Response; response.StatusCode = status; response.ContentType = "text/html"; - string description = HttpListenerResponse.GetStatusDescription(status); + string description = HttpStatusDescription.Get(status); string str; if (msg != null) str = string.Format("<h1>{0} ({1})</h1>", description, msg); else str = string.Format("<h1>{0}</h1>", description); - byte[] error = Encoding.Default.GetBytes(str); + byte[] error = _textEncoding.GetDefaultEncoding().GetBytes(str); response.Close(error, false); } catch |
