parslib/tinyparser.h

144 lines
3.4 KiB
C
Raw Normal View History

2024-08-15 23:12:06 +00:00
#ifndef PARSER_H
#define PARSER_H
#define CRLF "\r\n"
#define MAX_BOUND 1024
2024-08-15 23:12:06 +00:00
#define LINE_BUF 1024
#define TEST_ONE "GET / HTTP/1.1\r\n"\
"Host: archive.0xdeadbeer.xyz\r\n"\
"User-Agent: curl/8.9.1\r\n"\
"Accept: */*\r\n"\
"\r\n"\
"{\"key\": \"kefjoiawejfojgorgjbosejrgo\"}"\
2024-08-15 23:12:06 +00:00
// ENUMS
// SRC:https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
2024-08-15 23:12:06 +00:00
enum methods {
method_get = 1,
method_head,
2024-08-15 23:12:06 +00:00
method_post,
method_put,
method_delete,
method_connect,
method_options,
method_trace,
method_patch
2024-08-15 23:12:06 +00:00
};
// SRC:https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
2024-08-15 23:12:06 +00:00
enum headers {
header_a_im = 1,
2024-08-15 23:12:06 +00:00
header_accept,
header_accept_charset,
header_accept_datetime,
header_accept_encoding,
header_accept_language,
header_access_control_request_method,
header_access_control_request_headers,
header_authorization,
header_cache_control,
header_connection,
header_content_encoding,
header_content_length,
header_content_md5,
header_content_type,
header_cookie,
header_date,
header_expect,
header_forwarded,
header_from,
header_host,
header_http2_settings,
header_if_match,
header_if_modified_since,
header_if_none_match,
header_if_range,
header_if_unmodified_since,
header_max_forwards,
header_origin,
header_pragma,
header_prefer,
header_proxy_authorization,
header_range,
header_referer,
header_te,
header_trailer,
header_transfer_encoding,
header_user_agent,
header_upgrade,
header_via,
header_warning,
header_upgrade_insecure_requests,
header_x_requested_with,
header_dnt,
header_x_forwarded_for,
header_x_forwarded_host,
header_x_forwarded_proto,
header_front_end_https,
header_x_http_method_override,
header_x_att_deviceid,
header_x_wap_profile,
header_proxy_connection,
header_x_uidh,
header_x_csrf_token,
header_x_request_id,
header_x_correlation_id,
header_correlation_id,
header_save_data,
header_sec_gpc,
header_accept_ch,
header_access_control_allow_origin,
header_access_control_allow_credentials,
header_access_control_expose_headers,
header_access_control_max_age,
header_access_control_allow_methods,
header_access_control_allow_headers,
header_accept_patch,
header_accept_ranges,
header_age,
header_allow,
header_alt_svc,
header_content_disposition,
header_content_language,
header_content_location,
header_content_range,
header_delta_base,
header_etag,
header_expires,
header_im,
header_last_modified,
header_link,
header_location,
header_p3p,
header_preference_applied,
header_proxy_authenticate,
header_public_key_pins,
header_retry_after,
header_server,
header_set_cookie,
header_strict_transport_security,
header_tk,
header_vary,
header_www_authenticate,
header_x_frame_options,
header_content_security_policy,
header_expect_ct,
header_nel,
header_permissions_policy,
header_refresh,
header_report_to,
header_status,
header_timing_allow_origin,
header_x_content_duration,
header_x_content_type_options,
header_x_powered_by,
header_x_redirect_by,
header_x_ua_compatible,
header_x_xss_protection,
header_count
2024-08-15 23:12:06 +00:00
};
#endif