commit - e3c1cbab1623421ba65631719de71534f41597a3
commit + 232eee45ce904eca5fe392ba1a4f7d5f6453f142
blob - 4d2e19d22a42622d146c5e0f90b00249de96293a
blob + a9cfbd10ff1a48e28fa49445e79272d079414db4
--- fcgi.c
+++ fcgi.c
#include <unistd.h>
#include "log.h"
+#include "tmpl.h"
#include "galileo.h"
if ((clt = calloc(1, sizeof(*clt))) == NULL) {
log_warnx("calloc");
+ break;
+ }
+
+ clt->clt_tp = template(clt, clt_tp_puts, clt_tp_putc);
+ if (clt->clt_tp == NULL) {
+ free(clt);
+ log_warn("template");
break;
}
}
int
+clt_tp_puts(struct template *tp, const char *str)
+{
+ struct client *clt = tp->tp_arg;
+
+ if (clt_puts(clt, str) == -1) {
+ tp->tp_ret = -1;
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+clt_tp_putc(struct template *tp, int c)
+{
+ struct client *clt = tp->tp_arg;
+
+ if (clt_putc(clt, c) == -1) {
+ tp->tp_ret = -1;
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
fcgi_cmp(struct fcgi *a, struct fcgi *b)
{
return ((int)a->fcg_id - b->fcg_id);
SPLAY_GENERATE(fcgi_tree, fcgi, fcg_nodes, fcgi_cmp);
SPLAY_GENERATE(client_tree, client, clt_nodes, fcgi_client_cmp);
-
blob - bede9bcd83c52199ed920b3b4a3b8ac63d7a072a
blob + 751d06fe1ece115eb265af04a0a4eafb8a817b2c
--- galileo.h
+++ galileo.h
int clt_printf(struct client *, const char *, ...)
__attribute__((__format__(printf, 2, 3)))
__attribute__((__nonnull__(2)));
+int clt_tp_puts(struct template *, const char *);
+int clt_tp_putc(struct template *, int);
int fcgi_cmp(struct fcgi *, struct fcgi *);
int fcgi_client_cmp(struct client *, struct client *);
blob - 44302b7b6add1c4ed72d4a41d01762fe09db3ca5
blob + 58ab1fdeeafdaf3e8da708fd14c8920f3531da3f
--- proxy.c
+++ proxy.c
continue;
}
}
-
- return (0);
-}
-
-static int
-proxy_tp_puts(struct template *tp, const char *c)
-{
- struct client *clt = tp->tp_arg;
-
- if (clt_puts(clt, c) == -1) {
- tp->tp_ret = -1;
- return (-1);
- }
- return (0);
-}
-
-static int
-proxy_tp_putc(struct template *tp, int c)
-{
- struct client *clt = tp->tp_arg;
- if (clt_putc(clt, c) == -1) {
- tp->tp_ret = -1;
- return (-1);
- }
return (0);
}
fcgi_end_request(clt, 1);
goto err;
}
-
- if (clt->clt_translate) {
- clt->clt_tp = template(clt, proxy_tp_puts, proxy_tp_putc);
+ if (clt->clt_translate)
ctype = "text/html;charset=utf-8";
- } else
+ else
ctype = mime;
if (clt_printf(clt, "Content-Type: %s\r\n\r\n", ctype) == -1)