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

Commented Unassigned: Memory Leak occurred in VC++(MFC) [17]

$
0
0
I have been working on a project with VC++(MFC).
(Using VS 2012 update 2)

I just added http_client header files.
However, a memory leak has occurred.

```
Detected memory leaks!
Dumping objects ->
{420} normal block at 0x00774B68, 32 bytes long.
Data: <u t f - 1 6 b e > 75 00 74 00 66 00 2D 00 31 00 36 00 62 00 65 00
{419} normal block at 0x00774B20, 8 bytes long.
Data: < U > 80 C4 D4 55 00 00 00 00
{418} normal block at 0x00774AC0, 32 bytes long.
Data: <u t f - 1 6 l e > 75 00 74 00 66 00 2D 00 31 00 36 00 6C 00 65 00
{417} normal block at 0x00774A78, 8 bytes long.
Data: <t U > 74 C7 D4 55 00 00 00 00
{416} normal block at 0x00774A30, 8 bytes long.
Data: <P U > 50 C9 D4 55 00 00 00 00
{415} normal block at 0x007749E8, 8 bytes long.
Data: <T U > 54 C8 D4 55 00 00 00 00
{414} normal block at 0x00774988, 32 bytes long.
Data: <i s o - 8 8 5 9 > 69 00 73 00 6F 00 2D 00 38 00 38 00 35 00 39 00
{413} normal block at 0x00774940, 8 bytes long.
Data: <d U > 64 C4 D4 55 00 00 00 00
{412} normal block at 0x007748E0, 32 bytes long.
Data: <u s - a s c i i > 75 00 73 00 2D 00 61 00 73 00 63 00 69 00 69 00
{411} normal block at 0x00774898, 8 bytes long.
Data: <| U > 7C C5 D4 55 00 00 00 00
{410} normal block at 0x00774818, 64 bytes long.
Data: <a p p l i c a t > 61 00 70 00 70 00 6C 00 69 00 63 00 61 00 74 00
{409} normal block at 0x007747D0, 8 bytes long.
Data: < U > E4 C7 D4 55 00 00 00 00
{408} normal block at 0x00774760, 48 bytes long.
Data: <a p p l i c a t > 61 00 70 00 70 00 6C 00 69 00 63 00 61 00 74 00
{407} normal block at 0x00774718, 8 bytes long.
Data: <p U > 70 C8 D4 55 00 00 00 00
{406} normal block at 0x007746A8, 48 bytes long.
Data: <t e x t / x - j > 74 00 65 00 78 00 74 00 2F 00 78 00 2D 00 6A 00
{405} normal block at 0x00774660, 8 bytes long.
Data: <X U > 58 C7 D4 55 00 00 00 00
{404} normal block at 0x00774600, 32 bytes long.
Data: <t e x t / j a v > 74 00 65 00 78 00 74 00 2F 00 6A 00 61 00 76 00
{403} normal block at 0x007745B8, 8 bytes long.
Data: < U > C8 C7 D4 55 00 00 00 00
{402} normal block at 0x00774558, 32 bytes long.
Data: <t e x t / x - j > 74 00 65 00 78 00 74 00 2F 00 78 00 2D 00 6A 00
{401} normal block at 0x00774510, 8 bytes long.
Data: < U > D0 C5 D4 55 00 00 00 00
{400} normal block at 0x007744B0, 32 bytes long.
Data: <t e x t / j s o > 74 00 65 00 78 00 74 00 2F 00 6A 00 73 00 6F 00
{399} normal block at 0x00774468, 8 bytes long.
Data: < U > 9C C4 D4 55 00 00 00 00
{398} normal block at 0x007743E8, 64 bytes long.
Data: <t e x t / p l a > 74 00 65 00 78 00 74 00 2F 00 70 00 6C 00 61 00
{397} normal block at 0x007743A0, 8 bytes long.
Data: < U > DC C9 D4 55 00 00 00 00
{396} normal block at 0x00774320, 64 bytes long.
Data: <t e x t / p l a > 74 00 65 00 78 00 74 00 2F 00 70 00 6C 00 61 00
{395} normal block at 0x007742D8, 8 bytes long.
Data: < U > 98 C5 D4 55 00 00 00 00
{394} normal block at 0x00774258, 64 bytes long.
Data: <t e x t / p l a > 74 00 65 00 78 00 74 00 2F 00 70 00 6C 00 61 00
{393} normal block at 0x00774210, 8 bytes long.
Data: < U > C0 C9 D4 55 00 00 00 00
{392} normal block at 0x007741B0, 32 bytes long.
Data: <t e x t / p l a > 74 00 65 00 78 00 74 00 2F 00 70 00 6C 00 61 00
{391} normal block at 0x00774168, 8 bytes long.
Data: < U > 08 C6 D4 55 00 00 00 00
{390} normal block at 0x007740E8, 64 bytes long.
Data: <a p p l i c a t > 61 00 70 00 70 00 6C 00 69 00 63 00 61 00 74 00

```


Comments: please reopen !

New Post: Problems Linking on Linux

$
0
0
I am trying to port our Casablanca based application to Linux (Ubuntu 14.04) and am having a problem with a bunch of symbols not being found by the linker. I am hoping someone else has had a similar problem porting their cpprest application(s) to Linux and will recognize the problem and point me towards a solution.

Thanks in advance for your help!

Short Version

I am linking against locally built boost and cpprest libraries. They are built against ICU libraries installed as part of the libicu-dev. Everything compiles fine but the linker doesn't find the symbols in the icu library - even though nm sees them just fine.

All the Gory Details

In the link part of my build I am getting a pile of undefined references to ucnv_* functions (ucnv_open_52, ucnv_close_52, etc.). The g++ link command has –licuuc. The linker isn’t complaining about not finding the library but it doesn’t seem to find the symbols in it.

In case it helps the g++ command looks something like this (cleaned up to hopefully improve readability):
/usr/bin/g++ {application .o files} -o {application name} -rdynamic -licuuc -lssl -lcrypto {locally built boost .a files} -lpthread –pthread
However, I get a pile of errors associated with boost locale. For example:
/libraries/boost_1_55_0/stage/lib/libboost_locale.a(codepage.o): In function `boost::locale::conv::impl::uconv_to_utf<wchar_t>::open(char const*, boost::locale::conv::method_type)':
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0xac): undefined reference to `ucnv_open_52'
codepage.cpp:(.text._ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE[_ZN5boost6locale4conv4impl12uconv_to_utfIwE4openEPKcNS1_11method_typeE]+0xc4): undefined reference to `ucnv_close_52'
{many more}
This is on an ubuntu 14.04 machine using the default packages.
$ dpkg --get-selections | grep icu
icu-devtools                                    install
libicu-dev:amd64                                install
libicu52:amd64                                  install
Looking at ldconfig –v shows that libicuuc is being loaded from /usr/lib/x86_64-linux-gnu (didn’t include dump as it was pretty long)

However, dumping the symbols for those files and grep’ing for a symbol g++ could not find shows it is in both the .so and .a variants…
$ nm -DC  /usr/lib/x86_64-linux-gnu/libicuuc.so | grep ucnv_open_52
000000000005f3f0 T ucnv_open_52

$ nm -gC  /usr/lib/x86_64-linux-gnu/libicuuc.a | grep ucnv_open_52
0000000000000d10 T ucnv_open_52
                 U ucnv_open_52
                 U ucnv_open_52
                 U ucnv_open_52
                 U ucnv_open_52
                 U ucnv_open_52
                 U ucnv_open_52
So what did I miss? Why cannot g++ find the symbols for the ICU library?

Thanks again for your help.

New Post: Problems Linking on Linux

$
0
0
Hi mabgfounder,

Thanks for all the detail in your post! It sounds like your issue is your linking order. You said that your g++ line looks like:
/usr/bin/g++ {application .o files} -o {application name} -rdynamic -licuuc -lssl -lcrypto {locally built boost .a files} -lpthread –pthread
However, because of the way the GNU linker works, you will need to link dependencies AFTER the libraries that depend on them. So try changing your linking line to look like:
/usr/bin/g++ {application .o files} -o {application name} {locally built boost .a files} -rdynamic -licuuc -lssl -lcrypto -lpthread –pthread
For more details on this, you can look at my answer to this previous discussion: https://casablanca.codeplex.com/discussions/542485

I'm 99% sure this is your issue, but if this doesn't fix things, could you please post the full link line?

Sincerely,
roschuma

New Post: Looking for VS2010 support

$
0
0
Hi joeccmou,

Our latest release don't support Visual Studio 2010 any more, only 2012 and 2013 currently. Mainly due to compiler and standard library features that are present in newer versions. If you can't use a newer version then you could stick with one of our older releases. The last one that we produced binaries for 2010 was 1.2.0. If you want to build from source the last version that contained the 2010 project files was 1.3.1.

Regardless of the release you're using I recommend you use our NuGet packages. Here is a tutorial using the http_client consuming our NuGet package. If you aren't using our latest release you will need to use the NuGet package manager console to specify the version, i.e. "Install-Package cpprestsdk -Version 1.2.0"

Here is a prior discussion, about the end of Visual Studio 2010 support.

Steve

Commented Unassigned: missing json iterators [225]

$
0
0
My package is currently not recognizing .cbegin() .cend() .begin() and .end() as valid methods on objects of type web::json::value I double checked the documentation here: http://msdn.microsoft.com/en-us/library/jj948445.aspx to make sure they are definitely included.

I tested this not only on my code but using a snippet of an accepted blog post found under community samples found here:

http://voidnish.wordpress.com/2013/05/07/casablanca-code-snippets-getting-and-parsing-json-data/

my includes and namespaces are:

```
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/json.h>
using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
using namespace web::json;
```
Comments: Hi GrandaThePanda, Yes please don't use the reference documentation you found on msdn, it is for the 1.0.0 version that was included in Visual Studio 2013. The latest releases and [documentation](https://casablanca.codeplex.com/wikipage?title=Reference%20Documentation&referringTitle=Documentation) all is located here on CodePlex. In our 2.0.0 release we made a breaking API change to improve how iterating over JSON arrays and objects are handled, this is what you are seeing. The community sample you used is from an old version, before the change so that is why you are hitting the issue. We don't own most of those blog posts, they are made by other people. So we don't have any control over getting them updated. If you think they no longer provide any value we could remove the links on CodePlex to them, but that is about it. I'm going to close this issue as I don't think there are any problems that need addressing, let me know if you feel otherwise or have any other questions. Thanks, Steve

Closed Unassigned: missing json iterators [225]

$
0
0
My package is currently not recognizing .cbegin() .cend() .begin() and .end() as valid methods on objects of type web::json::value I double checked the documentation here: http://msdn.microsoft.com/en-us/library/jj948445.aspx to make sure they are definitely included.

I tested this not only on my code but using a snippet of an accepted blog post found under community samples found here:

http://voidnish.wordpress.com/2013/05/07/casablanca-code-snippets-getting-and-parsing-json-data/

my includes and namespaces are:

```
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/json.h>
using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
using namespace web::json;
```

Commented Unassigned: missing json iterators [225]

$
0
0
My package is currently not recognizing .cbegin() .cend() .begin() and .end() as valid methods on objects of type web::json::value I double checked the documentation here: http://msdn.microsoft.com/en-us/library/jj948445.aspx to make sure they are definitely included.

I tested this not only on my code but using a snippet of an accepted blog post found under community samples found here:

http://voidnish.wordpress.com/2013/05/07/casablanca-code-snippets-getting-and-parsing-json-data/

my includes and namespaces are:

```
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/json.h>
using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
using namespace web::json;
```
Comments: Yes, I think removing that one in particular is a good idea, the link in question , with the more recent model provides very little value for learning how to interact with json values. I think it might throw off more people. Thanks a lot for the quick reply to this, I was like why isn't this a thing. Since I posted this I have found the new way so much better to work with. Regards, Granda

New Post: Problems Linking on Linux

$
0
0
Thanks roschuma! That was my problem exactly.

I had a little trouble getting cmake to play along - for the benefit of anyone finding this thread later my fix was simply to add icuuc to the list of target_link_libraries for ${Casablanca_LIBRARY} itself. (in Release/src/CMakeLists.txt). Otherwise CMake kept placing cpprest and boost after the target_link_libraries for my application. After I did this it was easy enough to simply use add_directory to pull in the cpprest dependencies.

Thanks again roschuma for your help!

Updated Wiki: Blog Posts

$
0
0

Community Blog Posts

The Casablanca team is very excited to see the support we have received from the community around this project. Below are links to blog posts written by various contributors. These posts provide some great examples and tips on using the C++ REST SDK.
  • C++ REST SDK WebSocket client by Kavya Kotacherry: _"With the C++ REST SDK 2.1 release, we are excited to announce support for client side WebSockets across multiple platforms (Linux, OSX, iOS, Windows Desktop and Store). This is a relatively new protocol, providing full duplex communication over TCP."
  • Using Casablanca to consume a REST API by Nish Sivakumar: "This article quickly demonstrates a skeletal ASP.NET MVC 4 REST web service that is consumed by C++ code that uses Casablanca to do the four common HTTP operations - GET, POST, PUT, and DELETE. It also shows how to parse and create JSON, and also how to use the PPL extensions to write asynchronous code."

Commented Unassigned: missing json iterators [225]

$
0
0
My package is currently not recognizing .cbegin() .cend() .begin() and .end() as valid methods on objects of type web::json::value I double checked the documentation here: http://msdn.microsoft.com/en-us/library/jj948445.aspx to make sure they are definitely included.

I tested this not only on my code but using a snippet of an accepted blog post found under community samples found here:

http://voidnish.wordpress.com/2013/05/07/casablanca-code-snippets-getting-and-parsing-json-data/

my includes and namespaces are:

```
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#include <cpprest/json.h>
using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
using namespace web::json;
```
Comments: Hi Granda, I've removed it. Steve

Closed Issue: Unable to bring up Manage NuGet Packages [214]

$
0
0
Hello Everyone!

I am having a problem to start develop to C++ Rest SDK. The problem maybe could be simple but I do not see any solution =( .

I created an empty 'Console Win 32 Project' and when I clicked with the right button in project to go to "Manage NuGet Packages" the follow message appears: "The Project 'ProjectName' is unsupported".

I try to follow the tutorial: [https://casablanca.codeplex.com/wikipage?title=Using%20NuGet%20to%20add%20the%20C%2b%2b%20REST%20SDK%20to%20a%20VS%20project](http://www.example.com) but this is not work.

I try to make one DLL for use with unity3d so I believe I could not embed any windows plataform code. Could this be the problem? This SDK needs the Windows.h to be used?


Obs: I am using the visual studio 2012 Pro

Thx for all!
Comments: Closing as this is an issue with NuGet and Visual Studio integration not the C++ Rest SDK.

Updated Release: C++ REST SDK 2.2.0

$
0
0
Please fill in bugs and features as they are added into the release notes.

Linux
  • Updated to requirements for Boost to version 1.54 and Ubuntu 14.04.
OS X, iOS
  • Replace internally to use boost locks instead of from standard library due to bug.
http_client
  • Improve timeouts to be reset and work properly when data is still being written.
  • Added configuration option to buffer request body data on Windows Desktop. This can be helpful for situations where authentication challenges might occur.
  • Removed http_response::error_code() API. This was bad API that shouldn't have existed. Error codes are reported through http_exception with a std::error_code.
  • Added tcp socket connection pooling on our Boost http_client implementation.
  • Implemented http_client cancellation on Linux/iOS/OS X.
http_listener
  • Fix a merge error that accidentally removed https support on Windows.
  • Improve close semantics so you no longer have to make sure to respond to all requests and destroy all http_request/http_response instances, bug 205.
  • Fix an issue where an error during processing could cause a hang on iOS/OS X/Linux.
websocket client
  • Removed the APIs for sending message fragments, we only support sending full messages.
  • BREAKING API CHANGE - moved specifying the host URI from the constructor to the connect API.
json
  • Added application/x-json to known MIME types. Bug 197.
  • Added option to extract_string and extract_json to force regardless of Content-Type header and treat as UTF-8.
miscellaneous
  • Changes to make work for FreeBSD 10+
  • Added options to cmake for building samples, tests, separately

New Features

oAuth
Added library support for oAuth 1.0 and 2.0 in an experimental namespace while we fine tune the API.

Commented Issue: extract_json() memory leak Reported [78]

$
0
0
Hi.

I've used v1.4 in my VC++(MFC) project. ( i solved dll unloaded problem - https://casablanca.codeplex.com/workitem/17 )
And I get a memory leak report.

I tested SDI Project with the following code in VS2013, VS2012

// URI
web::http::uri_builder request_uri;
request_uri.set_scheme(L"http");
request_uri.set_host(m_hostAddress.c_str());
request_uri.set_path(L"/user/login");
request_uri.append_query(L"apiKey", m_strAppKey.c_str());
request_uri.append_query(L"email", userID.c_str());
request_uri.append_query(L"passwd", userPassword.c_str());

// Request Message
web::http::http_request request(web::http::methods::POST);
request.set_request_uri(request_uri.to_string());

http_client client(request.request_uri());

client.request(request.method()).then([&](pplx::task<http_response> responseTask)
{
try
{
http_response response = responseTask.get();

if(response.status_code() == status_codes::OK)
{

pplx::task<web::json::value> previousTask = response.extract_json();
}
}
catch( const http_exception &e )
{

}
}).wait();

The same probliem appears in extract_string().

Comments: We are seeing exactly the same leaks. I have shortened the output a bit: Data: <ABCDEFGHIJKLMNOP> 41 42 Data: <u t f - 1 6 b e > 75 00 Data: <u t f - 1 6 l e > 75 00 Seems to be this in the source code: _base64_enctbl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; And something inside http_constants.dat: DAT(utf16le, "utf-16le") DAT(utf16be, "utf-16be") kisuya is seeing this (which is in http_constants.dat as well): Data: <a p p l i c a t > 61 00 Data: <a p p l i c a t > 61 00 Data: <t e x t / x - j > 74 00 Data: <t e x t / j a v > 74 00 We are using Visual Studio 2013 Update 2 MFC-Project as well. And we have the leaks as early as possible. If we include <cpp_rest/http_client.h> without a call to any function it is already leaking. If we delete the include then the leak disappears. I drilled a little into it but there is not enoug separation in the .h-file to point this out easily (separation between .h and .cpp-file). I have looked into the preprocessor-output - it could be located in the http_msg.i (preprocessor-file)

New Post: Looking for VS2010 support

New Post: Looking for VS2010 support

$
0
0
stevetgates wrote:
Hi joeccmou,

Our latest release don't support Visual Studio 2010 any more, only 2012 and 2013 currently. Mainly due to compiler and standard library features that are present in newer versions. If you can't use a newer version then you could stick with one of our older releases. The last one that we produced binaries for 2010 was 1.2.0. If you want to build from source the last version that contained the 2010 project files was 1.3.1.

Regardless of the release you're using I recommend you use our NuGet packages. Here is a tutorial using the http_client consuming our NuGet package. If you aren't using our latest release you will need to use the NuGet package manager console to specify the version, i.e. "Install-Package cpprestsdk -Version 1.2.0"

Here is a prior discussion, about the end of Visual Studio 2010 support.

Steve
Thank you for your attention. I have read the prior discussion, it seems that version 1.2.0 doesn't run stably on XP. If I want to run my program on both XP and Win7, does it mean I need to write my codes on VS2013 with the last version of C++ REST SDK?

New Post: get http_exception while access to https site in mac os x

$
0
0
roschuma, thanks for your reply. I will try that latter today.

New Post: Compiling a program on linux.

$
0
0
So I managed to compile this on windows and I'm not too familiar with compilation on linux, just learning to work on a linux platform really. Anyway I sucessfully built the sdk on linux and passed all tests sucessfully.

However I go to compile the program on linux which is a short program and it spits an overflowing ammount of errors at me. Not too sure on this one.

command I'm using: gcc -std=c++11 -o Realms RealmStatusMain.cpp -I/home/granda/casablanca/Release/include/ -lboost -lcasablanca

I can post the errors too, but Im hoping its as simple as me incorrectly using a command because the errors are so numerous.

Thanks,
Granda

New Post: Compiling a program on linux.

$
0
0
Hi Granda,

Your issue is that you link boost before you link Casablanca. You need to exchange the "-lboost" and "-lcasablanca" options to the gcc line.

Please see the following two discussions for more information:
https://casablanca.codeplex.com/discussions/542485
https://casablanca.codeplex.com/discussions/558306

If this doesn't solve the issue, could you please post the details of your situation (Distro version, gcc version, architecture, the exact errors you get, what version of boost you have)?

Thanks,
roschuma

Edit: Also, you should probably be using g++ instead of gcc.

New Post: get http_exception while access to https site in mac os x

$
0
0
here is what i got:

e web::http::http_exception & 0x0000000102f4bf98 0x0000000102f4bf98
m_msg std::__1::string "Error code in handle_handshake is "
m_errorCode std::__1::error_code
_val int 60 60
_cat const std::__1::error_category * 0x7fff7324df48 0x00007fff7324df48

New Post: Looking for VS2010 support

$
0
0
Hi,

Yes the 1.2 release was the first one containing XP support, but it probably will still work fine. The other option is to build for Windows from source with the 1.3.0 release.

In general I'd strongly advise you to use Visual Studio 2012 or 2013 so you can take advantage of our later releases. Each release contains more features and numerous bug fixes and improvements. What about using Visual Studio 2013 Desktop Express?

Steve
Viewing all 4845 articles
Browse latest View live


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