mirror of https://github.com/nealey/eris.git
Remove fmemopen
This commit is contained in:
parent
d63e957ee3
commit
9f2749512f
12
eris.c
12
eris.c
|
@ -550,10 +550,11 @@ handle_request()
|
|||
/* Interpret path into fspath. */
|
||||
path = p - 1;
|
||||
{
|
||||
FILE *f = fmemopen(fspath, sizeof fspath, "w");
|
||||
char *fsp = fspath;
|
||||
char *query_string = NULL;
|
||||
|
||||
fprintf(f, "./");
|
||||
*(fsp++) = '.';
|
||||
*(fsp++) = '/';
|
||||
for (; *p != ' '; p += 1) {
|
||||
if (! query_string) {
|
||||
char c = *p;
|
||||
|
@ -584,11 +585,12 @@ handle_request()
|
|||
break;
|
||||
}
|
||||
|
||||
fputc(c, f);
|
||||
if (fsp - fspath + 1 < sizeof fspath) {
|
||||
*(fsp++) = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
fputc(0, f);
|
||||
fclose(f);
|
||||
*fsp = 0;
|
||||
|
||||
*(p++) = 0; /* NULL-terminate path */
|
||||
|
||||
|
|
13
strings.c
13
strings.c
|
@ -116,15 +116,10 @@ void
|
|||
url_esc(FILE *f, char *s)
|
||||
{
|
||||
for (; *s; s += 1) {
|
||||
switch (*s) {
|
||||
case '%':
|
||||
case 127:
|
||||
case -127 ... 31:
|
||||
fprintf(f, "%%%02x", *s);
|
||||
break;
|
||||
default:
|
||||
fputc(*s, f);
|
||||
break;
|
||||
if ((*s == '%') || (*s == 127) || (*s < 31)) {
|
||||
fprintf(f, "%%%02x", *s);
|
||||
} else {
|
||||
fputc(*s, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue