mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-09 15:50:26 +03:00
* HTTP.cpp : rename method
This commit is contained in:
parent
8cb3e3418a
commit
2d252e6459
2
HTTP.cpp
2
HTTP.cpp
@ -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
2
HTTP.h
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user