-/* $OpenBSD: server.c,v 1.17 2014/07/30 13:49:48 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.18 2014/07/31 14:25:14 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
event_del(&clt->clt_ev);
if (clt->clt_bev != NULL)
bufferevent_disable(clt->clt_bev, EV_READ|EV_WRITE);
- if (clt->clt_file != NULL)
- bufferevent_disable(clt->clt_file, EV_READ|EV_WRITE);
+ if (clt->clt_srvbev != NULL)
+ bufferevent_disable(clt->clt_srvbev, EV_READ|EV_WRITE);
if ((env->sc_opts & HTTPD_OPT_LOGUPDATE) && msg != NULL) {
memset(&ibuf, 0, sizeof(ibuf));
if (clt->clt_output != NULL)
evbuffer_free(clt->clt_output);
- if (clt->clt_file != NULL)
- bufferevent_free(clt->clt_file);
+ if (clt->clt_srvbev != NULL)
+ bufferevent_free(clt->clt_srvbev);
if (clt->clt_fd != -1)
close(clt->clt_fd);
if (clt->clt_s != -1)
-/* $OpenBSD: server_fcgi.c,v 1.2 2014/07/31 14:18:38 reyk Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.3 2014/07/31 14:25:14 reyk Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
uint16_t content_len;
uint8_t padding_len;
uint8_t reserved;
-}__packed;
+} __packed;
struct fcgi_begin_request_body {
uint16_t role;
uint8_t flags;
uint8_t reserved[5];
-}__packed;
+} __packed;
void server_fcgi_read(struct bufferevent *, void *);
void server_fcgi_error(struct bufferevent *, short, void *);
if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1)
goto fail;
- if (clt->clt_fcgi != NULL)
- bufferevent_free(clt->clt_fcgi);
- clt->clt_fcgi = bufferevent_new(fd, server_fcgi_read,
+ if (clt->clt_srvbev != NULL)
+ bufferevent_free(clt->clt_srvbev);
+ clt->clt_srvbev = bufferevent_new(fd, server_fcgi_read,
NULL, server_fcgi_error, clt);
- if (clt->clt_fcgi == NULL) {
+ if (clt->clt_srvbev == NULL) {
errstr = "failed to allocate fcgi buffer event";
goto fail;
}
- bufferevent_settimeout(clt->clt_fcgi,
+ bufferevent_settimeout(clt->clt_srvbev,
srv_conf->timeout.tv_sec, srv_conf->timeout.tv_sec);
- bufferevent_enable(clt->clt_fcgi, EV_READ);
+ bufferevent_enable(clt->clt_srvbev, EV_READ);
bzero(&buf, sizeof(buf));
fcgi_record_header)];
begin->role = htons(FCGI_RESPONDER);
- bufferevent_write(clt->clt_fcgi, &buf,
+ bufferevent_write(clt->clt_srvbev, &buf,
sizeof(struct fcgi_record_header) +
sizeof(struct fcgi_begin_request_body));
h->content_len = htons(total_len);
- bufferevent_write(clt->clt_fcgi, &buf,
+ bufferevent_write(clt->clt_srvbev, &buf,
sizeof(struct fcgi_record_header) +
ntohs(h->content_len));
h->content_len = 0;
- bufferevent_write(clt->clt_fcgi, &buf,
+ bufferevent_write(clt->clt_srvbev, &buf,
sizeof(struct fcgi_record_header));
h->type = FCGI_STDIN;
- bufferevent_write(clt->clt_fcgi, &buf,
+ bufferevent_write(clt->clt_srvbev, &buf,
sizeof(struct fcgi_record_header));
return (0);
-/* $OpenBSD: server_file.c,v 1.20 2014/07/31 13:28:15 reyk Exp $ */
+/* $OpenBSD: server_file.c,v 1.21 2014/07/31 14:25:14 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
}
clt->clt_fd = fd;
- if (clt->clt_file != NULL)
- bufferevent_free(clt->clt_file);
+ if (clt->clt_srvbev != NULL)
+ bufferevent_free(clt->clt_srvbev);
- clt->clt_file = bufferevent_new(clt->clt_fd, server_read,
+ clt->clt_srvbev = bufferevent_new(clt->clt_fd, server_read,
server_write, server_file_error, clt);
- if (clt->clt_file == NULL) {
+ if (clt->clt_srvbev == NULL) {
errstr = "failed to allocate file buffer event";
goto fail;
}
- bufferevent_settimeout(clt->clt_file,
+ bufferevent_settimeout(clt->clt_srvbev,
srv_conf->timeout.tv_sec, srv_conf->timeout.tv_sec);
- bufferevent_enable(clt->clt_file, EV_READ);
+ bufferevent_enable(clt->clt_srvbev, EV_READ);
bufferevent_disable(clt->clt_bev, EV_READ);
return (0);