Commit e51f32d1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

More struct http polishing

parent 1cf2d3c4
...@@ -45,7 +45,9 @@ ...@@ -45,7 +45,9 @@
static char vrt_hostname[255] = ""; static char vrt_hostname[255] = "";
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------
* VRT variables relating to first line of HTTP/1.1 req/resp
*/
static void static void
vrt_do_string(struct http *hp, int fld, vrt_do_string(struct http *hp, int fld,
...@@ -59,9 +61,9 @@ vrt_do_string(struct http *hp, int fld, ...@@ -59,9 +61,9 @@ vrt_do_string(struct http *hp, int fld,
if (b == NULL || *b == '\0') { if (b == NULL || *b == '\0') {
VSLb(hp->vsl, SLT_LostHeader, "%s", err); VSLb(hp->vsl, SLT_LostHeader, "%s", err);
hp->failed = 1; hp->failed = 1;
} else { return;
http_SetH(hp, fld, b);
} }
http_SetH(hp, fld, b);
} }
#define VRT_HDR_L(obj, hdr, fld) \ #define VRT_HDR_L(obj, hdr, fld) \
...@@ -138,7 +140,9 @@ VRT_HDR_LR(beresp, reason, HTTP_HDR_REASON) ...@@ -138,7 +140,9 @@ VRT_HDR_LR(beresp, reason, HTTP_HDR_REASON)
VRT_STATUS_L(beresp) VRT_STATUS_L(beresp)
VRT_STATUS_R(beresp) VRT_STATUS_R(beresp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------
* bool-fields (.do_*)
*/
#define VBERESPW0(field) #define VBERESPW0(field)
#define VBERESPW1(field) \ #define VBERESPW1(field) \
...@@ -235,9 +239,13 @@ VRT_l_client_identity(const struct vrt_ctx *ctx, const char *str, ...) ...@@ -235,9 +239,13 @@ VRT_l_client_identity(const struct vrt_ctx *ctx, const char *str, ...)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
va_start(ap, str); va_start(ap, str);
// XXX ?
b = VRT_String(ctx->req->http->ws, NULL, str, ap); b = VRT_String(ctx->req->http->ws, NULL, str, ap);
va_end(ap); va_end(ap);
if (b == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "client.identity");
ctx->req->http->failed = 1;
return;
}
ctx->req->client_identity = b; ctx->req->client_identity = b;
} }
...@@ -296,6 +304,8 @@ VRT_r_beresp_backend_ip(const struct vrt_ctx *ctx) ...@@ -296,6 +304,8 @@ VRT_r_beresp_backend_ip(const struct vrt_ctx *ctx)
return (NULL); return (NULL);
} }
/*--------------------------------------------------------------------*/
const char * const char *
VRT_r_beresp_storage_hint(const struct vrt_ctx *ctx) VRT_r_beresp_storage_hint(const struct vrt_ctx *ctx)
{ {
...@@ -318,6 +328,11 @@ VRT_l_beresp_storage_hint(const struct vrt_ctx *ctx, const char *str, ...) ...@@ -318,6 +328,11 @@ VRT_l_beresp_storage_hint(const struct vrt_ctx *ctx, const char *str, ...)
va_start(ap, str); va_start(ap, str);
b = VRT_String(ctx->bo->ws, NULL, str, ap); // XXX: ctx->ws ? b = VRT_String(ctx->bo->ws, NULL, str, ap); // XXX: ctx->ws ?
va_end(ap); va_end(ap);
if (b == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "storage.hint");
ctx->bo->beresp->failed = 1;
return;
}
ctx->bo->storage_hint = b; ctx->bo->storage_hint = b;
} }
...@@ -414,7 +429,6 @@ VRT_r_req_can_gzip(const struct vrt_ctx *ctx) ...@@ -414,7 +429,6 @@ VRT_r_req_can_gzip(const struct vrt_ctx *ctx)
return (RFC2616_Req_Gzip(ctx->req->http)); // XXX ? return (RFC2616_Req_Gzip(ctx->req->http)); // XXX ?
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
long long
......
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