Beispiel #1
0
    void check_url_parsing (std::string const& url, bool expected)
    {
        auto result = parse_URL (url);

        expect (result.first == expected,
            (expected ? "Failed to parse " : "Succeeded in parsing ") + url);
        expect (to_string (result.second) == url);
    }
Beispiel #2
0
void serve_request(client_t *client) {
    parsed_url_t url;
    parse_URL(client->url, url);
    std::string &request_uri = url.path;
    DCERR("request_uri: " << request_uri << endl);

    if (request_uri == "/face/suggest/") {
        handle_suggest(client, url);
    }
    else if (request_uri == "/face/import/") {
        handle_import(client, url);
    }
    else if (request_uri == "/face/export/") {
        handle_export(client, url);
    }
    else if (request_uri == "/face/stats/") {
        handle_stats(client, url);
    }
    else {
        handle_invalid_request(client, url);
    }
}