[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-filesystem-dev
Subject:    RE: [Filesystem-dev] RE: [Client-dev] FW:
From:       <Praveen.Thimmashetty () nokia ! com>
Date:       2008-02-05 23:03:36
Message-ID: 2A15C07EF7DF6243A092FB438FD4B366C2D4ED () daebe103 ! NOE ! Nokia ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Eric,
Please find the updated diff and source code. I have made all the
changes suggested by you 1-5 and 7.
for change suggested 6,
 
6) - 
-#if defined(THREADS_SUPPORTED) 
-    HXMutex::MakeMutex(m_pMutex); 
-#else 
-    HXMutex::MakeStubMutex(m_pMutex); 
-#endif 

    Why is this removed? 

Praveen: Moved form constructor to initobject. This change was taken
from the head. 

Thanks
Praveen


________________________________

From: filesystem-dev-bounces@helixcommunity.org
[mailto:filesystem-dev-bounces@helixcommunity.org] 
Sent: Tuesday, February 05, 2008 3:16 PM
To: ehyche@real.com; common-dev@helixcommunity.org;
filesystem-dev@helixcommunity.org; client-dev@helixcommunity.org
Subject: [Filesystem-dev] RE: [Client-dev] FW:
CR:RESEND:(hxclient_2_1_0_cayennes Changes)Porting of HTTP 1.1 fromhead
to Symbian (hxclient_2_1_0_cayennes) 




Hi Eric, 

I am planning to add HELIX_FEATURE_HTTP_DISABLE_CACHE for caching
feature and 
HELIX_CONFIG_HTTP_EXCLUDE_DATAFSYS for data file system. 

I can define these flags in symbian specific pfi file. 

I shall re-send the CR for other changes that you have suggested. 

Let me know these above flags are fine. 

Thanks 
Praveen 




-----Original Message----- 
From: ext Eric Hyche [mailto:ehyche@real.com <mailto:ehyche@real.com> ] 
Sent: Tuesday, February 05, 2008 10:53 AM 
To: Thimmashetty Praveen (Nokia-D-MSW/Dallas);
common-dev@helixcommunity.org; filesystem-dev@helixcommunity.org;
client-dev@helixcommunity.org

Subject: RE: [Client-dev] FW: CR:RESEND: (hxclient_2_1_0_cayennes
Changes)Porting of HTTP 1.1 from head to Symbian
(hxclient_2_1_0_cayennes) 


Praveen, 

Here are my comments: 

1) In both the Umakefil and in the code, I would prefer to 
   split out the features of the current filesystem/http 
   that you don't want/need by the use of HELIX_FEATURE_xxx 
   defines rather than by platform (making them non-Symbian). 
   Then you can simply disable these features on symbian 
   and leave then enabled on other platforms. That way other 
   platforms who may have similar requirements to Symbian 
   may also take advantage of these changes. 

   I would suggest perhaps HELIX_FEATURE_HTTP_CACHE or 
   something like that for the caching features. 

2) Same thing for including/excluding the data: filesystem 
   in the httpfsys plugin. Please use a HELIX_FEATURE_xxx 
   instead of platform preprocessor defines. Perhaps 
   HELIX_FEATURE_HTTP_INCLUDE_DATAFSYS. 

3) In this change: 

@@ -213,20 +251,17 @@ 
 //#define LOG_DUMP_FILE "c:/temp/avi.txt" 
  
 #ifdef SUPPORT_SECURE_SOCKETS 
-const char* CHTTPFileSystem::zm_pProtocol       = "http|chttp|https"; 
+const char* const CHTTPFileSystem::zm_pProtocol       =
"http|chttp|https"; 
 #else 
-const char* CHTTPFileSystem::zm_pProtocol       = "http|chttp"; 
+const char* const CHTTPFileSystem::zm_pProtocol       = "http|chttp"; 
 #endif 
  

   This plugin should only claim "chttp" if caching support is enabled. 


4) +#if !defined(_SYMBIAN)         
+        pChunkyRes = new CChunkyRes(pContext); 
+#else        
         pChunkyRes = new CChunkyRes(); 
+#endif        

  If you are going to use CChunkyRes in filesystem/http on 
  the Cay210s, then you should merge the changes from the 
  HEAD in CChunkyRes to Cay210s. Then the above change will 
  not be needed. There shouldn't be *too* many changes in 
  CChunkyRes between HEAD and Cay210s. 

        
5) Here: 

+#if !defined(HELIX_CONFIG_NOSTATICS) 
     if (g_pCacheEntry) 
     { 
         g_pCacheEntry->close(); 
         delete g_pCacheEntry; 
         g_pCacheEntry = NULL; 
     } 
- 
+#endif 
     return HXR_OK; 

   This doesn't seem like the right change. If HELIX_CONFIG_NOSTATICS 
   is defined but HELIX_FEATURE_HTTP_CACHE (the new define) *is*
defined, 
   then we just need to get g_pCacheEntry from the global manager. If 
   HELIX_FEATURE_HTTP_CACHE is not defined, then it doesn't matter 
   if HELIX_CONFIG_NOSTATICS is defined or not here. 


6) - 
-#if defined(THREADS_SUPPORTED) 
-    HXMutex::MakeMutex(m_pMutex); 
-#else 
-    HXMutex::MakeStubMutex(m_pMutex); 
-#endif 

    Why is this removed? 

Praveen: Moved form constructor to initobject. This change was taken
from the head. 

7) Here: 

+#if !defined(HELIX_CONFIG_NOSTATICS) 
         m_pChunkyRes = g_ChunkyResMap.GetChunkyResForURL(url, this); 
- 
+#else        
+        if(!m_pChunkyResMap) 
+        { 
+            m_pChunkyResMap = new CChunkyResMap; 
+        } 
+        if(m_pChunkyResMap) 
+        { 
+            m_pChunkyRes = m_pChunkyResMap->GetChunkyResForURL(url,
this, m_pContext); 
+        } 
+#endif 

   I don't think if HELIX_CONFIG_NOSTATICS is not defined, we should 
   create a new copy every time - we should get m_pChunkRes from the
global manager. 
   If you create a new chunkyres every time, then if you have two 
   http sessions going at once, then they cannot share CChunkyRes
objects. 



Rest looks good. 

============================================= 
Eric Hyche (ehyche@real.com) 
Technical Lead 
RealNetworks, Inc.  

> -----Original Message----- 
> From: client-dev-bounces@helixcommunity.org 
> [mailto:client-dev-bounces@helixcommunity.org
<mailto:client-dev-bounces@helixcommunity.org> ] On Behalf Of 
> Praveen.Thimmashetty@nokia.com 
> Sent: Tuesday, February 05, 2008 11:21 AM 
> To: common-dev@helixcommunity.org; 
> filesystem-dev@helixcommunity.org; client-dev@helixcommunity.org 
> Subject: [Client-dev] FW: CR:RESEND: (hxclient_2_1_0_cayennes 
> Changes)Porting of HTTP 1.1 from head to Symbian 
> (hxclient_2_1_0_cayennes) 
> 
> 
> 
> ______________________________________________ 
> From:   Thimmashetty Praveen (Nokia-D-MSW/Dallas)  
> Sent:   Sunday, February 03, 2008 5:57 PM 
> To:     'filesystem-dev@helixcommunity.org'; 
> common-dev@helixcommunity.org 
> Subject:        CR: (hxclient_2_1_0_cayennes Changes) Porting 
> of HTTP 1.1 from head to Symbian (hxclient_2_1_0_cayennes) 
> 
> 
> "Nokia submits this code under the terms of a commercial contribution 
> agreement with Real Networks, and I am authorized to contribute this 
> code under said agreement." 
> 
>       Modified by:  Praveen.Thimmashetty@nokia.com 
> 
>       Reviewed by: 
> 
>       Date: 03-February-2008 
> 
>       Project: SymbianMmf 
> 
>       ErrorId: SUB 409-795 
> 
>                   
>       Synopsis:  CR: Porting of HTTP 1.1 from head to Symbian 
> (hxclient_2_1_0_cayennes) 
>                               This CR has changes that needs to go to 
> hxclient_2_1_0_cayennes. I will do the separate CR for HEAD changes. 
> Symbian will not be using data file system/cache file system. It will 
> just make use of Cchunkres to process data from network. 
> 
>                       
>       Root Cause of the problem: New Feature 
>         
>       Files Modified: 
>       Common\fileio\chunkres.cpp 
>       Common\fileio\pub\chunkres.h 
>       Common\include\hxresult.h 
> 
>       filesystem\http\Umakefil 
>       filesystem\http\factory.cpp 
>       filesystem\http\factory.h 
>       filesystem\http\httpfsys.cpp 
>       filesystem\http\httpfsys.h 
>       filesystem\http\pub\http_debug.h 
> 
>       New files added: 
>       filesystem\http\symbian.pcf 
> 
> 
>       Image Size and Heap Use impact: no major impact (added
httpfsys.dll 
> (112k)) 
> 
>       Module Release testing (STIF) :  Passed. 
> 
>       Test case(s) Added  :  No. 
> 
>       Memory leak check performed : Yes.  No new leaks introduced. 
> 
>       Platforms and Profiles Build Verified: 
> helix-client-s60-32-mmf-mdf-arm 
> 
>       Platforms and Profiles Functionality verified: armv5,winscw 
> 
>       Branch: hxclient_2_1_0_cayennes 
>   
> <<diff.txt>> <<210changes.zip>> 
> 
> 


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>RE: [Client-dev] FW: CR:RESEND: (hxclient_2_1_0_cayennes \
Changes)Porting of HTTP 1.1 from head to Symbian (hxclient_2_1_0_cayennes)</TITLE> \
<META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META \
content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD> <BODY>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>Hi Eric,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>Please find the updated diff and source code. I have made 
all the changes suggested by you 1-5 and 7.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>for change suggested 6,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2><SPAN lang=en-us><FONT face=Arial 
size=2></FONT></SPAN></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2><SPAN lang=en-us><FONT face=Arial size=2>6) -</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>-#if 
defined(THREADS_SUPPORTED)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>-&nbsp;&nbsp;&nbsp; HXMutex::MakeMutex(m_pMutex);</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>-#else</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>-&nbsp;&nbsp;&nbsp; 
HXMutex::MakeStubMutex(m_pMutex);</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>-#endif</FONT></SPAN> </DIV>
<DIV dir=ltr align=left>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; Why is this 
removed?</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial color=#800000 size=2>Praveen: Moved form 
constructor to initobject.</FONT><FONT face=Arial color=#800000 size=2> This 
change was taken from the head.</FONT></SPAN> </P></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>Thanks</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=038075322-05022008><FONT face=Arial 
color=#0000ff size=2>Praveen</FONT></SPAN></DIV></FONT></SPAN></DIV><FONT 
face=Arial color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> filesystem-dev-bounces@helixcommunity.org 
[mailto:filesystem-dev-bounces@helixcommunity.org] <BR><B>Sent:</B> Tuesday, 
February 05, 2008 3:16 PM<BR><B>To:</B> ehyche@real.com; 
common-dev@helixcommunity.org; filesystem-dev@helixcommunity.org; 
client-dev@helixcommunity.org<BR><B>Subject:</B> [Filesystem-dev] RE: 
[Client-dev] FW: CR:RESEND:(hxclient_2_1_0_cayennes Changes)Porting of HTTP 1.1 
fromhead to Symbian (hxclient_2_1_0_cayennes) <BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P><SPAN lang=en-us><FONT face=Arial size=2></FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>Hi Eric,</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>I am planning to add 
HELIX_FEATURE_HTTP_DISABLE_CACHE for caching feature and </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>HELIX_CONFIG_HTTP_EX</FONT><FONT face=Arial 
size=2>CLUDE_DATAFSYS</FONT><FONT face=Arial size=2> for data file 
system.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>I can define these flags in symbian 
specific pfi file. </FONT></SPAN></P>
<P><SPAN lang=en-us><FONT face=Arial size=2>I shall re-send the CR for other 
changes that you have suggested.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>Let me know these above flags are 
fine.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>Thanks</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>Praveen</FONT></SPAN> </P><BR><BR><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>-----Original 
Message-----</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>From: 
ext Eric Hyche [</FONT></SPAN><A href="mailto:ehyche@real.com"><SPAN 
lang=en-us><U><FONT face=Arial color=#0000ff 
size=2>mailto:ehyche@real.com</FONT></U></SPAN></A><SPAN lang=en-us><FONT 
face=Arial size=2>] </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>Sent: Tuesday, February 05, 2008 10:53 AM</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>To: Thimmashetty Praveen 
(Nokia-D-MSW/Dallas); common-dev@helixcommunity.org; 
filesystem-dev@helixcommunity.org; 
client-dev@helixcommunity.org</FONT></SPAN></P>
<P><SPAN lang=en-us><FONT face=Arial size=2>Subject: RE: [Client-dev] FW: 
CR:RESEND: (hxclient_2_1_0_cayennes Changes)Porting of HTTP 1.1 from head to 
Symbian (hxclient_2_1_0_cayennes) </FONT></SPAN></P><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>Praveen,</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>Here are my comments:</FONT></SPAN> 
</P>
<P><SPAN lang=en-us><FONT face=Arial size=2>1) In both the Umakefil and in the 
code, I would prefer to</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp; split out the features of the current filesystem/http 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; that you 
don't want/need by the use of HELIX_FEATURE_xxx</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; defines rather than by platform 
(making them non-Symbian).</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp; Then you can simply disable these features on 
symbian</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; 
and leave then enabled on other platforms. That way other</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; platforms who may have 
similar requirements to Symbian</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp;&nbsp; may also take advantage of these 
changes.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; I would suggest perhaps 
HELIX_FEATURE_HTTP_CACHE or </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp; something like that for the caching features.</FONT></SPAN> 
</P>
<P><SPAN lang=en-us><FONT face=Arial size=2>2) Same thing for 
including/excluding the data: filesystem</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; in the httpfsys plugin. Please 
use a HELIX_FEATURE_xxx</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp; instead of platform preprocessor defines. 
Perhaps</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; 
HELIX_FEATURE_HTTP_INCLUDE_DATAFSYS.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>3) In this change:</FONT></SPAN> 
</P>
<P><SPAN lang=en-us><FONT face=Arial size=2>@@ -213,20 +251,17 @@</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;//#define LOG_DUMP_FILE 
"c:/temp/avi.txt"</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;#ifdef SUPPORT_SECURE_SOCKETS</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>-const char* 
CHTTPFileSystem::zm_pProtocol&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
"http|chttp|https";</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+const char* const 
CHTTPFileSystem::zm_pProtocol&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
"http|chttp|https";</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;#else</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>-const char* 
CHTTPFileSystem::zm_pProtocol&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
"http|chttp";</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>+const 
char* const CHTTPFileSystem::zm_pProtocol&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
"http|chttp";</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;#endif</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; This plugin should only 
claim "chttp" if caching support is enabled.</FONT></SPAN> </P><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>4) +#if 
!defined(_SYMBIAN)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChunkyRes = new 
CChunkyRes(pContext);</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+#else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pChunkyRes = new 
CChunkyRes();</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+#endif&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp; If you are going to use 
CChunkyRes in filesystem/http on</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp; the Cay210s, then you should merge the changes from 
the</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp; HEAD in 
CChunkyRes to Cay210s. Then the above change will</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp; not be needed. There shouldn't be 
*too* many changes in</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp; CChunkyRes between HEAD and Cay210s.</FONT></SPAN> </P>
<P><SPAN lang=en-us>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>5) Here:</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>+#if 
!defined(HELIX_CONFIG_NOSTATICS)</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp; if (g_pCacheEntry)</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp; 
{</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
g_pCacheEntry-&gt;close();</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delete 
g_pCacheEntry;</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_pCacheEntry = 
NULL;</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>-</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+#endif</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp; return HXR_OK;</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; This doesn't seem like 
the right change. If HELIX_CONFIG_NOSTATICS</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; is defined but 
HELIX_FEATURE_HTTP_CACHE (the new define) *is* defined,</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; then we just need to get 
g_pCacheEntry from the global manager. If</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; HELIX_FEATURE_HTTP_CACHE is not 
defined, then it doesn't matter</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp;&nbsp; if HELIX_CONFIG_NOSTATICS is defined or not 
here.</FONT></SPAN> </P><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>6) -</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>-#if defined(THREADS_SUPPORTED)</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>-&nbsp;&nbsp;&nbsp; 
HXMutex::MakeMutex(m_pMutex);</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>-#else</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>-&nbsp;&nbsp;&nbsp; HXMutex::MakeStubMutex(m_pMutex);</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>-#endif</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; Why is this 
removed?</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial color=#800000 size=2>Praveen: Moved form 
constructor to initobject.</FONT><FONT face=Arial color=#800000 size=2> This 
change was taken from the head.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>7) Here:</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>+#if 
!defined(HELIX_CONFIG_NOSTATICS)</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pChunkyRes 
= g_ChunkyResMap.GetChunkyResForURL(url, this);</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>-</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>+#else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(!m_pChunkyResMap)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
m_pChunkyResMap = new CChunkyResMap;</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
if(m_pChunkyResMap)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
m_pChunkyRes = m_pChunkyResMap-&gt;GetChunkyResForURL(url, this, 
m_pContext);</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>+#endif</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; I don't think if 
HELIX_CONFIG_NOSTATICS is not defined, we should </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; create a new copy every time - 
we should get m_pChunkRes from the global manager.</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&nbsp;&nbsp; If you create a new chunkyres 
every time, then if you have two</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&nbsp;&nbsp; http sessions going at once, then they cannot 
share CChunkyRes objects.</FONT></SPAN> </P><BR><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>Rest looks good.</FONT></SPAN> </P>
<P><SPAN lang=en-us><FONT face=Arial 
size=2>=============================================</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>Eric Hyche (ehyche@real.com)</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>Technical Lead</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>RealNetworks, Inc.&nbsp; 
</FONT></SPAN></P>
<P><SPAN lang=en-us><FONT face=Arial size=2>&gt; -----Original 
Message-----</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
From: client-dev-bounces@helixcommunity.org</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; [</FONT></SPAN><A 
href="mailto:client-dev-bounces@helixcommunity.org"><SPAN lang=en-us><U><FONT 
face=Arial color=#0000ff 
size=2>mailto:client-dev-bounces@helixcommunity.org</FONT></U></SPAN></A><SPAN 
lang=en-us><FONT face=Arial size=2>] On Behalf Of </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; 
Praveen.Thimmashetty@nokia.com</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; Sent: Tuesday, February 05, 2008 11:21 AM</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; To: 
common-dev@helixcommunity.org;</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; filesystem-dev@helixcommunity.org; 
client-dev@helixcommunity.org</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; Subject: [Client-dev] FW: CR:RESEND: 
(hxclient_2_1_0_cayennes </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; Changes)Porting of HTTP 1.1 from head to Symbian</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
(hxclient_2_1_0_cayennes)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
______________________________________________ </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; From:&nbsp;&nbsp; Thimmashetty Praveen 
(Nokia-D-MSW/Dallas)&nbsp; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; Sent:&nbsp;&nbsp; Sunday, February 03, 2008 5:57 PM 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
To:&nbsp;&nbsp;&nbsp;&nbsp; 'filesystem-dev@helixcommunity.org'; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
common-dev@helixcommunity.org </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CR: 
(hxclient_2_1_0_cayennes Changes) Porting </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; of HTTP 1.1 from head to Symbian 
(hxclient_2_1_0_cayennes)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; "Nokia submits 
this code under the terms of a commercial contribution </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; agreement with Real Networks, and I am 
authorized to contribute this </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; code under said agreement."</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Modified by:&nbsp; 
Praveen.Thimmashetty@nokia.com</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reviewed by: </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date: 
03-February-2008</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Project: SymbianMmf</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorId: SUB 
409-795</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Synopsis:&nbsp; CR: Porting of HTTP 1.1 from head 
to Symbian</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
(hxclient_2_1_0_cayennes) </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 This CR has changes that needs to go to </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; hxclient_2_1_0_cayennes. I will do the separate CR for 
HEAD changes. </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
Symbian will not be using data file system/cache file system. It will 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; just make use of 
Cchunkres to process data from network.</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Root Cause of the problem: New 
Feature</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Files Modified: 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Common\fileio\chunkres.cpp 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Common\fileio\pub\chunkres.h 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Common\include\hxresult.h</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\Umakefil 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\factory.cpp 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\factory.h </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
filesystem\http\httpfsys.cpp </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\httpfsys.h 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\pub\http_debug.h</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New files 
added: </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filesystem\http\symbian.pcf</FONT></SPAN> 
<BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Image Size and Heap Use 
impact: no major impact (added httpfsys.dll </FONT></SPAN><BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; (112k))</FONT></SPAN> <BR><SPAN 
lang=en-us><FONT face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Module Release testing 
(STIF) :&nbsp; Passed. </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Test case(s) Added&nbsp; :&nbsp; No. 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Memory leak check performed : Yes.&nbsp; No new 
leaks introduced. </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Platforms and Profiles Build Verified: 
</FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial size=2>&gt; 
helix-client-s60-32-mmf-mdf-arm</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Platforms and Profiles Functionality 
verified: armv5,winscw</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Branch: 
hxclient_2_1_0_cayennes</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt;&nbsp;&nbsp; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; &lt;&lt;diff.txt&gt;&gt; 
&lt;&lt;210changes.zip&gt;&gt;</FONT></SPAN> <BR><SPAN lang=en-us><FONT 
face=Arial size=2>&gt; </FONT></SPAN><BR><SPAN lang=en-us><FONT face=Arial 
size=2>&gt; </FONT></SPAN></P></BODY></HTML>


["diff_update.txt" (text/plain)]

Index: Umakefil
===================================================================
RCS file: /cvsroot/filesystem/http/Umakefil,v
retrieving revision 1.9
diff -w -u -b -r1.9 Umakefil
@@ -57,15 +57,18 @@
 # here for testing purposes.
 #project.AddDefines("HELIX_FEATURE_HTTP_GZIP")
 
-project.AddModuleIncludes("common/include")
+project.AddModuleIncludes("common/include","common/util/pub")
 
 project.AddSources("factory.cpp",
-                   "httpfsys.cpp",
-                   "cache.cpp",
-                   "fsdb.cpp")
+                   "httpfsys.cpp")
 
-project.AddModuleLibraries("filesystem/data[datafsys]",
-                           "protocol/http[httplib]",
+if not project.IsDefined("HELIX_FEATURE_HTTP_DISABLE_CACHE"):
+    project.AddSources("cache.cpp")
+
+if not project.IsDefined("HELIX_CONFIG_HTTP_EXCLUDE_DATAFSYS"):
+    project.AddSources("fsdb.cpp")                       
+
+project.AddModuleLibraries("protocol/http[httplib]",
                            "protocol/common/util[protutillib]",
                            "common/dbgtool[debuglib]",
                            "common/fileio[fileiolib]",
@@ -76,6 +79,9 @@
                            "common/netio[netiolib]",
                            "common/log/logutil[logutillib]")
 
+if not project.IsDefined("HELIX_CONFIG_HTTP_EXCLUDE_DATAFSYS"):
+    project.AddModuleLibraries("filesystem/data[datafsys]")                          \
 +
 if project.IsDefined("HELIX_FEATURE_HTTP_GZIP"):
     project.AddSources("decoder.cpp")
     project.AddModuleLibraries("common/import/zlib[zlib]")

 /****************************************************************************
Index: httpfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v
retrieving revision 1.88.2.2
diff -w -u -b -r1.88.2.2 httpfsys.cpp
@@ -113,6 +113,8 @@
 #include "httpfsys.h"
 #include "ihxcookies2.h"
 #include "hxtlogutil.h"
+#include "hxdir.h"
+
 
 #ifdef _MACINTOSH
 //#include "../dcondev/dcon.h"
@@ -153,6 +155,10 @@
 
 #define REDIRECT_LIMIT          20
 
+// For PR 152375
+#define LARGEST_CHUNK_SIZE_WE_ACCEPT_CONFIG_KEY \
"config.HTTPChunkedEncodingMaxChunkSize" +#define LARGEST_CHUNK_SIZE_WE_ACCEPT (256L \
* 1024L) +
 #undef  LOG_DATA
 #define MAX_CACHE_SIZE          (64 * 1024 * 1024)
 #define CACHE_DEFAULT_TTL_SECS  (1 * 60 * 60)
@@ -164,7 +170,9 @@
 
 #include <string.h>
 
+#if !defined(HELIX_CONFIG_NOSTATICS) 
 UINT32 g_ulDefTtl;
+#endif
 
 #ifndef USE_TEMP_CACHE_LOCATION
 #define DEF_CACHE_DB            "cache_db"
@@ -175,8 +183,10 @@
 
 #define HTTP_MAX_BUFFER_BEFORE_PROCESSIDLE (64 * 1024)
 
+#if !defined(HELIX_CONFIG_NOSTATICS) 
 CCacheEntry*   g_pCacheEntry = NULL;
 IHXBuffer*    CreateBufferFromValues (IHXValues *pHeaderValues);
+#endif
 
 // default if no timeouts in preferences.
 #define DEF_HTTP_SERVER_TIMEOUT     (20 * MILLISECS_PER_SECOND)
@@ -189,6 +199,35 @@
 // just wait for old-fashioned reading to catch up
 #define BYTE_RANGE_SEEK_THRESHHOLD (4 * 1024)
 
+// #define HELIX_FEATURE_HTTP_MEMCACHE
+
+// MemCache Setting
+#if defined(HELIX_FEATURE_HTTP_MEMCACHE)
+#if defined(HELIX_FEATURE_MIN_HEAP)
+#define DFLT_MEM_CACHE_SIZE	0x00080000  // 0.5MB
+#define MIN_MEM_CACHE_SIZE	0x00010000  //  64KB
+#else	// HELIX_FEATURE_MIN_HEAP
+#define DFLT_MEM_CACHE_SIZE	0x00400000  //   4MB
+#define MIN_MEM_CACHE_SIZE	0x00040000  // 256KB
+#endif	// HELIX_FEATURE_MIN_HEAP
+#else	// HELIX_FEATURE_HTTP_MEMCACHE
+#define DFLT_MEM_CACHE_SIZE	0x00000000
+#define MIN_MEM_CACHE_SIZE	0x00000000
+#endif	// HELIX_FEATURE_HTTP_MEMCACHE
+
+#define MEM_CACHE_TRIM_THRESHOLD_DENOM	    4	    // Denominator indicating fraction \
of the +						    // mem cache capacity that needs to be
+						    // present in direct path of data read
+						    // to avoid trimming the memory to make
+						    // room for additional data.
+						    // It also indicates the fraction by which
+						    // the mem-cache will be trimmed when
+						    // more room is needed.
+						    // Must be >= 2  (>= 50% of mem cache capacity).
+						    
+#define DFLT_MEM_CACHE_CONTIG_LENGTH_TRIM_THRESHOLD (DFLT_MEM_CACHE_SIZE / \
MEM_CACHE_TRIM_THRESHOLD_DENOM) +#define DFLT_MEM_CACHE_TRIM_SIZE		    \
(DFLT_MEM_CACHE_SIZE / MEM_CACHE_TRIM_THRESHOLD_DENOM) +
 // Tresholds for the amount of data to receive before attempting to make
 // sense of the response and associated headers
 #define HTTP_MIN_STARTUP_LENGTH_NEEDED              5       // bytes
@@ -196,11 +235,10 @@
 
 #define ICECAST_META_SIZE_MULTIPLE                  16      // bytes
 
-
-const char* CHTTPFileSystem::zm_pDescription    = "RealNetworks HTTP File System \
                with CHTTP Support";
-const char* CHTTPFileSystem::zm_pCopyright      = HXVER_COPYRIGHT;
-const char* CHTTPFileSystem::zm_pMoreInfoURL    = HXVER_MOREINFO;
-const char* CHTTPFileSystem::zm_pShortName      = "pn-http";
+const char* const CHTTPFileSystem::zm_pDescription    = "RealNetworks HTTP File \
System with CHTTP Support"; +const char* const CHTTPFileSystem::zm_pCopyright      = \
HXVER_COPYRIGHT; +const char* const CHTTPFileSystem::zm_pMoreInfoURL    = \
HXVER_MOREINFO; +const char* const CHTTPFileSystem::zm_pShortName      = "pn-http";
 
 /// This name is used to indicate the http server is
 /// actually RealServer. If the server team changes
@@ -211,22 +249,26 @@
 //#define SUPPORT_SECURE_SOCKETS
 //#define CREATE_LOG_DUMP
 //#define LOG_DUMP_FILE "c:/temp/avi.txt"
-
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)
 #ifdef SUPPORT_SECURE_SOCKETS
-const char* CHTTPFileSystem::zm_pProtocol       = "http|chttp|https";
+const char* const CHTTPFileSystem::zm_pProtocol       = "http|chttp|https";
 #else
-const char* CHTTPFileSystem::zm_pProtocol       = "http|chttp";
-#endif
+const char* const CHTTPFileSystem::zm_pProtocol       = "http|chttp";
+#endif //SUPPORT_SECURE_SOCKETS
+#else
+#ifdef SUPPORT_SECURE_SOCKETS
+const char* const CHTTPFileSystem::zm_pProtocol       = "http|https";
+#else
+const char* const CHTTPFileSystem::zm_pProtocol       = "http";
+#endif //SUPPORT_SECURE_SOCKETS
+#endif //HELIX_FEATURE_HTTP_DISABLE_CACHE
 
+#if !defined(HELIX_CONFIG_NOSTATICS) 
 HXBOOL CHTTPFileSystem::m_bSaveNextStream = FALSE;
 //CHXString CHTTPFileSystem::m_SaveFileName( "" );
 CHXString CHTTPFileSystem::m_SaveFileName;
-
-
-static INT32 g_nRefCount_http  = 0;
-
 static CChunkyResMap g_ChunkyResMap;
-
+#endif //HELIX_CONFIG_NOSTATICS
 
 #define WWW_AUTHENTICATION_RECENT_KEY "authentication.http.realm.recent"
 #define PROXY_AUTHENTICATION_RECENT_KEY "proxy-authentication.http.realm.recent"
@@ -247,6 +289,24 @@
 }
 #endif
 
+#if defined(HELIX_CONFIG_NOSTATICS)
+static CChunkyResMap* GetGlobalCChunkyResMap()
+{
+
+ static const int key = 0; // address of static var (we hope) comprises unique key \
id +
+ CChunkyResMap*& g_p = (CChunkyResMap*&)HXGlobalPtr::Get(&key);
+
+ if(! g_p)
+ {
+     g_p = new CChunkyResMap();
+ }
+
+ return g_p;
+
+}
+#endif
+
 // ChunkyResMap is a manager-type class that is able to re-use the same ChunkyRes \
for different  // file objects that use the same url. This happens, for example, if \
you're http-streaming a  // surestream file which may have many logical streams \
pasted one after another. @@ -262,7 +322,7 @@
 }
 
 CChunkyRes*
-CChunkyResMap::GetChunkyResForURL(const char* pURL, void* pCursorOwner)
+CChunkyResMap::GetChunkyResForURL(const char* pURL, void* pCursorOwner, IUnknown* \
pContext)  {
     CChunkyRes* pChunkyRes = NULL;
 
@@ -368,14 +428,14 @@
     {
         return HXR_OK;
     }
-
+#if !defined(HELIX_CONFIG_NOSTATICS) 
     if (g_pCacheEntry)
     {
         g_pCacheEntry->close();
         delete g_pCacheEntry;
         g_pCacheEntry = NULL;
     }
-
+#endif
     return HXR_OK;
 }
 
@@ -393,14 +453,17 @@
  */
 HX_RESULT CHTTPFileSystem::CanUnload(void)
 {
-    return (g_nRefCount_http ? HXR_FAIL : HXR_OK);
+    HX_RESULT result = (CHXBaseCountingObject::ObjectsActive() > 0) ? HXR_FAIL : \
HXR_OK; +    return (result);
 }
 
 
 BEGIN_INTERFACE_LIST(CHTTPFileSystem)
     INTERFACE_LIST_ENTRY(IID_IHXPlugin, IHXPlugin)
     INTERFACE_LIST_ENTRY(IID_IHXFileSystemObject, IHXFileSystemObject)
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)    
     INTERFACE_LIST_ENTRY(IID_IHXFileSystemCache, IHXFileSystemCache)
+#endif    
     INTERFACE_LIST_ENTRY(IID_IHXHTTPAutoStream, IHXHTTPAutoStream)
 END_INTERFACE_LIST
 
@@ -408,12 +471,10 @@
     m_pContext(NULL)
     , m_pOptions(NULL)
 {
-    g_nRefCount_http++;
 }
 
 CHTTPFileSystem::~CHTTPFileSystem()
 {
-    g_nRefCount_http--;
     HX_RELEASE(m_pContext);
     HX_RELEASE(m_pOptions);
 }
@@ -551,7 +612,7 @@
 
 
 
-
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)
 /////////////////////////////////////////////////////////////////////////
 //  Method:
 //      CHTTPFileSystem::RefreshCache
@@ -688,7 +749,7 @@
 
     return HXR_OK;
 }
-
+#endif //HELIX_FEATURE_HTTP_DISABLE_CACHE
 
 STDMETHODIMP_(void)
 CHTTPFileSystem::SetDestinationFile( const char *pFilename )
@@ -799,9 +860,10 @@
     {
         AddRef();
         *ppvObj = (IHXPendingStatus*)(this);
-
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE
         //FNH This is probably not needed
         ProcessCacheCompletions(FALSE);
+#endif        
         return HXR_OK;
     }
     if (IsEqualIID(IID_IHXRequestHandler, riid))
@@ -913,6 +975,7 @@
 
     , m_bInitialized(FALSE)
     , m_bInDestructor(FALSE)
+    , m_bClosed(FALSE)
 
     , m_ulCurrentReadPosition (0)
     , m_ulLastKnownEndOfValidContiguousRange(0)
@@ -920,7 +983,6 @@
     , m_pDecoder(NULL)
     , m_pChunkyRes(NULL)
     , m_pMutex(NULL)
-
     , m_nPort(DEF_HTTP_PORT)
 
     , m_nRedirectLevel(0)
@@ -937,6 +999,9 @@
     , m_bConvertFailedSeeksToLinear(TRUE)
     , m_bHaltSocketReadTemporarily(FALSE)
     , m_ulMaxBufSize(MAX_CHUNK_SIZE)
+    , m_ulMemCacheSize(DFLT_MEM_CACHE_SIZE)
+    , m_ulMemCacheContigLengthTrimThreshold(DFLT_MEM_CACHE_CONTIG_LENGTH_TRIM_THRESHOLD)
 +    , m_ulMemCacheTrimSize(DFLT_MEM_CACHE_TRIM_SIZE)
 
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     , m_bDownloadCompleteReported(FALSE)
@@ -975,6 +1040,7 @@
 
     , m_bKnowContentSize(FALSE)
     , m_nContentSize(0)
+    , m_nOriginalContentSize(0)
     , m_bEncoded(FALSE)
 
     , m_bChunkedEncoding(FALSE)
@@ -1046,7 +1112,6 @@
     , m_bByteRangeSeekPending(FALSE)
     , m_bCheckingWhetherByteRangeWorks(FALSE)
     , m_bServerPresumablyWorksWithByteRangeRequests(TRUE)
-    , m_bClosed(FALSE)
     , m_pLastHeader(NULL)
     , m_ulMinStartupLengthNeeded(HTTP_MIN_STARTUP_LENGTH_NEEDED)
     , m_ulIgnoreBytesYetToBeDownloaded(0)
@@ -1055,12 +1120,6 @@
 /*************************/
 {
     SetSupportsByteRanges(m_bSupportsByteRanges);
-
-#if defined(THREADS_SUPPORTED)
-    HXMutex::MakeMutex(m_pMutex);
-#else
-    HXMutex::MakeStubMutex(m_pMutex);
-#endif
 }
 
 void
@@ -1088,6 +1147,7 @@
 void
 CHTTPFileObject::SetReadContentsDone(HXBOOL bReadContentsDone)
 {
+    HXLOGL4(HXLOG_HTTP, "CHTTPFileObject::SetReadContentsDone");
     m_bReadContentsDone = bReadContentsDone;
 #if defined(HELIX_FEATURE_PROGRESSIVE_DOWNLD_STATUS)
     if (m_pBytesToDur  &&  bReadContentsDone)
@@ -1152,6 +1212,12 @@
     {
         m_pContext = pContext;
         m_pContext->AddRef();
+    	#if defined(THREADS_SUPPORTED) || defined(_UNIX_THREADS_SUPPORTED)
+            HXMutex::MakeMutex(m_pMutex);
+        #else
+            HXMutex::MakeStubMutex(m_pMutex);
+        #endif
+        HX_ASSERT( m_pMutex );
 
         m_pContext->QueryInterface(IID_IHXScheduler, (void**) &m_pScheduler);
         m_pContext->QueryInterface(IID_IHXCommonClassFactory, (void \
**)&m_pCommonClassFactory); @@ -1270,11 +1336,21 @@
 
 //      if (szBaseURL && ::strncmp (szBaseURL, "http:", 5) == 0)
         {
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE            
             CacheSupport_InitObject();
+#endif            
         }
 
         // buffer ahead amount for throttling download if desired
         ReadPrefUINT32(m_pPreferences, "HTTPBufferAheadAmount", \
m_ulBufferAheadAmount); +	
+	// Use memory cache only if desired of indicated size
+        ReadPrefUINT32(m_pPreferences, "HTTPMemCacheSize", m_ulMemCacheSize);
+    }
+    
+    if ((m_ulMemCacheSize != 0) && (m_ulMemCacheSize < MIN_MEM_CACHE_SIZE))
+    {
+	m_ulMemCacheSize = MIN_MEM_CACHE_SIZE;
     }
 
     if (m_pCallback && m_pCallback->IsCallbackPending())
@@ -1472,6 +1548,11 @@
  */
 STDMETHODIMP CHTTPFileObject::Close()
 {
+    if (m_bClosed)
+    {
+	return HXR_OK;
+    }
+
     m_pMutex->Lock();
 
     HXLOGL1(HXLOG_HTTP, "Close(%s)", NULLOK(m_pFilename));
@@ -1481,8 +1562,16 @@
         m_bGetProxyInfoPending = FALSE;
         m_pPAC->AbortProxyInfo(this);
     }
-
+#if !defined(HELIX_CONFIG_NOSTATICS) 
     g_ChunkyResMap.RelinquishChunkyRes(m_pChunkyRes, this);
+#else
+    CChunkyResMap *pChunkyResMap  = GetGlobalCChunkyResMap();
+	if ( pChunkyResMap )
+	{
+		pChunkyResMap->RelinquishChunkyRes(m_pChunkyRes, this);
+	}
+#endif
+    
     m_pChunkyRes = NULL;
 
     HX_RELEASE(m_pFileSystem);
@@ -1662,6 +1751,7 @@
  */
 STDMETHODIMP CHTTPFileObject::Read(ULONG32 ulCount)
 {
+    HXLOGL4(HXLOG_HTTP, "CHTTPFileObject::Read");
     HXScopeLock lock(m_pMutex);
 
     HX_RESULT           lResult      = HXR_OK;
@@ -1731,7 +1821,9 @@
 
         while (ulCount > ulCurrentContig && lSocketReadResult == HXR_OK)
         {
+		    m_pMutex->Unlock();
             lSocketReadResult = _DoSomeReadingFromSocket(TRUE);
+		    m_pMutex->Lock();
 
             if (SUCCEEDED(lSocketReadResult))
             {
@@ -1822,6 +1914,8 @@
         _SetCurrentReadPos(ulOffset);
     }
 
+    TrimMemCacheIfNeeded();
+
     /* check if there were any pending reads */
     if (m_bSeekPending || m_bReadPending)
     {
@@ -2020,6 +2114,10 @@
     {
         m_bConvertFailedSeeksToLinear = TRUE;
     }
+    else if (HX_FILEADVISE_NETWORKACCESS == ulInfo)
+    {
+	pnr = HXR_ADVISE_NETWORK_ACCESS;
+    }
 
     return pnr;
 }
@@ -2268,10 +2366,8 @@
             CHXString statusDesc = "Contacting ";
             statusDesc += m_strHost;
             statusDesc += "...";
-            pStatusDesc = new CHXBuffer;
-            pStatusDesc->AddRef();
-            pStatusDesc->Set((UCHAR*)(const char*) statusDesc,
-                             strlen((const char*)statusDesc)+1);
+	    CreateAndSetBufferCCF(pStatusDesc, (UCHAR*)(const char*) statusDesc,
+                             strlen((const char*)statusDesc)+1, m_pContext);
         }
         ulPercentDone   = 0;
     }
@@ -2313,17 +2409,43 @@
  */
 HX_RESULT CHTTPFileObject::_InitializeChunkyRes(const char* url)
 {
+    HXLOGL4(HXLOG_HTTP, "CHTTPFileObject::_InitializeChunkyRes");
+    HX_RESULT theErr = HXR_OK;
+    
     if (!m_pChunkyRes)
     {
+#if !defined(HELIX_CONFIG_NOSTATICS) 
         m_pChunkyRes = g_ChunkyResMap.GetChunkyResForURL(url, this);
-
+#else  
+        CChunkyResMap *pChunkyResMap  = GetGlobalCChunkyResMap();
+    	if ( pChunkyResMap )
+    	{
+    		m_pChunkyRes  = pChunkyResMap->GetChunkyResForURL(url, this, m_pContext);
+    	}
+#endif
+        if(m_pChunkyRes)
+        {
         HXLOGL1(HXLOG_HTTP, "_InitializeChunkyRes(%s) ==> %lx", NULLOK(url), \
m_pChunkyRes);  
-        if (m_bOnServer)
+            if (m_bOnServer || (m_ulMemCacheSize != 0))
         {
             m_pChunkyRes->DisableDiskIO();
-        }
 
+        	    if (m_ulMemCacheSize != 0)
+        	    {
+        		// We set here by how much to trim the memory cache once trimming is \
needed +        		m_ulMemCacheTrimSize = (m_ulMemCacheSize / \
MEM_CACHE_TRIM_THRESHOLD_DENOM); +        					
+        		// Also set when to trigger the mem cache trimming
+        		m_ulMemCacheContigLengthTrimThreshold = (m_ulMemCacheSize / \
MEM_CACHE_TRIM_THRESHOLD_DENOM); +        	    }
+            }
+        }
+        else
+        {
+            HXLOGL1(HXLOG_HTTP, "_InitializeChunkyRes(%s) ==> %lx FAILED", \
NULLOK(url), m_pChunkyRes); +            theErr = HXR_OUTOFMEMORY;
+        }
 #if defined(HELIX_FEATURE_HTTP_GZIP)
         m_pDecoder = new CDecoder;
         if (m_pDecoder && m_pChunkyRes)
@@ -2333,7 +2455,7 @@
 #endif
 
     }
-    return HXR_OK;
+    return theErr;
 }
 
 /************************************************************************
@@ -2347,7 +2469,7 @@
 {
     HX_RESULT       theErr  = HXR_OK;
     HX_RESULT       lResult = HXR_OK;
-    UINT16          un16Temp = 0;
+    UINT16          un16Temp = 1;
     char*           pTemp   = NULL;
     IHXBuffer*      pBuffer = NULL;
     IHXBuffer*      pProxyName = NULL;
@@ -2591,9 +2713,9 @@
 CHTTPFileObject::_OpenFileExt()
 {
     HX_RESULT   theErr = HXR_OK;
-
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE
     CacheSupport_OpenFile();
-
+#endif
     if (m_bCached)
     {
         m_bInitPending = FALSE;
@@ -2717,10 +2839,11 @@
         }
     }
 
+    TrimMemCacheIfNeeded();
 
+    m_pMutex->Unlock();
     _DoSomeReadingFromSocket(TRUE);
 
-    m_pMutex->Unlock();
     HX_RESULT ReadErr = ProcessPendingReads();
     m_pMutex->Lock();
 
@@ -3197,8 +3320,11 @@
                 HX_DELETE(pHXURL);
             }
 
-            IHXValues* pValuesRequestHeaders = new CHXHeader();
-            pValuesRequestHeaders->AddRef();
+            IHXValues* pValuesRequestHeaders = NULL;	    
+	    if (HXR_OK != CreateValuesCCF(pValuesRequestHeaders, m_pContext))
+	    {
+		goto exit;
+	    }
 
             CHXHeader::mergeHeaders(pValuesRequestHeaders, pHeaders);
 
@@ -3529,7 +3655,7 @@
 
 
     m_strRequest += "\r\n\r\n";
-
+    m_nTotalRequestSize = (UINT16)m_strRequest.GetLength();
     HX_VECTOR_DELETE(pOutBuffer);
 
     if (!m_pSocket)
@@ -3577,7 +3703,6 @@
         }
     }
 
-    m_nTotalRequestSize = (UINT16)m_strRequest.GetLength();
 
     HXLOGL2(HXLOG_HTTP, "BeginGet: request size is %lu",m_nTotalRequestSize);
 
@@ -3611,9 +3736,8 @@
             FAILED(m_pOptions->GetPropertyBuffer("Agent", pBuffer)))
         {
             // Finally, fall back to the default User Agent value
-            pBuffer = new CHXBuffer();
-            pBuffer->AddRef();
-            pBuffer->Set((UCHAR*)DEF_USER_AGENT, strlen(DEF_USER_AGENT) + 1);
+	    CreateAndSetBufferCCF(pBuffer, (UCHAR*)DEF_USER_AGENT, 
+				  strlen(DEF_USER_AGENT) + 1, m_pContext);
         }
     }
 
@@ -3770,8 +3894,10 @@
                     bHandleReadImmediately = TRUE;
                 }
                 
+                    m_pMutex->Unlock();
                 _DoSomeReadingFromSocket(bHandleReadImmediately);
                 
+                    m_pMutex->Lock();
                 if (bHandleReadImmediately)
                 {
                     m_pMutex->Unlock();
@@ -3923,11 +4049,10 @@
         }
         else
         {
-            IHXBuffer* pRedirectURL = new CHXBuffer();
+            IHXBuffer* pRedirectURL = NULL;
 
-            pRedirectURL->AddRef();
-            pRedirectURL->Set((const UCHAR*)(const char*)sLocation,
-                sLocation.GetLength()+1);
+	    CreateAndSetBufferCCF(pRedirectURL, (UCHAR*)(const char*)sLocation,
+				  sLocation.GetLength()+1, m_pContext);
 
             if (HXR_NOTIMPL == m_pRedirectResponse->RedirectDone(pRedirectURL))
                 bContinueRedirect = TRUE;
@@ -4025,8 +4150,9 @@
             theErr = _ReOpen();
         }
     }
-
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE
     ProcessCacheCompletions(TRUE);
+#endif    
     return theErr;
 }
 
@@ -4045,11 +4171,6 @@
 
     if (!m_bSeekPending && !m_bByteRangeSeekPending && m_pChunkyRes)
     {
-        // xxxbobclark assert that it either has some data or it's
-        // at the very end of the resource.
-
-        HX_ASSERT((_GetContiguousLength() > 0) || (m_ulCurrentReadPosition == \
                m_nContentSize));
-
         if (m_nContentRead >= m_ulCurrentReadPosition)
         {
             ULONG32 ulLength = _GetContiguousLength();
@@ -4354,13 +4475,6 @@
 
     bShouldReadSocket = FALSE;
 
-    if (bHandleBuffersImmediately && ulPreProcessedAmount > 0)
-    {
-        // as we're being called from Process Idle, we'll
-        // go ahead and process accumulated preprocessed content.
-        bShouldReadSocket = TRUE;
-    }
-
     if (m_ulBufferAheadAmount > 0)
     {
         // if m_ulBufferAheadAmount is nonzero, that will tell how
@@ -4383,6 +4497,11 @@
         bShouldReadSocket = TRUE;
     }
 
+    if (bShouldReadSocket)
+    {
+	bShouldReadSocket = (!IsMemCacheFull());
+    }
+    
     if (bShouldReadSocket && !bHandleBuffersImmediately)
     {
         // if it's NOT processidle and we're starting to accrue too
@@ -4491,13 +4610,19 @@
         }
         else if (HXR_SOCK_ENDSTREAM == retVal)
         {
+            if (!m_bKnowContentSize)
+            {
+                // if "Content-Length" is not set in HTTP Reponse, 
+                // we need to assume we have read all the content if the socket was \
closed by the server. +                SetReadContentsDone(TRUE);
+            }
+
             // normal end of data reached
             if( m_pSocket )
             {
                 m_pSocket->Close();
                 HX_RELEASE(m_pSocket);
                 HXLOGL1(HXLOG_HTTP, "_DoSomeReadingFromSocket END OF STREAM (closing \
                socket)");
-                SetReadContentsDone(TRUE);
 
                 // we should still kick-start a callback, since we may need to \
                process reads
                 // if another owner (like in a surestream file) is reading for us.
@@ -4573,7 +4698,79 @@
     return retVal;
 }
 
+HXBOOL
+CHTTPFileObject::IsMemCacheFull(void)
+{
+    HXBOOL bRetVal = FALSE;
+    
+    if (m_ulMemCacheSize)
+    {
+	bRetVal = ((!m_pChunkyRes) ||
+		   (m_pChunkyRes->GetCurrentMemoryUsage() >= m_ulMemCacheSize));
+    }
+    
+    return bRetVal;
+}
+
+HXBOOL
+CHTTPFileObject::TrimMemCacheIfNeeded(void)
+{
+    HXBOOL bRetVal = FALSE;
+    
+    if (m_pChunkyRes && IsMemCacheFull())
+    {
+	UINT32 ulCurrentContigLength = _GetContiguousLength();
+	UINT32 ulCursorCount = (UINT32) m_pChunkyRes->CountCursors();
+	
+	if (ulCursorCount == 0)
+	{
+	    ulCursorCount = 1;
+	}
+
+	if ((ulCurrentContigLength < (m_ulMemCacheContigLengthTrimThreshold / \
ulCursorCount)) && +	    ((!m_bKnowContentSize) ||
+	     ((m_ulCurrentReadPosition + ulCurrentContigLength) < m_nContentSize)))
+	{
+	    // We do not have enogh contiguous length ahead of the current read positions
+	    // and mem-cache is full thus disallowing more data to be read.
+	    // We must trim the mem-cache
 
+	    // First - make sure to make data ahead of read positions most recent
+	    // to prevent deletion of this data
+	    if (ulCursorCount == 1)
+	    {
+		m_pChunkyRes->TouchRange(m_ulCurrentReadPosition, m_ulMemCacheTrimSize);
+	    }
+	    else
+	    {
+		UINT32 ulCursorIndex;
+		void* pCursorOwner;
+		UINT32 ulCursorLocation;
+	    
+		for (ulCursorIndex = 0; ulCursorIndex < ulCursorCount; ulCursorIndex++)
+		{
+		    ulCursorLocation = 0;
+		    if (SUCCEEDED(m_pChunkyRes->GetNthCursorInformation(ulCursorIndex, \
pCursorOwner, ulCursorLocation))) +		    {
+			m_pChunkyRes->TouchRange(ulCursorLocation, m_ulMemCacheTrimSize / ulCursorCount);
+			if (pCursorOwner)
+			{
+			    CHTTPFileObject* pHTTPFileObject = (CHTTPFileObject*) pCursorOwner;
+			    pHTTPFileObject->m_ulLastKnownEndOfValidContiguousRange = 0;
+			}
+		    }
+		}
+	    }
+	    
+	    m_pChunkyRes->SetMemUsageThreshold(m_ulMemCacheSize - m_ulMemCacheTrimSize);
+	    m_ulLastKnownEndOfValidContiguousRange = 0;
+	    
+	    bRetVal = TRUE;
+	}
+    }
+    
+    return bRetVal;
+}
 
 void
 CHTTPFileObject::_SetCurrentReadPos(UINT32 ulNewCurrentReadPosition)
@@ -4736,6 +4933,9 @@
             IHXBuffer* pServerHeaderBuffer = NULL;
             HX_RESULT retVal = HXR_OK;
 
+            const char* pszHost = GetActualHost();
+            SetCStringPropertyCCF(pResponseHeaders, "_host", pszHost, m_pContext);
+
             // Keep this connection alive?
             pResponseHeaders->GetPropertyCString
             (
@@ -5132,7 +5332,7 @@
         UINT32 ulValue = 0;
         if (pMessage->getHeaderValue("content-length", ulValue))
         {
-            m_nContentSize = ulValue;
+            m_nOriginalContentSize = m_nContentSize = ulValue;
 
             // xxxbobclark the problem is that m_nContentSize is really
             // the content size of this particular GET. And if we're getting
@@ -5157,7 +5357,7 @@
                 if (numFields == 2)
                 {
                     CHXString theDenominator = theContentRange.NthField('/', 2);
-                    m_nContentSize = strtol((const char*)theDenominator, 0, 10);
+                    m_nOriginalContentSize = m_nContentSize = strtol((const \
char*)theDenominator, 0, 10);  }
             }
 
@@ -5172,7 +5372,7 @@
                 m_ulPrgDnTotalFileSize != HX_PROGDOWNLD_UNKNOWN_FILE_SIZE)
         {
             m_bKnowContentSize = TRUE;
-            m_nContentSize = m_ulPrgDnTotalFileSize;
+            m_nOriginalContentSize = m_nContentSize = m_ulPrgDnTotalFileSize;
         }
         else if (m_bKnowContentSize)
         {
@@ -5182,7 +5382,9 @@
 
         if (m_pCacheEntry)
         {
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE          
             CacheSupport_HandleSuccess(pMessage);
+#endif            
         }
 
         // Find the mime type to support mime reporting...
@@ -5376,6 +5578,31 @@
             bLive = TRUE;
         }
     }
+    else if (!m_bKnowHTTPResponseContentSize && !m_bEncoded)
+    {
+        // We add this case because we have encountered live HTTP streams
+        // for which there is no Content-Length, and we have no other
+        // indication that this is a live stream. Currently, httpfsys
+        // uses IsLiveStream to determine two things:
+        // a) If IsLiveStream() == TRUE, then return PREFER_LINEAR to
+        //    the Advise(RANDOM_ACCESS) query. Fileformats use this
+        //    information to know not to seek to the end of the file.
+        // b) If IsLiveStream() == TRUE, then we tell chunky-res to
+        //    throw data away after it has read it once.
+        // For truly live streams, we want to do both (a) and (b). 
+        // However, we may encounter a case that a web server is
+        // mis-configured and does not report a Content-Length for
+        // on-demand files. For such mis-configured web servers, we
+        // really want to do just (a) and not (b). However, we currently
+        // don't have any way to distinguish between these truly
+        // live streams and mis-configured on-demand streams. The
+        // downside to declaring these streams live is that
+        // some data may have to be downloaded twice if the
+        // data needs to be read twice. However, this seems like
+        // a reasonable trade-off, since if a server is mis-configured,
+        // it is expected that clients would have to be less efficient.
+        bLive = TRUE;
+    }
 
     return bLive;
 }
@@ -5538,6 +5765,7 @@
         LOGX((szDbgTemp, "    m_pFilename='%s'", m_pFilename));
         LOGX((szDbgTemp, "    m_pCacheFile='%s'", (char \
*)m_pCacheFile->GetBuffer()));  
+#if !defined(HELIX_CONFIG_NOSTATICS)
         // Create the cache database if need be
         if (g_pCacheEntry == NULL)
         {
@@ -5547,6 +5775,7 @@
         }
         if (m_pCacheEntry == NULL)
             m_pCacheEntry = g_pCacheEntry;
+#endif        
     }
 
     // Strip off any URL parameters and store them
@@ -5872,6 +6101,7 @@
 /*
  * This supplies the bulk of processing needed by the _OpenFile method
  */
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE
 STDMETHODIMP_(void)
 CHTTPFileObject::CacheSupport_InitObject (void)
 {
@@ -6548,7 +6778,7 @@
     return HXR_OK;
 }
 
-
+#endif //HELIX_FEATURE_HTTP_DISABLE_CACHE
 STDMETHODIMP_( void )
 CHTTPFileObject::SetDestinationFile( const char *pFilename )
 {
@@ -7187,8 +7417,7 @@
             pTemp = new char[pCookie->GetSize()];
 
             // Create the final output buffer
-            pFinalBuf = new CHXBuffer();
-            pFinalBuf->AddRef();
+	    CreateBufferCCF(pFinalBuf, m_pContext);
 
             pFinalBuf->SetSize(pCookie->GetSize());
             pFinal = (char*)pFinalBuf->GetBuffer();
@@ -7304,8 +7533,7 @@
         if (*pInput != '!')
         {
             // Copy the real domain into a new buffer
-            pDomain = new CHXBuffer();
-            pDomain->AddRef();
+	    CreateBufferCCF(pDomain, m_pContext);
 
             pDomain->SetSize(ulCookieLen);
             pData = (char*)pDomain->GetBuffer();
@@ -7359,8 +7587,7 @@
                             pInput += 5;
 
                             // Copy the real path into a new buffer
-                            pPath = new CHXBuffer();
-                            pPath->AddRef();
+			    CreateBufferCCF(pPath, m_pContext);
 
                             pPath->SetSize(ulCookieLen);
                             pData = (char*)pPath->GetBuffer();
@@ -7776,7 +8003,9 @@
 
         if (m_pCacheEntry)
         {
+#if !defined HELIX_FEATURE_HTTP_DISABLE_CACHE        
             CacheSupport_ReadDone();
+#endif            
         }
 
         // Saving a copy of the file if appropriate
@@ -8020,8 +8249,14 @@
         //
         if (ulLength >= m_ulMinStartupLengthNeeded)
         {
+#if !defined HELIX_FEATURE_SERVER
             pMessage = (HTTPResponseMessage*) Parser.parse((const char*) szHeader,
                                                            ulHeaderLength);
+#else
+            BOOL bMsgTooLarge = FALSE;
+            pMessage = (HTTPResponseMessage*) Parser.parse((const char*) szHeader,
+                                                           ulHeaderLength, \
bMsgTooLarge); +#endif /* !HELIX_FEATURE_SERVER */
         }
 
         if (pMessage &&
@@ -8089,16 +8324,16 @@
                         pResponseHeaders->AddKeyValue(pHeader->name(),pTmpBuffer);
 
                         // Disable http 1.1 support if the server explicitly says to
-                        if (!strcmpi(pHeader->name(), "Accept-Ranges"))
+                        if (!stricmp(pHeader->name(), "Accept-Ranges"))
                         {
-                            if (!strcmpi((const char*)pTmpBuffer->GetBuffer(), \
"none")) +                            if (!stricmp((const \
char*)pTmpBuffer->GetBuffer(), "none"))  {
                                 bNotAcceptRanges = TRUE;
                             }
                         }
-                        else if (!strcmpi(pHeader->name(), "Server"))
+                        else if (!stricmp(pHeader->name(), "Server"))
                         {
-                            if (!strcmpi((const char*)pTmpBuffer->GetBuffer(), \
REALSERVER_RESPONSE_NAME)) +                            if (!stricmp((const \
char*)pTmpBuffer->GetBuffer(), REALSERVER_RESPONSE_NAME))  {
                                 bRealServer = TRUE;
                             }
@@ -8635,6 +8870,27 @@
     return theErr;
 }
 
+unsigned long
+CHTTPFileObject::GetMaxChunkSizeAccepted()
+{
+    INT32 max = LARGEST_CHUNK_SIZE_WE_ACCEPT;
+    if (m_pRegistry)
+    {
+        if (HXR_OK != m_pRegistry->GetIntByName(
+                LARGEST_CHUNK_SIZE_WE_ACCEPT_CONFIG_KEY, max))
+        {
+            max = LARGEST_CHUNK_SIZE_WE_ACCEPT;
+        }
+
+        if (max < 0)
+        {
+          max = LARGEST_CHUNK_SIZE_WE_ACCEPT;
+        }
+    }
+
+    return max;
+}
+
 #ifdef HELIX_FEATURE_HTTPFSYS_MEM_GROWTH_LIMIT
 
 HX_RESULT
Index: httpfsys.h
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.h,v
retrieving revision 1.34
diff -w -u -b -r1.34 httpfsys.h
--- httpfsys.h	11 Oct 2005 22:22:05 -0000	1.34
+++ httpfsys.h	5 Feb 2008 22:47:22 -0000
@@ -60,8 +60,10 @@
 #include "hxauto.h"
 #include "hxpac.h"
 #include "hxnet.h"
-
+#include "hxplugncompat.h"
 #include "miscsp.h"
+#include "hxthread.h"   // HXMutex
+#include "baseobj.h"
 
 
 /* forward decl. */
@@ -103,10 +105,12 @@
 #define DEFAULT_CHUNK_SIZE 1024 //default size of chunk buffer
 
 #ifdef HELIX_FEATURE_HTTPFSYS_MEM_GROWTH_LIMIT
-
-#define CHUNK_RES_MEM_FLOOR     512000  //512 KB
-#define CHUNK_RES_MEM_CEILING   1000000 // 1MB
-
+# if !defined(CHUNK_RES_MEM_FLOOR)
+#   define CHUNK_RES_MEM_FLOOR     512000
+# endif
+# if !defined(CHUNK_RES_MEM_CEILING)
+#   define CHUNK_RES_MEM_CEILING   1000000
+# endif
 #endif //HELIX_HTTPFSYS_MEM_GROWTH_LIMIT
 
 typedef enum
@@ -121,6 +125,7 @@
 {
     unsigned long    size;
     unsigned long    read;
+    unsigned long    maxChunkSizeAccepted;
     HXBOOL             lastchunk;
     CEState          state;
     char*            buf;
@@ -133,7 +138,7 @@
 public:
     CChunkyResMap();
     virtual ~CChunkyResMap();
-    CChunkyRes* GetChunkyResForURL(const char* pURL, void* pCursorOwner);
+    CChunkyRes* GetChunkyResForURL(const char* pURL, void* pCursorOwner, IUnknown* \
pContext);  void RelinquishChunkyRes(CChunkyRes* pChunkyRes, void* pCursorOwner);
 
 private:
@@ -156,7 +161,9 @@
 class CHTTPFileSystem : public CUnknownIMP,
                        public IHXPlugin,
                        public IHXFileSystemObject,
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)                       
                        public IHXFileSystemCache,
+#endif                       
                        public IHXHTTPAutoStream
 {
     DECLARE_UNKNOWN(CHTTPFileSystem)
@@ -222,11 +229,12 @@
 
     STDMETHOD(CreateDir)        (THIS_
                                 IUnknown**     /*OUT*/     ppDirObject);
-
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)
     // IHXFileSystemCache methods...
     STDMETHOD (RefreshCache) (THIS);
     STDMETHOD (EmptyCache) (THIS);
     STDMETHOD (MoveCache) (THIS_ const char *path);
+#endif    
 
     // IHXHTTPAutoStream methods...
     STDMETHOD_( void, SetDestinationFile) ( THIS_ const char *pFilename );
@@ -235,15 +243,19 @@
 private:
     IUnknown*                   m_pContext;
     IHXValues*                  m_pOptions;
-    static const char*          zm_pDescription;
-    static const char*          zm_pCopyright;
-    static const char*          zm_pMoreInfoURL;
-    static const char*          zm_pShortName;
-    static const char*          zm_pProtocol;
-
+    static const char* const         zm_pDescription;
+    static const char* const         zm_pCopyright;
+    static const char* const         zm_pMoreInfoURL;
+    static const char* const        zm_pShortName;
+    static const char* const         zm_pProtocol;
+#if !defined(_SYMBIAN)
     // Autostreaming support
     static HXBOOL                 m_bSaveNextStream;
     static CHXString            m_SaveFileName;
+#else    
+    HXBOOL                 m_bSaveNextStream;
+	CHXString            m_SaveFileName;
+#endif	
 };
 
 /////////////////////////////////////////////////////////////////////////////
@@ -536,7 +548,7 @@
         HX_RESULT   HX_RESULTStatus,
         IHXRequest* pIHXRequestResponse
     );
-
+#if !defined(HELIX_FEATURE_HTTP_DISABLE_CACHE)
     // Support for cache
     STDMETHOD_ (IHXBuffer*, CreateBufferFromValues)     (THIS_ IHXValues /*IN*/ \
                *pHeaderValues);
     STDMETHOD_ (IHXValues*, CreateValuesFromBuffer)     (THIS_ IHXBuffer *pBuffer);
@@ -545,7 +557,7 @@
     STDMETHOD_ (void,        CacheSupport_ReadDone)      (THIS);
     STDMETHOD_ (void,        CacheSupport_HandleSuccess) (THIS_ HTTPResponseMessage* \
                pMessage);
     STDMETHOD  (ProcessCacheCompletions)                 (THIS_ HXBOOL bRedirected);
-
+#endif
     // Support for autostreaming
     STDMETHOD_( void, SetDestinationFile) ( THIS_ const char *pFilename );
 
@@ -667,6 +679,9 @@
     HX_RESULT       HandleSocketRead(HX_RESULT status, IHXBuffer* pBuffer);
     HX_RESULT       HandleHeaderRead(IHXBuffer* pBuffer);
 
+    // MemCache handling
+    HXBOOL	    IsMemCacheFull(void);
+    HXBOOL	    TrimMemCacheIfNeeded(void);
 
     // Error reporting
     void            ReportDNSFailure        ();
@@ -683,6 +698,8 @@
 				 UINT32 ulMetaDataSegmentSize,
 				 UINT32 ulMetaDataSegmentReach,
 				 UINT32 ulMetaDataSize);
+
+    unsigned long   GetMaxChunkSizeAccepted();
     HX_RESULT       DecodeChunkedEncoding(HTTPChunkedEncoding*& pChunkedEncoding,
                                           const char*           pChunk,
                                           int                   l);
@@ -691,6 +708,7 @@
 
     friend class HTTPFileObjCallback;
     friend class HTTPTCPResponse;
+    friend class CChunkyResMap;
 
     HX_RESULT                   m_LastError;
 
@@ -734,6 +752,7 @@
     HXBOOL                        m_bTCPReadPending;
     HTTPTCPResponse*            m_pTCPResponse;
 
+
     char*                       m_szBaseURL;
 
     char*                       m_pFilename;
@@ -767,6 +786,10 @@
     ULONG32                     m_ulCurrentReadPosition;
     UINT32                      m_ulLastKnownEndOfValidContiguousRange;
 
+    UINT32			m_ulMemCacheSize;
+    UINT32			m_ulMemCacheContigLengthTrimThreshold;
+    UINT32			m_ulMemCacheTrimSize;
+
 #if defined(HELIX_FEATURE_HTTP_GZIP)
     CDecoder*                   m_pDecoder;
 #else
@@ -786,7 +809,6 @@
 
     CHXSimpleList               m_PendingReadList;
     CHXSimpleList               m_PreProcessedReadBuffers;
-    static CHXSimpleList        zm_pList;
 
     int                         m_nPort;
 
@@ -851,6 +873,7 @@
 
     HXBOOL                        m_bKnowContentSize;
     ULONG32                     m_nContentSize;
+    ULONG32                     m_nOriginalContentSize;
     HXBOOL                        m_bEncoded;
 
     HXBOOL                        m_bChunkedEncoding;


["updated_source.zip" (application/x-zip-compressed)]

_______________________________________________
Filesystem-dev mailing list
Filesystem-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/filesystem-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic