Create dedicate crate for php_escaping.rs
[hiphop-php.git] / hphp / runtime / server / http-protocol.h
blob09f17c1a5a33475182d35319222598b9c68ed415
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_HTTP_PROTOCOL_H_
18 #define incl_HPHP_HTTP_PROTOCOL_H_
20 #include "hphp/runtime/server/transport.h"
22 namespace HPHP {
23 ///////////////////////////////////////////////////////////////////////////////
25 struct Array;
26 struct RequestURI;
27 struct SourceRootInfo;
28 struct StringBuffer;
29 struct Variant;
30 struct VirtualHost;
32 struct HttpProtocol {
33 static const VirtualHost *GetVirtualHost(Transport *transport);
34 static void PrepareSystemVariables(Transport *transport,
35 const RequestURI &r,
36 const SourceRootInfo &sri);
37 static void PrepareRequestVariables(Array& request,
38 const Array& get,
39 const Array& post,
40 const Array& cookie,
41 const std::string& requestOrder);
42 static void PrepareGetVariable(Array& get,
43 const RequestURI &r);
44 static void PreparePostVariables(Array& post,
45 Variant& raw_post,
46 Array& files,
47 Transport* transport,
48 const RequestURI& r);
49 static bool PrepareCookieVariable(Array& cookie,
50 Transport *transport);
51 static void PrepareServerVariable(Array& server,
52 Transport *transport,
53 const RequestURI &r,
54 const SourceRootInfo &sri,
55 const VirtualHost *vhost);
57 static bool ProxyRequest(Transport *transport, bool force,
58 const std::string &url, int &code,
59 std::string &error, StringBuffer &response,
60 HeaderMap *extraHeaders = nullptr);
62 static std::string RecordRequest(Transport *transport);
63 static void ClearRecord(bool success, const std::string &tmpfile);
65 static void DecodeParameters(Array& variables,
66 const char *data,
67 size_t size,
68 bool post = false);
69 static void DecodeRfc1867(Transport* transport,
70 Array& post,
71 Array& files,
72 size_t contentLength,
73 const void*& data,
74 size_t& size,
75 std::string boundary);
76 static void DecodeCookies(Array& variables, char *data);
77 static bool IsRfc1867(std::string contentType, std::string &boundary);
79 static const char *GetReasonString(int code);
82 ///////////////////////////////////////////////////////////////////////////////
85 #endif // incl_HPHP_HTTP_PROTOCOL_H_