// and pass control back down to the HTTP layer to output the response back to
// the client.
//
-// Copyright (c) 1996-2021 by the citadel.org team
+// Copyright (c) 1996-2022 by the citadel.org team
//
// This program is open source software. It runs great on the
// Linux operating system (and probably elsewhere). You can use,
h->response_code = 502;
h->response_string = strdup("bad gateway");
add_response_header(h, strdup("Content-type"), strdup("text/plain"));
- h->response_body =
- strdup(_
- ("This program was unable to connect or stay connected to the Citadel server. Please report this problem to your system administrator."));
+ h->response_body = strdup(_("This program was unable to connect or stay connected to the Citadel server. Please report this problem to your system administrator."));
h->response_body_length = strlen(h->response_body);
}
// Legacy URL patterns (/readnew?gotoroom=xxx&start_reading_at=yyy) ...
// Direct room name (/my%20blog) ...
+ // HTTP-01 challenge [RFC5785 section 3, RFC8555 section 9.2]
+ if (!strncasecmp(h->url, HKEY("/.well-known"))) { // Static content
+ output_static(h);
+ return;
+ }
+
+ if (!strcasecmp(h->url, "/favicon.ico")) {
+ output_static(h);
+ return;
+ }
+
// Everything below this line is strictly REST URL patterns.
- if (strncasecmp(h->url, HKEY("/ctdl/"))) { // Reject non-REST
+ if (strncasecmp(h->url, HKEY("/ctdl/"))) { // Reject non-REST
do_404(h);
return;
}
- if (!strncasecmp(h->url, HKEY("/ctdl/s/"))) { // Static content
+ if (!strncasecmp(h->url, HKEY("/ctdl/s/"))) { // Static content
output_static(h);
return;
}
// WebDAV methods like OPTIONS and PROPFIND *require* a logged-in session,
// even if the Citadel server allows anonymous access.
if (IsEmptyStr(c->auth)) {
- if ((!strcasecmp(h->method, "OPTIONS"))
- || (!strcasecmp(h->method, "PROPFIND"))
- || (!strcasecmp(h->method, "REPORT"))
- || (!strcasecmp(h->method, "DELETE"))
- ) {
+ if ( (!strcasecmp(h->method, "OPTIONS"))
+ || (!strcasecmp(h->method, "PROPFIND"))
+ || (!strcasecmp(h->method, "REPORT"))
+ || (!strcasecmp(h->method, "DELETE"))
+ ) {
request_http_authenticate(h);
disconnect_from_citadel(c);
return;
case 'c': // /ctdl/c/ == misc Citadel server commands
ctdl_c(h, c);
break;
+ case 'f': // /ctdl/f/ == RESTful path to floors
+ ctdl_f(h, c);
+ break;
case 'r': // /ctdl/r/ == RESTful path to rooms
ctdl_r(h, c);
break;