lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev Lynx Support for bibp URLs (Bibliographic Protocol)


From: Rob Cameron
Subject: lynx-dev Lynx Support for bibp URLs (Bibliographic Protocol)
Date: Tue, 2 Jan 2001 07:31:43 -0800 (PST)

Last month,  I volunteered to add support for the bibp: scheme
(bibliographic protocol) to lynx.

Bibliographic protocol is currently described by the internet draft:
http://www.ietf.org/internet-drafts/draft-cameron-tatu-bibp-02.txt

We have implemented bibp support as described by the enclosed
patch file for 2.8.4dev.16.  Patch files for 2.8.4dev.14 and 2.8.3
are available from http://www.usin.org/software/clients/ .

There are some rudimentary demos/tests available at http://usin.org/ .
I had delayed sending the patch to lynx-dev, hoping to have more
interesting server side demos (and final publication of the bibp
document as an RFC).   But with the pace of activities on the list,
I thought I'd better get this in.  

Please let me know what to do from here.

Robert D. Cameron, Professor
School of Computing Science
Simon Fraser University
Burnaby, B.C. V5A 1S6
---------------------------------------------------------------------------
diff -ur lynx2-8-4r16/LYMessages_en.h lynx2-8-4r16.bibp/LYMessages_en.h
--- lynx2-8-4r16/LYMessages_en.h        Thu Sep 21 19:21:59 2000
+++ lynx2-8-4r16.bibp/LYMessages_en.h   Tue Jan  2 06:06:44 2001
@@ -355,6 +355,7 @@
 #define POPUP_FAILED gettext("Unable to create popup window!")
 #define GOTO_DISALLOWED gettext("Goto a random URL is disallowed!")
 #define GOTO_NON_HTTP_DISALLOWED gettext("Goto a non-http URL is disallowed!")
+#define GOTO_BIBP_DISALLOWED gettext("You are not allowed to goto \"bibp:\" 
URLs")
 #define GOTO_CSO_DISALLOWED gettext("You are not allowed to goto \"cso:\" 
URLs")
 #define GOTO_FILE_DISALLOWED gettext("You are not allowed to goto \"file:\" 
URLs")
 #define GOTO_FINGER_DISALLOWED gettext("You are not allowed to goto 
\"finger:\" URLs")
diff -ur lynx2-8-4r16/WWW/Library/Implementation/HTAnchor.c 
lynx2-8-4r16.bibp/WWW/Library/Implementation/HTAnchor.c
--- lynx2-8-4r16/WWW/Library/Implementation/HTAnchor.c  Wed Oct 25 09:35:28 2000
+++ lynx2-8-4r16.bibp/WWW/Library/Implementation/HTAnchor.c     Tue Jan  2 
06:06:44 2001
@@ -83,6 +83,7 @@
     newAnchor->FileCache = NULL;       /* Path to a disk-cached copy. - FM */
     newAnchor->SugFname = NULL;        /* Suggested filename. - FM */
     newAnchor->RevTitle = NULL;        /* TITLE for a LINK with REV. - FM */
+    newAnchor->citehost = NULL;        /* LINK REL=citehost - RDC */
     newAnchor->cache_control = NULL;   /* Cache-Control. - FM */
     newAnchor->no_cache = FALSE;       /* no-cache? - FM */
     newAnchor->content_type = NULL;    /* Content-Type. - FM */
@@ -743,6 +744,7 @@
     FREE(me->bookmark);
     FREE(me->owner);
     FREE(me->RevTitle);
+    FREE(me->citehost);
 #ifdef SOURCE_CACHE
     HTAnchor_clearSourceCache(me);
 #endif
@@ -1048,6 +1050,23 @@
                me->RevTitle[i] = ' ';
            }
        }
+    }
+}
+
+/*     Citehost for bibp links from LINKs with REL="citehost". - RDC
+*/
+PUBLIC CONST char * HTAnchor_citehost ARGS1(
+       HTParentAnchor *,       me)
+{
+    return( me ? me->citehost : NULL);
+}
+
+PUBLIC void HTAnchor_setCitehost ARGS2(
+       HTParentAnchor *,       me,
+       CONST char *,           citehost)
+{
+    if (me) {
+       StrAllocCopy(me->citehost, citehost);
     }
 }
 
diff -ur lynx2-8-4r16/WWW/Library/Implementation/HTAnchor.h 
lynx2-8-4r16.bibp/WWW/Library/Implementation/HTAnchor.h
--- lynx2-8-4r16/WWW/Library/Implementation/HTAnchor.h  Wed Dec 15 03:03:18 1999
+++ lynx2-8-4r16.bibp/WWW/Library/Implementation/HTAnchor.h     Tue Jan  2 
06:06:44 2001
@@ -67,6 +67,7 @@
   char *       title;          /* Title of document */
   char *       owner;          /* Owner of document */
   char *       RevTitle;       /* TITLE in REV="made" or REV="owner" LINK */
+  char *       citehost;       /* Citehost from REL="citehost" LINK */
 #ifdef USE_HASH
   char *       style;
 #endif
@@ -294,6 +295,15 @@
 extern void HTAnchor_setRevTitle PARAMS((
        HTParentAnchor *        me,
        CONST char *            title));
+
+/*     Citehost for bibp links from LINKs with REL="citehost". - RDC
+*/
+extern CONST char * HTAnchor_citehost PARAMS((
+       HTParentAnchor *        me));
+
+extern void HTAnchor_setCitehost PARAMS((
+       HTParentAnchor *        me,
+       CONST char *            citehost));
 
 /*     Suggested filename handling. - FM
 **     (will be loaded if we had a Content-Disposition
diff -ur lynx2-8-4r16/lynx.cfg lynx2-8-4r16.bibp/lynx.cfg
--- lynx2-8-4r16/lynx.cfg       Wed Oct 25 09:35:28 2000
+++ lynx2-8-4r16.bibp/lynx.cfg  Tue Jan  2 06:06:44 2001
@@ -1102,6 +1102,19 @@
 #
 #LYNX_SIG_FILE:.lynxsig
 
+.h1 Bibliographic Protocol (bibp scheme)
+     
+.h2 BIBP_GLOBAL_SERVER
+# BIBP_GLOBAL_SERVER is the default global server for bibp: links, used
+# when a local bibhost or document-specified citehost is unavailable.
+# Set in userdefs.h and can be changed here.
+#BIBP_GLOBAL_SERVER:http://usin.org/
+
+.h2 BIBP_BIBHOST
+# BIBP_BIBHOST is the URL at which local bibp service may be found, if
+# it exists.   Defaults to http://bibhost/ for protocol conformance, but
+# may be overridden here or via --bibhost parameter.
+#BIBP_BIBHOST:http://bibhost/
 
 .h1 Interaction
 # These settings control interaction of the user with lynx.
diff -ur lynx2-8-4r16/lynx_help/lynx_url_support.html 
lynx2-8-4r16.bibp/lynx_help/lynx_url_support.html
--- lynx2-8-4r16/lynx_help/lynx_url_support.html        Thu Apr 13 19:39:31 2000
+++ lynx2-8-4r16.bibp/lynx_help/lynx_url_support.html   Tue Jan  2 06:06:44 2001
@@ -18,6 +18,7 @@
 <a href="#mailto">mailto</a> <em>|</em>
 <a href="#finger">finger</a> <em>|</em>
 <a href="#cso">cso</a> <em>|</em>
+<a href="#bibp">bibp</a> <em>|</em>
 <a href="#exec">lynxexec, lynxprog</a> <em>|</em>
 <a href="#cgi">lynxcgi</a><em>|</em>
 <a href="#internal">internal</a><em>]</em>
@@ -537,6 +538,15 @@
 (searches) which appear to be a URL with a supported scheme will be
 converted into a link for accessing that URL.
 <HR>
+
+<H2><a name="bibp">The <em>bibp</em> URL:</a></H2>
+
+<p>Lynx provides built-in support for bibliographic protocol (BibP).
+BibP links are links to published works such as books or journal articles,
+without a predefined server.  BibP links are intended for resolution
+by a local bibhost server (http://bibhost/) if it exists.   Otherwise,
+resolution is performed by a document-specified server or a known global
+server.
 
 <H2><a name="exec">The <em>lynxexec</em> and <em>lynxprog</em> URLs:</a></H2>
 
Only in lynx2-8-4r16/po: es.po
Only in lynx2-8-4r16/po: it.po
Only in lynx2-8-4r16/po: ko.po
Only in lynx2-8-4r16/po: no.po
Only in lynx2-8-4r16/po: pl.po
Only in lynx2-8-4r16/po: pt.po
diff -ur lynx2-8-4r16/src/HTML.c lynx2-8-4r16.bibp/src/HTML.c
--- lynx2-8-4r16/src/HTML.c     Thu Dec 21 18:44:11 2000
+++ lynx2-8-4r16.bibp/src/HTML.c        Tue Jan  2 06:06:44 2001
@@ -1556,6 +1556,13 @@
                        StrAllocCopy(temp, "RelTitle: ");
                        StrAllocCat(temp, value[HTML_LINK_REL]);
                    }
+               } else
+               if (!strcasecomp(value[HTML_LINK_REL], "citehost")) {
+                   /*  Citehost determination for bibp links. - RDC */
+                   HTAnchor_setCitehost(me->node_anchor, href);
+                   CTRACE((tfp, "HTML: citehost '%s' found\n", href));
+                   FREE(href);
+                   break;
                } else {
                    CTRACE((tfp, "HTML: LINK with REL=\"%s\" ignored.\n",
                                 value[HTML_LINK_REL]));
diff -ur lynx2-8-4r16/src/LYGetFile.c lynx2-8-4r16.bibp/src/LYGetFile.c
--- lynx2-8-4r16/src/LYGetFile.c        Wed Oct 25 09:35:28 2000
+++ lynx2-8-4r16.bibp/src/LYGetFile.c   Tue Jan  2 06:06:44 2001
@@ -758,6 +758,27 @@
 #ifdef DIRED_SUPPORT
                    lynx_edit_mode = FALSE;
 #endif /* DIRED_SUPPORT */
+                   if (url_type == BIBP_URL_TYPE) {  
+                     char *bibpTmp=NULL;
+                     if (!BibP_bibhost_checked) LYCheckBibHost();
+                     if (BibP_bibhost_available) {
+                        StrAllocCopy(bibpTmp, BibP_bibhost);
+                      } else if (HTMainAnchor && 
HTAnchor_citehost(HTMainAnchor)) {
+                       StrAllocCopy(bibpTmp, HTAnchor_citehost(HTMainAnchor));
+                     } else {
+                        StrAllocCopy(bibpTmp, BibP_globalserver);
+                      }
+                     if (HTMainAnchor && HTAnchor_citehost(HTMainAnchor)) {
+                       StrAllocCat(bibpTmp, "bibp1.0/resolve?citehost=");
+                       StrAllocCat(bibpTmp, HTAnchor_citehost(HTMainAnchor));
+                       StrAllocCat(bibpTmp, "&usin=");
+                     }
+                     else StrAllocCat(bibpTmp, "bibp1.0/resolve?usin=");
+                     StrAllocCat(bibpTmp, doc->address+5); /* USIN after bibp: 
*/
+                     StrAllocCopy(doc->address, bibpTmp);
+                     WWWDoc.address = doc->address;
+                      FREE(bibpTmp);
+                    }
 
                    if (url_type == FILE_URL_TYPE) {
                        /*
@@ -865,6 +886,8 @@
                                 url_type == FILE_URL_TYPE) ||
                                (no_goto_lynxcgi &&
                                 url_type == LYNXCGI_URL_TYPE) ||
+                               (no_goto_bibp &&
+                                url_type == BIBP_URL_TYPE) ||
                                (no_goto_cso &&
                                 url_type == CSO_URL_TYPE) ||
                                (no_goto_finger &&
diff -ur lynx2-8-4r16/src/LYGlobalDefs.h lynx2-8-4r16.bibp/src/LYGlobalDefs.h
--- lynx2-8-4r16/src/LYGlobalDefs.h     Wed Oct 25 09:35:28 2000
+++ lynx2-8-4r16.bibp/src/LYGlobalDefs.h        Tue Jan  2 06:06:44 2001
@@ -242,6 +242,7 @@
 extern BOOLEAN no_goto_lynxexec;
 extern BOOLEAN no_goto_lynxprog;
 extern BOOLEAN no_goto_mailto;
+extern BOOLEAN no_goto_bibp;
 extern BOOLEAN no_goto_news;
 extern BOOLEAN no_goto_nntp;
 extern BOOLEAN no_goto_rlogin;
@@ -364,6 +365,10 @@
 extern BOOLEAN LYMBMAdvanced;          /* MBM statusline for ADVANCED?  */
 extern int LYStatusLine;               /* Line for statusline() or -1   */
 extern BOOLEAN LYCollapseBRs;          /* Collapse serial BRs?          */
+extern char *BibP_globalserver;         /* global server for bibp: links */
+extern char *BibP_bibhost;              /* local server for bibp: links  */
+extern BOOLEAN BibP_bibhost_checked;    /* bibhost has been checked      */
+extern BOOLEAN BibP_bibhost_available;  /* bibhost is responding         */
 extern BOOLEAN LYSetCookies;           /* Process Set-Cookie headers?   */
 extern BOOLEAN LYAcceptAllCookies;      /* accept ALL cookies?           */
 extern char *LYCookieAcceptDomains;     /* domains to accept all cookies */
diff -ur lynx2-8-4r16/src/LYMain.c lynx2-8-4r16.bibp/src/LYMain.c
--- lynx2-8-4r16/src/LYMain.c   Mon Jan  1 17:39:50 2001
+++ lynx2-8-4r16.bibp/src/LYMain.c      Tue Jan  2 06:06:44 2001
@@ -248,6 +248,7 @@
 PUBLIC BOOLEAN no_goto_lynxexec = FALSE;
 PUBLIC BOOLEAN no_goto_lynxprog = FALSE;
 PUBLIC BOOLEAN no_goto_mailto = FALSE;
+PUBLIC BOOLEAN no_goto_bibp = FALSE;
 #ifndef DISABLE_NEWS
 PUBLIC BOOLEAN no_goto_news = FALSE;
 PUBLIC BOOLEAN no_goto_nntp = FALSE;
@@ -411,6 +412,10 @@
 PUBLIC BOOLEAN LYMBMAdvanced = TRUE;
 PUBLIC int LYStatusLine = -1;           /* Line for statusline() if > -1 */
 PUBLIC BOOLEAN LYCollapseBRs = COLLAPSE_BR_TAGS;  /* Collapse serial BRs? */
+PUBLIC char *BibP_globalserver = NULL;   /* global server for bibp: links */
+PUBLIC char *BibP_bibhost = NULL;        /* local server for bibp: links  */
+PUBLIC BOOLEAN BibP_bibhost_checked = FALSE;  /*  until LYCheckBibHost   */
+PUBLIC BOOLEAN BibP_bibhost_available = FALSE;  /* until check succeeds  */
 PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */
 PUBLIC BOOLEAN LYAcceptAllCookies = ACCEPT_ALL_COOKIES; /* take all cookies? */
 PUBLIC char *LYCookieAcceptDomains = NULL; /* domains to accept all cookies */
@@ -624,6 +629,8 @@
     FREE(LynxSigFile);
     FREE(system_mail);
     FREE(system_mail_flags);
+    FREE(BibP_bibhost);
+    FREE(BibP_globalserver);
 #ifdef EXP_PERSISTENT_COOKIES
     FREE(LYCookieFile);
     FREE(LYCookieSaveFile);
@@ -1145,7 +1152,8 @@
     StrAllocCopy(URLDomainPrefixes, URL_DOMAIN_PREFIXES);
     StrAllocCopy(URLDomainSuffixes, URL_DOMAIN_SUFFIXES);
     StrAllocCopy(XLoadImageCommand, XLOADIMAGE_COMMAND);
-
+    StrAllocCopy(BibP_globalserver, BIBP_GLOBAL_SERVER);
+    StrAllocCopy(BibP_bibhost, "http://bibhost/";);  /* protocol specified. */
     /*
      * Disable news posting if the compilation-based
      * LYNewsPosting value is FALSE.  This may be changed
@@ -3061,6 +3069,10 @@
    PARSE_FUN(
       "base",          4|FUNCTION_ARG,         base_fun,
       "prepend a request URL comment and BASE tag to text/html\noutputs for 
-source dumps"
+   ),
+   PARSE_STR(
+      "bibhost",       4|NEED_LYSTRING_ARG,    &BibP_bibhost,
+      "=URL\nlocal bibp server (default http://bibhost/)"
    ),
 #ifdef USE_SLANG
    PARSE_FUN(
Only in lynx2-8-4r16.bibp/src: LYMain.c~
diff -ur lynx2-8-4r16/src/LYMainLoop.c lynx2-8-4r16.bibp/src/LYMainLoop.c
--- lynx2-8-4r16/src/LYMainLoop.c       Thu Dec 21 18:44:11 2000
+++ lynx2-8-4r16.bibp/src/LYMainLoop.c  Tue Jan  2 06:06:44 2001
@@ -560,6 +560,10 @@
                   !strncmp(user_input_buffer, "mailto:";, 7)) {
            HTUserMsg(GOTO_MAILTO_DISALLOWED);
 
+       } else if (no_goto_bibp &&
+                  !strncmp(user_input_buffer, "bibp:", 5)) {
+           HTUserMsg(GOTO_BIBP_DISALLOWED);
+
 #ifndef DISABLE_NEWS
        } else if (no_goto_news &&
                   !strncmp(user_input_buffer, "news:";, 5)) {
diff -ur lynx2-8-4r16/src/LYReadCFG.c lynx2-8-4r16.bibp/src/LYReadCFG.c
--- lynx2-8-4r16/src/LYReadCFG.c        Thu Dec 21 18:44:11 2000
+++ lynx2-8-4r16.bibp/src/LYReadCFG.c   Tue Jan  2 06:06:44 2001
@@ -1404,6 +1404,8 @@
 #ifdef DIRED_SUPPORT
      PARSE_ENV("auto_uncache_dirlists", CONF_INT, &LYAutoUncacheDirLists),
 #endif
+     PARSE_STR("bibp_bibhost", CONF_STR, &BibP_bibhost),
+     PARSE_STR("bibp_globalserver", CONF_STR, &BibP_globalserver),
      PARSE_SET("block_multi_bookmarks", CONF_BOOL, &LYMBMBlocked),
      PARSE_SET("bold_h1", CONF_BOOL, &bold_H1),
      PARSE_SET("bold_headers", CONF_BOOL, &bold_headers),
Only in lynx2-8-4r16.bibp/src: LYReadCFG.c~
diff -ur lynx2-8-4r16/src/LYUtils.c lynx2-8-4r16.bibp/src/LYUtils.c
--- lynx2-8-4r16/src/LYUtils.c  Thu Dec 21 18:44:11 2000
+++ lynx2-8-4r16.bibp/src/LYUtils.c     Tue Jan  2 06:06:44 2001
@@ -2858,6 +2858,9 @@
     } else if (compare_type(cp, "mailto:";, 7)) {
        return(MAILTO_URL_TYPE);
 
+    } else if (compare_type(cp, "bibp:", 5)) {
+       return(BIBP_URL_TYPE);
+
     } else if (compare_type(cp, "file:", 5)) {
        if (LYisLocalFile(cp)) {
            return(FILE_URL_TYPE);
@@ -4198,6 +4201,7 @@
             no_inside_rlogin = !(CAN_ANONYMOUS_INSIDE_DOMAIN_RLOGIN);
            no_outside_rlogin = !(CAN_ANONYMOUS_OUTSIDE_DOMAIN_RLOGIN);
                      no_goto = !(CAN_ANONYMOUS_GOTO);
+                no_goto_bibp = !(CAN_ANONYMOUS_GOTO_BIBP);
                  no_goto_cso = !(CAN_ANONYMOUS_GOTO_CSO);
                 no_goto_file = !(CAN_ANONYMOUS_GOTO_FILE);
 #ifndef DISABLE_FINGER
@@ -6946,6 +6950,29 @@
        StrAllocCopy((p->name), newname);
     }
 }
+
+/*
+ *  Check that bibhost defines the BibP icon.
+ */
+PUBLIC void LYCheckBibHost NOARGS
+{
+  DocAddress bibhostIcon;
+  BOOLEAN saveFlag;
+  bibhostIcon.address = NULL;
+  StrAllocCopy(bibhostIcon.address, BibP_bibhost);
+  StrAllocCat(bibhostIcon.address, "bibp1.0/bibpicon.jpg");
+  bibhostIcon.post_data = NULL;
+  bibhostIcon.post_content_type = NULL;
+  bibhostIcon.bookmark = FALSE;
+  bibhostIcon.isHEAD = FALSE;
+  bibhostIcon.safe = FALSE;
+  saveFlag = traversal;
+  traversal = TRUE;  /* Hack to force error response. */
+  BibP_bibhost_available = HTLoadAbsolute(&bibhostIcon) == YES;
+  traversal = saveFlag;
+  BibP_bibhost_checked = TRUE;
+}
+
 
 /*
  *  Management of User Interface Pages. - kw
diff -ur lynx2-8-4r16/src/LYUtils.h lynx2-8-4r16.bibp/src/LYUtils.h
--- lynx2-8-4r16/src/LYUtils.h  Thu Dec 21 18:44:11 2000
+++ lynx2-8-4r16.bibp/src/LYUtils.h     Tue Jan  2 06:06:44 2001
@@ -108,6 +108,7 @@
 extern void LYAddPathSep PARAMS((char **path));
 extern void LYAddPathSep0 PARAMS((char *path));
 extern void LYAddPathToHome PARAMS((char *fbuffer, size_t fbuffer_size, char 
*fname));
+extern void LYCheckBibHost NOPARAMS;
 extern void LYCheckMail NOPARAMS;
 extern void LYCleanupTemp NOPARAMS;
 extern void LYCloseTemp PARAMS((char *name));
@@ -212,6 +213,7 @@
     TELNET_GOPHER_URL_TYPE,
     INDEX_GOPHER_URL_TYPE,
     MAILTO_URL_TYPE,
+    BIBP_URL_TYPE,
     FINGER_URL_TYPE,
     CSO_URL_TYPE,
     HTTPS_URL_TYPE,
Only in lynx2-8-4r16.bibp/src: LYUtils.h~
diff -ur lynx2-8-4r16/userdefs.h lynx2-8-4r16.bibp/userdefs.h
--- lynx2-8-4r16/userdefs.h     Fri Jun 23 08:15:08 2000
+++ lynx2-8-4r16.bibp/userdefs.h        Tue Jan  2 06:06:44 2001
@@ -838,6 +838,12 @@
 #define LYNX_SIG_FILE ".lynxsig"
 
 /********************************
+ * BIBP_GLOBAL_SERVER is the default global server for bibp: links, used
+ * when a local bibhost or document-specified citehost is unavailable.
+ */
+#define BIBP_GLOBAL_SERVER "http://usin.org/";
+
+/********************************
  * If USE_SELECT_POPUPS is set FALSE, Lynx will present a vertical list
  * of radio buttons for the OPTIONs in SELECT blocks which lack the
  * MULTIPLE attribute, instead of using a popup menu.  Note that if
@@ -1581,6 +1587,7 @@
  * set to FALSE if you don't want users of your anonymous
  * account to be able to goto particular URLs.
  */
+#define CAN_ANONYMOUS_GOTO_BIBP                TRUE    /* BIBP maps to HTTP */
 #define CAN_ANONYMOUS_GOTO_CSO         FALSE
 #define CAN_ANONYMOUS_GOTO_FILE                FALSE
 #define CAN_ANONYMOUS_GOTO_FINGER      TRUE
---------------------------------------------------------------------------

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]