Skip to content

Commit 184c0fc

Browse files
committed
Method Utility.GetUserAgent fixed when no user-agent is available
Response.End() fixed when issuing an exception.
1 parent 1b9a643 commit 184c0fc

File tree

11 files changed

+30
-9
lines changed

11 files changed

+30
-9
lines changed

rls/API.Library.dll

0 Bytes
Binary file not shown.

rls/API.Library.pdb

0 Bytes
Binary file not shown.

src/API.Library/Entities/API.JSONRPC.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public void ProcessRequest(HttpContext context)
128128
}
129129
}
130130
}
131+
catch (ThreadAbortException e)
132+
{
133+
// Thread aborted, do nothing
134+
// The finally block will take care of everything safely
135+
}
131136
catch (Exception e)
132137
{
133138
Log.Instance.Fatal(e);
@@ -196,7 +201,15 @@ private void ParseError(ref HttpContext context, string id, JSONRPC_Error error)
196201
Log.Instance.Info("IP: " + Utility.GetIP() + ", Error Code: " + error.code.ToString() + ", Error Message: " + error.message.ToString() + ", Error Data: " + (error.data == null ? "" : error.data.ToString()));
197202
object output = new JSONRPC_ResponseError { jsonrpc = JSONRPC_Version, error = error, id = id };
198203
context.Response.Write(Utility.JsonSerialize_IgnoreLoopingReference(output));
199-
context.Response.End();
204+
205+
try
206+
{
207+
context.Response.End();
208+
}
209+
catch (ThreadAbortException e)
210+
{
211+
// Thread intentially aborted, do nothing
212+
}
200213
}
201214

202215
/// <summary>

src/API.Library/Entities/API.RESTful.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,15 @@ private void ParseError(ref HttpContext context, HttpStatusCode statusCode, stri
134134
context.Response.StatusCode = (int)statusCode;
135135
if (!string.IsNullOrEmpty(statusDescription))
136136
context.Response.StatusDescription = statusDescription;
137-
context.Response.End();
137+
138+
try
139+
{
140+
context.Response.End();
141+
}
142+
catch (ThreadAbortException e)
143+
{
144+
// Thread intentially aborted, do nothing
145+
}
138146
}
139147

140148
/// <summary>

src/API.Library/Entities/Utility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static string GetIP()
133133
/// </summary>
134134
public static string GetUserAgent()
135135
{
136-
return HttpContext.Current == null ? "" : HttpContext.Current.Request.UserAgent.ToString();
136+
return HttpContext.Current.Request.UserAgent == null ? "" : HttpContext.Current.Request.UserAgent;
137137
}
138138

139139
/// <summary>

src/API.Library/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("4.3.0")]
35-
[assembly: AssemblyFileVersion("4.3.0")]
34+
[assembly: AssemblyVersion("4.3.1")]
35+
[assembly: AssemblyFileVersion("4.3.1")]
3636

3737
// Configure log4net using the Web.config file by default
3838
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

test/API.Test/API.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
7373
</PropertyGroup>
7474
<ItemGroup>
75-
<Reference Include="API.Library, Version=4.3.0, Culture=neutral, processorArchitecture=MSIL">
75+
<Reference Include="API.Library, Version=4.3.1, Culture=neutral, processorArchitecture=MSIL">
7676
<SpecificVersion>False</SpecificVersion>
77-
<HintPath>..\packages\API.Library.4.3.0\API.Library.dll</HintPath>
77+
<HintPath>..\packages\API.Library.4.3.1\API.Library.dll</HintPath>
7878
</Reference>
7979
<Reference Include="Enyim.Caching, Version=2.16.0.0, Culture=neutral, PublicKeyToken=cec98615db04012e, processorArchitecture=MSIL">
8080
<HintPath>..\packages\EnyimMemcached.2.16.0\lib\net35\Enyim.Caching.dll</HintPath>

test/API.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
//
3131
// You can specify all the values or you can default the Revision and Build Numbers
3232
// by using the '*' as shown below:
33-
[assembly: AssemblyVersion("4.3.0")]
34-
[assembly: AssemblyFileVersion("4.3.0")]
33+
[assembly: AssemblyVersion("4.3.1")]
34+
[assembly: AssemblyFileVersion("4.3.1")]

0 commit comments

Comments
 (0)