1
0
ithewei 3 жил өмнө
parent
commit
08d6130162

+ 2 - 2
http/Http1Parser.cpp

@@ -117,9 +117,9 @@ int on_headers_complete(http_parser* parser) {
     }
     iter = hp->parsed->headers.find("content-length");
     if (iter != hp->parsed->headers.end()) {
-        int content_length = atoi(iter->second.c_str());
+        size_t content_length = atoll(iter->second.c_str());
         hp->parsed->content_length = content_length;
-        int reserve_length = MIN(content_length + 1, MAX_CONTENT_LENGTH);
+        size_t reserve_length = MIN(content_length + 1, MAX_CONTENT_LENGTH);
         if ((!skip_body) && reserve_length > hp->parsed->body.capacity()) {
             hp->parsed->body.reserve(reserve_length);
         }

+ 2 - 2
http/HttpMessage.cpp

@@ -334,7 +334,7 @@ append:
 void HttpMessage::FillContentLength() {
     auto iter = headers.find("Content-Length");
     if (iter != headers.end()) {
-        content_length = atoi(iter->second.c_str());
+        content_length = atoll(iter->second.c_str());
     }
     if (content_length == 0) {
         DumpBody();
@@ -439,7 +439,7 @@ void HttpMessage::DumpBody() {
 void HttpMessage::DumpBody(std::string& str) {
     DumpBody();
     const char* content = (const char*)Content();
-    int content_length = ContentLength();
+    size_t content_length = ContentLength();
     if (content && content_length) {
         str.append(content, content_length);
     }