~ubuntu-branches/ubuntu/quantal/apt-cacher-ng/quantal-backports

« back to all changes in this revision

Viewing changes to source/showinfo.cc

  • Committer: Package Import Robot
  • Author(s): Eduard Bloch
  • Date: 2011-11-26 13:09:45 UTC
  • mfrom: (1.1.30) (29.1.18 sid)
  • Revision ID: package-import@ubuntu.com-20111126130945-acifclz6ksfl8607
Tags: 0.6.10-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
 
60
60
        string contents;
61
61
        filereader fr;
62
 
        if(!fr.OpenFile(acfg::confdir+SZPATHSEP+m_sFileName))
 
62
        if(fr.OpenFile(acfg::confdir+SZPATHSEP+m_sFileName) ||
 
63
                        (!acfg::suppdir.empty() && fr.OpenFile(acfg::suppdir+SZPATHSEP+m_sFileName)))
 
64
        {
 
65
                contents.assign(fr.GetBuffer(), fr.GetSize());
 
66
                ModContents(contents, cmd);
 
67
        }
 
68
        else
 
69
        {
63
70
                contents="Information about APT configuration not available, "
64
71
                                "please contact the system administrator.";
65
 
        else
66
 
        {
67
 
                contents.assign(fr.GetBuffer(), fr.GetSize());
68
 
                ModContents(contents, cmd);
69
72
        }
70
73
        tSS buf(1023);
71
74
        buf << "HTTP/1.1 " << (m_sHttpCode ? m_sHttpCode : "200")
76
79
        SendRawData(contents.data(), contents.length(), 0);
77
80
}
78
81
 
79
 
 
80
82
void tDeleter::ModContents(mstring & contents, cmstring &cmd)
81
83
{
82
84
#define BADCHARS "<>\"'|\t"
88
90
                contents.clear();
89
91
                return;
90
92
        }
91
 
        tStrVec toks, files;
 
93
        tStrVec files;
92
94
        bool bConfirmMode(stmiss==cmd.find("doDeleteYes"));
93
95
        tSS sHidParms;
 
96
        mstring params(cmd, qpos+1);
94
97
 
95
 
        Tokenize(cmd.substr(qpos+1), "&", toks);
96
 
        for(tStrVecIterConst it=toks.begin(); it!=toks.end(); it++)
 
98
        for(tSplitWalk split(&params, "&"); split.Next();)
97
99
        {
98
100
                char *sep(0);
99
 
                if(startsWithSz(*it, "kf")
100
 
                                && strtoul(it->c_str()+2, &sep, 10)>0
 
101
                mstring tok(split);
 
102
                if(startsWithSz(tok, "kf")
 
103
                                && strtoul(tok.c_str()+2, &sep, 10)>0
101
104
                                && sep && '=' == *sep)
102
105
                {
103
106
                        files.push_back(UrlDecode(sep+1));