commit - b691dc5834da50450379bfc33318e109d055de96
commit + fc1cb9ea0716bf54463829dfca90b942ad5c8bf9
blob - 4ac86591014a4994c6134ee8be8fa3a93ef90893
blob + 2f6ad087b9d0f3d8b128f73aef43fef2cd5bbe56
--- parse.y
+++ parse.y
/* ... */
}
| PROXY '{' optnl proxyopts_l '}'
- | STYLESHEET string { /* ... */ }
+ | STYLESHEET string {
+ size_t n;
+
+ n = strlcpy(srv->srv_conf.stylesheet, $2,
+ sizeof(srv->srv_conf.stylesheet));
+ if (n >= sizeof(srv->srv_conf.stylesheet))
+ yyerror("stylesheet path too long!");
+ free($2);
+ }
;
proxyopts_l : proxyopts_l proxyoptsl nl
blob - 3c81f89f249dc85bb6ef5e513b6089263a2635d2
blob + 021cf57a2d86ca0c43e68ab95612bcc1f96d59d4
--- proxy.c
+++ proxy.c
proxy_read(struct bufferevent *bev, void *d)
{
struct client *clt = d;
+ struct proxy_config *pc = clt->clt_pc;
struct evbuffer *src = EVBUFFER_INPUT(bev);
const char *ctype;
char *hdr;
clt->clt_headersdone = 1;
if (clt->clt_translate) {
- if (clt_puts(clt, "<!doctype html>"
- "<html><head></head><body>") == -1)
+ if (clt_puts(clt, "<!doctype html><html><head>") == -1)
return;
+ log_debug("stylesheet is %s", pc->stylesheet);
+ if (*pc->stylesheet != '\0' &&
+ clt_printf(clt, "<link rel='stylesheet' href='%s' />",
+ pc->stylesheet) == -1)
+ return;
+ if (clt_puts(clt, "</head><body>") == -1)
+ return;
}
goto copy;