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

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.
  • Updated all binaries to use whole program optimizations, slightly decreasing binary size and small potential performance improvements.
  • Merged pull request adding support for CMake for Windows desktop.

OSX
  • Merged a pull request to work around a FindOpenSSL.cmake issue, enabling it to find Homebrew's copy.
  • Added support for iOS 64bit simulator. #196

websocket_client
  • Fixed a race condition in Websocket++ based implementation during websocket client destructor which would sometimes result in an AV/Segfault.
  • Added proxy support for Websocket++ based implementation.
  • Added support for Server Name Indication (SNI) to Websocket++ based implementation.
  • Updated server certificate verification to accept SERVER_GATED_CRYPTO and SGC_NETSCAPE usage for Websocket++ based implementation on Windows.

http_client
  • Make std::function parameter to http_client::add_handler passed by const reference.
  • Fixed invalid check in WinHTTP based implementation causing autologon security level to be high if credentials are not provided.
  • Added extract_utf8string and extract_utf16string to http_request and http_response classes. This allows uses either UTF-8 or UTF-16, instead of utility::string_t, more efficiently regardless of the platform.
  • Implemented native handle API for non-Windows platforms exposing Boost.Asio structures. This allows for configuring additional options like client certificates for example. #168
  • Fixed bug in Boost.Asio based implementation that incorrectly caused multiple handshakes to occur when reusing connections with HTTPS.

json
  • Fixed issue where the JSON library assumes char is a signed type, however C++ doesn't guarantee this. On ARM with Clang for example char is an unsigned type. This lead to incorrect parsing.

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

New Post: Error in SSL handshake for consecutive requests

$
0
0
FYI the fix is now in the development branch, and will eventually be in release 2.5.0.

Steve

New Post: rest sdk http_listener as a network server

$
0
0
@Golabi, if I am not wrong, the sole purpose of this SDK is to use http_listener in network so that one can connect with this listener in network. Now I have a situation, where I have the listener application in multiple PCs, and this listener application has to communicate with a WCF web service. Now in order to make it interact with the web service, the we service has to access this http_listener remotely.

Now there is a small problem. This http listener will be used in customer / client's PC. So configuring NGINX to each and every customer's PC will be a huge problem. Therefore can you also suggest me some alternative?

Thanks.

New Post: rest sdk http_listener as a network server

$
0
0
@maverick786us
1- the purpose of this SDK is to provide a modern API to consume RESTFUL services. (http_listener is an experimental feature).

2- i had the same problem , i tried to integrate NGINX code inside my application but that didn't work,
i tried to programmatically control NGINX service from my application code ( check if the service is running and if it is not then run the service),
but that had it's problems too !

eventually after 3 days ! i get rid of NGINX and started to integrate C# asp.net webapi selfhost (http://www.asp.net/web-api/overview/older-versions/self-host-a-web-api) into my application using C++ CLI ( i was on windows ).

that was my experience ( maybe i was not a good programmer ), but C++ CLI and C# webapi really worked,
it was easy to integrate C# assembles into my native C++ application and the asp.net webapi was stable enough not to cause more troubles.

New Post: the right way to read JSON from a file and POST it

$
0
0
I am trying this exact code (copy&past from damienhocking - Dec 17, 2014 at 6:25 AM) with cpprest 2.4.0.1 on windows 8.1 and visual studio 2013 linking against the v120 files.

Only adding a http_client
http_client httpclient{ U("http://myserver.azurewebsites.net/") };
and a file containing json in utf8.

It will only work if i send less than 1000 bytes (did not check exact number, but 950 bytes was ok and 1000 bytes was not ok)

If i send more than 1000 bytes, it will always raise a http_exception: WinHttpSendRequest chunked: 87
Same exception occurs if i set the body in any other way (bytestream, std::vector<>, std::string)

Is there any way to send more data?

New Post: the right way to read JSON from a file and POST it

$
0
0
Hi Holger_0000,

I've never heard of this happening before. Do you have a repro that works on a public server I can hit? Can you please share the full 'exact' code you are hitting the problem with? If you don't want to publically share on the forums here you can email me the code at stgates at Microsoft dot com.

Thanks,
Steve

New Post: Error in SSL handshake for consecutive requests

New Post: rest sdk http_listener as a network server

$
0
0
This is pretty surprising that casablanca doesn't offer a way to accesss http_listener to access the server locally. Now my clients have clearly said that they don't want any CLR or .NET framework to be used, because most of the consumers in his network still use Windows XP, therefore doens't have .NET framework in their PCs.

New Post: the right way to read JSON from a file and POST it

$
0
0
Hi Steve,

I could locate the problem.

It seems it does not work if i set the global locale to anything but "C"
auto a2 = std::locale("en-us");
std::locale::global(a2);
If i do this for my application the post request will raise the exception.

QuickFix1: (not really a fix)
If i change my "Digit grouping" (in Region settings) from = "123.456.7892 to "123456789" it will work again.

QuickFix2:
After setting the body of the request, I remove the Content-Length header and add it again with a correctly formatted value
postrequest.set_body(fileStream, length, U("application/json"));
postrequest.headers().remove(U("Content-Length"));
postrequest.headers().add(U("Content-Length"), U("91335"));

Commented Feature: on-demand thread creation/lib initialization [68]

$
0
0
Hello,

I would like to use casablanca in a child process in Linux.

When the application starts the crossplat::threadpool::s_shared is automatically constructed in the parent process. However, the 40 threads are not inherited by the child process created by a fork call and, thus, I cannot use casablanca in the child process.

It would be helpful for me if I could control when the threads are created, a sort of init_casablanca() function.

Regards,
Sorin
Comments: Hi, what is the current status ? This is a very important feature for me project. There are any workaround ?

Commented Issue: http_listener hangs on open() if pplx task is created in parallel on Win Server 20012 R2 [306]

$
0
0
http_listener.open() simply hangs if I pplx::create_task() {Sleep(forewer);} before hand.
If I first start listener and then launch the task, then all incoming http requests will hang.

This repros 100% on Windows 2012 R2 in Azure (Azure provided image), however it it doesn't repro on Win8.1 non-virtual machine. Win 8.1 non-virtual works just fine, but server hangs.
I use cpprest120d_2_2.dll
Code:
try
{
pplx::create_task([]
{
Sleep(1000000);
});

std::wcout << L"Launching" << std::endl;

listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();


while (true){ Sleep(1000); }
}
catch (exception const & e)
{
wcout << e.what() << endl;
}

otuput:

httpsample.exe localhost --c
url: http://localhost:9575/restdemo
Launching

// hangs right here




Comments: Hi Steve, any update on this? Is there any workaround? Thank you, Ruslan

New Post: Suitable algorithm to find an element in C++ Rest JSON

$
0
0
Hi

I get a huge json from API. I have to find concrete fields.
I would like to know the most suitable algorithm for getting an element from C++ Rest JSON

Thanks

New Post: Suitable algorithm to find an element in C++ Rest JSON

$
0
0
Hi ggiloyan89,

It sounds like you have a json object, so you could use the web::json::value::has_field function to check if an object has a field. You can look up fields using the json::value::at(...) or operator[] functions. There are a few examples as well on this wiki documentation page.

Steve

Commented Issue: http_listener hangs on open() if pplx task is created in parallel on Win Server 20012 R2 [306]

$
0
0
http_listener.open() simply hangs if I pplx::create_task() {Sleep(forewer);} before hand.
If I first start listener and then launch the task, then all incoming http requests will hang.

This repros 100% on Windows 2012 R2 in Azure (Azure provided image), however it it doesn't repro on Win8.1 non-virtual machine. Win 8.1 non-virtual works just fine, but server hangs.
I use cpprest120d_2_2.dll
Code:
try
{
pplx::create_task([]
{
Sleep(1000000);
});

std::wcout << L"Launching" << std::endl;

listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();


while (true){ Sleep(1000); }
}
catch (exception const & e)
{
wcout << e.what() << endl;
}

otuput:

httpsample.exe localhost --c
url: http://localhost:9575/restdemo
Launching

// hangs right here




Comments: Hi Ruslan, No I haven't spent any more time investigating this further. For the library our main focus isn't really on the http_listener so most of it's bugs are lower priority. Steve

Commented Feature: on-demand thread creation/lib initialization [68]

$
0
0
Hello,

I would like to use casablanca in a child process in Linux.

When the application starts the crossplat::threadpool::s_shared is automatically constructed in the parent process. However, the 40 threads are not inherited by the child process created by a fork call and, thus, I cannot use casablanca in the child process.

It would be helpful for me if I could control when the threads are created, a sort of init_casablanca() function.

Regards,
Sorin
Comments: Hi Marc_R, What exactly are you looking to accomplish with this feature? Currently there is a [pull request](https://casablanca.codeplex.com/SourceControl/network/forks/simonlep/cpprest/contribution/8059) that makes the threadpool used for scheduling tasks be lazy initialized. This can work for forking processes in Linux as long as you don't schedule any tasks. Steve

New Post: the right way to read JSON from a file and POST it

$
0
0
Hi Holger_0000,

Yes I see the problem. A stringstream is being used to write the Content-Length header which inherits the global locale. I'm working on a fix and will update this thread again once it is checked into the development branch.

Steve

Commented Feature: on-demand thread creation/lib initialization [68]

$
0
0
Hello,

I would like to use casablanca in a child process in Linux.

When the application starts the crossplat::threadpool::s_shared is automatically constructed in the parent process. However, the 40 threads are not inherited by the child process created by a fork call and, thus, I cannot use casablanca in the child process.

It would be helpful for me if I could control when the threads are created, a sort of init_casablanca() function.

Regards,
Sorin
Comments: Exactly the same as the pull request, who come from my co-worker. - Create a daemon on Linux.

Commented Issue: http_listener hangs on open() if pplx task is created in parallel on Win Server 20012 R2 [306]

$
0
0
http_listener.open() simply hangs if I pplx::create_task() {Sleep(forewer);} before hand.
If I first start listener and then launch the task, then all incoming http requests will hang.

This repros 100% on Windows 2012 R2 in Azure (Azure provided image), however it it doesn't repro on Win8.1 non-virtual machine. Win 8.1 non-virtual works just fine, but server hangs.
I use cpprest120d_2_2.dll
Code:
try
{
pplx::create_task([]
{
Sleep(1000000);
});

std::wcout << L"Launching" << std::endl;

listener
.open()
.then([&listener](){std::wcout << L"Start to listen"<<std::endl ; })
.wait();


while (true){ Sleep(1000); }
}
catch (exception const & e)
{
wcout << e.what() << endl;
}

otuput:

httpsample.exe localhost --c
url: http://localhost:9575/restdemo
Launching

// hangs right here




Comments: Tried again with workaround from 106. Apparently the same issue, but on dual core machine. I am not sure why the workaround didn't work for me before. I did try it. So the workaround concurrency::CurrentScheduler::Create(Concurrency::SchedulerPolicy(1, 2, Concurrency::MinConcurrency)); works for me now. Thanks, Ruslan

New Post: Workarounds to build for Android under Mac OS X

$
0
0
So any idea when this will be fixed? I can't really used the 32bit versions of the libraries.

Heisenberg

New Post: Workarounds to build for Android under Mac OS X

$
0
0

Well there is still a probe;em: I get this error now:

Since you've disabled or enabled at least one algorithm, you need to do
the following before building:
make depend
Configured for android-x86.
making depend in crypto...
../util/domd: line 25: i686-linux-android-gcc: command not found
make[2]: *** [depend] Error 1
make[1]: *** [depend] Error 1

make: *** [x86/lib/libssl.a] Error 2

Also the sed lines in the Makefile for openssl fail on Mac

setenv-android-x86.sh: setenv-android.sh
    cp setenv-android.sh setenv-android-x86.sh.tmp
    sed -i 's/_ANDROID_EABI="arm-linux-androideabi-4.8"/_ANDROID_EABI="x86-4.8"/g' setenv-android-x86.sh.tmp
    sed -i 's/_ANDROID_ARCH=arch-arm/_ANDROID_ARCH=arch-x86/g' setenv-android-x86.sh.tmp
    mv setenv-android-x86.sh.tmp setenv-android-x86.sh
With this error:
sed: 1: "setenv-android-x86.sh.tmp": unterminated substitute in regular expression


Heisenberg
Viewing all 4845 articles
Browse latest View live