http: Allow > 2GB responses.

This commit is contained in:
Unknown W. Brackets committed 2016-05-26 18:16:42 -07:00
1 parent 1f3615b411
commit 06c3dca1da
2 files changed
+8 -3

No files matched your search

+3 -2
View File
@@ -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));
+5 -1
View File
@@ -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_;