Home > Archive > Prolog > January 2006 > http_open vs. http_get using proxy
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
http_open vs. http_get using proxy
|
|
|
| Hello All,
I am using the little test program below to make sure I get past my
proxy. The first one works and the second one doesnt.
Anybody have any ideas about what I am doing wrong?
Thanks in Advance!
Mans
P.S.
I am running 5.6.0 on WindowsXP.
------------------
:- use_module(library('http/http_client')).
:- use_module(library('http/http_sgml_plugin')).
:- use_module(library('http/http_open')).
runit :-
http_open('http://www.google.com', In,[proxy('11.0.0.5',80)]),
copy_stream_data(In, user_output),
close(In).
testit :-
http_get('http://www.google.com', Response, [proxy('11.0.0.5',80)]),
write(Response).
| |
| Jan Wielemaker 2006-01-10, 9:58 pm |
| On 2006-01-10, mans <mshapshak@gmail.com> wrote:
> Hello All,
>
> I am using the little test program below to make sure I get past my
> proxy. The first one works and the second one doesnt.
>
> Anybody have any ideas about what I am doing wrong?
http://www.google.com answers using a redirect message and this is not
handled by http_get, while it is handled automatically by http_open.
I will have a look at that.
Cheers --- Jan
>
> Thanks in Advance!
> Mans
> P.S.
> I am running 5.6.0 on WindowsXP.
>
> ------------------
>
>
>
>:- use_module(library('http/http_client')).
>:- use_module(library('http/http_sgml_plugin')).
>:- use_module(library('http/http_open')).
>
> runit :-
> http_open('http://www.google.com', In,[proxy('11.0.0.5',80)]),
> copy_stream_data(In, user_output),
> close(In).
>
> testit :-
> http_get('http://www.google.com', Response, [proxy('11.0.0.5',80)]),
> write(Response).
>
| |
|
| Jan,
Thanks for looking at that.
The result from test it is:
2 ?- testit.
ERROR: Domain error: `sgml_option' expected, found `proxy(proxy03,
8080)'
^ Exception: (20) sgml:sgml_parse(sgml_parser(523660),
[document(_G3419), source('$stream'(447404)), content_length(221),
syntax_errors(quiet), max_errors(-1), proxy(proxy03, 8080)]) ?
If that helps any.
Best Regards,
Mans
| |
| Jan Wielemaker 2006-01-11, 7:56 am |
| On 2006-01-11, mans <mshapshak@gmail.com> wrote:
> Jan,
>
> Thanks for looking at that.
>
> The result from test it is:
>
> 2 ?- testit.
> ERROR: Domain error: `sgml_option' expected, found `proxy(proxy03,
> 8080)'
> ^ Exception: (20) sgml:sgml_parse(sgml_parser(523660),
> [document(_G3419), source('$stream'(447404)), content_length(221),
> syntax_errors(quiet), max_errors(-1), proxy(proxy03, 8080)]) ?
Would have helped if you sent that along with the first message :-)
Anyway, thats a bug. I just fixed it. I also added code in http_get/3
to handle the 302 redirect messages automatically. You find both
patches in the CVS version of http_client.pl. You can fetch this
file using your browser from the address below. Simply overwrite
the installed file and all should be fine.
http://gollem.science.uva.nl/cgi-bi.../http_client.pl
This patch will be in SWI-Prolog 5.6.2 (5.6.1 was released yesterday).
Enjoy --- Jan
| |
|
| Jan,
That is spectacular!!! Works great!
Thanks,
Mans
|
|
|
|
|