00001
#ifndef STREAMSOAP_HTTP_SERVER_CHANNEL_H
00002
#define STREAMSOAP_HTTP_SERVER_CHANNEL_H
00003
00004
#include <map>
00005
00006
#include <xct/socket/Socket.hpp>
00007
#include <xct/socket/SocketStream.hpp>
00008
00009
#include "CommunicationChannel.hpp"
00010
00011
namespace xsoap {
00013 class HttpServerChannel :
00014
public CommunicationChannel
00015 {
00016
public:
00017
enum statesEnum {
00018 PROTOCOL,
00019 HOST,
00020 PORT,
00021 LOCATION
00022 };
00023
00024
enum httpHeaders {
00025 HTTP_SIGNATURE,
00026 HTTP_RETURN_CODE,
00027 HTTP_END_HEADERS
00028 };
00029
00030
HttpServerChannel(xct::socket::Socket *,
bool keepAlive =
false);
00031 ~
HttpServerChannel(
void);
00032
00033
HttpServerChannel& operator<<(
const std::string& str);
00034
void send(
const std::string& str);
00035
void receive(std::string&);
00036
void flush();
00037
void setResponseProperty(std::string key, std::string val);
00038 std::string readLine(std::string buffer,
int *index);
00039
void shutDown();
00040 std::string getURL() {
return requestURI;}
00041
bool closed();
00042
00043
private:
00044 xct::socket::Socket *m_socket;
00045 std::string m_buf;
00046
typedef std::map<std::string,std::string> mss;
00047 mss m_properties;
00048 std::string requestURI;
00049
00050 std::string reasonPhrase(std::string code);
00051
00052
bool m_keepAlive;
00053
bool m_requestAlive;
00054
00055 };
00056 }
00057
00058
00059
#endif
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074