I get the following exception if trying to pass invalid characters as arguments. E.g.:
http://localhost:9576/lucyhttptest?{ .
With exception:
STACK_TEXT:
KERNELBASE!RaiseException+0x68
MSVCR120D!_CxxThrowException+0x116 [f:\dd\vctools\crt\crtw32\eh\throw.cpp @ 154]
cpprest120d_2_2!web::hex_char_digit_to_decimal_char+0x395
cpprest120d_2_2!std::_Debug_pointer<<lambda_ba2697e9ad314c5f3f6c2bafb10744d5> >+0x1f
cpprest120d_2_2!Concurrency::task<web::http::http_request>::_CreateImpl+0x175
cpprest120d_2_2!std::_Func_impl<std::_Callable_obj<<lambda_4b963204d53058a2001fbec56ddaeade>,0>,std::allocator<std::_Func_class<void,unsigned long,unsigned long> >,void,unsigned long,unsigned long>::_Move+0xbd
cpprest120d_2_2!std::_Hash<std::_Umap_traits<web::http::experimental::listener::details::http_listener_impl * __ptr64,std::unique_ptr<web::http::experimental::details::http_windows_server::listener_registration,std::default_delete<web::http::experimental::details::http_windows_server::listener_registration> >,std::_Uhash_compare<web::http::experimental::listener::details::http_listener_impl * __ptr64,std::hash<web::http::experimental::listener::details::http_listener_impl * __ptr64>,std::equal_to<web::http::experimental::listener::details::http_listener_impl * __ptr64> >,std::allocator<std::pair<web::http::experimental::listener::details::http_listener_impl * __ptr64 const,std::unique_ptr<web::http::experimental::details::http_windows_server::listener_registration,std::default_delete<web::http::experimental::details::http_windows_server::listener_registration> > > >,0> >::erase+0x327
cpprest120d_2_2!std::copy<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<unsigned char> > >,stdext::checked_array_iterator<unsigned char * __ptr64> >+0x12a
cpprest120d_2_2!std::_Func_class<void,void * __ptr64>::_Do_alloc<std::_Func_impl<std::_Callable_obj<<lambda_383e03dea2dee782e69b3b00ae082657>,0>,std::allocator<std::_Func_class<void,void * __ptr64> >,void,void * __ptr64>,<lambda_383e03dea2dee782e69b3b00ae082657>,std::allocator<std::_Func_class<void,void * __ptr64> > >+0x39
cpprest120d_2_2!std::_Ptr_base<web::http::oauth1::details::oauth1_handler>::_Decref+0x21
KERNEL32!BasepTpIoCallback+0x49
ntdll!TppIopExecuteCallback+0x175
ntdll!TppWorkerThread+0x818
KERNEL32!BaseThreadInitThunk+0xd
ntdll!RtlUserThreadStart+0x1d
FOLLOWUP_IP:
cpprest120d_2_2!web::hex_char_digit_to_decimal_char+395
00007ff9`53c55985 90 nop
I can repro it with the simplest setup:
// This policy fixes the issue
concurrency::CurrentScheduler::Create(Concurrency::SchedulerPolicy(1, 2, Concurrency::MinConcurrency));
std::wstring url = prot + L"://" + host + L":" + port + L"/lucyhttptest";
std::wcout << "url: " << url << std::endl;
http_listener listener(url);
listener.support(methods::GET, handle_get);
try
{
std::wcout << L"Launching" << std::endl;
listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();
std::wcout << L"press enter to exit" << std::endl;
std::string line;
std::getline(std::cin, line);
listener.close().wait();
}
catch (exception const & e)
{
wcout << e.what() << endl;
return 1;
}
return 0;
can attach VS2013 project if needed for repro.
Comments: Hi Steve,
thanks for looking into this!
I didn't have a chance to test it with the latest casablanca. In my case I could not figure out how to capture such exception since the main listener try/catch didn't handle it. So a malformed request would just kill my server.
I will try it out with the latest when I have a chance.
Thanks,
Ruslan