|
|
|||
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_THTTPCLIENT_H_ 0021 #define _THRIFT_TRANSPORT_THTTPCLIENT_H_ 1 0022 0023 #include <thrift/transport/THttpTransport.h> 0024 0025 namespace apache { 0026 namespace thrift { 0027 namespace transport { 0028 0029 /** 0030 * @brief Client transport using HTTP. The path is an optional field that is 0031 * not required by Thrift HTTP server or client. It can be used i.e. with HTTP 0032 * redirection, load balancing or forwarding on the server. 0033 */ 0034 class THttpClient : public THttpTransport { 0035 public: 0036 /** 0037 * @brief Constructor that wraps an existing transport, but also sets the 0038 * host and path. The host and path are not used for the connection but are 0039 * set in the HTTP header of the transport. 0040 */ 0041 THttpClient(std::shared_ptr<TTransport> transport, 0042 std::string host = "localhost", 0043 std::string path = "/service", 0044 std::shared_ptr<TConfiguration> config = nullptr); 0045 0046 /** 0047 * @brief Constructor that will create a new socket transport using the host 0048 * and port. 0049 */ 0050 THttpClient(std::string host, int port, 0051 std::string path = "", 0052 std::shared_ptr<TConfiguration> config = nullptr); 0053 0054 ~THttpClient() override; 0055 0056 void flush() override; 0057 0058 void setPath(std::string path); 0059 0060 protected: 0061 std::string host_; 0062 std::string path_; 0063 0064 void parseHeader(char* header) override; 0065 bool parseStatusLine(char* status) override; 0066 }; 0067 } 0068 } 0069 } // apache::thrift::transport 0070 0071 #endif // #ifndef _THRIFT_TRANSPORT_THTTPCLIENT_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|