OpenWrt Forum Archive

Topic: [SOLVED?] Can't get polipo to use a disk cache...

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I was pleased to see polipo updated to v1.1.1 recently, so I thought I'd give it another go!

I have used it before without problems, but this time I can't get it to use a disk cache.  I am sure I'm doing something simple wrong, but for the life of me I just can't see it!!  Maybe someone could glance at my configuration and point out my stupidity?

Here is some debugging information:

root@openwrt:/# ps -w | grep polipo
 3265 root      3220 S    /usr/sbin/polipo -c /var/etc/polipo.conf
14759 root      1356 S    grep polipo

root@openwrt:/# cat /var/etc/polipo.conf
### AUTOGENERATED CONFIGURATION
### DO NOT EDIT
### SEE /etc/config/polipo INSTEAD

### SECTION daemon
pidFile = "/var/run/polipo.pid"
daemonise = true

### SECTION general
proxyAddress = "0.0.0.0"
chunkHighMark = 2097152
logLevel = 0x2F
proxyPort = 8123
dnsMaxTimeout = 15
dnsQueryIPv6 = false
dnsUseGethostbyname = false
disableIndexing = false
disableServersList = false
logSyslog = true
allowedClients = "127.0.0.1", "172.16.0.0/12"

### SECTION cache
diskCacheTruncateTime = 3333d
diskCacheUnlinkTime = 9999d
cacheIsShared = true

### SECTION pmm

### VALUES THAT ARE DISABLED WHEN EMPTY
diskCacheRoot = "/opt/var/cache/polipo"
logFile = "/var/polipo.log"
localDocumentRoot = ""

root@openwrt:/# ls -al /opt/var/cache/polipo
drwxrwxrwx    2 root     root          4096 Jul 21 16:11 .
drwxr-xr-x    4 root     root          4096 Jul 20 22:28 ..

On http://172.27.0.1:8123/polipo/servers?, I can see the server list, and on http://172.27.0.1:8123/polipo/status?, I can see the objects in memory (and objects are being 'superseded' in the log).

However, http://172.27.0.1:8123/polipo/index? is empty, and if I click on Write out in-memory cache via http://172.27.0.1:8123/polipo/status?, nothing happens.

There are no helpful messages in the log file:

root@openwrt:/# rm /var/polipo.log
root@openwrt:/# /etc/init.d/polipo restart
root@openwrt:/# cat /var/polipo.log
Established listening socket on port 8123.

Any ideas?

(Last edited by zxdavb on 25 Sep 2014, 08:34)

same here on latest trunk (x86-32)

This is apparently a known bug - in my case, the devs lost interest with all the sheanigans over old/packages & stuff that have been going on, and I gave up, but since then:

On 18 September 2014 01:25, <crypto@xxx.at> wrote:
Hello.

I am running Polipo from Git master branch, and realized that the cache entries are not being written to disk.

I guess the regression has happened on commit:

2005534 - use checkRoot() which also handles WIN32 paths correctly (4 months ago) <xnoreq>

More specifically, in this hunk:

@@ -369,12 +368,7 @@ urlDirname(char *buf, int n, const char *url, int len)
     if(lwrcmp(url, "http://", 7) != 0)
         return -1;

-    if(diskCacheRoot == NULL ||
-       diskCacheRoot->length <= 0
-#ifndef WIN32
-       || diskCacheRoot->string[0] != '/'
-#endif
-       )
+    if(checkRoot(localDocumentRoot) <= 0)
         return -1;

     if(n <= diskCacheRoot->length)


I reverted this commit and the problem seems to be gone.

Thanks!

_______________________________________________
Polipo-users mailing list
Polipo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/polipo-users

Note that I have not checked this patch myself.

(Last edited by zxdavb on 25 Sep 2014, 08:36)

After reviewing the patch that caused the error, a workaround is to set localDocumentRoot to a valid directory (which can be empty), for example:

uci set polipo.general.localDocumentRoot=/opt/var/share/polipo/www/
uci commit
/etc/init.d/polipo reload

At least it worked for me.

My first patch!

@@ -368,7 +368,7 @@ urlDirname(char *buf, int n, const char
     if(lwrcmp(url, "http://", 7) != 0)
         return -1;

-    if(checkRoot(localDocumentRoot) <= 0)
+    if(checkRoot(diskCacheRoot) <= 0)
         return -1;

     if(n <= diskCacheRoot->length)
zxdavb wrote:

After reviewing the patch that caused the error, a workaround is to set localDocumentRoot to a valid directory (which can be empty), for example:

uci set polipo.general.localDocumentRoot=/opt/var/share/polipo/www/
uci commit
/etc/init.d/polipo reload

At least it worked for me.


Thanks for your efforts on this and the work around!
I have made a build based on the BB stable release (r46516) and the bug is still there.

zxdavb wrote:

After reviewing the patch that caused the error, a workaround is to set localDocumentRoot to a valid directory (which can be empty), for example:


At least it worked for me.

And yesterday I've  searched for this solution for many hours... finally I found it by myself, but... I'm using an up to date Chaks Calmer. Why isn't it fixed yet? sad
It is a very big sec.hole IMHO.  I can use disk cache, only after allowing the web server, which gives a simple admin interface as a side effect, without any authentication/authorization.
I'm more and more frustrated because of quality of openwrt packages. sad

The discussion might have continued from here.