Browse Source

* HTTP.cpp : rename method

pull/551/head
hagen 9 years ago
parent
commit
2d252e6459
  1. 2
      HTTP.cpp
  2. 2
      HTTP.h
  3. 2
      I2PControl.cpp
  4. 2
      tests/test-http-res.cpp

2
HTTP.cpp

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

2
HTTP.h

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

2
I2PControl.cpp

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

2
tests/test-http-res.cpp

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

Loading…
Cancel
Save