(handle_http_tcp): handle error from write(2)

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14398 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2004-12-13 22:18:38 +00:00
parent 1b20bf1897
commit ca0da3a363

View File

@@ -676,11 +676,19 @@ handle_http_tcp (struct descr *d)
"<H1>404 Not found</H1>\r\n"
"That page doesn't exist, maybe you are looking for "
"<A HREF=\"http://www.pdc.kth.se/heimdal/\">Heimdal</A>?\r\n";
write(d->s, proto, strlen(proto));
write(d->s, msg, strlen(msg));
kdc_log(0, "HTTP request from %s is non KDC request", d->addr_string);
kdc_log(5, "HTTP request: %s", t);
free(data);
if (write(d->s, proto, strlen(proto)) < 0) {
kdc_log(0, "HTTP write failed: %s: %s",
d->addr_string, strerror(errno));
return -1;
}
if (write(d->s, msg, strlen(msg)) < 0) {
kdc_log(0, "HTTP write failed: %s: %s",
d->addr_string, strerror(errno));
return -1;
}
return -1;
}
{
@@ -691,8 +699,16 @@ handle_http_tcp (struct descr *d)
"Pragma: no-cache\r\n"
"Content-type: application/octet-stream\r\n"
"Content-transfer-encoding: binary\r\n\r\n";
write(d->s, proto, strlen(proto));
write(d->s, msg, strlen(msg));
if (write(d->s, proto, strlen(proto)) < 0) {
kdc_log(0, "HTTP write failed: %s: %s",
d->addr_string, strerror(errno));
return -1;
}
if (write(d->s, msg, strlen(msg)) < 0) {
kdc_log(0, "HTTP write failed: %s: %s",
d->addr_string, strerror(errno));
return -1;
}
}
memcpy(d->buf, data, len);
d->len = len;