http_open in swi-prolog
From: Carlo Capelli (capelli_at_rdbos.it)
Date: 10/05/04
- Next message: Jan Wielemaker: "Re: http_open in swi-prolog"
- Previous message: Jan Wielemaker: "Re: WordNet 2.0 data files in MySQL format available for download"
- Next in thread: Jan Wielemaker: "Re: http_open in swi-prolog"
- Reply: Jan Wielemaker: "Re: http_open in swi-prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Jan Wielemaker: "Re: http_open in swi-prolog"
- Previous message: Jan Wielemaker: "Re: WordNet 2.0 data files in MySQL format available for download"
- Next in thread: Jan Wielemaker: "Re: http_open in swi-prolog"
- Reply: Jan Wielemaker: "Re: http_open in swi-prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|