Sending custom http response headers

Is there any way to set custom http headers from within the theme?
( the equivalent of nginx’s add_header X-foo "bar"; or like it’s done in wordpress php header("X-foo:bar"); )