Re: Problem with compile_predicates/1 under SWI




I am using IIS 5.1;

I set up an application mapping for .pl files as follows:
"c:\program files\pl\bin\plcon" -g go -t halt -q -s "%s"

Then I created a test.pl file:
p(a).
go :- compile_predicates([p/1]), write('Content-type: text/html\r\n\r\n'),
write(hi), flush_output.

When I ran it, it worked perfectly for me.


Some things to consider/try:
If you don't output much data, you may need to flush_output to ensure that
the headers are returned.
Make sure that plcon has a -q parameter so it doesn't show the "% sample.pl
compiled" message
If you consult other files, make sure that you consult them silently:
load_files([File],[silent(true)]).
Finally, I noticed that if I make a HTTP request to another site using SWI
Prolog, then SWI Prolog (well, version 5.4.5) will output an irrelevant "|:"
prompt on STDOUT (but not expect input). If it happened, I fixed it by
making my headers this:
write('Foo: bar\r\nContent-type: text/html\r\n\r\n')
this will add an irrelevant header if the |: prompt doesn't appear, and will
make your headers valid if the |: prompt does appear (you'll end up with a
header with key "|" and value ":Foo: bar").

-Benjamin Johnston

> Ye, I saw it...u r right. But my puzzle remains unsolved.
> I tried this simple script:
>
> p(a).
> go :- compile_predicates([p/1]), write('Content-type: text/html\r\n\r\n'),
> ...
>
> and it works on Apache server.
> Perhaps it is a problem of IIS6.0, the server I'm using for developing my
> app.
> Incredible!
> Thx
> M
>
> "Jan Wielemaker" <jan@xxxxxxxxxxxx> ha scritto nel messaggio
> news:slrnddaq90.9l5.jan@xxxxxxxxxxxxxxx
>> On 2005-07-13, Mauro Di Nuzzo <picorna@xxxxxxxxx> wrote:
>> > Hi all!
>> >
>> > I am running a prolog program as a CGI script.
>> > If I try to call compile_predicates/1 before sending http headers, I
> receive
>> > a server error message (telling me it received bad http headers).
>> > Since I have to call that predicate before sending http headers, the
> problem
>> > is evident.
>> > Does compile_predicates/1 outputs something? I do not see any "visible"
>> > output, but the server does not agree with me.
>> > Please help me.
>>
>> A quick scan through the source suggests it does not produce any textual
>> output unless an error is detected.
>>
>> Cheers --- Jan
>
>


.



Relevant Pages

  • Re: Problem Updating New Messages from NTTP News Server OE
    ... > as far as I know and he doesn't have a server in his setup. ... download the answer to a problem he had posted in the Outlook group and I had seen the answer almost immediately on July 1. ... sure how taking the check out of the download headers boxes would have helped. ... pane 3) Get headers at a time 4) No check in mark all messages as read when exiting newsgroup ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Problem Updating New Messages from NTTP News Server OE
    ... What's the precise difference between Tools>Syncronize Newsgroup Get a) all messages b) new messages c) headers only ... first check to see if the server now has it by ... > download the answer to a problem he had posted in the Outlook group and I had seen the answer almost immediately on July 1. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Problem Updating New Messages from NTTP News Server OE
    ... the discussion based on its headers. ... So I would be less inclined to blame the server and more inclined to blame ... feature anywhere within a newsgroup and synchronize that newsgroup with ... either the Synchronize Newsgroup or the Synchronize Account command. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: IP number question
    ... |> I can present a posting whose headers *claim* whatever IP address ... machine is running a news server and that you have completely formatted ... articles ready to pass along -- articles which might have originated ... There is nothing that would -prevent- nntp servers from adding trace ...
    (comp.security.misc)
  • Re: WMP11 "Find Album Info" not working
    ... Using lynx with a direct connection, I dumped the HTTP headers for http://fai.music.metaservices.microsoft.com/FAI/default.aspx: ... Server: Microsoft-IIS/6.0 ... Those are the response not the request headers. ...
    (microsoft.public.windowsmedia.player)