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.
(cherry picked from commit 2fcbe6df52)
This commit is contained in:
Fabrice Fontaine 2010-09-21 11:13:07 +02:00 committed by Marcelo Roberto Jimenez
parent 4a8c4f5c50
commit 82beb315c2
5 changed files with 55 additions and 6 deletions

View File

@ -221,6 +221,16 @@ Version 1.8.0
Version 1.6.7
*******************************************************************************
2010-09-21 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
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 <fabrice.fontaine(at)orange-ftgroup.com>
Customize the stack size of the threads used by pupnp through the new THREAD_STACK_SIZE variable

View File

@ -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
*

View File

@ -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 )

View File

@ -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 );

View File

@ -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
*