Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all 4845 articles
Browse latest View live

Commented Unassigned: How do I access data by name? [339]

$
0
0
How can I access data by name instead of having to do string processing? Attached please find my code to parse the json.

Comments: Ah yes I forgot, this will just return a json::value type. If you know it is a string you can use the [json::value::as_string()](http://microsoft.github.io/cpprestsdk/classweb_1_1json_1_1value.html#ad3416dd57e92d8660d4d938ef5a58960) function. There also are other functions to integrating with the C++ type system like as_integer(), as_double(), as_bool(), etc... So it would look something like the following: string_t str = myArray[0].as_string();

New Post: What would you suggest if I need use C++ REST SDK on Linux as a server, and want to secure the connection?

$
0
0
Thanks Both!
Is there any plan to support HTTPS for C++ REST SDK on Linux officially?

New Post: What would you suggest if I need use C++ REST SDK on Linux as a server, and want to secure the connection?

$
0
0
Hi evanc,

To be clear for the client portions of our library HTTPS is fully supported on all platforms. We aren't focusing much on the server side portions of the library so, no at this time we don't have concrete plans to go and implement it.

Steve

New Post: .pdb file mismatch

$
0
0
Microsoft (R) COFF/PE Dumper Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file C:\trunk\ThirdParty\cpprestsdk.2.2.0\build\native\bin\Win32\v120\Debug\Desktop\cpprest120d_2_2.dll

File Type: DLL
PDB file 'C:\trunk\ThirdParty\cpprestsdk.2.2.0\build\native\bin\Win32\v120\Debug\Desktop\cpprest120d_2_2.pdb' checked. (PDB signature mismatch)
PDB file 'c:\jenkins\build\arch\dev12_32\config\Debug\libtype\Shared\Binaries\win32\Debug\cpprest120d_2_2.pdb' checked. (File not found)
PDB file 'C:\WINDOWS\symbols\dll\cpprest120d_2_2.pdb' checked. (File not found)
PDB file 'C:\WINDOWS\dll\cpprest120d_2_2.pdb' checked. (File not found)
PDB file 'C:\WINDOWS\cpprest120d_2_2.pdb' checked. (File not found)


you can see from the dumpbin output for some reason it thinks there is a signature mismatch in the cpprestsdk2.2.0 bin.
Robyn

New Post: Creating a static library for Casablanca C++ rest SDK 2.3

$
0
0
I am trying to create a static library for my C++ rest SDK project.I have installed Casablanca C++ rest SDK 2.3 using Nuget package. My OS is Winodws8 and I am using VS2012.I have added the cpprest110d_2_3.lib into "Project Property --> Linker --> Input -->Additional Dependencies" and the includes in the Additional Include Directories .

Howerver I am getting the following link errors

error LNK2001: unresolved external symbol "public: static class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const web::http::methods::GET" (?GET@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)

error LNK2001: unresolved external symbol "public: static class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const web::http::methods::POST" (?POST@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)

error LNK2001: unresolved external symbol "public: static class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const web::http::methods::PUT" (?PUT@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)

error LNK2001: unresolved external symbol "public: static class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const web::http::methods::DEL" (?DEL@methods@http@web@@2V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@B)

I have also tried replacing the lib file with cpprest110d_app_2_3.lib file but I am getting the same errors.

I have directly used the lib files available from the packages that I downloaded from Nuget package.

Please help me in resolving this issue and also time is running out for my project

Created Unassigned: nullptr defined as NULL on g++ [340]

$
0
0
Using g++ with C++ Rest SDK redefines nullptr as NULL even if nullptr is available.

In file include/cpprest/details/SafeInt3.hpp the following code is used to check if nullptr is available:

```
#if defined nullptr_t
#define NEEDS_NULLPTR_DEFINED 0
#else
#define NEEDS_NULLPTR_DEFINED 1
#endif
...
#if NEEDS_NULLPTR_DEFINED
#define nullptr NULL
#endif
```
However this is not a valid check (nullptr_t is a type so #if defined nullptr_t always evaluate to false leading to NEEDS_NULLPTR_DEFINED always beeing defined to 1).

Trying to change
```
#if defined nullptr_t
```
to
```
#if __cplusplus >= 201103L
```
which seems to be a more valid check breaks compilation (c.f. build_output.txt) of C++ REST SDK on my machine (using g++ 4.9.2 and boost 1.57.0).

New Post: What would you suggest if I need use C++ REST SDK on Linux as a server, and want to secure the connection?

$
0
0
Thanks stevetgates for letting me know, though I care about the server side for now:)
But the reverse proxy seems to be a workable solution for me.

New Post: .pdb file mismatch

$
0
0
Possible mismatch between Debug/Release 32/64?

Commented Unassigned: If Webserver is down exception not thrown in connect call [338]

$
0
0
Hi Steve,
a) As mentioned, am opening a fresh issue. The following code crashes my app on Windows 7 ( where casablanca is loaded as a dll ) if the webserver is not online

auto current_context = task_continuation_context::use_default();
create_task([=]()
{
try
{
//Connect to the server and send local client information
m_ws_client->connect(serverAdd).then([=](task<void> conn_task) {

conn_task.get();
m_is_connected = true;
});
}
catch (websocket_exception& wex)
{
m_is_connected = false;
}
}, current_context);

b) Is there a method available in websocket_client is still active?

c) Any websocket sample projects available, all the projects in the distro now, viz BingRequest / Blackjack etc use http.

Regards

Vivek

Comments: Hi Steve, Thanks for your response. a) Can you please describe to me exactly what the symptoms of the crash are? What actually happens, are you getting an access violation or an exception going unhandled? As mentioned in the earlier thread, the app I am working with is protected by Themida guard, and not possible to run it in debug mode and capture trace and unhandled exception. The only thing I can report currently is the app window dissappears without any messages :). Will try out your suggested code and revert. b) "There are no websocket client examples in the repository on CodePlex." Very strange, as the whole library is about websockets and no websocket examples are provided, request you to add atleast one example. Regards Vivek

New Post: Creating a static library for Casablanca C++ rest SDK 2.3

$
0
0
Hi roshan,

The C++ REST SDK does not currently support building as a static library. If you add the NuGet package to your project, it will automatically select the correct .lib and .dll to link against your binary.

roschuma

New Post: .pdb file mismatch

$
0
0
Hi robyn,

Could you try using the latest version (v2.4.0) and report if you get a similar issue?

roschuma

Commented Unassigned: nullptr defined as NULL on g++ [340]

$
0
0
Using g++ with C++ Rest SDK redefines nullptr as NULL even if nullptr is available.

In file include/cpprest/details/SafeInt3.hpp the following code is used to check if nullptr is available:

```
#if defined nullptr_t
#define NEEDS_NULLPTR_DEFINED 0
#else
#define NEEDS_NULLPTR_DEFINED 1
#endif
...
#if NEEDS_NULLPTR_DEFINED
#define nullptr NULL
#endif
```
However this is not a valid check (nullptr_t is a type so #if defined nullptr_t always evaluate to false leading to NEEDS_NULLPTR_DEFINED always beeing defined to 1).

Trying to change
```
#if defined nullptr_t
```
to
```
#if __cplusplus >= 201103L
```
which seems to be a more valid check breaks compilation (c.f. build_output.txt) of C++ REST SDK on my machine (using g++ 4.9.2 and boost 1.57.0).
Comments: Hi, I added _add_definitions(-DNEEDS_NULLPTR_DEFINED=0)_ to CMakeList.txt of the Release directory but the compilation still break (c.f. new build_output.txt). As stated on [stackoverflow](http://stackoverflow.com/questions/28199162/nullptr-t-not-defined-on-g-4-9-2) This seems to be caused by boost::function that cannot handle nullptr: [svn.boost.org/trac/boost/ticket/10981](svn.boost.org/trac/boost/ticket/10981) Best regards, Simon

New Post: Converting strings to string_t

$
0
0
I'm a new coder trying to integrate Casablanca into an app in order to retrieve values from a page and would like to use a dynamic querystring. I can't quite figure out how to overcome this error at compile time:

Error 8 error C2440: 'initializing' : cannot convert from 'const std::string' to 'std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>'

The code I'm working with:

const string_t seedtoupload = localseed;
http_client client(U("http://somesite.com/"));
uri_builder builder(U("/appname/"));
builder.append_query(U("s"), seedtoupload);

localseed is a std::string, and I've tried various conversion gymnastics (converting it to a char array, c string, etc), but I always get a convert failure when I try to cast it into the string_t that the builder requires.

Suggestions?

New Post: Converting strings to string_t

$
0
0
Hi ActuallySparky,

In the C++ REST SDK we use utility::string_t for most string operations. It is a typedef to a specific string type depending on the platform. For Windows UTF-16 is the preferred string, and the type is a std::wstring. On Linux UTF-8 is used, as a std::string. Some of the APIs support parameters as both UTF-16 and UTF-8, but the uri_builder doesn't.

The library contains a series of string conversion functions that you can use. Take a look at the reference documentation, the one you are looking for here is utility::conversions::to_string_t(...).

Steve

Commented Unassigned: How do I access data by name? [339]

$
0
0
How can I access data by name instead of having to do string processing? Attached please find my code to parse the json.

Comments: I don't see any bug in the library here. Closing the issue. This type of question would be better as a discussion on the forum in the future. Steve

Closed Unassigned: How do I access data by name? [339]

$
0
0
How can I access data by name instead of having to do string processing? Attached please find my code to parse the json.

Commented Unassigned: exception in cpprest120d_2_2!web::hex_char_digit_to_decimal_char+395 [335]

$
0
0
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: There isn't an issue here, an exception should be thrown if an invalid URI is attempted to be constructed. Steve

Closed Unassigned: exception in cpprest120d_2_2!web::hex_char_digit_to_decimal_char+395 [335]

$
0
0
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.

Updated Release: C++ Rest SDK 2.5.0

$
0
0
Android
  • Fixed issue in CMakeLists.txt where parenthesis were incorrectly used instead of brackets.
  • Fixed issue in CMakeLists.txt where pplxlinux.cpp source file was missing.
  • Added Android TestRunner packing androidproj to build.

Windows
  • Fixed several code analysis warnings.
  • Updating NuGet package for missing OpenSSL license, also patched 2.4.0's NuGet package.
  • Fixed not working on XP issue because of crypto API. #331, #334
  • Fixed several functions missing an explicit calling convention. This caused problems if you changed the calling convention from the cdecl.
  • Added support for Windows on Devices/Galileo. #217
  • Added option to force using PPLX on Windows Threadpool instead of PPL on the Concurrency Runtime. Library can be rebuilt using CPPREST_FORCE_PPLX macro.

OSX
  • Merged a pull request to work around a FindOpenSSL.cmake issue, enabling it to find Homebrew's copy.

Websockets (non-WinRT)
  • Fixed a race condition during websocket client destructor which would sometimes result in an AV/Segfault.
  • Added proxy support for Websocket++ based implementation.

http_client
  • Make std::function parameter to http_client::add_handler passed by const reference.

Miscellaneous
  • Merged pull request adding http_constants.dat to be installed with 'make install'.

Tests
  • Fixed race conditions in close_callback_client_from_server
  • Added proper synchronization to test_websocket_server (preventing some race conditions). #305

Commented Unassigned: exception in cpprest120d_2_2!web::hex_char_digit_to_decimal_char+395 [335]

$
0
0
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
Viewing all 4845 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>