38 #include "http-strings.h"
40 #define ISO_number 0x23
41 #define ISO_percent 0x25
42 #define ISO_period 0x2e
43 #define ISO_slash 0x2f
44 #define ISO_question 0x3f
46 static char wwwroot[40];
47 static unsigned char wwwrootlen;
53 int rd = cfs_read(fd, wwwroot,
sizeof(wwwroot));
55 if(rd != -1) wwwrootlen = rd;
74 urlconv_tofilename(
char *dest,
char *source,
unsigned char maxlen)
76 static unsigned char len;
77 static unsigned char c, hex1;
78 static unsigned char *from, *to;
81 strncpy(dest + 1, wwwroot, wwwrootlen);
83 from = source; to = dest + wwwrootlen;
84 maxlen -= 2 + wwwrootlen;
94 hex1 = (*(from++) | 0x20) ^ 0x30;
95 if(hex1 > 0x50 && hex1 < 0x57)
100 c = (*(from++) | 0x20) ^ 0x30;
101 if(c > 0x50 && c < 0x57)
109 if(c < 0x20 || c > 0x7e)
114 if(c == ISO_slash || !c) {
124 if(to[-2] == ISO_slash) {
129 }
while(*to != ISO_slash);
141 if(*to == ISO_slash && (len +
sizeof(http_index_htm) - 3) < maxlen) {
142 strcpy(to, http_index_htm);
int cfs_open(const char *name, int flags)
Open a file.
#define CFS_READ
Specify that cfs_open() should open a file for reading.
void cfs_close(int fd)
Close an open file.