A particularly nasty bug that I fixed myself! (all the while learning about GitHub) #7
Changes from 14 commits
462934a
3bbbde5
8e6d7d7
740a542
8a7b893
7ca161d
f9215e2
5a8af0a
ac90a41
a34b8ff
e8e4df8
f59d7c3
24fb641
300650f
59f0b88
c72b934
5c6c81d
b7af44f
8dabe2f
3b2702b
f806b83
07461c7
0b55d16
969f2c5
a0dc419
d018e59
9bb3ec6
bf7968d
f25d28e
9eacf71
a338dd6
6277fd4
b4410ba
607604d
b761a46
8445963
3fc6ce7
0c03a66
e385d47
6b6272d
2920cd3
2d7b63d
9f23573
b59d5a1
900aed0
24b3b57
2865680
1b92c93
5393023
8235d6b
111add7
9b624f3
2305608
4da8a94
cd2b7b9
a0847a8
01bd7f3
01ffe1f
6a516b4
029222b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,9 +233,22 @@ public static Uri ToFullyQualifiedUrl(this VirtualPath virtualPath, Blog blog, s | |
} | ||
|
||
var builder = new UriBuilder { Scheme = scheme, Host = blog.Host }; | ||
if (HttpContext.Current != null && HttpContext.Current.Request != null && HttpContext.Current.Request.Url.Port != 80) | ||
if (HttpContext.Current != null | ||
&& HttpContext.Current.Request != null) | ||
{ | ||
builder.Port = HttpContext.Current.Request.Url.Port; | ||
if (HttpContext.Current.Request.IsSecureConnection == true) | ||
{ | ||
builder.Scheme = "https"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! Do we have unit tests for this method anywhere? I didn't see any updated tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No...while I managed to get the unit tests working in the 2.5 solution (i.e. Visual Studio 2008 and MbUnit), I haven't had any success thus far with the current 2.6 solution. MbUnit just barfs on me (complaining about the version of the .NET Framework being used). Note that I'm a Visual Studio "Team Suite" kind of guy, so I know next to nothing about MbUnit. I'd love to get it working -- and subsequently write tests first when making changes or enhancements -- but I'm going to need a little help to make that happen. Regardless of my current blocking issue with MbUnit, for this particular fix would it even be possible to write a unit test, given the call to HttpContext.Current? Sorry if this seems ignorant, but in my past experience I've always passed in an HttpContextBase parameter to methods when doing TDD. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, don't worry about it for now. :) Yeah, this would be hard to test as it stands. But that method would get annoying if we had to pass in an |
||
|
||
if (HttpContext.Current.Request.Url.Port != 443) | ||
{ | ||
builder.Port = HttpContext.Current.Request.Url.Port; | ||
} | ||
} | ||
else if (HttpContext.Current.Request.Url.Port != 80) | ||
{ | ||
builder.Port = HttpContext.Current.Request.Url.Port; | ||
} | ||
} | ||
return new Uri(builder.Uri, virtualPath); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ public class TrackBackNotificationProxy | |
return SendPing(trackBackUrl, parameters); | ||
} | ||
} | ||
return true; | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ummm, whoops! Heh. Nice catch. |
||
} | ||
|
||
private static bool SendPing(Uri trackBackItem, string parameters) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be explicit about ordering. This should probably be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done