Skip to content
/ i2pd Public
forked from PurpleI2P/i2pd

Commit

Permalink
* HTTP.cpp : rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
hagen committed Jun 28, 2016
1 parent 8cb3e34 commit 2d252e6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion HTTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion HTTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion I2PControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-http-res.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 2d252e6

Please sign in to comment.