proglog

主にプログラミングに関する断片的メモ

Polipo 1.0.5 (unreleased)をビルドしたメモ

tdm-gcc 4.5.1で。

用意するもの

正規表現ライブラリregexがないとforbiddenの設定が全て効かないらしい。
正規表現を使った設定だけじゃなくて。
そこで 猫科研究所(felid labo) - GNU regex, regex2.dllを参考にして MinGW - Minimalist GNU for Windows - Browse /UserContributed/regex/mingw-regex-2.5.1 at SourceForge.netから

  • mingw-libgnurx-2.5.1-dev.tar.gz
  • mingw-libgnurx-2.5.1-bin.tar.gz

をもらってきくる。
.aと.hは、mingwのデフォルトのライブラリと、インクルードファイルのとこに入れた。
後者のdllは実行時に必要なので、出来上がったpolipo.exeのディレクトリに。

Polipo ― a caching web proxyのソースは、公式の記述通り、gitで取得。

準備

makefilemingw用、regexありに設定

EXTRA_DEFINES=-DHAVE_REGEX
EXE=.exe
LDLIBS = -lwsock32 -lregex
CC=gcc

追加でなんとなく

なんとなくPOSIX pathというか、先頭が"/"でないパス指定を弾くような感じなので、いくつかの該当箇所をコメントアウトしてちょっと変えておいた。


forbidden.c

initForbidden(void)
{
    redirectorKill();
/*
    if(forbiddenFile)
        forbiddenFile = expandTilde(forbiddenFile);

    if(forbiddenFile == NULL) {
        forbiddenFile = expandTilde(internAtom("~/.polipo-forbidden"));
        if(forbiddenFile) {
            if(access(forbiddenFile->string, F_OK) < 0) {
                releaseAtom(forbiddenFile);
                forbiddenFile = NULL;
            }
        }
    }
*/
    if(forbiddenFile == NULL) {
      if(access(".\\forbidden", F_OK) >= 0)
          /*  forbiddenFile = internAtom("/etc/polipo/forbidden"); */
            forbiddenFile = internAtom(".\\forbidden");
    }

カレントから探してくれればいいや、って感じ。


diskcache.cが2ヶ所

static int
checkRoot(AtomPtr root)
{
    struct stat ss;
    int rc;

    if(!root || root->length == 0)
        return 0;

/*    if(root->string[0] != '/') {
        return -2;
    }
*/
static int
urlDirname(char *buf, int n, const char *url, int len)
{
    int i, j;
    if(len < 8)
        return -1;
    if(memcmp(url, "http://", 7) != 0)
        return -1;

    if(diskCacheRoot == NULL ||
/*       diskCacheRoot->length <= 0 || diskCacheRoot->string[0] != '/') */
       diskCacheRoot->length <= 0)

POSIX式のルートディレクトリチェックをコメントアウト


で、makeして出来上がったものを solipo経由で。


なんとなく動いているのでしばらく様子見。