MCPcopy Index your code
hub / github.com/php/frankenphp / addHeadersToServer

Function addHeadersToServer

cgi.go:160–174  ·  view source on GitHub ↗
(ctx context.Context, request *http.Request, trackVarsArray *C.zval)

Source from the content-addressed store, hash-verified

158}
159
160func addHeadersToServer(ctx context.Context, request *http.Request, trackVarsArray *C.zval) {
161 for field, val := range request.Header {
162 if k := commonHeaders[field]; k != nil {
163 v := strings.Join(val, ", ")
164 C.frankenphp_register_known_variable(k, toUnsafeChar(v), C.size_t(len(v)), trackVarsArray)
165 continue
166 }
167
168 // if the header name could not be cached, it needs to be registered safely
169 // this is more inefficient but allows additional sanitizing by PHP
170 k := phpheaders.GetUnCommonHeader(ctx, field)
171 v := strings.Join(val, ", ")
172 C.frankenphp_register_variable_safe(toUnsafeChar(k), toUnsafeChar(v), C.size_t(len(v)), trackVarsArray)
173 }
174}
175
176func addPreparedEnvToServer(fc *frankenPHPContext, trackVarsArray *C.zval) {
177 for k, v := range fc.env {

Callers 1

Calls 2

GetUnCommonHeaderFunction · 0.92
toUnsafeCharFunction · 0.85

Tested by

no test coverage detected