* More changes to pass the UPnP Device Validator.

This commit is contained in:
Justin Maggard 2009-05-20 01:31:34 +00:00
parent c10c913b30
commit 31cfba1a21
3 changed files with 52 additions and 16 deletions

View File

@ -426,7 +426,9 @@ static const struct action X_MS_MediaReceiverRegistrarActions[] =
{
{"IsAuthorized", GetIsAuthorizedArgs}, /* R */
{"IsValidated", GetIsValidatedArgs}, /* R */
#if 0 // Not needed? WMP12 still works. Need to check with 360 and WMP11.
{"RegisterDevice", GetRegisterDeviceArgs}, /* R */
#endif
{0, 0}
};

View File

@ -160,14 +160,26 @@ ParseHttpHeaders(struct upnphttp * h)
}
else if(strncasecmp(line, "SID", 3)==0)
{
p = colon + 1;
while(isspace(*p))
p++;
n = 0;
while(!isspace(p[n]))
n++;
h->req_SID = p;
h->req_SIDLen = n;
//zqiu: fix bug for test 4.0.5
//Skip the extra header like "SIDHEADER: xxxxxx xxx"
for(p=line+3;p<colon;p++)
{
if(!isspace(*p))
{
p = NULL; //unexpected header
break;
}
}
if(p) {
p = colon + 1;
while(isspace(*p))
p++;
n = 0;
while(!isspace(p[n]))
n++;
h->req_SID = p;
h->req_SIDLen = n;
}
}
/* Timeout: Seconds-nnnn */
/* TIMEOUT
@ -892,12 +904,12 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode,
h->res_buflen += snprintf(h->res_buf + h->res_buflen,
h->res_buf_alloclen - h->res_buflen,
"Date: %s\r\n", szTime);
// h->res_buflen += snprintf(h->res_buf + h->res_buflen,
// h->res_buf_alloclen - h->res_buflen,
// "contentFeatures.dlna.org: \r\n");
// h->res_buflen += snprintf(h->res_buf + h->res_buflen,
// h->res_buf_alloclen - h->res_buflen,
// "EXT:\r\n");
h->res_buflen += snprintf(h->res_buf + h->res_buflen,
h->res_buf_alloclen - h->res_buflen,
"contentFeatures.dlna.org: \r\n");
h->res_buflen += snprintf(h->res_buf + h->res_buflen,
h->res_buf_alloclen - h->res_buflen,
"EXT:\r\n");
#endif
h->res_buf[h->res_buflen++] = '\r';
h->res_buf[h->res_buflen++] = '\n';

View File

@ -786,8 +786,23 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
char * BrowseFlag = GetValueFromNameValueList(&data, "BrowseFlag");
char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria");
char * orderBy = NULL;
if( !BrowseFlag || (strcmp(BrowseFlag, "BrowseDirectChildren") && strcmp(BrowseFlag, "BrowseMetadata")) )
{
SoapError(h, 402, "Invalid Args");
if( h->req_client == EXbox )
ObjectId = malloc(1);
goto browse_error;
}
if( !ObjectId )
ObjectId = GetValueFromNameValueList(&data, "ContainerID");
{
if( !(ObjectId = GetValueFromNameValueList(&data, "ContainerID")) )
{
SoapError(h, 701, "No such object error");
if( h->req_client == EXbox )
ObjectId = malloc(1);
goto browse_error;
}
}
memset(&args, 0, sizeof(args));
if( !RequestedCount )
@ -830,7 +845,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
ObjectId, RequestedCount, StartingIndex,
BrowseFlag, Filter, SortCriteria);
if( BrowseFlag && (strcmp(BrowseFlag, "BrowseMetadata") == 0) )
if( strcmp(BrowseFlag+6, "Metadata") == 0 )
{
args.requested = 1;
sql = sqlite3_mprintf( SELECT_COLUMNS
@ -941,6 +956,13 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
char * newSearchCriteria = NULL;
char * orderBy = NULL;
char groupBy[] = "group by DETAIL_ID";
if( !ContainerID )
{
SoapError(h, 701, "No such object error");
if( h->req_client == EXbox )
ContainerID = malloc(1);
goto search_error;
}
memset(&args, 0, sizeof(args));
if( !RequestedCount )