From 8064569d41d63fb981530a034b7eebf7e9efa9e1 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 24 Dec 2019 16:11:47 +0900 Subject: [PATCH] [Modify] Use the Uri class --- websocket-sharp/Net/HttpListenerResponse.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/websocket-sharp/Net/HttpListenerResponse.cs b/websocket-sharp/Net/HttpListenerResponse.cs index 516a3c97..0caddbe0 100644 --- a/websocket-sharp/Net/HttpListenerResponse.cs +++ b/websocket-sharp/Net/HttpListenerResponse.cs @@ -72,7 +72,7 @@ namespace WebSocketSharp.Net private WebHeaderCollection _headers; private bool _headersSent; private bool _keepAlive; - private string _location; + private Uri _location; private ResponseStream _outputStream; private bool _sendChunked; private int _statusCode; @@ -180,7 +180,7 @@ namespace WebSocketSharp.Net } if (_location != null) - headers.InternalSet ("Location", _location, true); + headers.InternalSet ("Location", _location.AbsoluteUri, true); if (_cookies != null) { foreach (var cookie in _cookies) { @@ -572,7 +572,7 @@ namespace WebSocketSharp.Net /// public string RedirectLocation { get { - return _location; + return _location != null ? _location.OriginalString : null; } set { @@ -596,7 +596,7 @@ namespace WebSocketSharp.Net if (!Uri.TryCreate (value, UriKind.Absolute, out uri)) throw new ArgumentException ("Not an absolute URL.", "value"); - _location = value; + _location = uri; } } @@ -1020,7 +1020,7 @@ namespace WebSocketSharp.Net if (!Uri.TryCreate (url, UriKind.Absolute, out uri)) throw new ArgumentException ("Not an absolute URL.", "url"); - _location = url; + _location = uri; _statusCode = 302; _statusDescription = "Found"; }