[][src]Type Definition libnghttp2_sys::nghttp2_on_invalid_header_callback

type nghttp2_on_invalid_header_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, frame: *const nghttp2_frame, name: *const u8, namelen: usize, value: *const u8, valuelen: usize, flags: u8, user_data: *mut c_void) -> c_int>;

@functypedef

Callback function invoked when a invalid header name/value pair is received for the |frame|.

The parameter and behaviour are similar to :type:nghttp2_on_header_callback. The difference is that this callback is only invoked when a invalid header name/value pair is received which is treated as stream error if this callback is not set. Only invalid regular header field are passed to this callback. In other words, invalid pseudo header field is not passed to this callback. Also header fields which includes upper cased latter are also treated as error without passing them to this callback.

This callback is only considered if HTTP messaging validation is turned on (which is on by default, see nghttp2_option_set_no_http_messaging()).

With this callback, application inspects the incoming invalid field, and it also can reset stream from this callback by returning :enum:NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE. By default, the error code is :enum:NGHTTP2_PROTOCOL_ERROR. To change the error code, call nghttp2_submit_rst_stream() with the error code of choice in addition to returning :enum:NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE.

If 0 is returned, the header field is ignored, and the stream is not reset.