+ /* 2010jun03: every now and then the connection to Citadel dies before this point. why? */
+
+ /*
+ * From what host is our user connecting? Go with
+ * the host at the other end of the HTTP socket,
+ * unless we are following X-Forwarded-For: headers
+ * and such a header has already turned up something.
+ */
+ if ( (!follow_xff) || (StrLength(WCC->Hdr->HR.browser_host) == 0) ) {
+ if (WCC->Hdr->HR.browser_host == NULL) {
+ WCC->Hdr->HR.browser_host = NewStrBuf();
+ Put(WCC->Hdr->HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"),
+ WCC->Hdr->HR.browser_host, HFreeStrBuf);
+ }
+ locate_host(WCC->Hdr->HR.browser_host, WCC->Hdr->http_sock);
+ }
+ if (WCC->serv_info == NULL) {
+ WCC->serv_info = get_serv_info(WCC->Hdr->HR.browser_host, WCC->Hdr->HR.user_agent);
+ }
+ if (WCC->serv_info == NULL){
+ begin_burst();
+ wc_printf(_("Received unexpected answer from Citadel server; bailing out."));
+ hprintf("HTTP/1.1 200 OK\r\n");
+ hprintf("Content-type: text/plain; charset=utf-8\r\n");
+ end_burst();
+ end_webcit_session();
+ return 1;
+ }
+ if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
+ begin_burst();
+ wc_printf(_("You are connected to a Citadel "
+ "server running Citadel %d.%02d. \n"
+ "In order to run this version of WebCit "
+ "you must also have Citadel %d.%02d or"
+ " newer.\n\n\n"),
+ WCC->serv_info->serv_rev_level / 100,
+ WCC->serv_info->serv_rev_level % 100,
+ MINIMUM_CIT_VERSION / 100,
+ MINIMUM_CIT_VERSION % 100
+ );
+ hprintf("HTTP/1.1 200 OK\r\n");
+ hprintf("Content-type: text/plain; charset=utf-8\r\n");
+ end_burst();
+ end_webcit_session();
+ return 1;
+ }
+ SetInlinMimeRenderers();
+ }
+ return 0;
+}
+
+/*