pnoltes commented on code in PR #851:
URL: https://github.com/apache/celix/pull/851#discussion_r4503619976
##########
bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c:
##########
@@ -518,63 +529,100 @@ static int remoteServiceAdmin_callback(struct
mg_connection *conn) {
if (export != NULL) {
exportRegistration_increaseUsage(export);
} else {
- result = 0;
RSA_LOG_WARNING(rsa, "No export registration found for service
id %lu", serviceId);
+ return 0;
}
- celixThreadRwlock_unlock(&rsa->exportedServicesLock);
}
+ } else {
+ //no rsa call, let civetweb handle.
+ return 0;
+ }
+ assert(export != NULL);
+ long long contentLength = request_info->content_length; //-1 if no content
length was provided
+ size_t maxRequestBodySize = rsa->maxRequestBodySize;
+ size_t readLen = 0;
- if (export != NULL) {
- uint64_t datalength = request_info->content_length;
- char* data = malloc(datalength + 1);
- mg_read(conn, data, datalength);
- data[datalength] = '\0';
-
- char *response = NULL;
- int responceLength = 0;
- int rc = exportRegistration_call(export, data, -1, &metadata,
&response, &responceLength);
- if (rc != CELIX_SUCCESS) {
- RSA_LOG_ERROR(rsa, "Error trying to invoke remove service, got
error %i\n", rc);
- }
+ if (contentLength > 0 && (unsigned long long)contentLength >
maxRequestBodySize) {
Review Comment:
added a check and log message for this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]