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

Function addHeader

frankenphp.go:509–519  ·  view source on GitHub ↗
(ctx context.Context, fc *frankenPHPContext, h *C.sapi_header_struct)

Source from the content-addressed store, hash-verified

507}
508
509func addHeader(ctx context.Context, fc *frankenPHPContext, h *C.sapi_header_struct) {
510 key, val := splitRawHeader(h.header, int(h.header_len))
511 if key == "" {
512 if fc.logger.Enabled(ctx, slog.LevelDebug) {
513 fc.logger.LogAttrs(ctx, slog.LevelDebug, "invalid header", slog.String("header", C.GoStringN(h.header, C.int(h.header_len))))
514 }
515
516 return
517 }
518 fc.responseWriter.Header().Add(key, val)
519}
520
521// split the raw header coming from C with minimal allocations
522func splitRawHeader(rawHeader *C.char, length int) (string, string) {

Callers 1

go_write_headersFunction · 0.85

Calls 3

splitRawHeaderFunction · 0.85
HeaderMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected