Chris Hanson [Sun, 21 Sep 2008 07:35:15 +0000 (07:35 +0000)]
Implement "chunked" transfer encoding, required by HTTP 1.1. Fix bug
in "transfer-encoding" header parser. Add new procedure
READ-RFC2822-FOLDED-LINE that reads a line of text, dealing with the
header-field folding from RFC 2822.
Chris Hanson [Wed, 17 Sep 2008 06:31:54 +0000 (06:31 +0000)]
Hair up handling of HTTP headers. In new model, there are codecs for
each known header (basically almost all of RFC 2616 at this point).
These codecs translate between the string representation of a header
value and its internal representation. MAKE-HTTP-HEADER accepts
either the string representation or the internal representation.
HTTP-HEADER-VALUE always contains the string representation, while
HTTP-HEADER-PARSED-VALUE contains the internal representation. If the
decoder for a header fails on a particular string represenation, or if
there's no decoder for that header, HTTP-HEADER-PARSED-VALUE contains
a default object (use DEFAULT-OBJECT? to test for it).
Additionally, HTTP requests have been changed so that the METHOD is a
string rather than a symbol (that is, "GET" rather than '|GET|).
Write output for temporary compilation into a file with a unique name
so that when the runtime loads the file, the microcode will not cache
the blocks under the same name for each compilation, which caused odd
effects such as
Chris Hanson [Mon, 15 Sep 2008 05:15:23 +0000 (05:15 +0000)]
Split "http-io.scm" to create new file "http-syntax.scm". I'm
currently working on the latter, so this minimizes the difference
between the trunk and my code.
In OPTIONAL-PORT, require only that if an argument was supplied it is
a port. Defer the guarantee that the port is an I/O port until it is
important: ports with PROMPT-FOR-{COMMAND-,}EXPRESSION operations need
not support input operations in order for the prompting procedures to
work.
In SIGNAL-IO-THREAD-EVENTS, we may not always find a dentry for all
the descriptors and modes listed. Don't assume that we shall.
This case arises particularly when there is no thread blocked in
BLOCK-ON-IO-DESCRIPTOR and someone invokes the PROCESS-WAIT primitive.
This should fix the random (%RECORD-REF #F 3) error that I have seen
when gunzipping MIT Scheme's Info reference manual and it isn't in the
operating system's disk buffer cache, which led to a losing race.
Change COMPILE-SCODE/INTERNAL/HOOK into three separate hooks:
COMPILE-SCODE/FILE/HOOK, COMPILE-SCODE/NO-FILE/HOOK, and
COMPILE-SCODE/RECURSIVE/HOOK. Use this in the C back end to fix
compilation of scode not from files. Handle temporary files more
carefully in the C back end. Remove vestiges of support for keeping
debugging info in the C back end, which depends on such operations as
SET-COMPILED-CODE-BLOCK/DEBUGGING-INFO! not available in the C code
generator. The info should perhaps be returned in the compiler
output, and applied in FINISH-C-COMPILATION to the compiled code
block, but this is trickier than it sounds. For now we'll just not
pretend to support keeping debugging info.
Add an optional argument to TEMPORARY-FILE-PATHNAME for a procedure
that transforms the generated pathname before trying to allocate a
temporary file. Implemented only on Unix because that's all I can
test, and the only user of it at the moment will be liarc, which runs
only on Unix anyway.
Clarify IMAP MIME body sections, which are confusing because every
message body is treated as a multipart body by the IMAP's indexing
scheme. This makes IMAIL never fetch TEXT body parts, except when
the user views a message raw with `C-c C-t C-m' (eventually, which
will also view arbitrary MIME bodies raw), and rather use numbered
parts, which will cause IMAIL to refill existing disk caches, even
though they already have mostly the same data in them. IMAIL will
also now show MIME bodies in IMAP and file folders more uniformly,
especially complex nesting of message/rfc822 and multipart bodies.
When walking the body of a message/rfc822 body to insert the latter
in-line, add BODY to the selector to disambiguate the message/rfc822
body from its own body. MIME selectors as used by the front end
continue to diverge from IMAP sections, which appear to make little
sense (although this requires further testing with more IMAP server
implementations).
- to make sense,
- to be more robust,
- to better reflect the terminology of the RFCs,
- to simplify code that uses MIME bodies,
- to move all generic MIME code into imail-mime.scm, and
- to fix a number of small bugs.
The documentation will need to be updated, since some user-visible
commands are now named with the word `body' rather than `entity'.
Undoubtedly, refactoring added many small bugs, too, still to be
weeded out.
Chris Hanson [Sun, 7 Sep 2008 04:33:13 +0000 (04:33 +0000)]
Rewrite of LIST-PARSER to be more general. Now there are three
variants: OBJECT-PARSER, LIST-PARSER, and VECTOR-PARSER. There are
corresponding OBJECT, LIST, and VECTOR keywords for switching between
the different modes. And the optimizer is considerably smarter.
Back out earlier changes concerning a phantom race condition with
the GC daemon (of course the access to the uncompressed file list
locks the GC daemon out), and instead avoid storing entries in it
before the uncompressor has returned normally. Also, handle file
errors in FASLOAD-LOADER, since they aren't all signalled as bad-
range-argument errors by the microcode.
When diffing with a buffer, ignore whether it is modified or not. The
user may want to see how a file has changed on disk even if the buffer
in memory has not been touched.
Use the term `dynamic', not `ephemeral', for parts of a message that
are subject to change on the server and should not be cached on disk,
to match the RFC's terminology.
If, when resynchronizing the mapping between sequence numbers and
UIDs with the server, the folder's length has not changed and all
the UIDs match, don't signal an INCREASE-LENGTH event.
- Record a somewhat finer approximation of the status of our
synchronization with the server, which lets us be more careful
about deleting caches for expunged messages: only if our mapping
between sequence numbers to UIDs is synchronized with the server
is it sensible to delete caches for expunged messages.
- If our length is desynchronized with the server when we update the
folder's length because of an EXISTS response, and if all the UIDs
that we know about are synchronized with the server, then no
messages have been expunged from the folder, and its length has
only increased. In this case, signal anINCREASE-LENGTH event,
rather than a SET-LENGTH event. This avoids regenerating summary
buffers when reconnecting if no messages have been expunged by
another client.
New generic procedure MESSAGE-PERMANENT-FLAGS returns the flags that
remain permanently and are therefore useful to retain when appending
messages to other folders. All %APPEND-MESSAGE methods now use this
rather than MESSAGE-FLAGS. This will keep `recent' flags from being
stored in file folders as an artefact of the IMAP.
Chris Hanson [Sun, 31 Aug 2008 07:53:07 +0000 (07:53 +0000)]
Implement new *parser forms ENCAPSULATE* and TRANSFORM* that call
their procedure with the values spread out as arguments. TRANSFORM*
additionally expects the procedure to return multiple values.
Change EXPUNGE folder modification event so that it includes the
message object and its mapped index. This is necessary to find
information about the message by identity, which will be needed by
future implementation of incremental updates to summary buffers.
In `imail-browser-view-container', if no resource is selected, prompt
the user for a URL, rather than signalling an error. This allows the
IMAIL browser to be an entry point into IMAIL.
In `vc-version-diff', ask to save the file only if we are diffing
against the current revision. If we are diffing two specified
revisions, there is no need to save changes in the buffer.
Fix the CVS method for LOCKING-USER in the case when FILE-ATTRIBUTES
returns #F.
When stringifying data, declare data objects after they are defined,
since the declaration is not a C forward declaration but a fragment of
C code that refers to the defined object and therefore must follow its
definition. This fixes compilation of source files that contain only
a literal datum (including empty source files, such as one finds in
scmutils).
When reading Info files into buffers, don't visit the files. This
prevents Edwin from trying to write over the Info files if something
goes wrong and the editor tries to save the file.
Implement a preliminary `imail-search-summary' command. This is like
`imail-search', but produces a buffer summarizing all search results
rather than selecting only the first search result.
Do meter the progress of caching folder contents, so that IMAIL does
not appear to be hung during the long sequence of lstat(2)s and body
structure traversals if the cache has many items already in it.
Also report a message when connecting to the IMAP server.
When resynchronizing message UIDs with the server, stop if we find a
message whose UID is uninitialized. This arises if the previous
attempt to read the UIDs from the server was interrupted.
Eliminate FILENAME->COMPILED-OBJECT and the call to it in
LOAD-PACKAGE-SET. LOAD will do the right thing when a built-in
object is available, and will also update debugging pathnames.