diff --git a/ext/native/net/http_server.cpp b/ext/native/net/http_server.cpp index 035d2ef68c..c5a6ccd065 100644 --- a/ext/native/net/http_server.cpp +++ b/ext/native/net/http_server.cpp @@ -59,10 +59,11 @@ Request::~Request() { delete out_; } -void Request::WriteHttpResponseHeader(int status, int size, const char *mimeType, const char *otherHeaders) const { +void Request::WriteHttpResponseHeader(int status, int64_t size, const char *mimeType, const char *otherHeaders) const { const char *statusStr; switch (status) { case 200: statusStr = "OK"; break; + case 206: statusStr = "Partial Content"; break; case 301: statusStr = "Moved Permanently"; break; case 302: statusStr = "Found"; break; case 304: statusStr = "Not Modified"; break; @@ -85,7 +86,7 @@ void Request::WriteHttpResponseHeader(int status, int size, const char *mimeType buffer->Printf("Content-Type: %s\r\n", mimeType ? mimeType : DEFAULT_MIME_TYPE); buffer->Push("Connection: close\r\n"); if (size >= 0) { - buffer->Printf("Content-Length: %u\r\n", size); + buffer->Printf("Content-Length: %llu\r\n", size); } if (otherHeaders) { buffer->Push(otherHeaders, (int)strlen(otherHeaders)); diff --git a/ext/native/net/http_server.h b/ext/native/net/http_server.h index bc7329998f..6ff92dc0f0 100644 --- a/ext/native/net/http_server.h +++ b/ext/native/net/http_server.h @@ -24,6 +24,10 @@ class Request { return header_.resource; } + RequestHeader::Method Method() const { + return header_.method; + } + bool GetParamValue(const char *param_name, std::string *value) const { return header_.GetParamValue(param_name, value); } @@ -45,7 +49,7 @@ class Request { bool IsOK() const { return fd_ > 0; } // If size is negative, no Content-Length: line is written. - void WriteHttpResponseHeader(int status, int size = -1, const char *mimeType = nullptr, const char *otherHeaders = nullptr) const; + void WriteHttpResponseHeader(int status, int64_t size = -1, const char *mimeType = nullptr, const char *otherHeaders = nullptr) const; private: net::InputSink *in_;