* Fix a couple bugs in client detection code.
* Fix incremental UPnPBrowse bug that was recently introduced.
This commit is contained in:
parent
b947187035
commit
0fa5f5b598
23
upnphttp.c
23
upnphttp.c
@ -100,7 +100,7 @@ SearchClientCache(struct in_addr addr)
|
|||||||
memset(&clients[i], 0, sizeof(struct client_cache_s));
|
memset(&clients[i], 0, sizeof(struct client_cache_s));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DPRINTF(E_DEBUG, L_HTTP, "Client [%d] found in cache.\n", clients[i].type);
|
DPRINTF(E_DEBUG, L_HTTP, "Client found in cache. [type %d/entry %d]\n", clients[i].type, i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,6 +205,9 @@ intervening space) by either an integer or the keyword "infinite". */
|
|||||||
}
|
}
|
||||||
else if(strncasecmp(line, "User-Agent", 10)==0)
|
else if(strncasecmp(line, "User-Agent", 10)==0)
|
||||||
{
|
{
|
||||||
|
/* Skip client detection if we already detected it. */
|
||||||
|
if( h->req_client )
|
||||||
|
continue;
|
||||||
p = colon + 1;
|
p = colon + 1;
|
||||||
while(isspace(*p))
|
while(isspace(*p))
|
||||||
p++;
|
p++;
|
||||||
@ -228,6 +231,17 @@ intervening space) by either an integer or the keyword "infinite". */
|
|||||||
h->reqflags |= FLAG_DLNA;
|
h->reqflags |= FLAG_DLNA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(strncasecmp(line, "X-AV-Client-Info", 16)==0)
|
||||||
|
{
|
||||||
|
p = colon + 1;
|
||||||
|
while(isspace(*p))
|
||||||
|
p++;
|
||||||
|
if(strstr(p, "PLAYSTATION 3"))
|
||||||
|
{
|
||||||
|
h->req_client = EPS3;
|
||||||
|
h->reqflags |= FLAG_DLNA;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(strncasecmp(line, "Transfer-Encoding", 17)==0)
|
else if(strncasecmp(line, "Transfer-Encoding", 17)==0)
|
||||||
{
|
{
|
||||||
p = colon + 1;
|
p = colon + 1;
|
||||||
@ -317,6 +331,13 @@ intervening space) by either an integer or the keyword "infinite". */
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( (n < EUnknownClient) && (h->req_client == EUnknownClient) )
|
||||||
|
{
|
||||||
|
/* If we know the client, but our new detection is generic, use our cached info */
|
||||||
|
h->reqflags |= clients[n].flags;
|
||||||
|
h->req_client = clients[n].type;
|
||||||
|
return;
|
||||||
|
}
|
||||||
clients[n].type = h->req_client;
|
clients[n].type = h->req_client;
|
||||||
clients[n].flags = h->reqflags & 0xFFF00000;
|
clients[n].flags = h->reqflags & 0xFFF00000;
|
||||||
clients[n].age = time(NULL);
|
clients[n].age = time(NULL);
|
||||||
|
10
upnpsoap.c
10
upnpsoap.c
@ -452,11 +452,14 @@ callback(void *args, int argc, char **argv, char **azColName)
|
|||||||
switch( passed_args->client )
|
switch( passed_args->client )
|
||||||
{
|
{
|
||||||
case EPS3:
|
case EPS3:
|
||||||
if( creator && (strcmp(mime, "video/x-msvideo") == 0) )
|
if( strcmp(mime, "video/x-msvideo") == 0 )
|
||||||
{
|
{
|
||||||
|
if( creator )
|
||||||
strcpy(mime+6, "divx");
|
strcpy(mime+6, "divx");
|
||||||
break;
|
else
|
||||||
|
strcpy(mime+6, "avi");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case EXbox:
|
case EXbox:
|
||||||
if( strcmp(mime, "video/x-msvideo") == 0 )
|
if( strcmp(mime, "video/x-msvideo") == 0 )
|
||||||
{
|
{
|
||||||
@ -751,7 +754,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
ObjectId, RequestedCount, StartingIndex,
|
ObjectId, RequestedCount, StartingIndex,
|
||||||
BrowseFlag, Filter, SortCriteria);
|
BrowseFlag, Filter, SortCriteria);
|
||||||
|
|
||||||
if( strcmp(BrowseFlag, "BrowseMetadata") == 0 )
|
if( BrowseFlag && (strcmp(BrowseFlag, "BrowseMetadata") == 0) )
|
||||||
{
|
{
|
||||||
args.requested = 1;
|
args.requested = 1;
|
||||||
sql = sqlite3_mprintf( SELECT_COLUMNS
|
sql = sqlite3_mprintf( SELECT_COLUMNS
|
||||||
@ -780,7 +783,6 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
ObjectId, orderBy, StartingIndex, RequestedCount);
|
ObjectId, orderBy, StartingIndex, RequestedCount);
|
||||||
DPRINTF(E_DEBUG, L_HTTP, "Browse SQL: %s\n", sql);
|
DPRINTF(E_DEBUG, L_HTTP, "Browse SQL: %s\n", sql);
|
||||||
ret = sqlite3_exec(db, sql, callback, (void *) &args, &zErrMsg);
|
ret = sqlite3_exec(db, sql, callback, (void *) &args, &zErrMsg);
|
||||||
totalMatches = args.returned;
|
|
||||||
}
|
}
|
||||||
sqlite3_free(sql);
|
sqlite3_free(sql);
|
||||||
if( ret != SQLITE_OK )
|
if( ret != SQLITE_OK )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user