*/
void do_openid_login(void)
{
- wcsession *WCC = WC;
char buf[4096];
if (havebstr("language")) {
}
if (havebstr("login_action")) {
snprintf(buf, sizeof buf,
- "OIDS %s|%s://%s/finalize_openid_login|%s://%s",
+ "OIDS %s|%s/finalize_openid_login|%s",
bstr("openid_url"),
- (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host),
- (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host)
+ ChrPtr(site_prefix),
+ ChrPtr(site_prefix)
);
serv_puts(buf);
void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
- if ((follow_xff) && (hdr->HR.http_host != NULL))
+ if ((follow_xff) && (hdr->HR.http_host != NULL)) {
return;
- else
+ }
+ else {
hdr->HR.http_host = Line;
+ if (site_prefix == NULL) {
+ site_prefix = NewStrBuf();
+ StrBufAppendPrintf(site_prefix, "%s://", (is_https ? "https" : "http") );
+ StrBufAppendBuf(site_prefix, Line, 0);
+ lprintf(CTDL_DEBUG, "\033[33m [%s] \033[0m\n", ChrPtr(site_prefix));
+ }
+ }
}
void Header_HandleXFFHost(StrBuf *Line, ParsedHttpHdrs *hdr)
* Output our host prefix for globally absolute URL's.
*/
void groupdav_identify_host(void) {
- wcsession *WCC = WC;
-
- if (StrLength(WCC->Hdr->HR.http_host)!=0) {
- wc_printf("%s://%s",
- (is_https ? "https" : "http"),
- ChrPtr(WCC->Hdr->HR.http_host));
- }
+ wc_printf("%s", ChrPtr(site_prefix));
}
void tmplput_GROUPDAV_HOSTNAME(StrBuf *Target, WCTemplputParams *TP)
{
- wcsession *WCC = WC;
-
- if (StrLength(WCC->Hdr->HR.http_host)!=0) {
- StrBufAppendPrintf(Target,
- "%s://%s",
- (is_https ? "https" : "http"),
- ChrPtr(WCC->Hdr->HR.http_host));
- }
+ StrBufAppendPrintf(Target, "%s", ChrPtr(site_prefix));
}
/*
* Output our host prefix for globally absolute URL's.
*/
void groupdav_identify_hosthdr(void) {
- wcsession *WCC = WC;
-
- if (StrLength(WCC->Hdr->HR.http_host)!=0) {
- hprintf("%s://%s",
- (is_https ? "https" : "http"),
- ChrPtr(WCC->Hdr->HR.http_host));
- }
+ hprintf("%s", ChrPtr(site_prefix));
}
* Subscribe command
*/
if (!strcasecmp(cmd, "subscribe")) {
- serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
+ serv_printf("SUBS subscribe|%s|%s|%s|%s/listsub",
room,
email,
subtype,
- (is_https ? "https" : "http"),
- ChrPtr(WC->Hdr->HR.http_host)
+ ChrPtr(site_prefix)
);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
* Unsubscribe command
*/
else if (!strcasecmp(cmd, "unsubscribe")) {
- serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
- room,
- email,
- (is_https ? "https" : "http"),
- ChrPtr(WC->Hdr->HR.http_host)
+ serv_printf("SUBS unsubscribe|%s|%s|%s/listsub",
+ room,
+ email,
+ ChrPtr(site_prefix)
);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
char buf[4096];
if (havebstr("attach_button")) {
- wcsession *WCC = WC;
lprintf(CTDL_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
snprintf(buf, sizeof buf,
- "OIDS %s|%s://%s/finalize_openid_login|%s://%s",
- bstr("openid_url"),
- (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host),
- (is_https ? "https" : "http"), ChrPtr(WCC->Hdr->HR.http_host)
+ "OIDS %s|%s/finalize_openid_login|%s",
+ bstr("openid_url"),
+ ChrPtr(site_prefix),
+ ChrPtr(site_prefix)
);
serv_puts(buf);
extern int follow_xff;
extern int num_threads_existing;
extern int num_threads_executing;
+extern StrBuf *site_prefix;
void InitialiseSemaphores(void);
void begin_critical_section(int which_one);
int follow_xff = 0; /* Follow X-Forwarded-For: header */
int home_specified = 0; /* did the user specify a homedir? */
int DisableGzip = 0;
+StrBuf *site_prefix = NULL;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;