http_open in swi-prolog

From: Carlo Capelli (capelli_at_rdbos.it)
Date: 10/05/04


Date: Tue, 5 Oct 2004 11:54:19 +0200

I traced the following sample code from swi-prolog distribution, package
htpp:
?- use_module(library('http/http_open')).

?- trace, http_open('http://www.swi-prolog.org/news.html', In, []),
copy_stream_data(In, user_output), close(In).

obtaining these results (I report only lines near to end, but nothing
relevant appears before):

   Call: (11) socket:tcp_open_socket('$socket'(560), _L210, _L211) ? creep
   Exit: (11) socket:tcp_open_socket('$socket'(560), '$stream'(3505098),
'$stream'(3522770)) ? creep
   Call: (11) set_stream('$stream'(3505098), record_position(false)) ? creep
   Exit: (11) set_stream('$stream'(3505098), record_position(false)) ? creep
   Call: (11) memberchk([], timeout(_G1288)) ? creep
   Fail: (11) memberchk([], timeout(_G1288)) ? creep
   Call: (11) true ? creep
   Exit: (11) true ? creep
   Exit: (10) http_open:open_socket('www.swi-prolog.org':80,
'$stream'(3505098), '$stream'(3522770), []) ? creep
^ Call: (10) format('$stream'(3522770), 'GET ~w HTTP/1.0\r\nHost:
~w\r\nUser-Agent: ~w\r\nConnection: close\r\n', ['/news.html',
'www.swi-prolog.org', 'SWI-Prolog (http://www.swi-prolog.org)']) ? creep
^ Exit: (10) format('$stream'(3522770), 'GET ~w HTTP/1.0\r\nHost:
~w\r\nUser-Agent: ~w\r\nConnection: close\r\n', ['/news.html',
'www.swi-prolog.org', 'SWI-Prolog (http://www.swi-prolog.org)']) ? creep
   Call: (10) http_open:x_headers([], '$stream'(3522770), _L212) ? creep
   Call: (11) lists:select(request_header(_G1299=_G1300), [], _L229) ? creep
   Fail: (11) lists:select(request_header(_G1299=_G1300), [], _L229) ? creep
   Redo: (10) http_open:x_headers([], '$stream'(3522770), _L212) ? creep
   Exit: (10) http_open:x_headers([], '$stream'(3522770), []) ? creep
^ Call: (10) format('$stream'(3522770), '\r\n', []) ? creep
^ Exit: (10) format('$stream'(3522770), '\r\n', []) ? creep
   Call: (10) close('$stream'(3522770)) ? creep
   Exit: (10) close('$stream'(3522770)) ? creep
   Call: (10) http_open:read_header('$stream'(3505098), _L213, _L214, _L215)
? creep
   Call: (11) read_util:read_line_to_codes('$stream'(3505098), _L228) ?
creep
   Call: (12) get_code('$stream'(3505098), _L247) ? creep
   Exit: (12) get_code('$stream'(3505098), -1) ? creep
   Call: (12) -1== -1 ? creep
   Exit: (12) -1== -1 ? creep
   Call: (12) _L228=end_of_file ? creep
   Exit: (12) end_of_file=end_of_file ? creep
   Call: (12) end_of_file=_L248 ? creep
   Exit: (12) end_of_file=end_of_file ? creep
   Exit: (11) read_util:read_line_to_codes('$stream'(3505098), end_of_file)
? creep
^ Call: (11) phrase(first_line(_G1297, _G1298), end_of_file) ? creep
   Call: (13) http_open:first_line(_G1297, _G1298, end_of_file, []) ? creep
   Fail: (13) http_open:first_line(_G1297, _G1298, end_of_file, []) ? creep
^ Fail: (11) phrase(first_line(_G1297, _G1298), end_of_file) ? creep

it seems that tcp_open succeded, but with an empty stream (read_code
returns -1). Someone could help?

Many tanks for your attention.

Bye Carlo.



Relevant Pages

  • swi prolog and odbc connectivity
    ... I've been experimenting with the ODBC package that's included in SWI ... Down at the bottom of the trace, I can tell the ODBC connectivity is ...
    (comp.lang.prolog)
  • Validating user input?
    ... For a valid input anything is okay, but when a user enters a invalid value I thought, the second goal checkwill fail and backtracking would bring me back to input. ... ?- trace. ...
    (comp.lang.prolog)
  • Re: What can be done about malicious emails with viruses?
    ... >track this creep down and report him to his ISP? ... >I tried replying to him once, ...
    (alt.computer.security)
  • Re: Printing a Report paper size problem
    ... for this is that Access' printing layout dimensions are in twips, ... Access' report sections can be sized in factors as small as .0007 inches ... slightly wider or smaller can minimize the impact of the "creep" as things ... line up better with the pixel output on your printer. ...
    (microsoft.public.access.reports)
  • Re: Printing a Report paper size problem
    ... your report rather than using a true type font. ... Access' report sections can be sized in factors as small as .0007 ... > as things line up better with the pixel output on your printer. ... >> printing multiple pages the report seems to creep down the sheet a small ...
    (microsoft.public.access.reports)