HTP
0.3
|
#include "htp.h"
htp_cfg_t* htp_config_copy | ( | htp_cfg_t * | cfg | ) |
Creates a copy of the supplied configuration structure. The idea is to create one or more configuration objects at configuration-time, but to use this function to create per-connection copies. That way it will be possible to adjust per-connection configuration as necessary, without affecting the global configuration. Make sure no other thread changes the configuration object while this function is operating.
cfg |
htp_cfg_t* htp_config_create | ( | void | ) |
Creates a new configuration structure. Configuration structures created at configuration time must not be changed afterwards in order to support lock-less copying.
void htp_config_destroy | ( | htp_cfg_t * | cfg | ) |
Destroy a configuration structure.
cfg |
void htp_config_register_log | ( | htp_cfg_t * | cfg, |
int(*)(htp_log_t *) | callback_fn | ||
) |
Registers a callback that is invoked every time there is a log message.
cfg | |
callback_fn |
void htp_config_register_multipart_parser | ( | htp_cfg_t * | cfg | ) |
Registers the MULTIPART parser. This parser will extract information stored in request bodies, when they are in multipart/form-data format.
cfg |
void htp_config_register_request | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request callback.
cfg | |
callback_fn |
void htp_config_register_request_body_data | ( | htp_cfg_t * | cfg, |
int(*)(htp_tx_data_t *) | callback_fn | ||
) |
Registers a request_body_data callback.
cfg | |
callback_fn |
void htp_config_register_request_file_data | ( | htp_cfg_t * | cfg, |
int(*)(htp_file_data_t *) | callback_fn | ||
) |
Registers a request_file_data callback.
cfg | |
callback_fn |
void htp_config_register_request_headers | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_headers callback.
cfg | |
callback_fn |
void htp_config_register_request_line | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_line callback.
cfg | |
callback_fn |
void htp_config_register_request_trailer | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_trailer callback.
cfg | |
callback_fn |
void htp_config_register_request_uri_normalize | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_uri_normalize callback.
cfg | |
callback_fn |
void htp_config_register_response | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a response callback.
cfg | |
callback_fn |
void htp_config_register_response_body_data | ( | htp_cfg_t * | cfg, |
int(*)(htp_tx_data_t *) | callback_fn | ||
) |
Registers a request_body_data callback.
cfg | |
callback_fn |
void htp_config_register_response_headers | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_headers callback.
cfg | |
callback_fn |
void htp_config_register_response_line | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_line callback.
cfg | |
callback_fn |
void htp_config_register_response_trailer | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a request_trailer callback.
cfg | |
callback_fn |
void htp_config_register_transaction_start | ( | htp_cfg_t * | cfg, |
int(*)(htp_connp_t *) | callback_fn | ||
) |
Registers a transaction_start callback.
cfg | |
callback_fn |
void htp_config_register_urlencoded_parser | ( | htp_cfg_t * | cfg | ) |
Registers the URLENCODED parser with the configuration. The parser will parse the query string when available, as well as the request body when in correct format.
cfg |
void htp_config_set_bestfit_map | ( | htp_cfg_t * | cfg, |
unsigned char * | map | ||
) |
Update the best-fit map, which is used to convert UCS-2 characters into single-byte characters. By default a Windows 1252 best-fit map is used. The map is an list of triplets, the first 2 bytes being an UCS-2 character to map from, and the third byte being the single byte to map to. Make sure that your map contains the mappings to cover the fullwidth form characters (U+FF00-FFEF).
cfg | |
map |
void htp_config_set_generate_request_uri_normalized | ( | htp_cfg_t * | cfg, |
int | generate | ||
) |
Whether to generate the request_uri_normalized field.
cfg | |
generate |
void htp_config_set_path_backslash_separators | ( | htp_cfg_t * | cfg, |
int | backslash_separators | ||
) |
Configures whether backslash characters are treated as path segment separators. They are not on Unix systems, but are on Windows systems. If this setting is enabled, a path such as "/one\two/three" will be converted to "/one/two/three".
cfg | |
backslash_separators |
void htp_config_set_path_case_insensitive | ( | htp_cfg_t * | cfg, |
int | case_insensitive | ||
) |
Configures filesystem sensitivity. This setting affects how URL paths are normalized. There are no path modifications by default, but on a case-insensitive systems path will be converted to lowercase.
cfg | |
case_insensitive |
void htp_config_set_path_compress_separators | ( | htp_cfg_t * | cfg, |
int | compress_separators | ||
) |
Configures whether consecutive path segment separators will be compressed. When enabled, a path such as "/one//two" will be normalized to "/one/two". The backslash_separators and decode_separators parameters are used before compression takes place. For example, if backshasl_deparators and decode_separators are both enabled, the path "/one\\/two\/%5cthree/%2f//four" will be converted to "/one/two/three/four".
cfg | |
compress_separators |
void htp_config_set_path_control_char_handling | ( | htp_cfg_t * | cfg, |
int | control_char_handling | ||
) |
This parameter is used to predict how a server will react when control characters are present in a request path, but does not affect path normalization.
cfg | |
control_char_handling | Use NONE with servers that ignore control characters in request path, and STATUS_400 with servers that respond with 400. |
void htp_config_set_path_convert_utf8 | ( | htp_cfg_t * | cfg, |
int | convert_utf8 | ||
) |
Controls the UTF-8 treatment of request paths. One option is to only validate path as UTF-8. In this case, the UTF-8 flags will be raised as appropriate, and the path will remain in UTF-8 (if it was UTF-8in the first place). The other option is to convert a UTF-8 path into a single byte stream using best-fit mapping.
cfg | |
convert_utf8 |
void htp_config_set_path_decode_separators | ( | htp_cfg_t * | cfg, |
int | decode_separators | ||
) |
Configures whether encoded path segment separators will be decoded. Apache does not do this, but IIS does. If enabled, a path such as "/one%2ftwo" will be normalized to "/one/two". If the backslash_separators option is also enabled, encoded backslash characters will be converted too (and subsequently normalized to forward slashes).
cfg | |
decode_separators |
void htp_config_set_path_decode_u_encoding | ( | htp_cfg_t * | cfg, |
int | decode_u_encoding | ||
) |
Configures whether u-encoded sequences in path will be decoded. Such sequences will be treated as invalid URL encoding if decoding is not desirable.
cfg | |
decode_u_encoding |
void htp_config_set_path_invalid_encoding_handling | ( | htp_cfg_t * | cfg, |
int | invalid_encoding_handling | ||
) |
Configures how server reacts to invalid encoding in path.
cfg | |
invalid_encoding_handling | The available options are: URL_DECODER_PRESERVE_PERCENT, URL_DECODER_REMOVE_PERCENT, URL_DECODER_DECODE_INVALID and URL_DECODER_STATUS_400. |
void htp_config_set_path_invalid_utf8_handling | ( | htp_cfg_t * | cfg, |
int | invalid_utf8_handling | ||
) |
Configures how server reacts to invalid UTF-8 characters in path. This setting will not affect path normalization; it only controls what response status we expect for a request that contains invalid UTF-8 characters.
cfg | |
invalid_utf8_handling | Possible values: NONE or STATUS_400. |
void htp_config_set_path_nul_encoded_handling | ( | htp_cfg_t * | cfg, |
int | nul_encoded_handling | ||
) |
Configures how server reacts to encoded NUL bytes. Some servers will terminate path at NUL, while some will respond with 400 or 404. When the termination option is not used, the NUL byte will remain in the path.
cfg | |
nul_encoded_handling | Possible values: TERMINATE, STATUS_400, STATUS_404 |
void htp_config_set_path_nul_raw_handling | ( | htp_cfg_t * | cfg, |
int | nul_raw_handling | ||
) |
Configures how server reacts to raw NUL bytes. Some servers will terminate path at NUL, while some will respond with 400 or 404. When the termination option is not used, the NUL byte will remain in the path.
cfg | |
nul_raw_handling | Possible values: TERMINATE, STATUS_400, STATUS_404 |
void htp_config_set_path_replacement_char | ( | htp_cfg_t * | cfg, |
int | replacement_char | ||
) |
Sets the replacement character that will be used to in the lossy best-fit mapping from Unicode characters into single-byte streams. The question mark is the default replacement character.
cfg | |
replacement_char |
void htp_config_set_path_unicode_mapping | ( | htp_cfg_t * | cfg, |
int | unicode_mapping | ||
) |
Controls what the library does when it encounters an Unicode character where only a single-byte would do (e.g., the u-encoded characters). Conversion always takes place; this parameter is used to correctly predict the status code used in response. In the future there will probably be an option to convert such characters to UCS-2 or UTF-8.
cfg | |
unicode_mapping | Possible values: BESTFIT, STATUS_400, STATUS_404. |
void htp_config_set_path_utf8_overlong_handling | ( | htp_cfg_t * | cfg, |
int | utf8_overlong_handling | ||
) |
Controls how server reacts to overlong UTF-8 characters. Not used at the moment.
cfg | |
utf8_overlong_handling |
void htp_config_set_response_decompression | ( | htp_cfg_t * | cfg, |
int | enabled | ||
) |
Controls whether compressed response bodies will be automatically decompressed.
cfg | |
enabled | set to 1 to enable decompression, 0 otherwise |
int htp_config_set_server_personality | ( | htp_cfg_t * | cfg, |
int | personality | ||
) |
Configure desired server personality.
cfg | |
personality |
void htp_config_set_tx_auto_destroy | ( | htp_cfg_t * | cfg, |
int | tx_auto_destroy | ||
) |
Configures whether transactions will be automatically destroyed once they are no longer needed.
cfg | |
tx_auto_destroy |