projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6890b64
)
New global variable 'site_prefix' which replaces the often-repeated code which constr...
author
Art Cancro
<ajc@citadel.org>
Wed, 8 Sep 2010 16:49:46 +0000
(12:49 -0400)
committer
Art Cancro
<ajc@citadel.org>
Wed, 8 Sep 2010 16:49:46 +0000
(12:49 -0400)
webcit/auth.c
patch
|
blob
|
history
webcit/context_loop.c
patch
|
blob
|
history
webcit/groupdav_main.c
patch
|
blob
|
history
webcit/listsub.c
patch
|
blob
|
history
webcit/openid.c
patch
|
blob
|
history
webcit/webcit.h
patch
|
blob
|
history
webcit/webserver.c
patch
|
blob
|
history
diff --git
a/webcit/auth.c
b/webcit/auth.c
index a03be8811f8b1c86063a33ba9a923e9e7d5218e7..0dc3b725592c23620ee4869e83cee6e19a529228 100644
(file)
--- a/
webcit/auth.c
+++ b/
webcit/auth.c
@@
-286,7
+286,6
@@
void openid_manual_create(void)
*/
void do_openid_login(void)
{
*/
void do_openid_login(void)
{
- wcsession *WCC = WC;
char buf[4096];
if (havebstr("language")) {
char buf[4096];
if (havebstr("language")) {
@@
-300,10
+299,10
@@
void do_openid_login(void)
}
if (havebstr("login_action")) {
snprintf(buf, sizeof buf,
}
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"),
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);
);
serv_puts(buf);
diff --git
a/webcit/context_loop.c
b/webcit/context_loop.c
index ca72387d7d791c6af8d03121cafd98674cb8c366..a358545e989c36ccbc46ce5be28f495cf4aa46a1 100644
(file)
--- a/
webcit/context_loop.c
+++ b/
webcit/context_loop.c
@@
-671,10
+671,18
@@
void Header_HandleUserAgent(StrBuf *Line, ParsedHttpHdrs *hdr)
void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
{
- if ((follow_xff) && (hdr->HR.http_host != NULL))
+ if ((follow_xff) && (hdr->HR.http_host != NULL))
{
return;
return;
- else
+ }
+ else {
hdr->HR.http_host = Line;
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)
}
void Header_HandleXFFHost(StrBuf *Line, ParsedHttpHdrs *hdr)
diff --git
a/webcit/groupdav_main.c
b/webcit/groupdav_main.c
index f72d09a2231aa8647f11d99d38d4bf95d691f8b6..3fc38fb306d1b585f4ef26d8ba873eb97655ffd1 100644
(file)
--- a/
webcit/groupdav_main.c
+++ b/
webcit/groupdav_main.c
@@
-190,39
+190,20
@@
void groupdav_main(void)
* Output our host prefix for globally absolute URL's.
*/
void groupdav_identify_host(void) {
* 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)
{
}
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) {
}
/*
* 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));
}
}
diff --git
a/webcit/listsub.c
b/webcit/listsub.c
index 60b5a49a6b272252c719565bec0222fc134c6834..c59cae348e29eec6582ae59a964b256ef76c3ec2 100644
(file)
--- a/
webcit/listsub.c
+++ b/
webcit/listsub.c
@@
-55,12
+55,11
@@
void do_listsub(void)
* Subscribe command
*/
if (!strcasecmp(cmd, "subscribe")) {
* 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,
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') {
);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
@@
-97,11
+96,10
@@
void do_listsub(void)
* Unsubscribe command
*/
else if (!strcasecmp(cmd, "unsubscribe")) {
* 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') {
);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
diff --git
a/webcit/openid.c
b/webcit/openid.c
index e58382d42d238c049e59c0599bb91cc38ef6d16d..8842e88102549f3f214d7d480a58a05a2417c917 100644
(file)
--- a/
webcit/openid.c
+++ b/
webcit/openid.c
@@
-66,15
+66,14
@@
void openid_attach(void) {
char buf[4096];
if (havebstr("attach_button")) {
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,
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);
);
serv_puts(buf);
diff --git
a/webcit/webcit.h
b/webcit/webcit.h
index e6086b1b91e9665d497b12df76fc93e553740cb2..24eca9ad3454d56c7d334fe281e8876301554d30 100644
(file)
--- a/
webcit/webcit.h
+++ b/
webcit/webcit.h
@@
-612,6
+612,7
@@
extern char wizard_filename[];
extern int follow_xff;
extern int num_threads_existing;
extern int num_threads_executing;
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);
void InitialiseSemaphores(void);
void begin_critical_section(int which_one);
diff --git
a/webcit/webserver.c
b/webcit/webserver.c
index b5ed93295b8dfcabfe2a5f8afb452326da082f0d..87b83afad5b71d5a5e9987f265e28c6e47d3fb01 100644
(file)
--- a/
webcit/webserver.c
+++ b/
webcit/webserver.c
@@
-25,6
+25,7
@@
int is_https = 0; /* Nonzero if I am an HTTPS service */
int follow_xff = 0; /* Follow X-Forwarded-For: header */
int home_specified = 0; /* did the user specify a homedir? */
int DisableGzip = 0;
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;
extern pthread_mutex_t SessionListMutex;
extern pthread_key_t MyConKey;