* HTTP.cpp : rename method

This commit is contained in:
hagen 2016-06-28 13:00:00 +00:00
parent 8cb3e3418a
commit 2d252e6459
4 changed files with 4 additions and 4 deletions

View File

@ -276,7 +276,7 @@ namespace http {
return false;
}
long int HTTPMsg::length() {
long int HTTPMsg::content_length() {
unsigned long int length = 0;
auto it = headers.find("Content-Length");
if (it == headers.end())

2
HTTP.h
View File

@ -62,7 +62,7 @@ namespace http {
void del_header(const char *name);
/** @brief Returns declared message length or -1 if unknown */
long int length();
long int content_length();
};
struct HTTPReq : HTTPMsg {

View File

@ -205,7 +205,7 @@ namespace client
}
/* append to json chunk of data from 1st request */
json.write(buf->begin() + len, bytes_transferred - len);
remains = req.length() - len;
remains = req.content_length() - len;
/* if request has Content-Length header, fetch rest of data and store to json buffer */
while (remains > 0) {
len = ((long int) buf->size() < remains) ? buf->size() : remains;

View File

@ -29,7 +29,7 @@ int main() {
assert(res->headers.find("Server")->second == "nginx/1.2.1");
assert(res->headers.find("Content-Length")->second == "536");
assert(res->is_chunked() == false);
assert(res->length() == 536);
assert(res->content_length() == 536);
delete res;
/* test: building request */