TFCweb
1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
Pàgina principal
Pàgines Relacionades
Espais de Noms
Classes
Fitxers
Llista dels Fitxers
Membres de Fitxers
src
AutoIndex.h
Veure la documentació d'aquest fitxer.
1
#if !defined(_AUTO_INDEX_H_)
2
#define _AUTO_INDEX_H_
3
15
/*
16
* Copyright (c) 2012 Toni Corvera
17
*
18
* This file is part of TFCWeb.
19
*
20
* TFCWeb is free software: you can redistribute it and/or modify
21
* it under the terms of the GNU General Public License as published by
22
* the Free Software Foundation, either version 3 of the License, or
23
* (at your option) any later version.
24
*
25
* TFCWeb is distributed in the hope that it will be useful,
26
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
* GNU General Public License for more details.
29
*
30
* You should have received a copy of the GNU General Public License
31
* along with TFCWeb. If not, see <http://www.gnu.org/licenses/>.
32
*/
33
34
#include "
CosResposta.h
"
35
#include "
portabilitat.h
"
36
#include "
Recurs.h
"
37
#include "
Uri.h
"
38
39
#include <cassert>
40
#include <stdexcept>
41
#include <string>
42
#include <sstream>
43
#include <boost/asio.hpp>
44
#include <boost/filesystem.hpp>
45
46
namespace
tfc {
47
53
class
AutoIndex
:
public
RecursDinamic
{
54
public
:
60
AutoIndex
(
const
PeticioHTTP
& p,
61
const
boost::asio::ip::tcp::endpoint & host_servidor,
62
const
Uri
& u,
63
const
Recurs
& d)
// TODO: Normalitzar interficie
64
:
RecursDinamic
(p),
65
url_
(u),
dir
(d),
host_
(host_servidor),
cache_
()
// FIXME: dir -> dir_
66
{
67
using namespace
boost::filesystem;
68
assert( is_directory(d.
fisica
()) );
69
}
70
72
AutoIndex
(
const
AutoIndex
& a)
73
:
RecursDinamic
(a),
url_
(a.
url_
),
dir
(a.
dir
),
host_
(a.
host_
),
cache_
(a.
cache_
)
74
{
75
// buit
76
}
77
78
const
Recurs
&
recurs
()
const
{
return
dir
; }
79
const
Uri
&
url
()
const
{
return
url_
; }
80
const
boost::filesystem::path
&
directori
()
const
{
return
dir
.
fisica
(); }
81
82
std::string
html
()
const
;
83
84
void
envia
(boost::asio::ip::tcp::socket &)
const
throw (std::runtime_error);
85
86
virtual
tipus_capsaleres
capsaleres
() const;
87
protected:
88
using
CosResposta
::
envia
;
89
private:
91
AutoIndex
& operator=(const
AutoIndex
& a) {
92
throw
ErrorNoImplementat
(
FITXER_I_LINIA_
);
93
}
94
95
const
Uri
url_
;
96
const
Recurs
dir
;
97
const
boost::asio::ip::tcp::endpoint
host_
;
98
mutable
std::string
cache_
;
99
};
100
101
}
// ns tfc
102
103
#endif // _AUTO_INDEX_H_
104
105
// vim:set ts=4 et ai: //
Generat a Dl Jun 17 2013 20:07:39 per a TFCweb per
1.8.1.2