This file is indexed.

/usr/share/doc/libpion-doc/html/_allow_nothing_service_8cpp_source.html is in libpion-doc 5.0.6+dfsg-1build1.

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>pion: services/AllowNothingService.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    </ul>
  </div>
<h1>services/AllowNothingService.cpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// ---------------------------------------------------------------------</span>
<a name="l00002"></a>00002 <span class="comment">// pion:  a Boost C++ framework for building lightweight HTTP interfaces</span>
<a name="l00003"></a>00003 <span class="comment">// ---------------------------------------------------------------------</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2014 Splunk Inc.  (https://github.com/splunk/pion)</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment">// Distributed under the Boost Software License, Version 1.0.</span>
<a name="l00007"></a>00007 <span class="comment">// See http://www.boost.org/LICENSE_1_0.txt</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;AllowNothingService.hpp&quot;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;pion/config.hpp&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;pion/http/response_writer.hpp&gt;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="keyword">using namespace </span>pion;
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="keyword">namespace </span>pion {        <span class="comment">// begin namespace pion</span>
<a name="l00017"></a>00017 <span class="keyword">namespace </span>plugins {     <span class="comment">// begin namespace plugins</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019     
<a name="l00020"></a><a class="code" href="classpion_1_1plugins_1_1_allow_nothing_service.html#ad2d81ee952406b541dae3c482cd564a9">00020</a> <span class="keywordtype">void</span> <a class="code" href="classpion_1_1plugins_1_1_allow_nothing_service.html#ad2d81ee952406b541dae3c482cd564a9">AllowNothingService::operator()</a>(http::request_ptr&amp; http_request_ptr, tcp::connection_ptr&amp; tcp_conn)
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022     <span class="keyword">static</span> <span class="keyword">const</span> std::string DENY_HTML = <span class="stringliteral">&quot;&lt;html&gt;&lt;body&gt;No, you can&apos;t.&lt;/body&gt;&lt;/html&gt;&quot;</span>;
<a name="l00023"></a>00023     http::response_writer_ptr writer(<a class="code" href="classpion_1_1http_1_1response__writer.html#a75084960d3162f724342ae947e7d07e3">http::response_writer::create</a>(tcp_conn, *http_request_ptr,
<a name="l00024"></a>00024                                                             boost::bind(&amp;<a class="code" href="classpion_1_1tcp_1_1connection.html#aa7ff7a6d8325c9cbfb026c1a441523fe">tcp::connection::finish</a>, tcp_conn)));
<a name="l00025"></a>00025     writer-&gt;get_response().set_status_code(http::types::RESPONSE_CODE_METHOD_NOT_ALLOWED);
<a name="l00026"></a>00026     writer-&gt;get_response().set_status_message(http::types::RESPONSE_MESSAGE_METHOD_NOT_ALLOWED);
<a name="l00027"></a>00027 
<a name="l00028"></a>00028     <span class="comment">// This is a legitimate header, but it crashes when it&apos;s sent.</span>
<a name="l00029"></a>00029     <span class="comment">//writer-&gt;get_response().add_header(&quot;Allow&quot;, &quot;&quot;);</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031     <span class="comment">// Use this line to demonstrate that it&apos;s the empty header value that&apos;s causing the problem.</span>
<a name="l00032"></a>00032     writer-&gt;get_response().add_header(<span class="stringliteral">&quot;Allow&quot;</span>, <span class="stringliteral">&quot;GET&quot;</span>);
<a name="l00033"></a>00033 
<a name="l00034"></a>00034     writer-&gt;write_no_copy(DENY_HTML);
<a name="l00035"></a>00035     writer-&gt;write_no_copy(http::types::STRING_CRLF);
<a name="l00036"></a>00036     writer-&gt;write_no_copy(http::types::STRING_CRLF);
<a name="l00037"></a>00037     writer-&gt;send();
<a name="l00038"></a>00038 }
<a name="l00039"></a>00039 
<a name="l00040"></a>00040     
<a name="l00041"></a>00041 }   <span class="comment">// end namespace plugins</span>
<a name="l00042"></a>00042 }   <span class="comment">// end namespace pion</span>
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 
<a name="l00046"></a>00046 <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> PION_PLUGIN <a class="code" href="classpion_1_1plugins_1_1_allow_nothing_service.html">pion::plugins::AllowNothingService</a> *pion_create_AllowNothingService(<span class="keywordtype">void</span>)
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classpion_1_1plugins_1_1_allow_nothing_service.html">pion::plugins::AllowNothingService</a>();
<a name="l00049"></a>00049 }
<a name="l00050"></a>00050 
<a name="l00052"></a>00052 <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> PION_PLUGIN <span class="keywordtype">void</span> pion_destroy_AllowNothingService(<a class="code" href="classpion_1_1plugins_1_1_allow_nothing_service.html">pion::plugins::AllowNothingService</a> *service_ptr)
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054     <span class="keyword">delete</span> service_ptr;
<a name="l00055"></a>00055 }
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 24 Mar 2014 for pion by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>