feat(lander): store filename if provided

This commit is contained in:
Jef Roosens 2023-11-12 16:13:54 +01:00
parent 04aef2643f
commit 6a5b23afaa
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 71 additions and 95 deletions

View file

@ -20,16 +20,9 @@ typedef enum lander_attr_type : uint8_t {
lander_attr_type_entry_type = 0,
lander_attr_type_content_type = 1,
lander_attr_type_url = 2,
lander_attr_type_file_name = 3,
} lander_attr_type;
typedef struct {
char *header;
lander_attr_type attr_type;
http_header header_type;
} header_to_attr;
extern header_to_attr header_to_attrs[];
typedef enum lander_entry_type : uint8_t {
lander_entry_type_redirect = 0,
lander_entry_type_paste = 1,
@ -67,11 +60,15 @@ bool lander_remove_entry(event_loop_conn *conn);
bool lander_post_file(event_loop_conn *conn);
/**
* Parse any custom headers and add them as attributes to the context's LSM
* entry
* Store the requested header as an attribute, if it's present.
*/
bool lander_headers_to_attrs(event_loop_conn *conn);
void lander_header_to_attr(http_loop_ctx *ctx, char *header,
lander_attr_type attr_type);
bool lander_attrs_to_headers(event_loop_conn *conn);
/**
* Store the attribute's value as the provided header, if present.
*/
void lander_attr_to_header(http_loop_ctx *ctx, lander_attr_type attr_type,
http_header header_type);
#endif