celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1639058 - /celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Date Wed, 12 Nov 2014 21:22:00 GMT
Author: abroekhuis
Date: Wed Nov 12 21:22:00 2014
New Revision: 1639058

URL: http://svn.apache.org/r1639058
Log:
CELIX-181: Added HTTP 204 reply when no data is returned.

Modified:
    celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c

Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c?rev=1639058&r1=1639057&r2=1639058&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Wed Nov 12 21:22:00 2014
@@ -66,12 +66,15 @@ struct get {
     int size;
 };
 
-static const char *response_headers =
+static const char *data_response_headers =
   "HTTP/1.1 200 OK\r\n"
   "Cache: no-cache\r\n"
   "Content-Type: application/json\r\n"
   "\r\n";
 
+static const char *no_content_response_headers =
+  "HTTP/1.1 204 OK\r\n";
+
 // TODO do we need to specify a non-Amdatu specific configuration type?!
 static const char * const CONFIGURATION_TYPE = "org.amdatu.remote.admin.http";
 static const char * const ENDPOINT_URL = "org.amdatu.remote.admin.http.url";
@@ -252,12 +255,14 @@ static int remoteServiceAdmin_callback(s
 						export->endpoint->handleRequest(export->endpoint->endpoint, data, &response);
 
 						if (response != NULL) {
-							mg_write(conn, response_headers, strlen(response_headers));
+						    mg_write(conn, data_response_headers, strlen(data_response_headers));
 							mg_write(conn, response, strlen(response));
 
-							result = 1;
 							free(response);
+						} else {
+						    mg_write(conn, no_content_response_headers, strlen(no_content_response_headers));
 						}
+                        result = 1;
 
 						free(data);
 					}



Mime
View raw message