aboutsummaryrefslogtreecommitdiff
path: root/mod_gsoap/gsoap_win/isapi/gsoap/HttpContext.cpp
blob: 0e72fbbd067e15457a45898adbd72ad28dc73291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/** Implementation of the HttpContext class
  * @file HttpContext.cpp
  * @author Christian Aberger 
  * Copyright (C) 2001 WebWare (http://www.webware.at) 
  */ 
#include "HttpContext.h"

HttpMessage::HttpMessage() {
}
HttpRequest::HttpRequest() 
: _method(GET)
, _body(NULL)
, _contentlength(0)
{
}
HttpRequest::~HttpRequest() {
    delete _body;
}
const char *HttpRequest::getQueryString() {
    return _querystring.c_str();
}
const char *HttpRequest::getBody() {
    static const char szEmpty[] = "";
    return NULL == _body ? szEmpty : _body;
}
void *HttpRequest::getData() {
    return _body;
}
HttpRequest::Method HttpRequest::getMethod() const {
    return _method;
}
unsigned long HttpRequest::getContentLength() const {
    return _contentlength;
}
bool HttpRequest::operator<<(std::istream& is) {
    delete _body, _body = NULL;
    bool bRet = true;
    if (0 != _contentlength) {
        _body = new char[_contentlength + 1];
        memset(_body, 0, _contentlength + 1);
        is.read(_body, _contentlength);
        bRet = is.good();
    } else {
        bRet = false;
    }
    return bRet;
}