Browse Source

HPCC-25894 Report 413 Request Entity Too Large in ESP

Current ESP shows the 400 error when the length of a request is
larger than the predefined limit.

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 4 years ago
parent
commit
93924047a4

+ 1 - 1
esp/bindings/http/platform/httptransport.cpp

@@ -1996,7 +1996,7 @@ int CHttpRequest::processHeaders(IMultiException *me)
     if(m_content_length > 0 && m_MaxRequestEntityLength > 0 && m_content_length > m_MaxRequestEntityLength && (!isUpload(false)))
     {
         UERRLOG("Bad request: Content-Length exceeded maxRequestEntityLength");
-        throw createEspHttpException(HTTP_STATUS_BAD_REQUEST_CODE, "The request length was too long.", HTTP_STATUS_BAD_REQUEST);
+        throw createEspHttpException(HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE_CODE, "The request length was too long.", HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE);
     }
     setPersistentEligible(checkPersistentEligible());
 

+ 1 - 0
esp/bindings/http/platform/httptransport.hpp

@@ -39,6 +39,7 @@
 #define HTTP_STATUS_FORBIDDEN               "403 Forbidden"
 #define HTTP_STATUS_NOT_FOUND               "404 Not Found"
 #define HTTP_STATUS_NOT_ALLOWED             "405 Method Not Allowed"
+#define HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE   "413 Request Entity Too Large"
 #define HTTP_STATUS_INTERNAL_SERVER_ERROR   "500 Internal Server Error"
 #define HTTP_STATUS_NOT_IMPLEMENTED         "501 Not Implemented"