File: request.h

package info (click to toggle)
bibledit-cloud 5.1.036-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 250,636 kB
  • sloc: xml: 915,934; ansic: 261,349; cpp: 92,628; javascript: 32,542; sh: 4,915; makefile: 586; php: 69
file content (90 lines) | stat: -rw-r--r-- 3,427 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
/*
Copyright (©) 2003-2025 Teus Benschop.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


#pragma once

#include <config/libraries.h>
#include <session/logic.h>
#include <database/config/user.h>
#include <database/users.h>
#include <database/styles.h>
#include <database/bibles.h>
#include <database/ipc.h>

class Webserver_Request
{
public:
  Webserver_Request ();
  ~Webserver_Request ();
  Webserver_Request(const Webserver_Request&) = delete;
  Webserver_Request operator=(const Webserver_Request&) = delete;
  // Whether the connection runs via the secure server.
  bool secure {false};
  // The session identifier of the cookie sent by the browser.
  std::string session_identifier {};
   // Whether to resend the cookie to the browser.
  bool resend_cookie {false};
   // The browser's or client's remote IPv4 or IPv6 address.
  std::string remote_address {};
  // The page the browser requests via GET or via POST.
  std::string get {};
   // Whether it is a POST request.
  bool is_post {false};
   // The query from the browser, e.g. foo=bar&baz=qux, neatly arranged into a map.
  std::map <std::string, std::string> query {};
   // The browser's user agent, e.g. Mozilla/x.0 (X11; Linux) ...
  std::string user_agent {};
   // The browser's or client's Accept-Language header.
  std::string accept_language {};
   // The server's host as requested by the client.
  std::string host {};
   // The content type of the browser request.
  std::string content_type {};
   // The content length of the browser request.
  int content_length {0};
  // The raw POSTed data from the browser.
  std::vector<std::pair<std::string,std::string>> post {};
  // Convenience functions on post_v2.
  int post_count(const std::string& key) const;
  std::string post_get(const std::string& key) const;
   // Header as received from the browser.
  std::string if_none_match {};
   // Extra header to be sent back to the browser.
  std::string header {};
   // Body to be sent back to the browser.
  std::string reply {};
   // Response code to be sent to the browser.
  int response_code {0};
   // The requested file's size for browser caching.
  std::string etag {};
   // The content type of the response.
  std::string response_content_type {};
   // The path of the file to copy from disk straight to the network without loading it in memory.
  std::string stream_file {};
  // Extra objects.
  Session_Logic * session_logic ();
  Database_Config_User * database_config_user ();
  Database_Users * database_users ();
  Database_Ipc * database_ipc ();
private:
  Session_Logic * session_logic_instance { nullptr };
  Database_Config_User * database_config_user_instance { nullptr };
  Database_Users * database_users_instance { nullptr };
  Database_Ipc * database_ipc_instance { nullptr };
};