/*
* Generic function to do an HTTP redirect. Easy and fun.
*/
-void http_redirect(char *whichpage) {
+void http_redirect(const char *whichpage) {
wprintf("HTTP/1.1 302 Moved Temporarily\n");
wprintf("Location: %s\r\n", whichpage);
wprintf("URI: %s\r\n", whichpage);
return;
}
- set_preference("startpage", bstr("startpage"), 1);
+ set_preference("startpage", NewStrBufPlain(bstr("startpage"), -1), 1);
output_headers(1, 1, 0, 0, 0, 0);
do_template("newstartpage");
void authorization_required(const char *message)
{
wprintf("HTTP/1.1 401 Authorization Required\r\n");
- wprintf("WWW-Authenticate: Basic realm=\"\"\r\n", serv_info.serv_humannode);
+ wprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", serv_info.serv_humannode);
wprintf("Content-Type: text/html\r\n\r\n");
wprintf("<h1>");
wprintf(_("Authorization Required"));
end_ajax_response();
}
-
+/**
+ * \brief Detects a 'mobile' user agent
+ */
+int is_mobile_ua(char *user_agent) {
+ if (strstr(user_agent,"iPhone OS") != NULL) {
+ return 1;
+ } else if (strstr(user_agent,"Windows CE") != NULL) {
+ return 1;
+ } else if (strstr(user_agent,"SymbianOS") != NULL) {
+ return 1;
+ }
+ return 0;
+}
/*
WC->upload_length = 0;
WC->upload = NULL;
- WC->is_wap = 0;
+ WC->is_mobile = 0;
hptr = req;
if (hptr == NULL) return;
}
else if (!strncasecmp(buf, "User-agent: ", 12)) {
safestrncpy(user_agent, &buf[12], sizeof user_agent);
+ if (is_mobile_ua(&buf[12])) {
+ WC->is_mobile = 1;
+ }
}
else if (!strncasecmp(buf, "X-Forwarded-Host: ", 18)) {
if (follow_xff) {
}
striplt(browser_host);
}
- /** Only WAP gateways explicitly name this content-type */
- else if (strstr(buf, "text/vnd.wap.wml")) {
- /* since we don't have wap pages we disable this.
- * WC->is_wap = 1;
- */
- }
}
if (ContentLength > 0) {
}
}
+
/*
* Replacement for sleep() that uses select() in order to avoid SIGALRM
*/