Handle proxy earlier
This commit is contained in:
@ -327,17 +327,17 @@ int respond(client_ctx_t *ctx) {
|
|||||||
close_proxy = 1;
|
close_proxy = 1;
|
||||||
}
|
}
|
||||||
info("WebSocket connection closed");
|
info("WebSocket connection closed");
|
||||||
|
} else if (ctx->use_proxy) {
|
||||||
|
return 3;
|
||||||
} else if (strcmp(req->method, "HEAD") != 0) {
|
} else if (strcmp(req->method, "HEAD") != 0) {
|
||||||
// default response
|
// default response
|
||||||
unsigned long snd_len = 0;
|
|
||||||
unsigned long len;
|
|
||||||
if (ctx->msg_buf != NULL) {
|
if (ctx->msg_buf != NULL) {
|
||||||
ret = sock_send(client, ctx->msg_buf, ctx->content_length, 0);
|
ret = sock_send(client, ctx->msg_buf, ctx->content_length, 0);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
error("Unable to send: %s", sock_strerror(client));
|
error("Unable to send: %s", sock_strerror(client));
|
||||||
}
|
}
|
||||||
snd_len += ret;
|
|
||||||
} else if (ctx->file != NULL) {
|
} else if (ctx->file != NULL) {
|
||||||
|
unsigned long len, snd_len = 0;
|
||||||
while (snd_len < ctx->content_length) {
|
while (snd_len < ctx->content_length) {
|
||||||
len = fread(buffer, 1, CHUNK_SIZE, ctx->file);
|
len = fread(buffer, 1, CHUNK_SIZE, ctx->file);
|
||||||
if (snd_len + len > ctx->content_length) {
|
if (snd_len + len > ctx->content_length) {
|
||||||
@ -352,8 +352,6 @@ int respond(client_ctx_t *ctx) {
|
|||||||
}
|
}
|
||||||
} else if (ctx->use_fastcgi) {
|
} else if (ctx->use_fastcgi) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if (ctx->use_proxy) {
|
|
||||||
return 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
Reference in New Issue
Block a user