🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #732

Re: SMALLNET.EXE, HTTP command extension;

#732
From: Paul L. Allen
Date: Wed, 06 Nov 1996 00:00
104 lines
4742 bytes
In article <847124130snz@siberia.demon.co.uk>
    Philip@siberia.demon.co.uk (Philip McNab) writes:

> Indeed, most browsers continue to smile when whacked on the head
> with a big stick; when I see the HTML they often have to render,
> I see why.  However, this may be an exception.
> 
> ---------------HTMLview--------------------
>   <!-- comment body -->

Correct.

>   Inserts a comment into the document. Must not contain any tags nested

Ummm, by my reading of the various RFC specs *and* my one perusal of
the SGML spec, there is absolutely no reason whatsoever why comments may
not have tags inside them, and HTMLview is talking bollocks.

Checks for foot-in-mouth mode by using sgmls (a *lovely* HTML checker
because it parses the DTDs using an SGML engine, or bits of one) and I'm
right.  Comments can indeed have embedded tags.  Well, some browsers might
complain, but they're *wrong*.

It most certainly is confusing, because comments appear to be degenerate
forms of other mechanisms such as entity declarations, but basically it goes
like this...

An entity declaration looks like:

  <!ENTITY lt CDATA "&#60;">

which says that the entity &lt; is character data and represents character
code 60.  But you can have comments to explain it, and the actual entity
declaration from a DTD may look like:

  <!ENTITY lt CDATA "&#60;" -- less than -->

Where the comment (inside the "--" pairs) explains what the entity is.  But
you can have more than one comment in there, so it could look like:

  <!ENTITY lt -- define an entity &lt; -- CDATA "&#60;" -- meaning
  less than -->

Entity declarations are not valid (AFAICS) inside HTML documents, but the
commenting mechanism is.  And that states that inside the "<!" and ">" the
sequence of characters "--" both start and end comments.  So:

 <! -- this is a comment -- -- and so is this -->

 <! -- this is a comment -- but this bit is treated as an invalid SGML
 declaration -- and this is another comment -->

However, most browsers are not based around SGML engines, so they tend to
ignore the SGML declarations anyway.

There is an important modifier to the statement that comments appear within
"<!" and ">" and are started and ended by "--", and that is that "<!>" is a
null comment (which is bugger-all use to anyone).

>   <! This is a comment >

No it isn't.  It's an invalid SGML declaration.  Any browser based around an
SGML engine would complain about it.  However, a browser would be sensible
if it treated it as a comment on the basis that it's unrecognised mark-up
and ">" ends "<!" if you're not in a comment.

>   Earlier versions of mosaic will recognise the following as a comment.
>   <! comment body >

They may do, or they may not.  As it happens, there are *all* sorts of
cock-ups in comment handling, which are different for different browsers and
for different versions of the same browser.  The latest Netscape screws up
on having "<!--" inside a comment - it thinks that is the start of a comment
(it should be ignored, as should anything else until the "--" closing the
original comment) then forgets the original comment and gets confused.

Here's an example:

   <!-- comment <!-->

This should be parsed as "<!" (start declaration), "--" (start comment),
" comment <!" (comment text), "--" (end comment), ">" (end declaration).

Netscape seems to parse it as "<!" (start declaration), "--" (start comment),
" comment " (comment text), "<!" (start declaration), "--" (start comment),
">" and the rest of your document (comment text).  I.e., total screw-up.

[RFC 1866, which is correct]

> So it seems that this may well be a case where care is needed.

Indeed.  A lot of browsers get things wrong when they attempt to recover
from common errors and end up treating legitimate comments as something
else.  Other browser just parse comments in a broken way.  The moral is
don't try anything clever...

> My interpretation of the above is that this is safe:
> 
> <!-- source: www.someware..com/path/filename.html -->

Yes.

Article Unavailable
Technical Details
Message-ID: <COMFd3j030n@sktb.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <846692592snz@bobsh.demon.co.uk> <846807613snz@wash.demon.co.uk> <847124130snz@siberia.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,7786c0ef12f828b9
X-Google-Attributes: gid10bb05,public
From: "Paul L. Allen" <pla@sktb.demon.co.uk>
Subject: Re: SMALLNET.EXE, HTTP command extension;
Date: 1996/11/06
Message-ID: <COMFd3j030n@sktb.demon.co.uk>
X-Deja-AN: 194916683
references: <846692592snz@bobsh.demon.co.uk> <846807613snz@wash.demon.co.uk> <847124130snz@siberia.demon.co.uk>
x-mail2news-user: pla@sktb.demon.co.uk
x-mail2news-path: relay-7.mail.demon.net!sktb.demon.co.uk
organization: Chaos
reply-to: pla@sktb.demon.co.uk
newsgroups: demon.ip.developers