From 7967a0cd45b9a1ff68903a39d97c630b37e478eb Mon Sep 17 00:00:00 2001 From: Marcelo Roberto Jimenez Date: Mon, 6 Aug 2007 05:11:07 +0000 Subject: [PATCH] Merge of patch submitted By Keith Brindley - brindlk SF Bug Tracker [ 1762758 ] Seek not working for large files. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@214 119443c7-1b9e-41f8-b6fc-b9c35fce742c --- ChangeLog | 16 ++++++++++++++++ THANKS | 1 + upnp/src/api/upnpapi.c | 2 +- upnp/src/genlib/net/http/webserver.c | 27 ++++++++++++++------------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5e9c00..f305189 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ Version 1.6.0 ******************************************************************************* +2007-08-06 Marcelo Jimenez + * Merge of patch submitted By Keith Brindley - brindlk + SF Bug Tracker [ 1762758 ] Seek not working for large files + Problem: + Requests from the uPnP client to seek to a position beyond 2GB in a large + file are handled as a request to see from the 2GB point. + + Impact: + Varies depending on client. The Xbox 360 kills the connection when it + realises. + + Solution: + GetNextRange function (webserver.c) is updated to handle large file sizes. + Fix should also recognise when built on a 32bit platform rather than 64 and + handle accordingly. + 2007-08-05 Marcelo Jimenez * Merge of Mac OS X patch from Stéphane Corthésy (davelopper), SF Bug Tracker [ 1686420 ] Modifications for MacOSX. diff --git a/THANKS b/THANKS index 9e2aa02..72559a5 100644 --- a/THANKS +++ b/THANKS @@ -20,6 +20,7 @@ exempt of errors. - Jiri Zouhar - John Dennis - Jonathan (no_dice) +- Keith Brindley - Leuk_He - Loigu - Luke Kim diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c index 489478a..c1f9822 100644 --- a/upnp/src/api/upnpapi.c +++ b/upnp/src/api/upnpapi.c @@ -953,7 +953,7 @@ GetDescDocumentAndURL( IN Upnp_DescType descriptionType, char *temp_str = NULL; FILE *fp = NULL; off_t fileLen; - unsigned num_read; + size_t num_read; time_t last_modified; struct stat file_info; struct sockaddr_in serverAddr; diff --git a/upnp/src/genlib/net/http/webserver.c b/upnp/src/genlib/net/http/webserver.c index 3551ab0..4d718ee 100644 --- a/upnp/src/genlib/net/http/webserver.c +++ b/upnp/src/genlib/net/http/webserver.c @@ -880,22 +880,24 @@ GetNextRange( char **SrcRangeStr, off_t *FirstByte, off_t *LastByte ) { - char *Ptr, - *Tok; - int i, - F = -1, - L = -1; + char *Ptr; + char *Tok; + int i; + int64_t F = -1; + int64_t L = -1; int Is_Suffix_byte_Range = 1; - if( *SrcRangeStr == NULL ) + if( *SrcRangeStr == NULL ) { return -1; + } Tok = StrTok( SrcRangeStr, "," ); - if( ( Ptr = strstr( Tok, "-" ) ) == NULL ) + if( ( Ptr = strstr( Tok, "-" ) ) == NULL ) { return -1; + } *Ptr = ' '; - sscanf( Tok, "%d%d", &F, &L ); + sscanf( Tok, "%"SCNd64"%"SCNd64, &F, &L ); if( F == -1 || L == -1 ) { *Ptr = '-'; @@ -910,16 +912,15 @@ GetNextRange( char **SrcRangeStr, } if( Is_Suffix_byte_Range ) { - *FirstByte = L; - *LastByte = F; + *FirstByte = (off_t)L; + *LastByte = (off_t)F; return 1; } } + *FirstByte = (off_t)F; + *LastByte = (off_t)L; - *FirstByte = F; - *LastByte = L; return 1; - } /************************************************************************