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

New Post: How to grab URI segments?

$
0
0
i listen on :
with:
const http::uri uri = http::uri::encode_uri(utility::conversions::to_string_t(theUri));
new VlHttp(uri);
and the constructor VlHttp lokks like this:
VlHttp::VlHttp(const http::uri& url) : m_listener(http_listener(url))
{
    printf("url is: %s\n", url.to_string().c_str());
    m_listener.support(methods::GET,
        std::tr1::bind(&VlHttp::handle_get,
        this,
        std::tr1::placeholders::_1));
    m_listener.support(methods::PUT,
        std::tr1::bind(&VlHttp::handle_put,
        this,
        std::tr1::placeholders::_1));
    m_listener.support(methods::POST,
        std::tr1::bind(&VlHttp::handle_post,
        this,
        std::tr1::placeholders::_1));
    m_listener.support(methods::DEL,
        std::tr1::bind(&VlHttp::handle_delete,
        this,
        std::tr1::placeholders::_1));
    try
    {
        m_listener
            .open()
            //.then([&m_listener](){TRACE(L"\nstarting to listen\n"); })
            .wait();

        while (true);
    }
    catch (exception const & e)
    {
        printf("%s", e.what());
        wcout << e.what() << endl;
    }
}
Here is what i have
i run in the console
handle GET

 path: °þZ☻

 fragment: ÈþZ☻

 query: ░þZ☻
i guess its somekind of encoded or stream thing?
but even if i do something like:
  • utility::conversions::to_utf8string
    it does not work
i also tried to convert to c_str
  • path.c_str();
    it returns an empty string
in PHP it is super easy like
$_SERVER['REQUEST_URI'];
and i would run a dispatcher matching classes / methods against the fragments.
i just don't know how to implement this with casablanca

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

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