blob: 142063d0c609823f4ee291303bcf48c121135056 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
Mark Slee9f0c6512007-02-28 23:58:26 +000019
Mark Slee8a98e1b2007-02-27 05:16:23 +000020#ifndef _THRIFT_TRANSPORT_THTTPCLIENT_H_
21#define _THRIFT_TRANSPORT_THTTPCLIENT_H_ 1
22
David Reiss112e3092010-08-12 23:03:29 +000023#include <transport/THttpTransport.h>
Mark Slee8a98e1b2007-02-27 05:16:23 +000024
T Jake Lucianib5e62212009-01-31 22:36:20 +000025namespace apache { namespace thrift { namespace transport {
Mark Slee8a98e1b2007-02-27 05:16:23 +000026
David Reiss112e3092010-08-12 23:03:29 +000027class THttpClient : public THttpTransport {
Mark Slee8a98e1b2007-02-27 05:16:23 +000028 public:
29 THttpClient(boost::shared_ptr<TTransport> transport, std::string host, std::string path="");
30
31 THttpClient(std::string host, int port, std::string path="");
32
33 virtual ~THttpClient();
34
David Reiss112e3092010-08-12 23:03:29 +000035 virtual void flush();
Mark Slee8a98e1b2007-02-27 05:16:23 +000036
37 protected:
38
Mark Slee8a98e1b2007-02-27 05:16:23 +000039 std::string host_;
40 std::string path_;
41
David Reiss112e3092010-08-12 23:03:29 +000042 virtual void parseHeader(char* header);
43 virtual bool parseStatusLine(char* status);
Mark Slee8a98e1b2007-02-27 05:16:23 +000044
45};
46
T Jake Lucianib5e62212009-01-31 22:36:20 +000047}}} // apache::thrift::transport
Mark Slee8a98e1b2007-02-27 05:16:23 +000048
49#endif // #ifndef _THRIFT_TRANSPORT_THTTPCLIENT_H_