}
if ( (WC->logged_in) && (!unset_cookies) ) {
- DoTemplate(HKEY("iconbar"), NULL, &NoCtx);
+ //DoTemplate(HKEY("iconbar"), NULL, &NoCtx);
+ page_popup();
}
if (do_room_banner == 1) {
* A template has been requested
*/
void url_do_template(void) {
+ const StrBuf *MimeType;
const StrBuf *Tmpl = sbstr("template");
begin_burst();
- output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(SKEY(Tmpl), NULL, &NoCtx);
- end_burst();
+ output_headers(0, 0, 0, 0, 1, 0);
+ MimeType = DoTemplate(SKEY(Tmpl), NULL, &NoCtx);
+ http_transmit_thing(ChrPtr(MimeType), 0);
}
StrBuf *UrlLine = NULL;
StrBuf *content = NULL;
const char *content_end = NULL;
- char browser_host[256];
+ StrBuf *browser_host = NULL;
char user_agent[256];
int body_start = 0;
int is_static = 0;
safestrncpy(c_httpauth_string, "", sizeof c_httpauth_string);
c_httpauth_user = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
c_httpauth_pass = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
- strcpy(browser_host, "");
WCC= WC;
if (WCC->WBuf == NULL)
WCC->upload = NULL;
WCC->is_mobile = 0;
WCC->trailing_javascript = NewStrBuf();
+ WCC->nWildfireHeaders = 0;
/** Figure out the action */
index[0] = action;
if ((follow_xff) &&
GetHash(HTTPHeaders, HKEY("X-FORWARDED-HOST"), &vLine) &&
(vLine != NULL)) {
- safestrncpy(WCC->http_host,
- ChrPtr((StrBuf*)vLine),
- sizeof WCC->http_host);
+ WCC->http_host = (StrBuf*)vLine;
}
- if (IsEmptyStr(WCC->http_host) &&
+ if ((StrLength(WCC->http_host) == 0) &&
GetHash(HTTPHeaders, HKEY("HOST"), &vLine) &&
(vLine!=NULL)) {
- safestrncpy(WCC->http_host,
- ChrPtr((StrBuf*)vLine),
- sizeof WCC->http_host);
-
+ WCC->http_host = (StrBuf*)vLine;
}
+
if (GetHash(HTTPHeaders, HKEY("X-FORWARDED-FOR"), &vLine) &&
(vLine!=NULL)) {
- safestrncpy(browser_host,
- ChrPtr((StrBuf*) vLine),
- sizeof browser_host);
- while (num_tokens(browser_host, ',') > 1) {
- remove_token(browser_host, 0, ',');
+ browser_host = (StrBuf*) vLine;
+
+ while (StrBufNum_tokens(browser_host, ',') > 1) {
+ StrBufRemove_token(browser_host, 0, ',');
}
- striplt(browser_host);
+ StrBufTrim(browser_host);
}
if (ContentLength > 0) {
}
/* make a note of where we are in case the user wants to save it */
- safestrncpy(WCC->this_page, ChrPtr(ReqLine), sizeof(WCC->this_page));
- remove_token(WCC->this_page, 2, ' ');
- remove_token(WCC->this_page, 0, ' ');
+ WCC->this_page = NewStrBufDup(ReqLine);
+ StrBufRemove_token(WCC->this_page, 2, ' ');
+ StrBufRemove_token(WCC->this_page, 0, ' ');
/* If there are variables in the URL, we must grab them now */
UrlLine = NewStrBufDup(ReqLine);
* unless we are following X-Forwarded-For: headers
* and such a header has already turned up something.
*/
- if ( (!follow_xff) || (strlen(browser_host) == 0) ) {
+ if ( (!follow_xff) || (StrLength(browser_host) == 0) ) {
+ if (browser_host == NULL) {
+ browser_host = NewStrBuf();
+ Put(HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"),
+ browser_host, HFreeStrBuf);
+ }
locate_host(browser_host, WCC->http_sock);
}
FreeStrBuf(&c_roomname);
FreeStrBuf(&c_httpauth_user);
FreeStrBuf(&c_httpauth_pass);
+ FreeStrBuf(&WCC->this_page);
fflush(stdout);
if (content != NULL) {
FreeStrBuf(&content);
WCC->upload_length = 0;
}
FreeStrBuf(&WCC->trailing_javascript);
+ WCC->http_host = NULL;
}