summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure1
-rw-r--r--configure.ac3
-rw-r--r--src/c/fastcgi.c36
3 files changed, 17 insertions, 23 deletions
diff --git a/configure b/configure
index 9f7ff84e..1bb0a96c 100755
--- a/configure
+++ b/configure
@@ -3445,7 +3445,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
# automake 1.12 requires this, but automake 1.11 doesn't recognize it
-
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
diff --git a/configure.ac b/configure.ac
index 1718b30b..5fde575f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,8 +3,7 @@ WORKING_VERSION=1
AC_USE_SYSTEM_EXTENSIONS
# automake 1.12 requires this, but automake 1.11 doesn't recognize it
-m4_pattern_allow([AM_PROG_AR])
-AM_PROG_AR
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define])
AC_PROG_CC()
diff --git a/src/c/fastcgi.c b/src/c/fastcgi.c
index 34042262..5677af83 100644
--- a/src/c/fastcgi.c
+++ b/src/c/fastcgi.c
@@ -40,7 +40,7 @@ typedef struct {
} FCGI_Output;
typedef struct {
- char buf[sizeof(FCGI_Record) + 255];
+ FCGI_Record r;
int available, used, sock;
} FCGI_Input;
@@ -76,32 +76,28 @@ static int fastcgi_send(FCGI_Output *o,
return uw_really_send(o->sock, &o->r, sizeof(o->r) - 65535 + contentLength);
}
-#define LATEST(i) ((FCGI_Record *)(i->buf + i->used))
-
static FCGI_Record *fastcgi_recv(FCGI_Input *i) {
+ if (i->used > 0) {
+ memmove((void*)&i->r, (void*)&i->r + i->used, i->available - i->used);
+ i->available -= i->used;
+ i->used = 0;
+ }
+
while (1) {
ssize_t n;
- if (i->available >= i->used + sizeof(FCGI_Record) - 65535
- && i->available >= i->used + sizeof(FCGI_Record) - 65535
- + ((LATEST(i)->contentLengthB1 << 8) | LATEST(i)->contentLengthB0)
- + LATEST(i)->paddingLength) {
- FCGI_Record *r = LATEST(i);
-
- i->used += sizeof(FCGI_Record) - 65535
- + ((LATEST(i)->contentLengthB1 << 8) | LATEST(i)->contentLengthB0)
- + LATEST(i)->paddingLength;
+ if (i->available >= sizeof(FCGI_Record) - 65535
+ && i->available >= sizeof(FCGI_Record) - 65535
+ + ((i->r.contentLengthB1 << 8) | i->r.contentLengthB0)
+ + i->r.paddingLength) {
+ i->used = sizeof(FCGI_Record) - 65535
+ + ((i->r.contentLengthB1 << 8) | i->r.contentLengthB0)
+ + i->r.paddingLength;
- return r;
- }
-
- if (i->used > 0) {
- memmove(i->buf, i->buf + i->used, i->available - i->used);
- i->available -= i->used;
- i->used = 0;
+ return &i->r;
}
- n = recv(i->sock, i->buf + i->available, sizeof(i->buf) - i->available, 0);
+ n = recv(i->sock, (void*)&i->r + i->available, sizeof(i->r) - i->available, 0);
if (n <= 0)
return NULL;