HTTP - general#
Methods#
-
enum http_method#
HTTP methods.
Values:
-
enumerator HTTP_INVALID = -1#
-
enumerator HTTP_DELETE#
-
enumerator HTTP_GET#
-
enumerator HTTP_POST#
-
enumerator HTTP_MIMEPOST#
-
enumerator HTTP_PATCH#
-
enumerator HTTP_PUT#
-
enumerator HTTP_INVALID = -1#
-
const char *http_method_print(enum http_method method)#
Get the HTTP method name string.
- Parameters:
method – the HTTP method
- Returns:
the HTTP method name
-
enum http_method http_method_eval(char method[])#
Get the HTTP method enumerator from a string.
- Parameters:
method – the HTTP method string
- Returns:
the HTTP method enumerator
Status Code#
- group HttpStatusCode
-
const char *http_code_print(int httpcode)#
Get the HTTP status code name string.
- Parameters:
httpcode – the HTTP status code
- Returns:
the HTTP status code name
-
const char *http_reason_print(int httpcode)#
Get the HTTP status code reason string.
- Parameters:
httpcode – the HTTP status code
- Returns:
the HTTP status code reason
Example#
struct user_agent *ua = ua_init(NULL);
ua_set_url(ua, "https://www.example.com");
struct ua_info info = { 0 };
struct ua_conn_attr conn_attr = { .method = HTTP_GET };
printf("Send %s\n", http_method_print(conn_attr.method));
ua_easy_run(ua, &info, NULL, &conn_attr);
printf("HTTP Status name: %s\n", http_code_print(info.httpcode));
printf("HTTP Status reason %s\n", http_reason_print(info.httpcode));
ua_cleanup(ua);