Fix FastCGI Non-Chunked bug
This commit is contained in:
@ -356,11 +356,6 @@ int fastcgi_recv_frame(fastcgi_cnx_t *cnx) {
|
|||||||
return header.type;
|
return header.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
long fastcgi_send(fastcgi_cnx_t *cnx, sock *client) {
|
|
||||||
char buf[CHUNK_SIZE];
|
|
||||||
return sock_splice_all(client, &cnx->out, buf, sizeof(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
int fastcgi_header(fastcgi_cnx_t *cnx, http_res *res, char *err_msg) {
|
int fastcgi_header(fastcgi_cnx_t *cnx, http_res *res, char *err_msg) {
|
||||||
long ret, len;
|
long ret, len;
|
||||||
char content[CLIENT_MAX_HEADER_SIZE];
|
char content[CLIENT_MAX_HEADER_SIZE];
|
||||||
|
@ -27,10 +27,8 @@ void fastcgi_handler_func(client_ctx_t *ctx) {
|
|||||||
int ret = fastcgi_handler_1(ctx, &fcgi_cnx);
|
int ret = fastcgi_handler_1(ctx, &fcgi_cnx);
|
||||||
respond(ctx);
|
respond(ctx);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
switch (fastcgi_handler_2(ctx, fcgi_cnx)) {
|
fastcgi_handler_2(ctx, fcgi_cnx);
|
||||||
case 1: return;
|
return;
|
||||||
case 2: break;
|
|
||||||
}
|
|
||||||
} else if (ctx->fcgi_ctx != NULL) {
|
} else if (ctx->fcgi_ctx != NULL) {
|
||||||
fastcgi_close(ctx->fcgi_ctx);
|
fastcgi_close(ctx->fcgi_ctx);
|
||||||
}
|
}
|
||||||
@ -176,15 +174,6 @@ static void fastcgi_error_cb(chunk_ctx_t *ctx) {
|
|||||||
|
|
||||||
static int fastcgi_handler_2(client_ctx_t *ctx, fastcgi_cnx_t *fcgi_cnx) {
|
static int fastcgi_handler_2(client_ctx_t *ctx, fastcgi_cnx_t *fcgi_cnx) {
|
||||||
int chunked = strcontains(http_get_header_field(&ctx->res.hdr, "Transfer-Encoding"), "chunked");
|
int chunked = strcontains(http_get_header_field(&ctx->res.hdr, "Transfer-Encoding"), "chunked");
|
||||||
|
handle_chunks(ctx, &fcgi_cnx->out, chunked ? SOCK_CHUNKED : 0, fastcgi_next_cb, fastcgi_error_cb);
|
||||||
if (chunked) {
|
|
||||||
handle_chunks(ctx, &fcgi_cnx->out, SOCK_CHUNKED, fastcgi_next_cb, fastcgi_error_cb);
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
fastcgi_send(fcgi_cnx, &ctx->socket);
|
|
||||||
fastcgi_close(ctx->fcgi_ctx);
|
|
||||||
ctx->fcgi_ctx = NULL;
|
|
||||||
fastcgi_handle(ctx);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user