diff --git a/ChangeLog b/ChangeLog index e67d166..2eae386 100644 --- a/ChangeLog +++ b/ChangeLog @@ -221,6 +221,16 @@ Version 1.8.0 Version 1.6.7 ******************************************************************************* +2010-09-21 Fabrice Fontaine + + Addition of WEB_SERVER_CONTENT_LANGUAGE parameter + + This patch adds the WEB_SERVER_CONTENT_LANGUAGE parameter so the user can specify + the language used by the device during Description and Presentation steps of UPnP + through the HTTP CONTENT-LANGUAGE header. + By default, the WEB_SERVER_CONTENT_LANGUAGE is an empty string so no + CONTENT-LANGUAGE is added. + 2010-09-18 Fabrice Fontaine Customize the stack size of the threads used by pupnp through the new THREAD_STACK_SIZE variable diff --git a/build/inc/config.h b/build/inc/config.h index 794a463..920f3ff 100644 --- a/build/inc/config.h +++ b/build/inc/config.h @@ -192,6 +192,20 @@ #define WEB_SERVER_BUF_SIZE (1024*1024) /* @} */ +/*! + * \name WEB_SERVER_CONTENT_LANGUAGE + * + * This configuration parameter sets the value of the Content-Language + * header for the webserver. Thanks to this parameter, the use can advertize + * the language used by the device in the description (friendlyName) and + * presentation steps of UPnP. The default value is empty string so no + * Content-Language header is added. + * + * @{ + */ +#define WEB_SERVER_CONTENT_LANGUAGE "" +/* @} */ + /*! * \name AUTO_RENEW_TIME * diff --git a/upnp/src/genlib/net/http/httpreadwrite.c b/upnp/src/genlib/net/http/httpreadwrite.c index b31bf55..3b02fc8 100644 --- a/upnp/src/genlib/net/http/httpreadwrite.c +++ b/upnp/src/genlib/net/http/httpreadwrite.c @@ -1908,6 +1908,8 @@ http_SendStatusResponse( IN SOCKINFO * info, * 'G': arg = range information // add range header * 'h': arg = off_t number // appends off_t number * 'K': (no args) // add chunky header + * 'L': (no args) appends HTTP Content-Language: header if + * WEB_SERVER_CONTENT_LANGUAGE is not empty * 'N': arg1 = off_t content_length // content-length header * 'q': arg1 = http_method_t // request start line and HOST header * arg2 = (uri_type *) @@ -2051,6 +2053,15 @@ http_MakeMessage( INOUT membuffer * buf, if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) { goto error_handler; } + } else if ( c == 'L' ) { + // Add CONTENT-LANGUAGE header only if WEB_SERVER_CONTENT_LANGUAGE + // is not empty + if (strcmp( WEB_SERVER_CONTENT_LANGUAGE, "" ) && http_MakeMessage( + buf, http_major_version, http_minor_version, + "ssc", + "CONTENT-LANGUAGE: ", WEB_SERVER_CONTENT_LANGUAGE ) != 0 ) { + goto error_handler; + } } else if( c == 'C' ) { if( ( http_major_version > 1 ) || ( http_major_version == 1 && http_minor_version == 1 ) diff --git a/upnp/src/genlib/net/http/webserver.c b/upnp/src/genlib/net/http/webserver.c index 7b3d734..ec0ef41 100644 --- a/upnp/src/genlib/net/http/webserver.c +++ b/upnp/src/genlib/net/http/webserver.c @@ -1400,7 +1400,7 @@ process_request( IN http_message_t * req, // Transfer-Encoding: chunked if (http_MakeMessage( headers, resp_major, resp_minor, - "R" "T" "GKD" "s" "tcS" "Xc" "sCc", + "R" "T" "GKLD" "s" "tcS" "Xc" "sCc", HTTP_PARTIAL_CONTENT, // status code UpnpFileInfo_get_ContentType(finfo), // content type RespInstr, // range info @@ -1415,7 +1415,7 @@ process_request( IN http_message_t * req, // Transfer-Encoding: chunked if (http_MakeMessage( headers, resp_major, resp_minor, - "R" "N" "T" "GD" "s" "tcS" "Xc" "sCc", + "R" "N" "T" "GLD" "s" "tcS" "Xc" "sCc", HTTP_PARTIAL_CONTENT, // status code RespInstr->ReadSendSize, // content length UpnpFileInfo_get_ContentType(finfo), // content type @@ -1432,7 +1432,7 @@ process_request( IN http_message_t * req, // Transfer-Encoding: chunked if (http_MakeMessage( headers, resp_major, resp_minor, - "RK" "TD" "s" "tcS" "Xc" "sCc", + "RK" "TLD" "s" "tcS" "Xc" "sCc", HTTP_OK, // status code UpnpFileInfo_get_ContentType(finfo), // content type "LAST-MODIFIED: ", @@ -1448,7 +1448,7 @@ process_request( IN http_message_t * req, // Transfer-Encoding: chunked if (http_MakeMessage( headers, resp_major, resp_minor, - "R" "N" "TD" "s" "tcS" "Xc" "sCc", + "R" "N" "TLD" "s" "tcS" "Xc" "sCc", HTTP_OK, // status code RespInstr->ReadSendSize, // content length UpnpFileInfo_get_ContentType(finfo), // content type @@ -1463,7 +1463,7 @@ process_request( IN http_message_t * req, // Transfer-Encoding: chunked if (http_MakeMessage( headers, resp_major, resp_minor, - "R" "TD" "s" "tcS" "b" "Xc" "sCc", + "R" "TLD" "s" "tcS" "b" "Xc" "sCc", HTTP_OK, // status code UpnpFileInfo_get_ContentType(finfo), // content type "LAST-MODIFIED: ", @@ -1753,7 +1753,7 @@ web_server_callback( IN http_parser_t * parser, http_MakeMessage( &headers, 1, 1, - "RTDSXcCc", + "RLTDSXcCc", ret, "text/html", X_USER_AGENT ); diff --git a/upnp/src/inc/config.h b/upnp/src/inc/config.h index 794a463..920f3ff 100644 --- a/upnp/src/inc/config.h +++ b/upnp/src/inc/config.h @@ -192,6 +192,20 @@ #define WEB_SERVER_BUF_SIZE (1024*1024) /* @} */ +/*! + * \name WEB_SERVER_CONTENT_LANGUAGE + * + * This configuration parameter sets the value of the Content-Language + * header for the webserver. Thanks to this parameter, the use can advertize + * the language used by the device in the description (friendlyName) and + * presentation steps of UPnP. The default value is empty string so no + * Content-Language header is added. + * + * @{ + */ +#define WEB_SERVER_CONTENT_LANGUAGE "" +/* @} */ + /*! * \name AUTO_RENEW_TIME *