Reverting Peter Hartley's last patch.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@303 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
c28942f6fe
commit
5bc8cae4ea
31
ChangeLog
31
ChangeLog
@ -2,37 +2,6 @@
|
|||||||
Version 1.6.4
|
Version 1.6.4
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
2008-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Peter Hartley's patch for "extra-headers". In his words:
|
|
||||||
Hi there,
|
|
||||||
|
|
||||||
The attached patch adds an "extra_headers" field to the libupnp web
|
|
||||||
server's File_Info structure, allowing VirtualDirCallbacks to, if they
|
|
||||||
choose, specify extra HTTP headers to be sent back in the response. The
|
|
||||||
string lifetime strategy is the same as that of the content_type field
|
|
||||||
in the same structure: caller does ixmlCloneDOMString, callee does
|
|
||||||
ixmlFreeDOMString.
|
|
||||||
|
|
||||||
Again this is aimed at supporting Rio Receiver service as well as UPnP
|
|
||||||
service in the same web server. The Receiver firmware has an unfortunate
|
|
||||||
bug whereby it does a case-sensitive comparison looking for a
|
|
||||||
"Content-Length" header. As libupnp sends "CONTENT-LENGTH", it doesn't
|
|
||||||
work out of the box. So I thought about changing libupnp to send the
|
|
||||||
version Receivers expect, but it's a bit inelegant IMO to change
|
|
||||||
specifics of a general-purpose library for the benefit of one client --
|
|
||||||
plus, it might break existing clients of libupnp. Instead, I suggest
|
|
||||||
this patch, which lets the Receiver server (only) choose to send an
|
|
||||||
additional "Content-Length" header. Other clients/servers are not
|
|
||||||
impacted, and indeed other users of libupnp might even find the facility
|
|
||||||
useful for their own purposes.
|
|
||||||
|
|
||||||
As the extra_headers field is added at the end of the File_Info
|
|
||||||
structure, and as (at least in the normal course of events) File_Info
|
|
||||||
structures are never allocated except by libupnp itself, this hopefully
|
|
||||||
doesn't count as an ABI or API change.
|
|
||||||
|
|
||||||
Peter
|
|
||||||
|
|
||||||
2008-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2008-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Workaround for a problem with the new automake AM_CONDITIONAL macro
|
* Workaround for a problem with the new automake AM_CONDITIONAL macro
|
||||||
from autotools-1.10. Thanks to Ingo Hofmann for helping with debugging
|
from autotools-1.10. Thanks to Ingo Hofmann for helping with debugging
|
||||||
|
10
configure.ac
10
configure.ac
@ -110,20 +110,14 @@ dnl ############################################################################
|
|||||||
dnl # Release 1.6.4:
|
dnl # Release 1.6.4:
|
||||||
dnl # "current:revision:age"
|
dnl # "current:revision:age"
|
||||||
dnl #
|
dnl #
|
||||||
dnl # - Code has changed in upnp
|
|
||||||
dnl # revision: 2 -> 3
|
|
||||||
dnl # - Interface changed in upnp
|
|
||||||
dnl # current: 3 -> 4
|
|
||||||
dnl # revision: 3 -> 0
|
|
||||||
dnl #
|
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
dnl #
|
dnl #
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
||||||
AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||||
dnl # - library code modified: revision++
|
dnl # - library code modified: revision++
|
||||||
|
@ -930,13 +930,9 @@ struct File_Info
|
|||||||
/** The content type of the file. This string needs to be allocated
|
/** The content type of the file. This string needs to be allocated
|
||||||
* by the caller using {\bf ixmlCloneDOMString}. When finished
|
* by the caller using {\bf ixmlCloneDOMString}. When finished
|
||||||
* with it, the SDK frees the {\bf DOMString}. */
|
* with it, the SDK frees the {\bf DOMString}. */
|
||||||
|
|
||||||
DOMString content_type;
|
DOMString content_type;
|
||||||
|
|
||||||
/** Additional HTTP headers to return. This string needs to be allocated
|
|
||||||
* by the caller using {\bf ixmlCloneDOMString}. When finished
|
|
||||||
* with it, the SDK frees the {\bf DOMString}. Each header line should be
|
|
||||||
* followed by "\r\n". */
|
|
||||||
DOMString extra_headers;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The type of handle returned by the web server for open requests. */
|
/* The type of handle returned by the web server for open requests. */
|
||||||
|
@ -1221,7 +1221,6 @@ process_request( IN http_message_t * req,
|
|||||||
// init
|
// init
|
||||||
request_doc = NULL;
|
request_doc = NULL;
|
||||||
finfo.content_type = NULL;
|
finfo.content_type = NULL;
|
||||||
finfo.extra_headers = NULL;
|
|
||||||
alias_grabbed = FALSE;
|
alias_grabbed = FALSE;
|
||||||
err_code = HTTP_INTERNAL_SERVER_ERROR; // default error
|
err_code = HTTP_INTERNAL_SERVER_ERROR; // default error
|
||||||
using_virtual_dir = FALSE;
|
using_virtual_dir = FALSE;
|
||||||
@ -1388,22 +1387,18 @@ process_request( IN http_message_t * req,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *extra_headers = finfo.extra_headers ? finfo.extra_headers
|
|
||||||
: "";
|
|
||||||
|
|
||||||
if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) {
|
if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) {
|
||||||
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "T" "GKD" "s" "tcS" "Xc" "sCc",
|
"R" "T" "GKD" "s" "tcS" "XcCc",
|
||||||
HTTP_PARTIAL_CONTENT, // status code
|
HTTP_PARTIAL_CONTENT, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
RespInstr, // range info
|
RespInstr, // range info
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
} else if( RespInstr->IsRangeActive && !RespInstr->IsChunkActive ) {
|
} else if( RespInstr->IsRangeActive && !RespInstr->IsChunkActive ) {
|
||||||
@ -1412,15 +1407,14 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "N" "T" "GD" "s" "tcS" "Xc" "sCc",
|
"R" "N" "T" "GD" "s" "tcS" "XcCc",
|
||||||
HTTP_PARTIAL_CONTENT, // status code
|
HTTP_PARTIAL_CONTENT, // status code
|
||||||
RespInstr->ReadSendSize, // content length
|
RespInstr->ReadSendSize, // content length
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
RespInstr, // range info
|
RespInstr, // range info
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1429,13 +1423,12 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"RK" "TD" "s" "tcS" "Xc" "sCc",
|
"RK" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1445,14 +1438,13 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "N" "TD" "s" "tcS" "Xc" "sCc",
|
"R" "N" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
RespInstr->ReadSendSize, // content length
|
RespInstr->ReadSendSize, // content length
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1460,13 +1452,12 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "TD" "s" "tcS" "b" "Xc" "sCc",
|
"R" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1495,7 +1486,6 @@ process_request( IN http_message_t * req,
|
|||||||
error_handler:
|
error_handler:
|
||||||
free( request_doc );
|
free( request_doc );
|
||||||
ixmlFreeDOMString( finfo.content_type );
|
ixmlFreeDOMString( finfo.content_type );
|
||||||
ixmlFreeDOMString( finfo.extra_headers );
|
|
||||||
if( err_code != UPNP_E_SUCCESS && alias_grabbed ) {
|
if( err_code != UPNP_E_SUCCESS && alias_grabbed ) {
|
||||||
alias_release( alias );
|
alias_release( alias );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user