list_add_tail(&in->list, &interpreters);
}
-static void cgi_main(struct client *cl, struct path_info *pi, const char *url)
+static void cgi_main(struct client *cl, struct path_info *pi, char *url)
{
const struct interpreter *ip = pi->ip;
struct env_var *var;
" %s: %s\n", ip ? ip->path : pi->phys, strerror(errno));
}
-static void cgi_handle_request(struct client *cl, const char *url, struct path_info *pi)
+static void cgi_handle_request(struct client *cl, char *url, struct path_info *pi)
{
unsigned int mode = S_IFREG | S_IXOTH;
return NULL;
}
-static bool __handle_file_request(struct client *cl, const char *url)
+static bool __handle_file_request(struct client *cl, char *url)
{
static const struct blobmsg_policy hdr_policy[__HDR_MAX] = {
[HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING },
void uh_handle_request(struct client *cl)
{
struct dispatch_handler *d;
- const char *url = blobmsg_data(blob_data(cl->hdr.head));;
+ char *url = blobmsg_data(blob_data(cl->hdr.head));;
+ char *error_handler;
d = dispatch_find(url, NULL);
if (d) {
return;
}
- if (__handle_file_request(cl, url) ||
- __handle_file_request(cl, conf.error_handler))
+ if (__handle_file_request(cl, url))
+ return;
+
+ error_handler = alloca(strlen(conf.error_handler) + 1);
+ strcpy(error_handler, conf.error_handler);
+ if (__handle_file_request(cl, error_handler))
return;
uh_client_error(cl, 404, "Not Found", "The requested URL %s was not found on this server.", url);
return NULL;
}
-static void lua_main(struct client *cl, struct path_info *pi, const char *url)
+static void lua_main(struct client *cl, struct path_info *pi, char *url)
{
struct blob_attr *cur;
const char *error;
exit(0);
}
-static void lua_handle_request(struct client *cl, const char *url, struct path_info *pi)
+static void lua_handle_request(struct client *cl, char *url, struct path_info *pi)
{
static struct path_info _pi;
void (*dispatch_add)(struct dispatch_handler *d);
bool (*path_match)(const char *prefix, const char *url);
- bool (*create_process)(struct client *cl, struct path_info *pi, const char *url,
- void (*cb)(struct client *cl, struct path_info *pi, const char *url));
+ bool (*create_process)(struct client *cl, struct path_info *pi, char *url,
+ void (*cb)(struct client *cl, struct path_info *pi, char *url));
struct env_var *(*get_process_vars)(struct client *cl, struct path_info *pi);
void (*client_error)(struct client *cl, int code, const char *summary, const char *fmt, ...);
return retlen;
}
-bool uh_create_process(struct client *cl, struct path_info *pi, const char *url,
- void (*cb)(struct client *cl, struct path_info *pi, const char *url))
+bool uh_create_process(struct client *cl, struct path_info *pi, char *url,
+ void (*cb)(struct client *cl, struct path_info *pi, char *url))
{
struct dispatch *d = &cl->dispatch;
struct dispatch_proc *proc = &d->proc;
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);
+ void (*handle_request)(struct client *cl, char *url, struct path_info *pi);
};
struct dispatch {
void uh_relay_free(struct relay *r);
struct env_var *uh_get_process_vars(struct client *cl, struct path_info *pi);
-bool uh_create_process(struct client *cl, struct path_info *pi, const char *url,
- void (*cb)(struct client *cl, struct path_info *pi, const char *url));
+bool uh_create_process(struct client *cl, struct path_info *pi, char *url,
+ void (*cb)(struct client *cl, struct path_info *pi, char *url));
int uh_plugin_init(const char *name);