 Chromium Code Reviews
 Chromium Code Reviews Issue 1686553006:
  skiaserve: Fix /cmd/N and /cmd/N[0|1], the response was never queued.  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master
    
  
    Issue 1686553006:
  skiaserve: Fix /cmd/N and /cmd/N[0|1], the response was never queued.  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master| Index: tools/skiaserve/skiaserve.cpp | 
| diff --git a/tools/skiaserve/skiaserve.cpp b/tools/skiaserve/skiaserve.cpp | 
| index e2e5450fbdfd066ba7d502d94a17347c396a0180..a55cd7e0313b89df025a6fc56d1ae3016fec41eb 100644 | 
| --- a/tools/skiaserve/skiaserve.cpp | 
| +++ b/tools/skiaserve/skiaserve.cpp | 
| @@ -143,6 +143,16 @@ static int process_upload_data(void* cls, enum MHD_ValueKind kind, | 
| return MHD_YES; | 
| } | 
| +// SendOK just sends an empty response with a 200 OK status code. | 
| +static int SendOK(MHD_Connection* connection) { | 
| + const char * data = ""; | 
| 
ethannicholas
2016/02/10 21:37:16
nit: space before '*'
 
jcgregorio
2016/02/10 21:42:19
Done.
 | 
| + | 
| + struct MHD_Response* response = MHD_create_response_from_buffer (strlen(data), (void*)data, MHD_RESPMEM_PERSISTENT); | 
| 
ethannicholas
2016/02/10 21:37:16
nit: space before '(', needs a line break
 
jcgregorio
2016/02/10 21:42:19
Done.
 | 
| + int ret = MHD_queue_response(connection, 200, response); | 
| + MHD_destroy_response(response); | 
| + return ret; | 
| +} | 
| + | 
| static int SendData(MHD_Connection* connection, const SkData* data, const char* type, | 
| bool setContentDisposition = false, const char* dispositionString = nullptr) { | 
| MHD_Response* response = MHD_create_response_from_buffer(data->size(), | 
| @@ -228,7 +238,7 @@ public: | 
| int n; | 
| sscanf(commands[1].c_str(), "%d", &n); | 
| request->fDebugCanvas->deleteDrawCommandAt(n); | 
| - return MHD_YES; | 
| + return SendOK(connection); | 
| } | 
| // /cmd/N/[0|1] | 
| @@ -237,7 +247,7 @@ public: | 
| sscanf(commands[1].c_str(), "%d", &n); | 
| sscanf(commands[2].c_str(), "%d", &toggle); | 
| request->fDebugCanvas->toggleCommand(n, toggle); | 
| - return MHD_YES; | 
| + return SendOK(connection); | 
| } | 
| return MHD_NO; |