|
@@ -459,21 +459,25 @@ int main (int argc, char **argv)
|
459
|
459
|
if (poll(&fds[2], 1, timeout * 1000) <= 0) return EXIT_FAILURE;
|
460
|
460
|
line = fgets(linebuf, sizeof(linebuf), fp);
|
461
|
461
|
while (line) {
|
|
462
|
+ fseek (fp, 0, SEEK_CUR); /* Workaround for Solaris */
|
462
|
463
|
char* token;
|
463
|
464
|
token = strtok(line, " \r\n");
|
464
|
465
|
if (token == NULL || strcmp(token, "get") != 0) {
|
465
|
466
|
fprintf (fp, "500 Invalid request\n");
|
|
467
|
+ fflush (fp);
|
466
|
468
|
return EXIT_FAILURE;
|
467
|
469
|
}
|
468
|
470
|
token = strtok(NULL, "\r\n");
|
469
|
471
|
if (!token) {
|
470
|
472
|
fprintf (fp, "500 Invalid request\n");
|
|
473
|
+ fflush (fp);
|
471
|
474
|
return EXIT_FAILURE;
|
472
|
475
|
}
|
473
|
476
|
key = url_decode(keybuf, sizeof(keybuf), token);
|
474
|
477
|
if (!key) break;
|
475
|
478
|
handler[i](srs, fp, key, domain, excludes);
|
476
|
479
|
if (poll(&fds[2], 1, timeout * 1000) <= 0) break;
|
|
480
|
+ fflush (fp);
|
477
|
481
|
line = fgets(linebuf, sizeof(linebuf), fp);
|
478
|
482
|
}
|
479
|
483
|
fclose (fp);
|