Skip to content

Commit c03b5d3

Browse files
committed
Fixed a bug in the Nancy & AspNetCore client where the port was being set to 0.
1 parent 6073a8d commit c03b5d3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Platforms/Exceptionless.AspNetCore/RequestInfoCollector.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public static RequestInfo Collect(HttpContext context, ExceptionlessConfiguratio
3030
if (!String.IsNullOrEmpty(context.Request.Host.Host))
3131
info.Host = context.Request.Host.Host;
3232

33-
if (context.Request.Host.Port.HasValue)
34-
info.Port = context.Request.Host.Port.Value;
33+
info.Port = context.Request.Host.Port.GetValueOrDefault(info.IsSecure ? 443 : 80);
3534

3635
if (context.Request.Headers.ContainsKey(HeaderNames.UserAgent))
3736
info.UserAgent = context.Request.Headers[HeaderNames.UserAgent].ToString();
@@ -46,9 +45,8 @@ public static RequestInfo Collect(HttpContext context, ExceptionlessConfiguratio
4645
if (config.IncludeQueryString)
4746
info.QueryString = context.Request.Query.ToDictionary(exclusionList);
4847

49-
if (config.IncludePostData) {
48+
if (config.IncludePostData)
5049
info.PostData = GetPostData(context, config, exclusionList);
51-
}
5250

5351
return info;
5452
}

src/Platforms/Exceptionless.Nancy/RequestInfoCollector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static RequestInfo Collect(NancyContext context, ExceptionlessConfigurati
2727
info.Host = context.Request.Url.HostName;
2828
info.IsSecure = context.Request.Url.IsSecure;
2929
info.Path = context.Request.Url.BasePath + context.Request.Url.Path;
30-
info.Port = context.Request.Url.Port ?? 80;
30+
info.Port = context.Request.Url.Port.GetValueOrDefault(info.IsSecure ? 443 : 80);
3131
}
3232

3333
if (!String.IsNullOrWhiteSpace(context.Request.Headers.Referrer))

0 commit comments

Comments
 (0)