The function kcHttpGetHeaderByIndex
returns name and value of the HTTP header field with the specified index.
This function may be called both in program unit and HTTP exit program.
In the program unit the function may only called in the first program unit run of a service.
kc_http_retcode kcHttpGetHeaderByIndex( int headerIndex, char * headerName, int * headerNameLth, char * headerValue, int * headerValueLth );
This function has following parameters:
>> | headerIndex | The index of the HTTP header field to read. |
<< | headerName | The pointer to a buffer in which the name of the HTTP header is returned. The length of the buffer must be at least headerNameLth bytes. |
<> | headerNameLth | The pointer to a variable in which the length of the buffer for the name of the HTTP header is passed and the actual length of the name is returned. |
<< | headerValue | The pointer to a buffer in which the value of the HTTP header is returned. The length of the buffer must be at least headerValueLth bytes. |
<> | headerValueLth | The pointer to a variable in which the length of the buffer for the value of the HTTP header is passed and the actual length of the value is returned. |
Meaning 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 not in the first program unit run after message reception from the HTTP client or outside an HTTP exit program.
KC_HTTP_NO_HTTP_CLIENT
The calling service was not initiated by an HTTP client.
KC_HTTP_INVALID_INDEX
The specified index headerIndex
is invalid (less or equal 0 or greater than number of HTTP header fields contained in HTTP request).
KC_HTTP_PARAM_VALUE_NULL
The pointer to the buffer for the header name headerName
or the pointer to the length of the header name headerNameLth
or the pointer to the buffer for the header value headerValue
or the pointer to the length of the header value headerValueLth
is NULL.
KC_HTTP_INVALID_LENGTH
The value of the length of header name headerNameLth
or value of the length of header value headerValueLth
is lower or equal 0.
KC_HTTP_RESULT_TRUNCATED
The length of the buffer for the header name and/or header value is less than the actual length of the name and/or value. The character strings are truncated and the actual lengths are returned.