Fix echo Makefile bug
This commit is contained in:
2
Makefile
2
Makefile
@ -54,7 +54,7 @@ bin/res/%.o: bin/res/%.txt
|
|||||||
|
|
||||||
bin/res/%.txt: res/%.*
|
bin/res/%.txt: res/%.*
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
echo -ne "\x00" >> $@
|
/bin/echo -ne "\x00" >> $@
|
||||||
|
|
||||||
bin/sesimos: bin/server.o bin/logger.o bin/cache_handler.o bin/async.o bin/workers.o \
|
bin/sesimos: bin/server.o bin/logger.o bin/cache_handler.o bin/async.o bin/workers.o \
|
||||||
bin/worker/request_handler.o bin/worker/tcp_acceptor.o \
|
bin/worker/request_handler.o bin/worker/tcp_acceptor.o \
|
||||||
|
@ -671,7 +671,9 @@ int proxy_send(proxy_ctx_t *proxy, sock *client, unsigned long len_to_send, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
int proxy_dump(proxy_ctx_t *proxy, char *buf, long len) {
|
int proxy_dump(proxy_ctx_t *proxy, char *buf, long len) {
|
||||||
sock_recv(&proxy->proxy, buf, len, 0);
|
long ret = sock_recv(&proxy->proxy, buf, len, 0);
|
||||||
|
if (ret == -1) return -1;
|
||||||
|
buf[ret] = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static int proxy_handler_1(client_ctx_t *ctx) {
|
|||||||
(content_length_f != NULL && strstarts(content_type, "text/html"))))
|
(content_length_f != NULL && strstarts(content_type, "text/html"))))
|
||||||
{
|
{
|
||||||
long content_len = (!streq(ctx->req.method, "HEAD") && content_length_f != NULL) ? strtol(content_length_f, NULL, 10) : 0;
|
long content_len = (!streq(ctx->req.method, "HEAD") && content_length_f != NULL) ? strtol(content_length_f, NULL, 10) : 0;
|
||||||
if (content_len <= sizeof(ctx->msg_content) - 1) {
|
if (content_len < sizeof(ctx->msg_content)) {
|
||||||
if (status->status != 101) {
|
if (status->status != 101) {
|
||||||
status->status = res->status->code;
|
status->status = res->status->code;
|
||||||
status->origin = res->status->code >= 400 ? SERVER : NONE;
|
status->origin = res->status->code >= 400 ? SERVER : NONE;
|
||||||
|
@ -300,10 +300,10 @@ int respond(client_ctx_t *ctx) {
|
|||||||
ctx->msg_buf_ptr = malloc(4096);
|
ctx->msg_buf_ptr = malloc(4096);
|
||||||
ctx->msg_buf = ctx->msg_buf_ptr;
|
ctx->msg_buf = ctx->msg_buf_ptr;
|
||||||
snprintf(msg_pre_buf_1, sizeof(msg_pre_buf_1), http_info->doc,
|
snprintf(msg_pre_buf_1, sizeof(msg_pre_buf_1), http_info->doc,
|
||||||
res->status->code, res->status->msg, http_msg != NULL ? http_msg->msg : "", err_msg[0] != 0 ? err_msg : "");
|
res->status->code, res->status->msg, http_msg != NULL ? http_msg->msg : "", err_msg);
|
||||||
ctx->content_length = snprintf(ctx->msg_buf, 4096, http_default_doc, res->status->code,
|
ctx->content_length = snprintf(ctx->msg_buf, 4096, http_default_doc, res->status->code, res->status->msg,
|
||||||
res->status->msg, msg_pre_buf_1, http_info->mode, http_info->icon, http_info->color, ctx->req_host,
|
msg_pre_buf_1, http_info->mode, http_info->icon, http_info->color,
|
||||||
proxy_doc, ctx->msg_content[0] != 0 ? ctx->msg_content : "", SERVER_STR_HTML);
|
ctx->req_host, proxy_doc, ctx->msg_content, SERVER_STR_HTML);
|
||||||
}
|
}
|
||||||
if (ctx->content_length >= 0) {
|
if (ctx->content_length >= 0) {
|
||||||
sprintf(buf0, "%li", ctx->content_length);
|
sprintf(buf0, "%li", ctx->content_length);
|
||||||
|
Reference in New Issue
Block a user