Source release v2.2.0-0-903 + third_party libs

Change-Id: I03f670eaeb052bc741abb347be06f8ddc58418e7
This commit is contained in:
Joey Parrish
2014-12-15 10:35:08 -08:00
parent 5318232d46
commit 1955c9c2c9
85 changed files with 5594 additions and 2830 deletions

View File

@@ -9,13 +9,13 @@ static const std::string kTwoBlankLines("\r\n\r\n");
size_t LicenseRequest::FindHeaderEndPosition(
const std::string& response) const {
return(response.find(kTwoBlankLines));
return response.find(kTwoBlankLines);
}
// This routine parses the license server's response message and
// extracts the drm message from the response header.
void LicenseRequest::GetDrmMessage(const std::string& response,
std::string& drm_msg) {
std::string& drm_msg) {
if (response.empty()) {
drm_msg.clear();
return;
@@ -27,23 +27,25 @@ void LicenseRequest::GetDrmMessage(const std::string& response,
// the drm message length as below instead of using Content-Length
size_t header_end_pos = FindHeaderEndPosition(response);
if (header_end_pos != std::string::npos) {
header_end_pos += kTwoBlankLines.size(); // points to response body
header_end_pos += kTwoBlankLines.size(); // points to response body
drm_msg.clear();
size_t drm_msg_pos = response.find(kTwoBlankLines, header_end_pos);
if (drm_msg_pos != std::string::npos) {
drm_msg_pos += kTwoBlankLines.size(); // points to drm message
} else {
// For backward compatibility, no blank line after error code
drm_msg_pos = response.find("\r\n", header_end_pos);
// Messages from Google Play server add a GLS wrapper. These start
// with "GLS/1.0 <status>".
if (response.find("GLS/1.", header_end_pos) == header_end_pos) {
// For GLS messages, we should skip past the next blank line, and use
// what's left of the message.
size_t drm_msg_pos = response.find(kTwoBlankLines, header_end_pos);
if (drm_msg_pos != std::string::npos) {
drm_msg_pos += 2; // points to drm message
drm_msg_pos += kTwoBlankLines.size(); // points to drm message
drm_msg = response.substr(drm_msg_pos);
} else {
LOGE("Message had GLS marker, but did not have extra blank line.");
drm_msg = response.substr(header_end_pos);
}
}
if (drm_msg_pos != std::string::npos) {
drm_msg = response.substr(drm_msg_pos);
} else {
// For servers that do not use the GLS wrapper, we should just strip of
// the headers, and use the rest of the message.
drm_msg = response.substr(header_end_pos);
}
} else {
@@ -62,11 +64,10 @@ void LicenseRequest::GetHeartbeatUrl(const std::string& response,
size_t header_end_pos = FindHeaderEndPosition(response);
if (header_end_pos != std::string::npos) {
header_end_pos += kTwoBlankLines.size(); // points to response body
header_end_pos += kTwoBlankLines.size(); // points to response body
heartbeat_url.clear();
size_t heartbeat_url_pos = response.find("Heartbeat-Url: ",
header_end_pos);
size_t heartbeat_url_pos = response.find("Heartbeat-Url: ", header_end_pos);
if (heartbeat_url_pos != std::string::npos) {
heartbeat_url_pos += sizeof("Heartbeat-Url: ");
heartbeat_url.assign(response.substr(heartbeat_url_pos));
@@ -78,4 +79,4 @@ void LicenseRequest::GetHeartbeatUrl(const std::string& response,
}
}
} // namespace wvcdm
} // namespace wvcdm