Commit 16b84c2a authored by Nils Goroll's avatar Nils Goroll

use s?size_t for req_bodybytes and VRB_Cache

The VRT side of things still needs attention
parent 6fd7f77d
......@@ -587,7 +587,7 @@ struct req {
enum sess_close doclose;
double d_ttl;
uint64_t req_bodybytes; /* Parsed req bodybytes */
ssize_t req_bodybytes; /* Parsed req bodybytes */
uint16_t err_code;
const char *err_reason;
......@@ -760,7 +760,7 @@ void V1P_Process(struct req *req, struct busyobj *bo, int fd);
/* cache_req_body.c */
int VRB_Ignore(struct req *req);
int VRB_Cache(struct req *req, ssize_t maxsize);
ssize_t VRB_Cache(struct req *req, ssize_t maxsize);
ssize_t VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv);
void VRB_Free(struct req *req);
......
......@@ -191,7 +191,7 @@ VRB_Free(struct req *req)
* off to prevent parallelism.
*/
int
ssize_t
VRB_Cache(struct req *req, ssize_t maxsize)
{
ssize_t l, yet;
......@@ -220,6 +220,7 @@ VRB_Cache(struct req *req, ssize_t maxsize)
vfc = req->htc->vfc;
if (req->htc->content_length > maxsize) {
// XXX #1664
req->req_body_status = REQ_BODY_FAIL;
(void)VFP_Error(vfc, "Request body too big to cache");
return (-1);
......@@ -240,6 +241,7 @@ VRB_Cache(struct req *req, ssize_t maxsize)
return (-1);
}
AZ(req->req_bodybytes);
AN(req->htc);
yet = req->htc->content_length;
if (yet < 0)
......@@ -265,7 +267,7 @@ VRB_Cache(struct req *req, ssize_t maxsize)
VFP_Close(vfc);
if (vfps == VFP_END) {
assert(req->req_bodybytes >= 0);
if (req->req_bodybytes != req->htc->content_length) {
/* We must update also the "pristine" req.* copy */
http_Unset(req->http0, H_Content_Length);
......
......@@ -475,6 +475,8 @@ VRT_ban_string(VRT_CTX, const char *str)
/*--------------------------------------------------------------------
*
* XXX this really should be ssize_t VRT_CacheReqBody(VRT_CTX, size_t)
* - change with next VRT major bump
*/
int
......
......@@ -37,6 +37,9 @@
* Whenever something is added, increment MINOR version
* Whenever something is deleted or changed in a way which is not
* binary/load-time compatible, increment MAJOR version
*
* changes to consider with next VRT_MAJOR_VERSION bump:
* - cache_vrt.c: -> ssize_t VRT_CacheReqBody(VRT_CTX, size_t)
*/
#define VRT_MAJOR_VERSION 2U
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment