Code cleanup for network module.
This commit is contained in:
@@ -8,7 +8,7 @@ using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Common.Network.Http11 {
|
||||
public class Http11Client {
|
||||
public class Http11Client : IDisposable {
|
||||
private readonly string _directHost;
|
||||
protected string DirectHost { get { return _directHost; } }
|
||||
|
||||
@@ -48,13 +48,23 @@ namespace Cryville.Common.Network.Http11 {
|
||||
public virtual void Close() {
|
||||
TcpClient.Close();
|
||||
}
|
||||
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public virtual void Dispose(bool disposing) {
|
||||
if (disposing) {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
public Http11Response Request(string method, Uri uri, string body = null, Encoding encoding = null) {
|
||||
string struri = GetUri(uri).PathAndQuery;
|
||||
return Request(Stream, method, struri, body, encoding);
|
||||
}
|
||||
|
||||
public Http11Response Request(Stream stream, string method, string uri, string body = null, Encoding encoding = null) {
|
||||
Http11Response Request(Stream stream, string method, string uri, string body = null, Encoding encoding = null) {
|
||||
var headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var h in Headers)
|
||||
headers.Add(h.Key, h.Value);
|
||||
|
Reference in New Issue
Block a user