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

Edited Issue: http_listener - doesn't report errors correctly after reading headers [220]

$
0
0
Taking a look at the code I think I can see this is an issue with the http_listener implementation. Basically it appears the problem is the listener implementation is NOT properly calling the _complete API in error cases after the HTT headers have been processed. For example in http_linux_server.cpp in the handle_body method if an error occurs we never actually end up calling _complete with an exception. There are several places where this is needed.

Affects Linux/OS X/iOS

Discovered when http_client cancellation functionality was implemented in this pull request:

https://casablanca.codeplex.com/SourceControl/network/forks/tsone/LinuxClientConnectionReuse/contribution/7093



New Post: How to listen on * (localhost and ip) without administrator privileges?

$
0
0
I can't understand why administrator privileges are required to listen on non-localhost with
not-80 or over 1024 tcp port number. So I can't make a simple web server program which accepts a request from another host.

Anyway, from https://casablanca.codeplex.com/discussions/532385

there may be a way with netsh, HttpCfg.exe or HttpSetServiceConfiguration.

Can I get the detailed howto about using the above ways?

Created Issue: http_listener - on Linux/iOS/OSX doesn't report underlying error code with exceptions [224]

$
0
0
Looking in http_linux_server.cpp it is easy to see the Boost error code is dropped.

New Post: How to listen on * (localhost and ip) without administrator privileges?

$
0
0
I'm the OP of the discussion that you referenced. The need for Administrator mode is an unwelcome surprise. Administrator mode is probably required for security reasons.
  1. The referenced discussion contains instructions on how to use netsh for a one-time Administrator mode setup.
  2. HttpCfg.exe seems to be deprecated after XP.
  3. HttpSetServiceConfiguration is an API callable from C++ or pinvoke from .Net. It is part of the HTTP Server API. Below are links to info:
HTTP Server API Version 1.0 Reference
HttpSetServiceConfiguration
httpsetserviceconfiguration (httpapi)
How to work with SSL certificate configuration records via HTTP Server API
SSL Related Question
helpful info from winehq.org

Edited Feature: websocket_client - provide ability to register call back handler for received messages [163]

$
0
0
The websocket_client class does not provide the ability to attach a call back handler for received messages. One of the benefits of web socket is that the client does not need to keep polling for updates from the server. However, with the current design of APIs, the client still needs to poll for any message received from the server. It has only removed the need to send request to the server while polling.

Thought the same behavior as call back handler can be achieved by writing asynchronous loop but this is a difficult to write and prone to errors from users. This is against the 'productivity' tenet we market about Casablanca.

Closed Issue: websocket_client: Pass URI in connect instead of taking it with the constructor [176]

$
0
0
The websocket_client takes URI in the constructor. Sometimes, we may not know the URI when creating the object.
2 possible solutions:
1. Either provide a constructor that does not take the URI and an option to set the URI later.
2. Take URI in connect call.
Comments: Fixed in development.

Edited Issue: websocket_client: Pass URI in connect instead of taking it with the constructor [176]

$
0
0
The websocket_client takes URI in the constructor. Sometimes, we may not know the URI when creating the object.
2 possible solutions:
1. Either provide a constructor that does not take the URI and an option to set the URI later.
2. Take URI in connect call.

Edited Feature: websocket_client: Expose the boost native handle to set client certificates [121]

$
0
0
A customer has requested support for client certificates in our desktop websocket implementation.
One option is to expose the boost native handle so that users can set the certificate themselves.


Edited Task: start using binscope on OS X, investigate what else [209]

$
0
0
An internal customer hit issues with the Quality Essentials requirement about running binscope for OS X. We need to start running this, perhaps as part of sign off. Someone needs to investigate all the requirements for releasing on OS X/iOS and we should run those tools as well.

New Post: Issue sending http request, no connection at all?

$
0
0
I am currently writing a small piece of code to familiarize myself with the REST SDK's JSON capabilities some more and following the JSON example in the documentation I have this:
pplx::task<void> WoWRealmCheck() {
    uri_builder uribuild(L"http://us.battle.net");
    uribuild.append_path(L"/api/realm/status");
    auto uri = uribuild.to_uri();
    http_client client(uri);
    return client.request(methods::GET)
        .then([](http_response response) -> pplx::task<json::value>
    {
        std::cout << "Received response code: " << response.status_code() << std::endl;
        if (response.status_code() == status_codes::OK)
            return response.extract_json();
        else
            return pplx::task_from_result(json::value());

    })
        .then([](pplx::task<json::value> jsonResponse)
    {
        try
        {
            const json::value& v = jsonResponse.get();
            std::cout << "Check 2\n";
        }
        catch (const web::http::http_exception& e)
        {
            std::cout << e.what();
        }
    });
};

int main() {
    std::cout << "Checking current status of all realms...\n";
    
    WoWRealmCheck();

}
The issue is the code does not even show a connection to the http client, it gets as the first return statement in the realm check function and then nothing, no message for response code or anything, it just cuts straight to the end of the run. I would love for someone to let me know what I'm doing incorrectly thank you.

Edit: I also know for sure the host I am connecting to provides data in the form of json per get request, http://blizzard.github.io/api-wow-docs/#realm-status-api is the api I am using.

New Post: Getting error " undefined reference to `pplx::get_ambient_scheduler()' " when trying to build

$
0
0
Please forgive me if I'm 'doing it wrong' posting this as a thread, this is my very first post here.

So, I'm trying to get Casablanca working, but even trying to include the headers ala the Bingrequest sample so:

include <cpprest/http_client.h>

include <cpprest/filestream.h>

Gives me the error:
undefined reference to `pplx::get_ambient_scheduler()'

I'm inserting a capp of my terminal for reference.
Image

Can someone explain what I'm doing wrong and how to correct it?

Thank you.

P.S. I was able to get everything installed and all the tests passed successfully as per Linux build instructions via: How to setup, build, and run tests on Linux
Image

New Post: Issue sending http request, no connection at all?

$
0
0
Suggest you try the URL in a browser. What does it return?

The shorter the program, the more likely you are to get feedback. Try reposting as a program of around 10 lines.

New Post: Getting error " undefined reference to `pplx::get_ambient_scheduler()' " when trying to build

$
0
0
I was able to build and run your test program successfully. Looks like your g++ command args are wrong. Try this:
g++ testcasa.cpp -std=c++11 -I /home/johnny/casablanca/Release/include -L /home/johnny/casablanca/Release/build.release/Binaries -lcpprest 
export LD_LIBRARY_PATH=/home/johnny/casablanca/Release/build.release/Binaries
./a.out

New Post: Getting error " undefined reference to `pplx::get_ambient_scheduler()' " when trying to build

$
0
0
Great, following your advice also worked on my machine too. Looks like I neglected to add this linker flag:
-L /home/johnny/casablanca/Release/build.release/Binaries

I guess I mistakenly assumed the
export LD_LIBRARY_PATH=/home/johnny/casablanca/Release/build.release/Binaries
command took care of that.

Also, is it possible to use something like pkg-config for Casablanca? For example, when working on GTKMM program in Code::Blocks (or even the terminal), I can just add:
pkg-config gtkmm-3.0 --cflags to Compiler settings > Other options, and
pkg-config gtkmm-3.0 --libs to Linker settings > Other linker options.

This would sure be helpful for relative novices to be able to quickly start learning Casablanca.

I guess I should learn how to use build toolchains better, I sure need help with them haha. It seems complicated kind of. Would learning 'Make' or 'CMake' be the best first step do you think?

Thanks alot for your help BTW, I appreciate it!

New Post: Issue sending http request, no connection at all?

$
0
0
Hi GrandaThePanda,

I didn't try your code out but looking at it, it looks like you are starting and asynchronous operation and not waiting for it complete. Your function WowRealmCheck returns a task, from calling http_client::request. In the main method of your program you are calling WowRealmCheck and not waiting the returned task, instead immediately exiting the process. If you add a call to wait on the task you should be all set. So you main would look something like this:
int main() {
    std::cout << "Checking current status of all realms...\n";
    
    WoWRealmCheck().wait()
};
Please note all potentially blocking operations in the C++ Rest API are asynchronous and return a Parallel Patterns Library task. Here are a couple of resources you can look at for how to use and write programs with tasks.

https://casablanca.codeplex.com/wikipage?title=Programming%20with%20Tasks&referringTitle=Documentation
http://msdn.microsoft.com/en-us/library/dd492427(v=vs.110).aspx

Steve

New Post: Issue sending http request, no connection at all?

$
0
0
Steve,

Thank you very much that did the trick and thank you very much for the resources, I'm new to working with ppl, so that helps greatly.

Granda

Created 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: Update: It seems this was just a discrepancy between older methods of handling JSON data and the current method "at()". I like the way the new method handles it, its cleaner. I know documentation is dodgy, but in my opinion it would be worth updating those samples as well as the hosted documentation or at least marking the removal. The correct methods are included in the downloadable documentation though which was something, at least.

New Post: Looking for VS2010 support

$
0
0
HI,Our IT department demand us to use an authorised edition of VS2010, I'm now developing an HTTP client on Win7 using C++ REST and want the program run on XP or Win7. But there seems little support for VS2010 and no documents, user guidance, API statements to help install and use the SDK. Where can I get these informations?

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: we have the same problem , disabling this is no solution for us we look forward for a solution !
Viewing all 4845 articles
Browse latest View live


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