X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fwebcit.c;h=f06c546a988790a2b1f76286b1ac0abea613da05;hp=9c50938438744b4dea9d415f26f4848e13b4f1fd;hb=6af728cfac4414a7b937d2b5658e03a75710c59b;hpb=596967c488c1b954003d0f2e3c43279f6736b78b diff --git a/webcit/webcit.c b/webcit/webcit.c index 9c5093843..f06c546a9 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1314,7 +1314,19 @@ void seconds_since_last_gexp(void) 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; +} /* @@ -1364,7 +1376,7 @@ void session_loop(struct httprequest *req) WC->upload_length = 0; WC->upload = NULL; - WC->is_wap = 0; + WC->is_mobile = 0; hptr = req; if (hptr == NULL) return; @@ -1422,6 +1434,9 @@ void session_loop(struct httprequest *req) } 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) { @@ -1440,12 +1455,6 @@ void session_loop(struct httprequest *req) } 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) { @@ -2110,6 +2119,7 @@ SKIP_ALL_THIS_CRAP: } } + /* * Replacement for sleep() that uses select() in order to avoid SIGALRM */