diff options
author | Přemysl Janouch <p@janouch.name> | 2018-10-13 04:08:09 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-10-13 04:08:43 +0200 |
commit | 8b334e9c9187f4eb8bdbfde7644f82a66d30af00 (patch) | |
tree | 107616116283755f8d6a42cabec78e8442b9f33a | |
parent | fd17b4e5046b98b7be7bbc9133140cec2e24777d (diff) | |
download | json-rpc-shell-8b334e9c9187f4eb8bdbfde7644f82a66d30af00.tar.gz json-rpc-shell-8b334e9c9187f4eb8bdbfde7644f82a66d30af00.tar.xz json-rpc-shell-8b334e9c9187f4eb8bdbfde7644f82a66d30af00.zip |
Fix fcgi_muxer_send()
Outgoing records were missing padding and the reserved field.
-rw-r--r-- | demo-json-rpc-server.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/demo-json-rpc-server.c b/demo-json-rpc-server.c index 995e7e2..fa7f833 100644 --- a/demo-json-rpc-server.c +++ b/demo-json-rpc-server.c @@ -145,14 +145,18 @@ fcgi_muxer_send (struct fcgi_muxer *self, hard_assert (len <= UINT16_MAX); struct str message = str_make (); + static char zeroes[8]; + size_t padding = -len & 7; str_pack_u8 (&message, FCGI_VERSION_1); str_pack_u8 (&message, type); str_pack_u16 (&message, request_id); - str_pack_u16 (&message, len); // content length - str_pack_u8 (&message, 0); // padding length + str_pack_u16 (&message, len); // content length + str_pack_u8 (&message, padding); // padding length + str_pack_u8 (&message, 0); // reserved str_append_data (&message, data, len); + str_append_data (&message, zeroes, padding); // XXX: we should probably have another write_cb that assumes ownership self->write_cb (self->user_data, message.str, message.len); |