From ce0f9fcfc4f7e460b148a0673177fd8db278b028 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Thu, 26 Dec 2024 23:43:00 -0500 Subject: [PATCH] Going to mess around with pairs --- fastcgi/client.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fastcgi/client.go b/fastcgi/client.go index 1ad1250..128235f 100644 --- a/fastcgi/client.go +++ b/fastcgi/client.go @@ -46,6 +46,18 @@ func (client *FCGIClient) writeEndRequest(appStatus int, protocolStatus uint8) e return client.writeRecord(FCGI_END_REQUEST, b) } +// Spec: https://www.mit.edu/~yandros/doc/specs/fcgi-spec.html#S3 +// Name value pairs such as: SCRIPT_PATH = /some/path +// Should be encoded as such: +// Name size +// Value size +// Name +// Value +// The high bit of name size and value size is used for signaling +// how many bytes are used to store the length/size. +// If the size is > 127, we can just use one byte, +// and the high bit will be 0, otherwise, we use +// four bytes and the high bit will be 1 func (client *FCGIClient) writePairs(recType FCGIRequestType, pairs map[string]string) error { w := newWriter(client, recType) b := make([]byte, 8)