Skip to content

Commit 2c0f374

Browse files
committed
The latest fixes for http listener
1 parent 7144f66 commit 2c0f374

File tree

5 files changed

+38
-20
lines changed

5 files changed

+38
-20
lines changed

Release/collateral/Samples/BlackJack/BlackJack_Client/Makefile

Lines changed: 0 additions & 8 deletions
This file was deleted.

Release/collateral/Samples/BlackJack/BlackJack_Server/Makefile

Lines changed: 0 additions & 8 deletions
This file was deleted.

Release/src/http/listener/http_windows_server.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,21 @@ pplx::task<void> http_windows_server::register_listener(_In_ http_listener *pLis
304304

305305
pplx::task<void> http_windows_server::unregister_listener(_In_ http_listener *pListener)
306306
{
307+
http::uri listener_uri = pListener->uri();
308+
if (listener_uri.is_port_default())
309+
{
310+
// Windows HTTP Server API has issues when the port isn't set to 80 here -- it expects a url prefix string
311+
// which always includes the port number
312+
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364698(v=vs.85).aspx
313+
http::uri_builder builder(listener_uri);
314+
builder.set_port(80);
315+
listener_uri = builder.to_uri();
316+
}
317+
307318
// Windows HTTP Server API will not accept a uri with an empty path, it must have a '/'.
308-
const http::uri listener_uri = pListener->uri();
319+
// Windows HTTP Server API will only accept decoded uri strings.
309320
utility::string_t host_uri = web::http::uri::decode(listener_uri.to_string());
310-
if(listener_uri.is_path_empty() && host_uri[host_uri.length() - 1] != '/' && listener_uri.query().empty() && listener_uri.fragment().empty())
321+
if(host_uri.back() != U('/') && listener_uri.query().empty() && listener_uri.fragment().empty())
311322
{
312323
host_uri.append(U("/"));
313324
}

Release/tests/Common/utilities/dirs.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
<ItemGroup Condition="'$(DevToolsVersion)'=='110'">
1010
<ProjectFile Include="VS11\CommonUtilities110.vcxproj" />
11-
<ProjectFile Include="VS11.xp\CommonUtilities110.xp.vcxproj" />
11+
<ProjectFile Include="VS11.xp\CommonUtilities110.xp.vcxproj" Condition="'$(Platform)'!='ARM'"/>
1212
</ItemGroup>
1313

1414
<ItemGroup Condition="'$(DevToolsVersion)'=='120'">
1515
<ProjectFile Include="VS12\CommonUtilities120.vcxproj" />
16-
<ProjectFile Include="VS12.xp\CommonUtilities120.xp.vcxproj" />
16+
<ProjectFile Include="VS12.xp\CommonUtilities120.xp.vcxproj" Condition="'$(Platform)'!='ARM'"/>
1717
</ItemGroup>
1818

1919
<ItemGroup Condition="'$(OsVersion)|$(DevToolsVersion)'=='6.2|120' or '$(OsVersion)|$(DevToolsVersion)'=='6.3|120'">

Release/tests/Functional/http/listener/connections_and_errors.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,27 @@ SUITE(connections_and_errors)
7171
(closeTask && clientTask).wait();
7272
}
7373

74+
// Note: Run with admin privileges to listen on default port.
75+
// This test will fail with "Access denied: attempting to add Address.." exception if it is not run as admin.
76+
TEST(default_port_close, "Ignore", "Manual")
77+
{
78+
uri address(U("http://localhost/portnotspecified"));
79+
http_listener listener(address);
80+
81+
try
82+
{
83+
listener.open().wait();
84+
}
85+
catch(const http_exception& ex)
86+
{
87+
VERIFY_IS_FALSE(true, ex.what());
88+
return;
89+
}
90+
91+
// Verify close does not throw an exception while listening on default port
92+
listener.close().wait();
93+
}
94+
7495
TEST_FIXTURE(uri_address, send_response_later)
7596
{
7697
http_listener listener(m_uri);
@@ -253,6 +274,8 @@ TEST_FIXTURE(uri_address, close_stream_with_exception, "Ignore:Linux", "760544")
253274
close_stream_early_impl(m_uri, false);
254275
}
255276

277+
278+
256279
}
257280

258281
}}}}

0 commit comments

Comments
 (0)