mirror of https://github.com/omar-polo/gmid.git
rename reason to meta
This commit is contained in:
parent
05c23a54ea
commit
df79b4c1d5
16
server.c
16
server.c
|
@ -247,26 +247,26 @@ handle_open_conn(struct pollfd *fds, struct client *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
start_reply(struct pollfd *pfd, struct client *client, int code, const char *reason)
|
start_reply(struct pollfd *pfd, struct client *c, int code, const char *meta)
|
||||||
{
|
{
|
||||||
char buf[1030]; /* status + ' ' + max reply len + \r\n\0 */
|
char buf[1030]; /* status + ' ' + max reply len + \r\n\0 */
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
client->code = code;
|
c->code = code;
|
||||||
client->meta = reason;
|
c->meta = meta;
|
||||||
client->state = S_INITIALIZING;
|
c->state = S_INITIALIZING;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%d ", code);
|
snprintf(buf, sizeof(buf), "%d ", code);
|
||||||
strlcat(buf, reason, sizeof(buf));
|
strlcat(buf, meta, sizeof(buf));
|
||||||
if (!strcmp(reason, "text/gemini") && client->host->lang != NULL) {
|
if (!strcmp(meta, "text/gemini") && c->host->lang != NULL) {
|
||||||
strlcat(buf, "; lang=", sizeof(buf));
|
strlcat(buf, "; lang=", sizeof(buf));
|
||||||
strlcat(buf, client->host->lang, sizeof(buf));
|
strlcat(buf, c->host->lang, sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlcat(buf, "\r\n", sizeof(buf));
|
len = strlcat(buf, "\r\n", sizeof(buf));
|
||||||
assert(len < (int)sizeof(buf));
|
assert(len < (int)sizeof(buf));
|
||||||
|
|
||||||
switch (tls_write(client->ctx, buf, len)) {
|
switch (tls_write(c->ctx, buf, len)) {
|
||||||
case TLS_WANT_POLLIN:
|
case TLS_WANT_POLLIN:
|
||||||
pfd->events = POLLIN;
|
pfd->events = POLLIN;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue