This file is indexed.

/usr/share/doc/libkyototycoon2/example/kthttpex.cc is in kyototycoon-doc 0.9.56-1build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <kthttp.h>

using namespace std;
using namespace kyototycoon;

// the flag whether the server is alive
HTTPServer* g_serv = NULL;

// stop the running server
static void stopserver(int signum) {
  if (g_serv) g_serv->stop();
  g_serv = NULL;
}

// main routine
int main(int argc, char** argv) {

  // set the signal handler to stop the server
  setkillsignalhandler(stopserver);

  // prepare the worker
  class Worker : public HTTPServer::Worker {
    int32_t process(HTTPServer* serv, HTTPServer::Session* sess,
                    const string& path, HTTPClient::Method method,
                    const map<string, string>& reqheads,
                    const string& reqbody,
                    map<string, string>& resheads,
                    string& resbody,
                    const map<string, string>& misc) {
      // echo back the input data
      for (map<string, string>::const_iterator it = reqheads.begin();
           it != reqheads.end(); it++) {
        if (!it->first.empty()) resbody.append(it->first + ": ");
        resbody.append(it->second + "\n");
      }
      resbody.append(reqbody);
      // return the status code
      return 200;
    }
  };
  Worker worker;

  // prepare the server
  HTTPServer serv;
  serv.set_network("127.0.0.1:1978", 1.0);
  serv.set_worker(&worker, 4);
  g_serv = &serv;

  // start the server and block until its stop
  serv.start();

  // clean up connections and other resources
  serv.finish();

  return 0;
}