Going to mess around with pairs

This commit is contained in:
Javier Feliz 2024-12-26 23:43:00 -05:00
parent b5745c941b
commit ce0f9fcfc4

View File

@ -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)