OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrCaps.h" | 8 #include "GrCaps.h" |
9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 static int SendTemplate(MHD_Connection* connection, bool redirect = false, | 157 static int SendTemplate(MHD_Connection* connection, bool redirect = false, |
158 const char* redirectUrl = nullptr) { | 158 const char* redirectUrl = nullptr) { |
159 SkString debuggerTemplate = generateTemplate(SkString("http://debugger.skia.
org")); | 159 SkString debuggerTemplate = generateTemplate(SkString("http://debugger.skia.
org")); |
160 | 160 |
161 MHD_Response* response = MHD_create_response_from_buffer( | 161 MHD_Response* response = MHD_create_response_from_buffer( |
162 debuggerTemplate.size(), | 162 debuggerTemplate.size(), |
163 (void*) const_cast<char*>(debuggerTemplate.c_str()), | 163 (void*) const_cast<char*>(debuggerTemplate.c_str()), |
164 MHD_RESPMEM_MUST_COPY); | 164 MHD_RESPMEM_MUST_COPY); |
165 | 165 |
| 166 int status = MHD_HTTP_OK; |
| 167 |
166 if (redirect) { | 168 if (redirect) { |
167 MHD_add_response_header (response, "Location", redirectUrl); | 169 MHD_add_response_header (response, "Location", redirectUrl); |
| 170 status = MHD_HTTP_SEE_OTHER; |
168 } | 171 } |
169 | 172 |
170 | 173 int ret = MHD_queue_response(connection, status, response); |
171 int ret = MHD_queue_response(connection, MHD_HTTP_OK, response); | |
172 MHD_destroy_response(response); | 174 MHD_destroy_response(response); |
173 return ret; | 175 return ret; |
174 } | 176 } |
175 | 177 |
176 typedef int (*UrlHandler)(Request* request, MHD_Connection* connection, | 178 typedef int (*UrlHandler)(Request* request, MHD_Connection* connection, |
177 const char* upload_data, size_t* upload_data_size); | 179 const char* upload_data, size_t* upload_data_size); |
178 | 180 |
179 int rootHandler(Request* request, MHD_Connection* connection, | 181 int rootHandler(Request* request, MHD_Connection* connection, |
180 const char* upload_data, size_t* upload_data_size) { | 182 const char* upload_data, size_t* upload_data_size) { |
181 return SendTemplate(connection); | 183 return SendTemplate(connection); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 MHD_stop_daemon(daemon); | 298 MHD_stop_daemon(daemon); |
297 return 0; | 299 return 0; |
298 } | 300 } |
299 | 301 |
300 #if !defined SK_BUILD_FOR_IOS | 302 #if !defined SK_BUILD_FOR_IOS |
301 int main(int argc, char** argv) { | 303 int main(int argc, char** argv) { |
302 SkCommandLineFlags::Parse(argc, argv); | 304 SkCommandLineFlags::Parse(argc, argv); |
303 return skiaserve_main(); | 305 return skiaserve_main(); |
304 } | 306 } |
305 #endif | 307 #endif |
OLD | NEW |