-//
// This module handles HTTP transactions.
//
// Copyright (c) 1996-2021 by the citadel.org team
h.request_body = malloc(h.request_body_length);
client_read(ch, h.request_body, h.request_body_length);
- //write(2, HKEY("\033[31m"));
- //write(2, h.request_body, h.request_body_length);
- //write(2, HKEY("\033[0m\n"));
+ // Write the entire request body to stderr -- not what you want during normal operation.
+ #ifdef BODY_TO_STDERR
+ write(2, HKEY("\033[31m"));
+ write(2, h.request_body, h.request_body_length);
+ write(2, HKEY("\033[0m\n"));
+ #endif
}
+
// Now pass control up to the next layer to perform the request.
perform_request(&h);
- // Output the results back to the client.
- //write(2, HKEY("\033[32m"));
- //write(2, h.response_body, h.response_body_length);
- //write(2, HKEY("\033[0m\n"));
+ // Write the entire response body to stderr -- not what you want during normal operation.
+ #ifdef BODY_TO_STDERR
+ write(2, HKEY("\033[32m"));
+ write(2, h.response_body, h.response_body_length);
+ write(2, HKEY("\033[0m\n"));
+ #endif
+ // Output the results back to the client.
syslog(LOG_DEBUG, "> %03d %s", h.response_code, h.response_string);
client_printf(ch, "HTTP/1.1 %03d %s\r\n", h.response_code, h.response_string);
client_printf(ch, "Connection: close\r\n");
-//
// Main entry point for the program.
//
// Copyright (c) 1996-2021 by the citadel.org team
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);
}
// 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;
-//
// Output static content
//
// Copyright (c) 1996-2021 by the citadel.org team
// Forum view (flat)
-//
function forum_readmessages(target_div, gt_msg, lt_msg) {
original_text = document.getElementById(target_div).innerHTML; // in case we need to replace it after an error
document.getElementById(target_div).innerHTML =
// Render a range of messages, with the div prefix specified
-//
function forum_render_messages(msgs, prefix, scroll_to) {
for (i=0; i<msgs.length; ++i) {
forum_render_one(prefix, msgs[i], scroll_to);
}
refs += msgid;
- console.log("initial len: " + refs.length);
// If the resulting string is too big, we can trim it here
while (refs.length > 900) {
r = refs.split("|");
r.splice(1,1); // remove the second element so we keep the root
refs = r.join("|");
- console.log("split len: " + refs.length);
}
-
-
return refs;
}
new_div_name = prefix + "reply_to_" + msgnum;
document.getElementById(target_div_name).outerHTML += "<div id=\"" + new_div_name + "\">reply box put here</div>";
- // FIXME - we need to retain the message number being replied to
-
replybox =
"<div class=\"ctdl-msg-wrapper ctdl-msg-reply\">" // begin message wrapper
+ "<div class=\"ctdl-avatar\">" // begin avatar
for (var i in headers) {
if (headers[i].startsWith("etag: ")) {
new_msg_num = headers[i].split(" ")[1];
- alert("div_name=" + div_name + " , reply_to_msgnum = " + reply_to_msgnum + " , new_msg_num = " + new_msg_num);
}
}
+ alert("div_name=" + div_name + " , reply_to_msgnum = " + reply_to_msgnum + " , new_msg_num = " + new_msg_num);
document.getElementById(div_name).outerHTML = ""; // close the editor
}
else {
if (error_message.length == 0) {
error_message = _("An error has occurred.");
}
- alert(error_message);
+ alert(error_message); // editor remains open
}
}
};