13854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt/*
23854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt * Copyright 2016 Google Inc.
33854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt *
43854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt * Use of this source code is governed by a BSD-style license that can be
53854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt * found in the LICENSE file.
63854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt */
73854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
83854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt#include "UrlHandler.h"
93854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
103854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt#include "microhttpd.h"
113854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt#include "../Request.h"
123854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt#include "../Response.h"
133854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
143854f11ce35857ccb6dbf8bb09bef9252543090fjoshualittusing namespace Response;
153854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
163854f11ce35857ccb6dbf8bb09bef9252543090fjoshualittbool RootHandler::canHandle(const char* method, const char* url) {
173854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt    return 0 == strcmp(method, MHD_HTTP_METHOD_GET) &&
183854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt           0 == strcmp(url, "/");
193854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt}
203854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
213854f11ce35857ccb6dbf8bb09bef9252543090fjoshualittint RootHandler::handle(Request* request, MHD_Connection* connection,
223854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt                        const char* url, const char* method,
233854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt                        const char* upload_data, size_t* upload_data_size) {
243854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt    return SendTemplate(connection);
253854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt}
263854f11ce35857ccb6dbf8bb09bef9252543090fjoshualitt
27