1 /** @file
2 
3   Multiplexes request to other origins.
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #pragma once
25 
26 #include <cassert>
27 #include <string>
28 #include <ts/ts.h>
29 
30 /*
31  * on dispatch we get one parsed request.
32  * So we want to alter and modify it back the way it was originally.
33  */
34 class OriginalRequest
35 {
36   TSMBuffer buffer_;
37   TSMLoc location_;
38   TSMLoc url_;
39   TSMLoc hostHeader_;
40   TSMLoc xMultiplexerHeader_;
41 
42   OriginalRequest(const OriginalRequest &);
43   OriginalRequest &operator=(const OriginalRequest &);
44 
45 public:
46   struct {
47     const std::string hostHeader;
48     const std::string urlHost;
49     const std::string urlScheme;
50     const std::string xMultiplexerHeader;
51   } original;
52 
53   ~OriginalRequest();
54 
55   OriginalRequest(const TSMBuffer, const TSMLoc);
56 
57   void urlScheme(const std::string &);
58   void urlHost(const std::string &);
59   void hostHeader(const std::string &);
60   bool xMultiplexerHeader(const std::string &);
61 };
62