wcsession *WCC = WC;
char httpnow[128];
- hprintf("HTTP/1.1 200 OK\n");
+ if (WCC->Hdr->HaveRange > 1)
+ hprintf("HTTP/1.1 206 Partial Content\r\n");
+ else
+ hprintf("HTTP/1.1 200 OK\r\n");
+
http_datestring(httpnow, sizeof httpnow, time(NULL));
if (do_httpheaders) {
end_burst();
}
+void http_transmit_headers(const char *content_type, int is_static, long is_chunked, int is_gzip)
+{
+ wcsession *WCC = WC;
+ syslog(LOG_DEBUG, "http_transmit_thing(%s)%s", content_type, ((is_static > 0) ? " (static)" : ""));
+ output_headers(0, 0, 0, 0, 0, is_static);
+
+ if (is_gzip)
+ hprintf("Content-encoding: gzip\r\n");
+
+ if (WCC->Hdr->HaveRange)
+ hprintf("Accept-Ranges: bytes\r\n"
+ "Content-Range: bytes %ld-%ld/%ld\r\n",
+ WCC->Hdr->RangeStart,
+ WCC->Hdr->RangeTil,
+ WCC->Hdr->TotalBytes);
+
+ hprintf("Content-type: %s\r\n"
+ "Server: "PACKAGE_STRING"\r\n"
+ "%s"
+ "Connection: close\r\n\r\n",
+ content_type,
+ (is_chunked)?"Transfer-Encoding: chunked\r\n":"");
+}
+
/*
* Convenience functions to display a page containing only a string
PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
);
hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", ChrPtr(WC->serv_info->serv_humannode));
+
+ /* if this is a false cookie authentication, remove it to avoid endless loops. */
+ if (StrLength(WCC->Hdr->HR.RawCookie) > 0)
+ stuff_to_cookie(1);
+
hprintf("Content-Type: text/html\r\n");
begin_burst();
wc_printf("<h1>");
if (havebstr("go")) {
syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
- StrBuf *teh_room = NewStrBufPlain(bstr("go"), strlen(bstr("go")));
- smart_goto(teh_room);
- FreeStrBuf(&teh_room);
+ smart_goto(sbstr("go"));
}
else if (default_landing_page) {
http_redirect(default_landing_page);