Status Information - summary?

George Phillips (phillips@cs.ubc.ca)
28 Apr 94 12:03 -0700


Bill Perry said:
> Send in patches and I'm sure most of us would consider merging them into
>our browsers. Otherwise, I'd say it was pretty low on the priority list
>for most people.

Well, I'm not so sure. It seems that the browser writers are so busy
that they can barely consider bug fix patches never mind extra feature
patches. Experience suggests that you'd better convince them to
add the feature before you implement it. But in the spirit of
optimism, I include here:

Status: patches to Mosaic 2.4 for X (2 diffs)
Status: patches to Lynx 2.2 (2 diffs)
A nph- CGI script to test Status: extensions which can be called
at http://www.cs.ubc.ca/test-status

The patches are trivial. First make HTMIME.c check for "Status:" header
lines and call HTProgress() with their contents. Then do the "bytes read"
call in HTCopy() before you pass the data on down the stream so
the "Status:" lines will override the "bytes read" messages.

-- George

====== Mosaic 2.4 patches

*** 1.1 1994/04/28 17:38:02
--- HTMIME.c 1994/04/28 18:05:12
***************
*** 37,42 ****
--- 37,43 ----
CONTENT_ENCODING,
CONTENT_LENGTH,
LOCATION,
+ STATUS,
SKIP_GET_VALUE, /* Skip space then get value */
GET_VALUE, /* Get value till white space */
JUNK_LINE, /* Ignore the rest of this folded line */
***************
*** 136,141 ****
--- 137,148 ----
fprintf (stderr,
"[MIME] Got L at beginning of line\n");
break;
+ case 's':
+ case 'S':
+ me->check_pointer = "tatus:";
+ me->if_ok = STATUS;
+ me->state = CHECK;
+ break;
case '\n': /* Blank line: End of Header! */
{
int compressed = COMPRESSED_NOT;
***************
*** 313,318 ****
--- 320,329 ----
me->state = SKIP_GET_VALUE;
/* Fall through! */
goto fall_through;
+ case STATUS:
+ me->field = me->state;
+ me->state = SKIP_GET_VALUE;
+ goto fall_through;
case LOCATION:
me->field = me->state;
me->state = SKIP_GET_VALUE;
***************
*** 386,391 ****
--- 397,410 ----
(stderr,
"[MIME_put_char] Picked up location '%s'\n", me->location);
break;
+ case STATUS:
+ if (c == '\n')
+ HTProgress(me->value);
+ else if (me->value_pointer < me->value + VALUE_SIZE - 1)
+ *me->value_pointer++ = ' ';
+ else
+ goto value_too_long;
+ break;
default: /* Should never get here */
break;
}

*** 1.1 1994/04/28 18:02:34
--- HTFormat.c 1994/04/28 18:03:06
***************
*** 508,521 ****

if (TRACE)
fprintf (stderr, "HTCopy: put_block on input_buffer '%s'\n", input_buffer);
- (*targetClass.put_block)(sink, input_buffer, status);
-
bytes += status;
if (loading_length == -1)
sprintf (line, msg, bytes);
else
sprintf (line, msg, bytes, loading_length);
HTProgress (line);
} /* next bufferload */

HTProgress (loading_inlined_images ?
--- 508,521 ----

if (TRACE)
fprintf (stderr, "HTCopy: put_block on input_buffer '%s'\n", input_buffer);
bytes += status;
if (loading_length == -1)
sprintf (line, msg, bytes);
else
sprintf (line, msg, bytes, loading_length);
HTProgress (line);
+
+ (*targetClass.put_block)(sink, input_buffer, status);
} /* next bufferload */

HTProgress (loading_inlined_images ?

====== Lynx 2.2 patches

*** 1.1 1994/04/28 18:11:30
--- HTMIME.c 1994/04/28 18:22:28
***************
*** 34,40 ****
CHECK, /* check against check_pointer */
MIME_NET_ASCII, /* Translate from net ascii */
MIME_IGNORE, /* ignore entire file */
! LOCATION /* different URL */
/* TRANSPARENT and IGNORE are defined as stg else in _WINDOWS */
} MIME_state;

--- 34,41 ----
CHECK, /* check against check_pointer */
MIME_NET_ASCII, /* Translate from net ascii */
MIME_IGNORE, /* ignore entire file */
! LOCATION, /* different URL */
! STATUS /* progress update from slow server */
/* TRANSPARENT and IGNORE are defined as stg else in _WINDOWS */
} MIME_state;

***************
*** 134,139 ****
--- 135,146 ----
fprintf (stderr,
"[MIME] Got L at beginning of line\n");
break;
+ case 's':
+ case 'S':
+ me->check_pointer = "tatus:";
+ me->if_ok = STATUS;
+ me->state = CHECK;
+ break;

case '\n': /* Blank line: End of Header! */
{
***************
*** 200,205 ****
--- 207,213 ----
case CONTENT_TYPE:
case CONTENT_TRANSFER_ENCODING:
case LOCATION:
+ case STATUS:
me->field = me->state; /* remember it */
me->state = SKIP_GET_VALUE;
/* Fall through! */
***************
*** 232,237 ****
--- 240,253 ----
fprintf(stderr,
"[MIME_put_char] Picked up location '%s'\n", me->value);
break;
+ case STATUS:
+ if (c == '\n')
+ HTProgress(me->value);
+ else if (me->value_pointer < me->value + VALUE_SIZE - 1)
+ *me->value_pointer++ = ' ';
+ else
+ goto value_too_long;
+ break;
default: /* Should never get here */
break;
}

*** 1.1 1994/04/28 18:09:33
--- HTFormat.c 1994/04/28 18:10:55
***************
*** 432,443 ****
}
#endif

- (*targetClass.put_block)(sink, input_buffer, status);
-
bytes += status;
sprintf(line, "Transfered %d bytes", bytes);
HTProgress(line);

} /* next bufferload */

HTProgress("Data transfer complete");
--- 432,443 ----
}
#endif

bytes += status;
sprintf(line, "Transfered %d bytes", bytes);
HTProgress(line);

+ (*targetClass.put_block)(sink, input_buffer, status);
+
} /* next bufferload */

HTProgress("Data transfer complete");

====== nph- CGI Status: test script

#!/bin/sh
#
# Demonstrate the Status: extension.
#

cr=`echo = | tr = '\015'`;

if [ $SERVER_PROTOCOL = HTTP/1.0 ]; then
cat <<EOF
HTTP/1.0 200 Document Follows$cr
MIME-Version: 1.0$cr
Content-Type: text/html$cr
EOF

for i in 10 20 30 40 50 60 70 80 90 100; do
sleep 1
echo "Status: $i% done$cr";
done

echo $cr
fi

cat <<"EOF"
Status: extension test If you have a browser with the ``Status:'' extension, you will have just seen The following sequence of status messages.

If not, well, this was only a test. EOF