W3C home > Mailing lists > Public > www-lib@w3.org > July to September 1999

Re: Help with HTLoadAbsolute...

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Wed, 21 Jul 1999 07:38:14 -0400
Message-Id: <>
To: Marco Ariano <marco.ariano@pipercreek.com>
Cc: www-lib@w3.org
At 18:03 20/07/1999 -0600, Marco Ariano wrote:

>After much head-scratching, I ended up creating two versions of the
>secureget program.  One was console-based and the other GUI-based.  I
>factored out the original contents of main() and called that same code
>from both apps.  It turns out the code would work in the console app but
>not in the GUI app.
>The two apps seemed to diverge in HTSaveLocally() when creating a file
>for output.  The GUI app had a null stdin or something, resulting in the
>use of HTErrorStream instead of a file stream.  I created a callback for
>the HT_A_PROMPT/HT_MSG_FILENAME pair that returned a valid file name and
>presto, the GUI-based app worked.  (I'm guessing this is similar to the
>reasons that HTLoadToFile worked as well.)

Ah - well done! This is of course the reason - if there isn't any converter
for the file that is being loaded, it tries to ask the user for a file name
but if no handler is registered for handling the UI with the user, it has
to fail.

There are two ways around that - one (number 2) of which I have problems
with myself - so this is a good change to ask more Windows savvy people:

1) You can register a file save stream as output stream for the request and
say that you just want to get the source as is. This is for example what
you can often see by these two lines in the sample applications:

	HTRequest_setOutputFormat(request, WWW_SOURCE);
	HTRequest_setOutputStream(request, HTFWriter_new(request, fp, NO));

and as you point out, this is also what HTLoadToFile(...) does.

2) When using the HTSaveLocally() stream defined in HTFSave.c, the user is
asked when data arrives under what name to save the file. This works fine
on Unix but on windows, I run into the problem that events are still
arriving from the network (when more data is available) while the modal GUI
box is presented to the user. The result is that I don't have any place to
put the data. Does anyone know how to get around this? I have been playing
with this in the Web commander but haven't found a way around it.

>The fix works for me but it suggests that something else (out of my
>realm of understanding) is broken.  I leave the solution as an exercise
>to the reader.  (I can provide my code on demand but I didn't think I'd
>make this message any longer for now...)  I'd prefer that no extra file
>need to exist.  (Is this a function of compiling a Debug configuration?)

Henrik Frystyk Nielsen,
World Wide Web Consortium
Received on Wednesday, 21 July 1999 15:29:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:51 UTC