aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skiaserve/Response.h
blob: ef115e9d23a4c89ab5bfb79e6eaf9f0430f5a44b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef Reponse_DEFINED
#define Reponse_DEFINED

struct MHD_Connection;
struct Request;
class SkData;

namespace Response {
    // SendOK just sends an empty response with a 200 OK status code.
    int SendOK(MHD_Connection* connection);

    int SendError(MHD_Connection* connection, const char* msg);

    int SendData(MHD_Connection* connection, const SkData* data, const char* type,
                 bool setContentDisposition = false, const char* dispositionString = nullptr);

    int SendJSON(MHD_Connection* connection, Request* request, int n);

    int SendTemplate(MHD_Connection* connection, bool redirect = false,
                     const char* redirectUrl = nullptr);
}

#endif