aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skiaserve/urlhandlers
diff options
context:
space:
mode:
authorGravatar jcgregorio <jcgregorio@google.com>2016-05-31 12:51:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-31 12:51:31 -0700
commitce8ea4c55b6ecaf7132edce46b1c1ed38d7437fd (patch)
tree03d78caa8463a89250e8f8dfc35d60df2325bbcc /tools/skiaserve/urlhandlers
parent71e055279336096f92d63c5c855641b4b31d6a54 (diff)
skiaserve: Add /quitquitquit handler. Will be used in the hosted debugger.
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2023023002 TBR=ethannicholas Review-Url: https://codereview.chromium.org/2023023002
Diffstat (limited to 'tools/skiaserve/urlhandlers')
-rw-r--r--tools/skiaserve/urlhandlers/QuitHandler.cpp26
-rw-r--r--tools/skiaserve/urlhandlers/UrlHandler.h9
2 files changed, 35 insertions, 0 deletions
diff --git a/tools/skiaserve/urlhandlers/QuitHandler.cpp b/tools/skiaserve/urlhandlers/QuitHandler.cpp
new file mode 100644
index 0000000000..a9196a0c69
--- /dev/null
+++ b/tools/skiaserve/urlhandlers/QuitHandler.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "UrlHandler.h"
+
+#include "microhttpd.h"
+#include "../Request.h"
+#include "../Response.h"
+
+using namespace Response;
+
+bool QuitHandler::canHandle(const char* method, const char* url) {
+ const char* kBaseName = "/quitquitquit";
+ return 0 == strcmp(method, MHD_HTTP_METHOD_GET) &&
+ 0 == strncmp(url, kBaseName, strlen(kBaseName));
+}
+
+int QuitHandler::handle(Request* request, MHD_Connection* connection,
+ const char* url, const char* method,
+ const char* upload_data, size_t* upload_data_size) {
+ exit(0);
+}
diff --git a/tools/skiaserve/urlhandlers/UrlHandler.h b/tools/skiaserve/urlhandlers/UrlHandler.h
index d767aaebd4..76547c5348 100644
--- a/tools/skiaserve/urlhandlers/UrlHandler.h
+++ b/tools/skiaserve/urlhandlers/UrlHandler.h
@@ -154,3 +154,12 @@ public:
const char* url, const char* method,
const char* upload_data, size_t* upload_data_size) override;
};
+
+class QuitHandler : public UrlHandler {
+public:
+ bool canHandle(const char* method, const char* url) override;
+ int handle(Request* request, MHD_Connection* connection,
+ const char* url, const char* method,
+ const char* upload_data, size_t* upload_data_size) override;
+};
+