Commit 167bb2f7 authored by justcoding121's avatar justcoding121

Fix version parse

parent 1849d31e
...@@ -55,7 +55,7 @@ namespace Titanium.Web.Proxy ...@@ -55,7 +55,7 @@ namespace Titanium.Web.Proxy
Version version = new Version(1, 1); Version version = new Version(1, 1);
if (httpCmdSplit.Length == 3) if (httpCmdSplit.Length == 3)
{ {
string httpVersion = httpCmdSplit[1].Trim(); string httpVersion = httpCmdSplit[2].Trim();
if (httpVersion == "http/1.0") if (httpVersion == "http/1.0")
{ {
...@@ -204,24 +204,24 @@ namespace Titanium.Web.Proxy ...@@ -204,24 +204,24 @@ namespace Titanium.Web.Proxy
var httpCmdSplit = httpCmd.Split(Constants.SpaceSplit, 3); var httpCmdSplit = httpCmd.Split(Constants.SpaceSplit, 3);
var httpMethod = httpCmdSplit[0]; var httpMethod = httpCmdSplit[0];
var httpVersion = httpCmdSplit[2].ToLower().Trim();
Version version; Version version = new Version(1, 1);
if (httpVersion == "http/1.1") if (httpCmdSplit.Length == 3)
{ {
version = new Version(1, 1); var httpVersion = httpCmdSplit[2].ToLower().Trim();
}
else if (httpVersion == "http/1.0")
{ {
version = new Version(1, 0); version = new Version(1, 0);
} }
}
args.WebSession.Request.RequestHeaders = new List<HttpHeader>(); args.WebSession.Request.RequestHeaders = new List<HttpHeader>();
string tmpLine; string tmpLine;
while (!string.IsNullOrEmpty(tmpLine = await clientStreamReader.ReadLineAsync().ConfigureAwait(false))) while (!string.IsNullOrEmpty(tmpLine = await clientStreamReader.ReadLineAsync().ConfigureAwait(false)))
{ {
var header = tmpLine.Split(new char[] { ':' }, 2); var header = tmpLine.Split(Constants.ColonSplit, 2);
args.WebSession.Request.RequestHeaders.Add(new HttpHeader(header[0], header[1])); args.WebSession.Request.RequestHeaders.Add(new HttpHeader(header[0], header[1]));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment