Rename files in runtime/base, part 6
[hiphop-php.git] / hphp / runtime / server / http_protocol.h
blob6b5b943b2b5c9657836fcdd730e2b53142966fa5
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2013 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/base/complex_types.h"
21 #include "hphp/runtime/server/transport.h"
23 namespace HPHP {
24 ///////////////////////////////////////////////////////////////////////////////
26 class RequestURI;
27 class SourceRootInfo;
28 class VirtualHost;
29 class StringBuffer;
31 class HttpProtocol {
32 public:
33 static const VirtualHost *GetVirtualHost(Transport *transport);
34 static void PrepareSystemVariables(Transport *transport, const RequestURI &r,
35 const SourceRootInfo &sourceRootInfo);
36 static bool ProxyRequest(Transport *transport, bool force,
37 const std::string &url, int &code,
38 std::string &error, StringBuffer &response,
39 HeaderMap *extraHeaders = nullptr);
41 static std::string RecordRequest(Transport *transport);
42 static void ClearRecord(bool success, const std::string &tmpfile);
44 static void DecodeParameters(Variant &variables, const char *data, int size,
45 bool post = false);
46 static void DecodeRfc1867(Transport *transport,
47 Variant &post, Variant &files, int contentLength,
48 const void *&data, int &size,
49 std::string boundary);
50 static void DecodeCookies(Variant &variables, char *data);
51 static bool IsRfc1867(const std::string contentType, std::string &boundary);
53 static const char *GetReasonString(int code);
55 private:
56 static void CopyParams(Variant &dest, Variant &src);
59 ///////////////////////////////////////////////////////////////////////////////
62 #endif // incl_HPHP_HTTP_PROTOCOL_H_