commit dbfac6425aabb4adbd527a38e74869fa05004b30
parent 3ffd8c7df60dc102afed2681bd3f5fb7a8ec887a
Author: William Casarin <jb55@jb55.com>
Date: Thu, 14 Jan 2021 15:19:19 -0800
cleanups
Diffstat:
1 file changed, 6 insertions(+), 29 deletions(-)
diff --git a/src/ap_json.c b/src/ap_json.c
@@ -136,35 +136,12 @@ static int handle_request_target(struct ap_json *a)
struct json_pusher *p = (struct json_pusher *)a->compact_handler.data;
struct cursor *c = &p->cur;
- if (!handle_key(a, "(request-target)")) {
- return 0;
- }
-
- if (!push_byte(c, '"')) {
- return 0;
- }
-
- if (!push_str(c, a->req->method)) {
- return 0;
- }
-
- if (!push_byte(c, ' ')) {
- return 0;
- }
-
- if (!push_str(c, a->req->path)) {
- return 0;
- }
-
- if (!push_byte(c, '"')) {
- return 0;
- }
-
- if (!push_byte(c, ',')) {
- return 0;
- }
-
- return 1;
+ return handle_key(a, "(request-target)")
+ && push_byte(c, '"')
+ && push_str(c, a->req->method)
+ && push_byte(c, ' ')
+ && push_str(c, a->req->path)
+ && push_str(c, "\",");
}
static int handle_wsheaders(struct ap_json *a)