commit - aa0fe0cf240e0add51d5b60a83dd554fd0575b28
commit + 75d233f00c010a1489d597b82b13e3d09bc01e45
blob - a057e17c4114ec7ef7f6088adf27405a4273d1ea
blob + 51cdc65babc246f824f93d4d676419cdc8282e15
--- gmid.c
+++ gmid.c
int start_reply(struct pollfd*, struct client*, int, const char*);
const char *path_ext(const char*);
const char *mime(const char*);
-int open_file(char*, struct pollfd*, struct client*);
-void start_cgi(const char*, struct pollfd*, struct client*);
+int open_file(char*, char*, struct pollfd*, struct client*);
+void start_cgi(const char*, const char*, struct pollfd*, struct client*);
void handle_cgi(struct pollfd*, struct client*);
-void send_file(char*, struct pollfd*, struct client*);
+void send_file(char*, char*, struct pollfd*, struct client*);
void send_dir(char*, struct pollfd*, struct client*);
void handle(struct pollfd*, struct client*);
}
int
-open_file(char *path, struct pollfd *fds, struct client *c)
+open_file(char *path, char *query, struct pollfd *fds, struct client *c)
{
char fpath[PATHBUF];
struct stat sb;
}
if (cgi && (sb.st_mode & S_IXUSR)) {
- start_cgi(fpath, fds, c);
+ start_cgi(fpath, query, fds, c);
return 0;
}
}
void
-start_cgi(const char *path, struct pollfd *fds, struct client *c)
+start_cgi(const char *path, const char *query,
+ struct pollfd *fds, struct client *c)
{
pid_t pid;
int p[2];
}
void
-send_file(char *path, struct pollfd *fds, struct client *c)
+send_file(char *path, char *query, struct pollfd *fds, struct client *c)
{
ssize_t ret, len;
if (c->fd == -1) {
- if (!open_file(path, fds, c))
+ if (!open_file(path, query, fds, c))
return;
c->state = S_SENDING;
}
strlcat(fpath, "index.gmi", sizeof(fpath));
- send_file(fpath, fds, client);
+ send_file(fpath, NULL, fds, client);
}
void
if (path_isdir(path))
send_dir(path, fds, client);
else
- send_file(path, fds, client);
+ send_file(path, query, fds, client);
break;
case S_INITIALIZING:
/* fallthrough */
case S_SENDING:
- send_file(NULL, fds, client);
+ send_file(NULL, NULL, fds, client);
break;
case S_CLOSING: