[sheepdog] [PATCH 1/4] sheep/http: change type of 'req->data_length' to uint64_t
Robin Dong
robin.k.dong at gmail.com
Fri Dec 27 10:14:02 CET 2013
From: Robin Dong <sanbai at taobao.com>
Change the type of 'data_length' in 'struct http_request' so we can
receive http request larger than 4G in 32bit environment.
Signed-off-by: Robin Dong <sanbai at taobao.com>
---
sheep/http/http.c | 4 ++--
sheep/http/http.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sheep/http/http.c b/sheep/http/http.c
index 4a2ae35..165c818 100644
--- a/sheep/http/http.c
+++ b/sheep/http/http.c
@@ -76,7 +76,7 @@ const char *str_http_req(const struct http_request *req)
{
static __thread char msg[1024];
- snprintf(msg, sizeof(msg), "%s %s, status = %s, data_length = %zd",
+ snprintf(msg, sizeof(msg), "%s %s, status = %s, data_length = %"PRIu64,
req->uri, stropcode(req->opcode), strstatus(req->status),
req->data_length);
@@ -194,7 +194,7 @@ void http_response_header(struct http_request *req, enum http_status status)
req->status = status;
http_request_writef(req, "Status: %s\r\n", strstatus(status));
if (req->opcode == HTTP_GET || req->opcode == HTTP_HEAD)
- http_request_writef(req, "Content-Length: %lu\r\n",
+ http_request_writef(req, "Content-Length: %"PRIu64"\r\n",
req->data_length);
http_request_writes(req, "Content-type: text/plain;\r\n\r\n");
}
diff --git a/sheep/http/http.h b/sheep/http/http.h
index 493e10f..20246dc 100644
--- a/sheep/http/http.h
+++ b/sheep/http/http.h
@@ -47,7 +47,7 @@ struct http_request {
char *uri;
enum http_opcode opcode;
enum http_status status;
- size_t data_length;
+ uint64_t data_length;
};
struct http_driver {
--
1.7.12.4
More information about the sheepdog
mailing list