+struct interpreter {
+ struct list_head list;
+ const char *path;
+ const char *ext;
+};
+
+struct path_info {
+ const char *root;
+ const char *phys;
+ const char *name;
+ const char *info;
+ const char *query;
+ const char *auth;
+ bool redirected;
+ struct stat stat;
+ const struct interpreter *ip;
+};
+
+struct env_var {
+ const char *name;
+ const char *value;
+};
+
+struct relay {
+ struct ustream_fd sfd;
+ struct uloop_process proc;
+ struct client *cl;
+
+ bool process_done;
+ int ret;
+ int header_ofs;
+
+ void (*header_cb)(struct relay *r, const char *name, const char *value);
+ void (*header_end)(struct relay *r);
+ void (*close)(struct relay *r, int ret);
+};
+
+struct dispatch_proc {
+ struct blob_buf hdr;
+ struct uloop_fd wrfd;
+ struct relay r;
+ int status_code;
+ char *status_msg;
+};
+
+struct dispatch_handler {
+ struct list_head list;
+
+ bool (*check_url)(const char *url);
+ bool (*check_path)(struct path_info *pi, const char *url);
+ void (*handle_request)(struct client *cl, const char *url, struct path_info *pi);
+};
+
+struct dispatch {
+ int (*data_send)(struct client *cl, const char *data, int len);
+ void (*data_done)(struct client *cl);
+ void (*write_cb)(struct client *cl);
+ void (*close_fds)(struct client *cl);
+ void (*free)(struct client *cl);
+ bool data_blocked;
+
+ union {
+ struct {
+ struct blob_attr **hdr;
+ int fd;
+ } file;
+ struct dispatch_proc proc;
+ };
+};
+