TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
CGI.h
Veure la documentació d'aquest fitxer.
1 #if !defined(_TFCWEB_CGI_H_)
2 #define _TFCWEB_CGI_H_
3 
10 /*
11  * Copyright (c) 2012 Toni Corvera
12  *
13  * This file is part of TFCWeb.
14  *
15  * TFCWeb is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * TFCWeb is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with TFCWeb. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #include "CosResposta.h"
30 #include "Excepcions.h"
31 #include "PeticioHTTP.h"
32 
33 #include <string>
34 #include <stdexcept>
35 #include <boost/filesystem.hpp>
36 
37 namespace tfc {
38 
39 // Rellevants:
40 // - Setting up CGI in NCSA httpd:
41 // http://www.meb.uni-bonn.de/docs/tutorials/cgi.html
42 // - http://www.w3.org/CGI/
43 
47 class ProgramaCGI : public RecursDinamic {
48 public:
52  explicit ProgramaCGI(const PeticioHTTP & peticio,
53  const boost::filesystem::path & arrel_servidor)
54  throw (ErrorRutaInexistent);
56  : RecursDinamic(c),
58  {
59  // buit
60  }
64  ruta_ = c.ruta_;
65  return *this;
66  }
67 
68  virtual std::string html() const { throw ErrorNoImplementat(FITXER_I_LINIA_); }
69 
70  virtual void envia(boost::asio::ip::tcp::socket & socket) const throw (std::runtime_error);
71 
72  virtual bool pot_generar_capsaleres() const { return true; }
73 protected:
74  using CosResposta::envia;
75 private:
77  enum {
78  MIDA_BUFFER = 8<<10
79  };
80 };
81 
82 } // ns tfc
83 
84 #endif // _TFCWEB_CGI_H_
85 
86 // vim:set ts=4 et ai: //