mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
fix blocked CGI read
This commit is contained in:
1 parent
f23d9ff3b0
commit
1de7fef760
3 files changed
+19
-18
No files matched your search
+4
-1
@@ -1305,7 +1305,10 @@ static int pull(FILE *fp, SOCKET sock, SSL *ssl, char *buf, int len) {
|
||||
if (ssl != NULL) {
|
||||
nread = SSL_read(ssl, buf, len);
|
||||
} else if (fp != NULL) {
|
||||
nread = fread(buf, 1, (size_t) len, fp);
|
||||
// Use read() instead of fread(), because if we're reading from the CGI
|
||||
// pipe, fread() may block until IO buffer is filled up. We cannot afford
|
||||
// to block and must pass all read bytes immediately to the client.
|
||||
nread = read(fileno(fp), buf, (size_t) len);
|
||||
if (ferror(fp))
|
||||
nread = -1;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user