You can use the function kcHttpPutStatus
to pass an HTTP status code for the HTTP response. Additionally a reason phrase may be passed.
The length of the reason phrase is restricted to 256 bytes. If NULL is passed for the reason phrase UTM will supply a default reason phrase for the specified status code.
The following status codes must not be passed:
- 100 Continue
- 101 Switching Protocols
- 203 Non-Authoritative Information
- 301 Moved Permanently
- 302 Found
- 307 Temporary Redirect
- 401 Unauthorized
- 407 Proxy Authentication Required
- 408 Request Timeout
- 411 Length Required
- 413 Request Entity Too Large
- 417 Expectation Failed
- 502 Bad Gateway
- 504 Gateway Timeout
- 505 HTTP Version Not Supported
This function may be called both in program unit and HTTP exit program. In the HTTP exit program, the function can only be called when processing the output message.
If this function is called in a program unit run, in the same program unit run an output message has to be supplied by MPUT and the service has to be finished else the header information is lost.
kc_http_retcode kcHttpPutStatus( int statusCode, char * reasonPhrase );
This function has following function parameter:
>> | statusCode | Status code for the HTTP response. |
>> | reasonPhrase | Pointer to the buffer containing the reason phrase for the HTTP response or NULL. |
Description of returned value of function call:
KC_HTTP_OK
The function has successfully terminated.
KC_HTTP_FUNCTION_CALL_NOT_ALLOWED
The function was called by the KDCS program unit before the KDCS call INIT was executed or outside the HTTP exit program.
KC_HTTP_NO_HTTP_CLIENT
The calling service was not initiated by an HTTP client.
KC_HTTP_INVALID_STATUS_CODE
The specified status code is invalid.
KC_HTTP_STATUS_CODE_NOT_ALLOWED
The specified status code must not passed to UTM.
KC_HTTP_REASON_PHRASE_TOO_LONG
The specified reason phrase is too long.
KC_HTTP_REASON_PHRASE_NOT_PRINTABLE
The reason phrase contains a non printable character.