* 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 */ {"IsAuthorized", GetIsAuthorizedArgs}, /* R */
{"IsValidated", GetIsValidatedArgs}, /* R */ {"IsValidated", GetIsValidatedArgs}, /* R */
#if 0 // Not needed? WMP12 still works. Need to check with 360 and WMP11.
{"RegisterDevice", GetRegisterDeviceArgs}, /* R */ {"RegisterDevice", GetRegisterDeviceArgs}, /* R */
#endif
{0, 0} {0, 0}
}; };

View File

@ -160,6 +160,17 @@ ParseHttpHeaders(struct upnphttp * h)
} }
else if(strncasecmp(line, "SID", 3)==0) else if(strncasecmp(line, "SID", 3)==0)
{ {
//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; p = colon + 1;
while(isspace(*p)) while(isspace(*p))
p++; p++;
@ -169,6 +180,7 @@ ParseHttpHeaders(struct upnphttp * h)
h->req_SID = p; h->req_SID = p;
h->req_SIDLen = n; h->req_SIDLen = n;
} }
}
/* Timeout: Seconds-nnnn */ /* Timeout: Seconds-nnnn */
/* TIMEOUT /* TIMEOUT
Recommended. Requested duration until subscription expires, Recommended. Requested duration until subscription expires,
@ -892,12 +904,12 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode,
h->res_buflen += snprintf(h->res_buf + h->res_buflen, h->res_buflen += snprintf(h->res_buf + h->res_buflen,
h->res_buf_alloclen - h->res_buflen, h->res_buf_alloclen - h->res_buflen,
"Date: %s\r\n", szTime); "Date: %s\r\n", szTime);
// h->res_buflen += snprintf(h->res_buf + h->res_buflen, h->res_buflen += snprintf(h->res_buf + h->res_buflen,
// h->res_buf_alloclen - h->res_buflen, h->res_buf_alloclen - h->res_buflen,
// "contentFeatures.dlna.org: \r\n"); "contentFeatures.dlna.org: \r\n");
// h->res_buflen += snprintf(h->res_buf + h->res_buflen, h->res_buflen += snprintf(h->res_buf + h->res_buflen,
// h->res_buf_alloclen - h->res_buflen, h->res_buf_alloclen - h->res_buflen,
// "EXT:\r\n"); "EXT:\r\n");
#endif #endif
h->res_buf[h->res_buflen++] = '\r'; h->res_buf[h->res_buflen++] = '\r';
h->res_buf[h->res_buflen++] = '\n'; 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 * BrowseFlag = GetValueFromNameValueList(&data, "BrowseFlag");
char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria"); char * SortCriteria = GetValueFromNameValueList(&data, "SortCriteria");
char * orderBy = NULL; 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 ) 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)); memset(&args, 0, sizeof(args));
if( !RequestedCount ) if( !RequestedCount )
@ -830,7 +845,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
ObjectId, RequestedCount, StartingIndex, ObjectId, RequestedCount, StartingIndex,
BrowseFlag, Filter, SortCriteria); BrowseFlag, Filter, SortCriteria);
if( BrowseFlag && (strcmp(BrowseFlag, "BrowseMetadata") == 0) ) if( strcmp(BrowseFlag+6, "Metadata") == 0 )
{ {
args.requested = 1; args.requested = 1;
sql = sqlite3_mprintf( SELECT_COLUMNS sql = sqlite3_mprintf( SELECT_COLUMNS
@ -941,6 +956,13 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
char * newSearchCriteria = NULL; char * newSearchCriteria = NULL;
char * orderBy = NULL; char * orderBy = NULL;
char groupBy[] = "group by DETAIL_ID"; 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)); memset(&args, 0, sizeof(args));
if( !RequestedCount ) if( !RequestedCount )