diff --git a/libupnp/upnp/src/api/upnpapi.c b/libupnp/upnp/src/api/upnpapi.c index 59f57eb..fa1ea8b 100644 --- a/libupnp/upnp/src/api/upnpapi.c +++ b/libupnp/upnp/src/api/upnpapi.c @@ -4213,33 +4213,6 @@ UpnpSetContentLength( IN UpnpClient_Handle Hnd, IN int contentLength /** Permissible content length */ ) -{ - return UpnpSetMaxContentLength (contentLength); -} - -/************************************************************************** - * Function: UpnpSetMaxContentLength - * - * Parameters: - * IN int contentLength: The maximum size to be set - * - * Description: - * Sets the maximum content-length that the SDK will process on an - * incoming SOAP requests or responses. This API allows devices that have - * memory constraints to exhibit consistent behaviour if the size of the - * incoming SOAP message exceeds the memory that device can allocate. - * The default maximum content-length is {\tt DEFAULT_SOAP_CONTENT_LENGTH} - * = 16K bytes. - * - * Return Values: int - * UPNP_E_SUCCESS: The operation completed successfully. - * - ***************************************************************************/ -int -UpnpSetMaxContentLength ( - IN size_t contentLength - /** Permissible content length, in bytes */ - ) { int errCode = UPNP_E_SUCCESS; struct Handle_Info *HInfo = NULL; @@ -4273,4 +4246,45 @@ UpnpSetMaxContentLength ( } + +/************************************************************************** + * Function: UpnpSetMaxContentLength + * + * Parameters: + * IN int contentLength: The maximum size to be set + * + * Description: + * Sets the maximum content-length that the SDK will process on an + * incoming SOAP requests or responses. This API allows devices that have + * memory constraints to exhibit consistent behaviour if the size of the + * incoming SOAP message exceeds the memory that device can allocate. + * The default maximum content-length is {\tt DEFAULT_SOAP_CONTENT_LENGTH} + * = 16K bytes. + * + * Return Values: int + * UPNP_E_SUCCESS: The operation completed successfully. + * + ***************************************************************************/ +int +UpnpSetMaxContentLength ( + IN size_t contentLength + /** Permissible content length, in bytes */ + ) +{ + int errCode = UPNP_E_SUCCESS; + + do { + if( UpnpSdkInit != 1 ) { + errCode = UPNP_E_FINISH; + break; + } + + g_maxContentLength = contentLength; + + } while( 0 ); + + return errCode; + +} + /*********************** END OF FILE upnpapi.c :) ************************/ diff --git a/libupnp/upnp/src/inc/upnpapi.h b/libupnp/upnp/src/inc/upnpapi.h index 74293ad..a1ef4e6 100644 --- a/libupnp/upnp/src/inc/upnpapi.h +++ b/libupnp/upnp/src/inc/upnpapi.h @@ -57,7 +57,7 @@ #define DEFAULT_SOAP_CONTENT_LENGTH 16000 #define MAX_SOAP_CONTENT_LENGTH 32000 -extern int g_maxContentLength; +extern size_t g_maxContentLength; // 30-second timeout #define UPNP_TIMEOUT 30