projects
/
project
/
uhttpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor cleanup
[project/uhttpd.git]
/
file.c
diff --git
a/file.c
b/file.c
index
7091ef7
..
ae4517c
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-127,7
+127,8
@@
next:
/* Returns NULL on error.
** NB: improperly encoded URL should give client 400 [Bad Syntax]; returning
** NULL here causes 404 [Not Found], but that's not too unreasonable. */
/* Returns NULL on error.
** NB: improperly encoded URL should give client 400 [Bad Syntax]; returning
** NULL here causes 404 [Not Found], but that's not too unreasonable. */
-struct path_info * uh_path_lookup(struct client *cl, const char *url)
+static struct path_info *
+uh_path_lookup(struct client *cl, const char *url)
{
static char path_phys[PATH_MAX];
static char path_info[PATH_MAX];
{
static char path_phys[PATH_MAX];
static char path_info[PATH_MAX];
@@
-314,10
+315,10
@@
static char * uh_file_unix2date(time_t ts)
static char *uh_file_header(struct client *cl, int idx)
{
static char *uh_file_header(struct client *cl, int idx)
{
- if (!cl->d
ata
.file.hdr[idx])
+ if (!cl->d
ispatch
.file.hdr[idx])
return NULL;
return NULL;
- return (char *) blobmsg_data(cl->d
ata
.file.hdr[idx]);
+ return (char *) blobmsg_data(cl->d
ispatch
.file.hdr[idx]);
}
static void uh_file_response_ok_hdrs(struct client *cl, struct stat *s)
}
static void uh_file_response_ok_hdrs(struct client *cl, struct stat *s)
@@
-528,7
+529,7
@@
static void uh_file_dirlist(struct client *cl, struct path_info *pi)
static void file_write_cb(struct client *cl)
{
char buf[512];
static void file_write_cb(struct client *cl)
{
char buf[512];
- int fd = cl->d
ata
.file.fd;
+ int fd = cl->d
ispatch
.file.fd;
int r;
while (cl->us->w.data_bytes < 256) {
int r;
while (cl->us->w.data_bytes < 256) {
@@
-549,7
+550,7
@@
static void file_write_cb(struct client *cl)
static void uh_file_free(struct client *cl)
{
static void uh_file_free(struct client *cl)
{
- close(cl->d
ata
.file.fd);
+ close(cl->d
ispatch
.file.fd);
}
static void uh_file_data(struct client *cl, struct path_info *pi, int fd)
}
static void uh_file_data(struct client *cl, struct path_info *pi, int fd)
@@
-582,9
+583,10
@@
static void uh_file_data(struct client *cl, struct path_info *pi, int fd)
return;
}
return;
}
- cl->data.file.fd = fd;
- cl->dispatch_write_cb = file_write_cb;
- cl->dispatch_free = uh_file_free;
+ cl->dispatch.file.fd = fd;
+ cl->dispatch.write_cb = file_write_cb;
+ cl->dispatch.free = uh_file_free;
+ cl->dispatch.close_fds = uh_file_free;
file_write_cb(cl);
}
file_write_cb(cl);
}
@@
-602,7
+604,7
@@
static void uh_file_request(struct client *cl, struct path_info *pi, const char
blobmsg_parse(hdr_policy, __HDR_MAX, tb, blob_data(cl->hdr.head), blob_len(cl->hdr.head));
blobmsg_parse(hdr_policy, __HDR_MAX, tb, blob_data(cl->hdr.head), blob_len(cl->hdr.head));
- cl->d
ata
.file.hdr = tb;
+ cl->d
ispatch
.file.hdr = tb;
if (!(pi->stat.st_mode & S_IROTH))
goto error;
if (!(pi->stat.st_mode & S_IROTH))
goto error;
@@
-640,7
+642,7
@@
static bool __handle_file_request(struct client *cl, const char *url)
if (!pi->redirected) {
uh_file_request(cl, pi, url);
if (!pi->redirected) {
uh_file_request(cl, pi, url);
- cl->d
ata
.file.hdr = NULL;
+ cl->d
ispatch
.file.hdr = NULL;
}
return true;
}
return true;