You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Tacio A.G. Santos" <sa...@fokus.gmd.de> on 2002/05/23 13:49:16 UTC

httpd-2.0.36 - mod_cache problems

Hi,
   I'm trying to configure mod_cache+mod_proxy, but mod_cache is not 
working properly. One thing i found strange is that if you look in the 
cache directory we have the following strange file permissions:

-rw-------    1 webu     webg         2326 May 22 16:41 wkL1JcPol1pQ.data
----------    1 webu     webg          355 May 22 16:41 
wkL1JcPol1pQ.header

If we manually changed it (chmod 600 *) the file is served from disk
(cache) otherwise apache gets it again from the originating server.
Another problem is that even if it gets from the cache it somehow 
changes the Content-Type header to text/plain so the browser shows the 
html source file instead of rendering the page.

This test was also performed using the latest (actually yesterday 
version) httpd2 cvs version.

I've started attaching a debugger and digging into the code but i do 
need some help. Could someone point me where can i get more info about 
mod_cache?
Have i overlooked some simple thing? Does anybody have a suggestion 
what else should i try?

Thanks in advance,

Tacio


PS: I configure it with:
./configure  --prefix=/home2/apps/web/apache2 --enable-proxy=shared \
    --enable-proxy-connect=shared  --enable-proxy-ftp=shared \
    --enable-proxy-http=shared --enable-cache=shared 
--enable-disk-cache=shared \
    --enable-mem-cache=shared  2>&1> log_configure.txt

In my httpd.conf i have:

<IfModule mod_proxy.c>
ProxyRequests On
<Proxy *>
     Order deny,allow
     Deny from all
     Allow from .fokus.gmd.de sitak localhost localhost.ailab.fokus.gmd.de
</Proxy>
ProxyVia On
<IfModule mod_cache.c>
    CacheOn On
    <IfModule mod_disk_cache.c>
    CacheRoot /home2/apps/web/apache2/proxy
    CacheSize 4096
    CacheEnable disk /
    CacheDirLevels 1
    CacheDirLength 5
    </IfModule>
   </IfModule>
</IfModule>







Re: httpd-2.0.36 - mod_cache problems

Posted by Jeff Trawick <tr...@attglobal.net>.
"Tacio A.G. Santos" <sa...@fokus.gmd.de> writes:

> Thanks ,
>    It solved the problem with file permission, but there's still a
> problem with the content type.

Thanks for the quick feedback on my simple fix.  Hopefully the smart
people can help you with the content type problem.

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: httpd-2.0.36 - mod_cache problems

Posted by "Tacio A.G. Santos" <sa...@fokus.gmd.de>.
Hi,
   Why do we need to set the content type at cache_storage.c at line 
240, i just commented it out and it seems to be working. Sorry about 
my ignorance, but may it cause a side effect?
Thanks,
Tacio

PS:
  diff -u cache_storage.c-orig cache_storage.c
--- cache_storage.c-orig        Thu May 23 17:33:31 2002
+++ cache_storage.c     Thu May 23 17:32:59 2002
@@ -237,7 +237,7 @@
          return rv;
      }

-    ap_set_content_type(r, apr_pstrdup(r->pool, info->content_type));
+    /*ap_set_content_type(r, apr_pstrdup(r->pool, info->content_type));*/
      r->filename = apr_pstrdup(r->pool, info->filename );

      return APR_SUCCESS;





Tacio A.G. Santos wrote:
> Thanks ,
>   It solved the problem with file permission, but there's still a 
> problem with the content type.
> For example getting a index.html file i get in the first request:
> 
> 2 Date: Thu, 23 May 2002 14:14:46 GMT
> 3 Server: Apache/1.3.23 (Unix) mod_perl/1.26
> 4 Content-Location: index.html.en
> 5 Vary: negotiate,accept-language,accept-charset
> 6 TCN: choice
> 7 Last-Modified: Tue, 23 Apr 2002 14:56:35 GMT
> 8 ETag: "6cb4-5b1-3cc57623;3cc57623"
> 9 Accept-Ranges: bytes
> 10 Content-Type: text/html; charset=ISO-8859-1
> 11 Content-Language: en
> 12 Via: 1.0 sitak:8080
> 13 Content-Length: 1457
> 14 Connection: close
> 
> If i try to get it again the following headers are returned:
> 
> 
> 2 Date: Thu, 23 May 2002 14:21:24 GMT
> 3 Server: Apache/1.3.23 (Unix) mod_perl/1.26
> 4 Content-Location: index.html.en
> 5 Vary: negotiate,accept-language,accept-charset
> 6 TCN: choice
> 7 ETag: "6cb4-5b1-3cc57623;3cc57623"
> 8 Accept-Ranges: bytes
> 9 Content-Language: en
> 10 Via: 1.0 sitak:8080
> 11 Last-Modified: Tue, 23 Apr 2002 14:56:35 GMT
> 12 Content-Type: text/plain; charset=ISO-8859-1
> 13 Content-Length: 1457
> 14 Connection: close
> 
> 
> It just changed the Content-Type to text/plain. It also happens with 
> image files. Somehow mod_cache is not taking into account the 
> Content-Type written in the respective cache header file. Does anybody 
> know where is it set?
> 
> Thanks again,
> Tacio
> 
> 
> Jeff Trawick wrote:
> 
>> "Tacio A.G. Santos" <sa...@fokus.gmd.de> writes:
>>
>>
>>> Hi,
>>>   I'm trying to configure mod_cache+mod_proxy, but mod_cache is not
>>> working properly. One thing i found strange is that if you look in the
>>> cache directory we have the following strange file permissions:
>>>
>>> -rw-------    1 webu     webg         2326 May 22 16:41 
>>> wkL1JcPol1pQ.data
>>> ----------    1 webu     webg          355 May 22 16:41
>>> wkL1JcPol1pQ.header
>>
>>
>>
>> Perhaps you could try this patch?
>>
>> Index: mod_disk_cache.c
>> ===================================================================
>> RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_disk_cache.c,v
>> retrieving revision 1.33
>> diff -u -r1.33 mod_disk_cache.c
>> --- mod_disk_cache.c    17 May 2002 11:33:09 -0000    1.33
>> +++ mod_disk_cache.c    23 May 2002 11:59:03 -0000
>> @@ -548,7 +548,7 @@
>>  
>>          rv = apr_file_open(&dobj->hfd, dobj->hdrsfile,
>>                             APR_WRITE | APR_CREATE | APR_EXCL,
>> -                           0, r->pool);
>> +                           APR_OS_DEFAULT, r->pool);
>>          if (rv != APR_SUCCESS) {
>>              return rv;
>>          }
>>
>> Thanks,
>>
>> Jeff
> 
> 
> 
> 



-- 
Tacio A.G. dos Santos                    E-mail: santos@fokus.gmd.de
FhI FOKUS / Global Networking (GloNe)    Tel: +49-30-3463-7154
Kaiserin-Augusta-Allee 31                Fax: +49-30-3463-8287
D-10589 Berlin, Germany


Re: httpd-2.0.36 - mod_cache problems

Posted by "Tacio A.G. Santos" <sa...@fokus.gmd.de>.
Thanks ,
   It solved the problem with file permission, but there's still a 
problem with the content type.
For example getting a index.html file i get in the first request:

2 Date: Thu, 23 May 2002 14:14:46 GMT
3 Server: Apache/1.3.23 (Unix) mod_perl/1.26
4 Content-Location: index.html.en
5 Vary: negotiate,accept-language,accept-charset
6 TCN: choice
7 Last-Modified: Tue, 23 Apr 2002 14:56:35 GMT
8 ETag: "6cb4-5b1-3cc57623;3cc57623"
9 Accept-Ranges: bytes
10 Content-Type: text/html; charset=ISO-8859-1
11 Content-Language: en
12 Via: 1.0 sitak:8080
13 Content-Length: 1457
14 Connection: close

If i try to get it again the following headers are returned:


2 Date: Thu, 23 May 2002 14:21:24 GMT
3 Server: Apache/1.3.23 (Unix) mod_perl/1.26
4 Content-Location: index.html.en
5 Vary: negotiate,accept-language,accept-charset
6 TCN: choice
7 ETag: "6cb4-5b1-3cc57623;3cc57623"
8 Accept-Ranges: bytes
9 Content-Language: en
10 Via: 1.0 sitak:8080
11 Last-Modified: Tue, 23 Apr 2002 14:56:35 GMT
12 Content-Type: text/plain; charset=ISO-8859-1
13 Content-Length: 1457
14 Connection: close


It just changed the Content-Type to text/plain. It also happens with 
image files. Somehow mod_cache is not taking into account the 
Content-Type written in the respective cache header file. Does anybody 
know where is it set?

Thanks again,
Tacio


Jeff Trawick wrote:
> "Tacio A.G. Santos" <sa...@fokus.gmd.de> writes:
> 
> 
>>Hi,
>>   I'm trying to configure mod_cache+mod_proxy, but mod_cache is not
>>working properly. One thing i found strange is that if you look in the
>>cache directory we have the following strange file permissions:
>>
>>-rw-------    1 webu     webg         2326 May 22 16:41 wkL1JcPol1pQ.data
>>----------    1 webu     webg          355 May 22 16:41
>>wkL1JcPol1pQ.header
> 
> 
> Perhaps you could try this patch?
> 
> Index: mod_disk_cache.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_disk_cache.c,v
> retrieving revision 1.33
> diff -u -r1.33 mod_disk_cache.c
> --- mod_disk_cache.c	17 May 2002 11:33:09 -0000	1.33
> +++ mod_disk_cache.c	23 May 2002 11:59:03 -0000
> @@ -548,7 +548,7 @@
>  
>          rv = apr_file_open(&dobj->hfd, dobj->hdrsfile,
>                             APR_WRITE | APR_CREATE | APR_EXCL,
> -                           0, r->pool);
> +                           APR_OS_DEFAULT, r->pool);
>          if (rv != APR_SUCCESS) {
>              return rv;
>          }
> 
> Thanks,
> 
> Jeff



Re: httpd-2.0.36 - mod_cache problems

Posted by Jeff Trawick <tr...@attglobal.net>.
"Tacio A.G. Santos" <sa...@fokus.gmd.de> writes:

> Hi,
>    I'm trying to configure mod_cache+mod_proxy, but mod_cache is not
> working properly. One thing i found strange is that if you look in the
> cache directory we have the following strange file permissions:
> 
> -rw-------    1 webu     webg         2326 May 22 16:41 wkL1JcPol1pQ.data
> ----------    1 webu     webg          355 May 22 16:41
> wkL1JcPol1pQ.header

Perhaps you could try this patch?

Index: mod_disk_cache.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_disk_cache.c,v
retrieving revision 1.33
diff -u -r1.33 mod_disk_cache.c
--- mod_disk_cache.c	17 May 2002 11:33:09 -0000	1.33
+++ mod_disk_cache.c	23 May 2002 11:59:03 -0000
@@ -548,7 +548,7 @@
 
         rv = apr_file_open(&dobj->hfd, dobj->hdrsfile,
                            APR_WRITE | APR_CREATE | APR_EXCL,
-                           0, r->pool);
+                           APR_OS_DEFAULT, r->pool);
         if (rv != APR_SUCCESS) {
             return rv;
         }

Thanks,

Jeff
-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...