Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:35:03

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements. See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership. The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License. You may obtain a copy of the License at
0009  *
0010  *   http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing,
0013  * software distributed under the License is distributed on an
0014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015  * KIND, either express or implied. See the License for the
0016  * specific language governing permissions and limitations
0017  * under the License.
0018  */
0019 
0020 #ifndef _THRIFT_TRANSPORT_THTTPSERVER_H_
0021 #define _THRIFT_TRANSPORT_THTTPSERVER_H_ 1
0022 
0023 #include <thrift/transport/THttpTransport.h>
0024 
0025 namespace apache {
0026 namespace thrift {
0027 namespace transport {
0028 
0029 class THttpServer : public THttpTransport {
0030 public:
0031   THttpServer(std::shared_ptr<TTransport> transport, std::shared_ptr<TConfiguration> config = nullptr);
0032 
0033   ~THttpServer() override;
0034 
0035   void flush() override;
0036 
0037 protected:
0038   virtual std::string getHeader(uint32_t len);
0039   void readHeaders();
0040   void parseHeader(char* header) override;
0041   bool parseStatusLine(char* status) override;
0042   std::string getTimeRFC1123();
0043 };
0044 
0045 /**
0046  * Wraps a transport into HTTP protocol
0047  */
0048 class THttpServerTransportFactory : public TTransportFactory {
0049 public:
0050   THttpServerTransportFactory() = default;
0051 
0052   ~THttpServerTransportFactory() override = default;
0053 
0054   /**
0055    * Wraps the transport into a buffered one.
0056    */
0057   std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
0058     return std::shared_ptr<TTransport>(new THttpServer(trans));
0059   }
0060 };
0061 }
0062 }
0063 } // apache::thrift::transport
0064 
0065 #endif // #ifndef _THRIFT_TRANSPORT_THTTPSERVER_H_