Error when referencing http_parameters

Phillip Soltan <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAKQRMJjWcg9PAP0_KCEbU3bAUDA1KbeXNxsuzQXR=7tqU6V_6w@mail.gmail.com>
Hello,

I recently discovered that an HTTP package was added to SWI Prolog and I
thought this was the perfect solution for me.  Between the documentation,
reading the module code and stepping through the modules with the debugger,
I think it is going to be suitable for a web site I'm building.

I've run into a problem and I'm wondering if someone could help.  I've
created a predicate that handles showing the login page:

login_page(Request) :-
html_set_options([dialect('html5')]),
(http_session_data(lang(_));http_session_asserta(lang('en'))),
(memberchk(method(post),Request) ->
http_parameters(Request,
                        [ email(Email_value, [default('empty')]),
                          password(Pass_value, [default('empty')])
                        ]);
        Email_value = '[email protected]',
        Pass_value = 'password'
    ),
reply_html_page(
[title('Login Page')],
           ........ snip .......

It gets called directly from the handler when there is a GET to the login
url (http://localhost/login) and also gets called from the login action
predicate:

% handle case of invalid email address
login_action_page(Request) :-
http_parameters(Request,
                        [ email(Email, [default('empty')]),
                          password(_Pass, [default('empty')])
                        ]),
    \+epassword(Email,_),
    asserta(login_error('unrecognized email')),
login_page(Request).


The login_action_page handles the POST request when the submit button is
pressed.  It calls login_page to show the login page again showing which
field has erroneous data.

The POST request times out and return the error:

*copy_stream_data/3: Timeout in read from <stream>(0x888eaa0)*

This is the result of the second call to http_parameters.  I guess my
questions are:

Why?  Is there some reason I can't call http_parameters twice with the same
request?


Thank you in advance,

Phillip Soltan
email: [email protected]
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.