+Sat Mar 6 19:56:07 EST 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+ * webcit.c: added to getz() the ability to return an error code;
+ implemented this in the main loop, hopefully fixing problems
+ * Added "braindamage" file (frames/JS browser compatibility list)
+ * Added HTTP "User-agent:" detection (still need to DO SOMETHING)
+
1999-02-24 Nathan Bryant <bryant@cs.usm.maine.edu>
* context_loop.c: warning fix
* webcit.c: off_t is a 64-bit `long long' on BSDI (eek!)
wprintf("<INPUT type=\"submit\" NAME=\"action\" VALUE=\"Exit\">\n");
wprintf("<BR><INPUT TYPE=\"checkbox\" NAME=\"noframes\">");
- wprintf("<FONT SIZE=-1>Check here to disable frames</FONT>\n");
+ wprintf("<FONT SIZE=-1> Check here to disable frames</FONT>\n");
wprintf("</FORM></CENTER>\n");
/* Da instructions */
wprintf("enter the name and password you wish to use, and click\n");
wprintf("\"New User.\"<BR><LI>");
wprintf("<EM>Please log off properly when finished.</EM>");
- wprintf("<LI>You must use a browser that supports <i>frames</i> ");
- wprintf("and <i>cookies</i>.\n");
+ wprintf("<LI>You must use a browser that supports <i>cookies</i>.<BR>\n");
+ wprintf("<LI>Your browser is: ");
+ escputs(browser);
wprintf("</EM></UL>\n");
wDumpContent(1);
char (*req)[256];
char buf[256], hold[256];
char browser_host[256];
+ char browser[256];
int num_lines = 0;
int a;
int f;
}
bzero(req, sizeof(char[256][256])); /* clear it out */
+ strcpy(browser, "unknown");
printf("Reading request from socket %d\n", sock);
if (!strncasecmp(buf, "Content-length: ", 16)) {
ContentLength = atoi(&buf[16]);
}
+ if (!strncasecmp(buf, "User-agent: ", 12)) {
+ strcpy(browser, &buf[12]);
+ }
strcpy(&req[num_lines++][0], buf);
} while(strlen(buf)>0);
/* Run the actual WebCit session */
execlp("./webcit", "webcit", str_session, defaulthost,
- defaultport, browser_host, NULL);
+ defaultport, browser_host, browser, NULL);
/* Simple page to display if exec fails */
printf("HTTP/1.0 404 WebCit Failure\n\n");
--- /dev/null
+# braindamage
+#
+# This file contains a list of browsers which are known to support
+# or not support various functions.
+#
+# The list is parsed from the top down. When a match is made, parsing
+# immediately stops. This implies that records at the top of the list
+# take precedence over records towards the bottom.
+#
+# Each record must start with a key value:
+# YES = This browser implements frame sets and JavaScript compatibly
+# enough to run WebCit in its full functionality.
+# NO = This browser is brain damaged, so WebCit must run in its
+# non-frames, non-JavaScript mode.
+# ASK = We don't know, so ask the user.
+
+
+# Look for Internet Explorer first, because the morons at Microsoft decided
+# to make life difficult by calling their user-agent "Mozilla" as well, and
+# put the 'MSIE' in parentheses.
+
+# Any version of Internet Explorer earlier than 4.0 is utter trash.
+# Version 4 and 5 appear to be ok.
+NO Mozilla*MSIE 1.*
+NO Mozilla*MSIE 2.*
+NO Mozilla*MSIE 3.*
+YES Mozilla*MSIE 4.*
+YES Mozilla*MSIE 5.*
+
+
+# Opera is untested, and some versions of Opera also use a user-agent string
+# starting with "Mozilla" (arrgh...)
+ASK *Opera*
+
+# Anything else starting with "Mozilla" is assumed to be a genuine
+# Netscape browser. Use the full frames/JavaScript mode starting with
+# version 3.
+NO Mozilla/1.*
+NO Mozilla/2.*
+YES Mozilla/3.*
+YES Mozilla/4.*
+YES Mozilla/5.*
+
+# Lynx is a text-mode browser. Forget it.
+NO *Lynx*
+
+# Konqueror (also known as kfm), the KDE browser/filemanager. Nope.
+NO Konqueror*
+
+# The default...
+ASK *
<NOFRAMES>
Your browser doesn't support frames.<BR>
This site uses frames.<BR>
- Please log in again, and check the "do not use
- frames" option.<BR>
+ Please log in again, and select the
+ "Check here to disable frames"
+ option.<BR>
</NOFRAMES>
</FRAMESET>
</HTML>
char wc_username[256];
char wc_password[256];
char wc_roomname[256];
+char browser[256];
int TransactionCount = 0;
int connected = 0;
int logged_in = 0;
}
-void getz(char *buf) {
+char *getz(char *buf) {
bzero(buf, 256);
- if (fgets(buf, 256, stdin) == NULL) strcpy(buf, "");
+ if (fgets(buf, 256, stdin) == NULL) {
+ strcpy(buf, "");
+ return NULL;
+ }
else {
while ((strlen(buf)>0)&&(!isprint(buf[strlen(buf)-1])))
buf[strlen(buf)-1] = 0;
+ return buf;
}
}
upload_length = 0;
upload = NULL;
- getz(cmd);
+ if (getz(cmd)==NULL) return;
extract_action(action, cmd);
do {
- getz(buf);
+ if (getz(buf)==NULL) return;
if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
strcpy(cookie, &buf[15]);
int main(int argc, char *argv[]) {
- if (argc != 5) {
+ if (argc != 6) {
fprintf(stderr,
- "webcit: usage error (argc must be 5, not %d)\n",
+ "webcit: usage error (argc must be 6, not %d)\n",
argc);
return 1;
}
strcpy(wc_username, "");
strcpy(wc_password, "");
strcpy(wc_roomname, "");
+ strcpy(browser, argv[5]);
while (1) {
session_loop(argv[4]);
extern char *upload;
extern char floorlist[128][256];
extern int noframes;
+extern char browser[256];
void stuff_to_cookie(char *, int, char *, char *, char *, int);
void cookie_to_stuff(char *, int *, char *, char *, char *, int *);