(ctx context.Context, fc *frankenPHPContext, h *C.sapi_header_struct)
| 507 | } |
| 508 | |
| 509 | func 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 |
| 522 | func splitRawHeader(rawHeader *C.char, length int) (string, string) { |
no test coverage detected