[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-filesystem-cvs
Subject: [Filesystem-cvs] http httpfsys.cpp,1.180,1.180.2.1
From: yijil () helixcommunity ! org
Date: 2012-07-10 9:27:31
[Download RAW message or body]
Update of /cvsroot/filesystem/http
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv6383
Modified Files:
Tag: SERVER_15_0
httpfsys.cpp
Log Message:
Merge code of version 1.179 and 1.180 in HEAD
Update SERVER_15_0_RN
Index: httpfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v
retrieving revision 1.180
retrieving revision 1.180.2.1
diff -u -d -r1.180 -r1.180.2.1
--- httpfsys.cpp 26 Jun 2012 16:06:06 -0000 1.180
+++ httpfsys.cpp 10 Jul 2012 09:27:28 -0000 1.180.2.1
@@ -1167,6 +1167,9 @@
, m_bDiscardOrphanLFInChunkedData(FALSE)
, m_bShoutcastSupportOnly(FALSE)
, m_bReuseResolver(FALSE)
+#ifdef HELIX_FEATURE_SERVER_DRM_VCAS
+ , m_bUserDrmVCAS(FALSE)
+#endif
, m_bNoNeedLock(FALSE)
, m_nHTTPMethod(0)
/*************************/
@@ -3040,10 +3043,9 @@
{
HX_UNLOCK(m_pMutex);
}
+ HX_RESULT ReadErr = _DoSomeReadingFromSocket(TRUE);
- HX_RESULT ReadErr = HXR_OK;
- ReadErr = _DoSomeReadingFromSocket(TRUE);
- if(HXR_OK == ReadErr)
+ if(!ReadErr)
{
ReadErr = ProcessPendingReads();
}
@@ -3051,8 +3053,11 @@
{
HX_LOCK(m_pMutex);
}
-
+#ifdef HELIX_FEATURE_SERVER
if(!theErr && HXR_SOCK_WOULDBLOCK != ReadErr)
+#else
+ if(!theErr)
+#endif
{
theErr = ReadErr;
}
@@ -3540,6 +3545,18 @@
HXLOGL3(HXLOG_HTTP, "BeginGet: Cookie: %s", (const \
char*)pCookieFromRqHdr->GetBuffer()); }
HX_RELEASE(pCookieFromRqHdr);
+
+#ifdef HELIX_FEATURE_SERVER_DRM_VCAS
+ IHXBuffer* pVcasFromRqHdr = NULL;
+ retCode = pHeaders->GetPropertyCString("DRM-REQUEST", pVcasFromRqHdr);
+ if( pVcasFromRqHdr )
+ {
+ m_bUserDrmVCAS = TRUE;
+ m_bNoNeedLock = TRUE;
+ HXLOGL3(HXLOG_HTTP, "BeginGet: DRM-REQUEST: %s", (const \
char*)pVcasFromRqHdr->GetBuffer()); + }
+ HX_RELEASE(pVcasFromRqHdr);
+#endif
IHXBuffer* pUserAgentFromRqHdr = NULL;
retCode = pHeaders->GetPropertyCString("User-Agent", \
pUserAgentFromRqHdr); @@ -3832,129 +3849,134 @@
m_strRequest += " HTTP/1.1\r\nAccept: */*";
}
- m_strRequest += szUserAgent;
- GetUserAgent(pUserAgent);
- m_strRequest += (const char*)pUserAgent->GetBuffer();
- HX_RELEASE(pUserAgent);
+#ifdef HELIX_FEATURE_SERVER_DRM_VCAS
+ if(!m_bUserDrmVCAS)
+#endif
+ {
+ m_strRequest += szUserAgent;
+ GetUserAgent(pUserAgent);
+ m_strRequest += (const char*)pUserAgent->GetBuffer();
+ HX_RELEASE(pUserAgent);
- m_strRequest += "\r\nIcy-MetaData: 1";
+ m_strRequest += "\r\nIcy-MetaData: 1";
- m_strRequest += (pOutBuffer ? pOutBuffer : "");
- m_strRequest += szKeepAlive;
+ m_strRequest += (pOutBuffer ? pOutBuffer : "");
+ m_strRequest += szKeepAlive;
- if(!m_strHost.IsEmpty())
- {
- m_strRequest += szHostHeader;
- // Use actual host, even when going through proxy..
- m_strRequest += m_strHost;
- if(m_nPort != 80)
+ if(!m_strHost.IsEmpty())
{
- m_strRequest += ":";
- m_strRequest.AppendULONG(m_nPort);
+ m_strRequest += szHostHeader;
+ // Use actual host, even when going through proxy..
+ m_strRequest += m_strHost;
+ if(m_nPort != 80)
+ {
+ m_strRequest += ":";
+ m_strRequest.AppendULONG(m_nPort);
+ }
}
- }
- if (m_pLanguage)
- {
- m_strRequest += szAcceptLang;
- m_strRequest += m_pLanguage->GetBuffer();
- }
+ if (m_pLanguage)
+ {
+ m_strRequest += szAcceptLang;
+ m_strRequest += m_pLanguage->GetBuffer();
+ }
- // Tell the server that we support encoded content
+ // Tell the server that we support encoded content
#if defined(HELIX_FEATURE_HTTP_GZIP)
- m_strRequest += szAcceptEncoding;
+ m_strRequest += szAcceptEncoding;
#endif
- if (m_bByteRangeSeekPending)
- {
- HX_ASSERT(m_bSupportsByteRanges);
-
- m_strRequest += "\r\nRange:bytes=";
- m_strRequest.AppendUINT64(ulOffsetStart);
- m_strRequest += "-";
+ if (m_bByteRangeSeekPending)
+ {
+ HX_ASSERT(m_bSupportsByteRanges);
- // XXXbobclark when we get smarter we can remember
- // the end of the range we're getting, and simply
- // do m_strRequest.AppendULONG(ulOffsetEnd); but
- // for now it'll just be starting at ulOffsetStart
- // and reading until it hits the end.
- }
+ m_strRequest += "\r\nRange:bytes=";
+ m_strRequest.AppendUINT64(ulOffsetStart);
+ m_strRequest += "-";
- retVal = m_pContext->QueryInterface(IID_IHXRegistry, (void**)&pRegistry);
- if (SUCCEEDED(retVal))
- {
- IHXBuffer* pBuffer = NULL;
+ // XXXbobclark when we get smarter we can remember
+ // the end of the range we're getting, and simply
+ // do m_strRequest.AppendULONG(ulOffsetEnd); but
+ // for now it'll just be starting at ulOffsetStart
+ // and reading until it hits the end.
+ }
- CHXString key("no-authentication-information");
+ retVal = m_pContext->QueryInterface(IID_IHXRegistry, (void**)&pRegistry);
+ if (SUCCEEDED(retVal))
+ {
+ IHXBuffer* pBuffer = NULL;
- CHXString recentAuthRealmInfo;
- CHXString recentProxyAuthRealmInfo;
+ CHXString key("no-authentication-information");
- IHXBuffer* pHeaderBuffer = NULL;
+ CHXString recentAuthRealmInfo;
+ CHXString recentProxyAuthRealmInfo;
- retVal = pRegistry->GetStrByName(WWW_AUTHENTICATION_RECENT_KEY, \
pHeaderBuffer);
- if (SUCCEEDED(retVal))
- {
- HX_ASSERT(pHeaderBuffer);
- recentAuthRealmInfo = CHXString((const char*)pHeaderBuffer->GetBuffer(), \
pHeaderBuffer->GetSize());
- HX_RELEASE(pHeaderBuffer);
- }
+ IHXBuffer* pHeaderBuffer = NULL;
- retVal = pRegistry->GetStrByName(PROXY_AUTHENTICATION_RECENT_KEY, \
pHeaderBuffer);
- if (SUCCEEDED(retVal))
- {
- HX_ASSERT(pHeaderBuffer);
- recentProxyAuthRealmInfo = CHXString((const \
char*)pHeaderBuffer->GetBuffer(), pHeaderBuffer->GetSize());
- HX_RELEASE(pHeaderBuffer);
- }
+ retVal = pRegistry->GetStrByName(WWW_AUTHENTICATION_RECENT_KEY, \
pHeaderBuffer); + if (SUCCEEDED(retVal))
+ {
+ HX_ASSERT(pHeaderBuffer);
+ recentAuthRealmInfo = CHXString((const \
char*)pHeaderBuffer->GetBuffer(), pHeaderBuffer->GetSize()); + \
HX_RELEASE(pHeaderBuffer); + }
- if (!bAlreadyHasAuthorization)
- {
- key = "authentication.http:";
- key += m_strHost.IsEmpty() ? pActualHost : (const char*)m_strHost;
- key += ":";
- key += recentAuthRealmInfo;
+ retVal = pRegistry->GetStrByName(PROXY_AUTHENTICATION_RECENT_KEY, \
pHeaderBuffer); + if (SUCCEEDED(retVal))
+ {
+ HX_ASSERT(pHeaderBuffer);
+ recentProxyAuthRealmInfo = CHXString((const \
char*)pHeaderBuffer->GetBuffer(), pHeaderBuffer->GetSize()); + \
HX_RELEASE(pHeaderBuffer); + }
- if (HXR_OK == pRegistry->GetStrByName((const char*)key, pBuffer) )
+ if (!bAlreadyHasAuthorization)
{
- if (pBuffer && 0 != strncasecmp((const char*)pBuffer->GetBuffer(), \
"NTLM", 4)) + key = "authentication.http:";
+ key += m_strHost.IsEmpty() ? pActualHost : (const char*)m_strHost;
+ key += ":";
+ key += recentAuthRealmInfo;
+
+ if (HXR_OK == pRegistry->GetStrByName((const char*)key, pBuffer) )
{
- CHXString authString((const char*)pBuffer->GetBuffer());
+ if (pBuffer && 0 != strncasecmp((const \
char*)pBuffer->GetBuffer(), "NTLM", 4)) + {
+ CHXString authString((const char*)pBuffer->GetBuffer());
- m_strRequest += "\r\nAuthorization: ";
- m_strRequest += (const char*)authString;
+ m_strRequest += "\r\nAuthorization: ";
+ m_strRequest += (const char*)authString;
+ }
+ HX_RELEASE(pBuffer);
}
- HX_RELEASE(pBuffer);
}
- }
- if (!bAlreadyHasProxyAuthorization)
- {
- key = "proxy-authentication.http:";
- key += pActualHost;
- key += ":";
- key += recentProxyAuthRealmInfo;
-
- if (HXR_OK == pRegistry->GetStrByName((const char*)key, pBuffer) )
+ if (!bAlreadyHasProxyAuthorization)
{
- if (pBuffer && 0 != strncasecmp((const char*)pBuffer->GetBuffer(), \
"NTLM", 4)) + key = "proxy-authentication.http:";
+ key += pActualHost;
+ key += ":";
+ key += recentProxyAuthRealmInfo;
+
+ if (HXR_OK == pRegistry->GetStrByName((const char*)key, pBuffer) )
{
- CHXString authString((const char*)pBuffer->GetBuffer());
+ if (pBuffer && 0 != strncasecmp((const \
char*)pBuffer->GetBuffer(), "NTLM", 4)) + {
+ CHXString authString((const char*)pBuffer->GetBuffer());
- m_strRequest += "\r\nProxy-Authorization: ";
- m_strRequest += (const char*)authString;
+ m_strRequest += "\r\nProxy-Authorization: ";
+ m_strRequest += (const char*)authString;
+ }
+ HX_RELEASE(pBuffer);
}
- HX_RELEASE(pBuffer);
}
+
+ HX_RELEASE(pRegistry);
}
- HX_RELEASE(pRegistry);
}
-
m_strRequest += "\r\n\r\n";
m_nTotalRequestSize = (UINT16)m_strRequest.GetLength();
HX_VECTOR_DELETE(pOutBuffer);
-
+
if (!m_pSocket)
{
// Ensure resolver and response objects are created and initialized
@@ -4057,7 +4079,7 @@
{
HXLOGL1(HXLOG_HTTP, "GetAddrInfoDone status %08x (going to create socket)", \
status); HX_RESULT retVal = HXR_FAIL;
-
+
if (!m_bNoNeedLock)
{
HX_LOCK(m_pMutex);
@@ -4077,7 +4099,8 @@
// Clear the return value
retVal = HXR_OK;
// Make sure we haven't already timed out
- if (!m_bConnTimedOut)
+ // Make sure that already a connection hasn't been established.
+ if (!m_bConnTimedOut && !m_bConnectDone)
{
// Did the resolve succeed?
if (SUCCEEDED(status) && ppAddrVec && nVecLen)
@@ -4411,7 +4434,7 @@
// If we are attempting a byte offset seek,
// check the server for byte seek support
- if (m_bByteRangeSeekPending && m_uByteRangeSeekOffset)
+ if (m_bByteRangeSeekPending)
{
m_bCheckingWhetherByteRangeWorks = TRUE;
}
@@ -4537,10 +4560,46 @@
if(m_pRequest)
{
- ResetRequestHeader(m_pRequest);
-
+ CHXString oldDomain;
+ CHXString newDomain;
+ IHXBuffer* pURLHost = NULL;
+ IHXBuffer* pURLPath = NULL;
+
m_pRequest->SetURL(sLocation);
-
+ //get the Domain name of old URL
+ UINT32 numFields = m_strHost.CountFields('.');
+ if(numFields > 1)
+ {
+ oldDomain = m_strHost.NthField('.', numFields-1);
+ }
+ // Separate the URL into a domain and path
+ theErr = GetHostAndPath(m_pRequest, pURLHost, pURLPath);
+ if(theErr != HXR_OK)
+ {
+ HX_RELEASE(pURLHost);
+ HX_RELEASE(pURLPath);
+ return theErr;
+ }
+ else
+ {
+ //get the Domain name of redirected URL
+ CHXString cHostCopy((const char*)pURLHost->GetBuffer());
+ numFields = cHostCopy.CountFields('.');
+ if(numFields > 1)
+ {
+ newDomain = cHostCopy.NthField('.', numFields-1);
+ }
+ HX_RELEASE(pURLHost);
+ HX_RELEASE(pURLPath);
+ }
+ HXLOGL3(HXLOG_HTTP, "OldDomain: %s NewDomain: %s", NULLOK((const \
char*)oldDomain), NULLOK((const char*)newDomain)); +
+ //If the redirection Domain has changed, then reset the Request Header
+ if(oldDomain != newDomain)
+ {
+ ResetRequestHeader(m_pRequest);
+ }
+
// Keep the request alive..
m_pRequest->AddRef();
@@ -5143,7 +5202,7 @@
}
else if (HXR_SOCK_WOULDBLOCK != retVal)
{
- //HX_ASSERT(false); // investigate
+ HX_ASSERT(false); // investigate
// severe error
if( m_pSocket )
{
@@ -8650,7 +8709,7 @@
}
-HX_RESULT CHTTPFileObject::ContainsMP3MimeType(const char* pData, UINT32 ulLength)
+HXBOOL CHTTPFileObject::ContainsMP3MimeType(const char* pData, UINT32 ulLength)
{
UINT32 ulIdx;
HXBOOL bRetVal = FALSE;
@@ -8804,10 +8863,10 @@
{
if (strncasecmp((const char*)szHeader, "HTTP/", 5) != 0 || m_bShoutcast)
{
- const char pDefHdr[] = "HTTP/1.1 200 OK\r\n";
- UINT32 ulDefHdrSize = sizeof(pDefHdr) - 1;
+ const char defHdr[] = "HTTP/1.1 200 OK\r\n\r\n";
+ UINT32 ulDefHdrSize = sizeof(defHdr) - 1;
UINT32 ulHdrShift = ulDefHdrSize;
- char* pHdr = (char*)pDefHdr;
+ char* pHdr = (char*)defHdr;
// Use heuristic to decide whether to treat this non-standard
// HTTP stream as a non-MP3 icecast stream.
@@ -8822,13 +8881,14 @@
// to the file format for parsing.
// The new file format will be required to obtain the needed header
// information from response headers.
- if (m_bShoutcast &&
- (strncasecmp((const char*) szHeader, "ICY", 3) == 0) &&
- ((StrNStr((const char*) szHeader,
- "Content-Type", ulLength, 12) != 0) ||
- (StrNStr((const char*) szHeader,
- "content-type", ulLength, 12) != 0)) &&
- (!ContainsMP3MimeType((const char*) szHeader, ulLength)))
+ // Ensure that only in case of mp3 header is passed to file format.
+ HXBOOL bContentTypeAvailable = (StrNStr((const char*) \
szHeader,"Content-Type", ulLength, 12) != 0) || (StrNStr((const char*) \
szHeader,"content-type", ulLength, 12) != 0) ; + HXBOOL bIsMp3 = FALSE;
+ if(bContentTypeAvailable)
+ {
+ bIsMp3 = ContainsMP3MimeType((const char*) szHeader, ulLength);
+ }
+ if ((strncasecmp((const char*) szHeader, "ICY", 3) == 0) && \
m_bShoutcast && bContentTypeAvailable && !bIsMp3) {
// This is an non-mp3 Icecast stream.
// Modify the ulDefHdrSize so that it will turn
@@ -8836,6 +8896,12 @@
ulDefHdrSize = 8;
ulHdrShift = 5;
}
+ else if (!bIsMp3)
+ {
+ // This is non-mp3 (audio/aacp) stream. do not append extra "\r\n" and let it be \
parsed here. + ulDefHdrSize -= 2;
+ ulHdrShift -= 2;
+ }
// If we had an http packet that was just a header, concatenate
// the current packet to it.
@@ -10249,7 +10315,7 @@
#endif //HELIX_FEATURE_HTTPFSYS_MEM_GROWTH_LIMIT
-STDMETHODIMP CHTTPFileObject::OpenURL(const char* pURL, HXBOOL bReconnect)
+STDMETHODIMP CHTTPFileObject::OpenURL(const char* pURL, IHXValues* pRequestHeaders, \
HXBOOL bReconnect) {
HX_RESULT theErr = HXR_OK;
if (m_pCommonClassFactory)
@@ -10259,6 +10325,10 @@
if (pRequest)
{
pRequest->SetURL(pURL);
+ if (pRequestHeaders)
+ {
+ pRequest->SetRequestHeaders(pRequestHeaders);
+ }
SetRequest(pRequest);
}
HX_RELEASE(pRequest);
_______________________________________________
Filesystem-cvs mailing list
Filesystem-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/filesystem-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic