http:request returns {error, session_remotly_closed}
Stephen Han
kruegger@REDACTED
Wed Mar 1 03:10:06 CET 2006
I ran your sample under Windows XP service pack 2 with OTP R10B-9.
I could not reproduce the problem.
One of my application do http:request every 5 minutes. It has been doing
that since 2005 June. So far didn't see that error since. But mine do
http:request every 5 min so yours probably do it really fast without
interval.
I think it may be the persistent connection that confuses whoever that is,
http module or web server. :-)
Try asynchronously and see if happens again.
regards,
On 2/26/06, Soren Gronvald <gronvald@REDACTED> wrote:
>
> hi,
>
> I have a problem with http:request that I think could
> be a bug (but of course it could be due to ignorance
> on my part).
>
> I am trying to read a url from yahoo.com in the
> simplest possible way - http:request(Url)- but it
> fails with the error
>
> {error,session_remotly_closed}
>
> This of course indicates that it is the server that
> causes trouble, but I can read the same url with other
> technologies (java and visual basic) with no hassle at
> all. And I can read similar but shorter urls from
> yahaoo.com with erlang http:request without problems.
>
> this url can be read successfully:
> U1 =
> "
> http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM&f=sl1d1t1c1baphgvn&e=.csv
> ".
>
> and this fails.
> U2 =
> "
> http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
> ".
>
> both should return a comma separated list of stock
> exchange quotes from yahoo.com.
>
> As I can read the same url with other technologies it
> makes me think that there is a bug in the http client
> module. Or, could it be that I need some
> HTTPOptins/Options to make it work?
>
> I am using erlang R10B-9 on Windows XP SP2
> professional edition with all updates applied. I have
> downloaded the precompiled version from erlang.org.
>
> Best regards
> Gronvald
>
>
> I have included program examples below
>
> this erlang program shows the problem
>
> % this works
> testurl(1) ->
> U =
> "
> http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM&f=sl1d1t1c1baphgvn&e=.csv
> ",
> geturl(U);
>
> % this exits
> testurl(2) ->
> U =
> "
> http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
> ",
> geturl(U).
>
> geturl(Url) ->
> application:start(inets),
> X = http:request(Url),
> case X of
> {ok, { {_Version, 200, _ReasonPhrase}, _Headers,
> Body} } ->
> Body;
> _ -> X
> end.
>
>
> this java program will handle same situation without
> error
>
> import java.net.*;
> import java.io.*;
>
> public class Geturl {
>
> public static void main(String[] args) throws
> Exception {
>
> String u2 =
>
> "
> http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
> ";
>
> URL url = new URL(u2);
> InputStream is = new
> BufferedInputStream(url.openStream());
> Reader r = new InputStreamReader(is);
>
> int c = r.read();
> while(c != -1) {
> System.out.print((char)c);
> c = r.read();
> }
> }
> }
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060228/4837cfe3/attachment.htm>
More information about the erlang-questions
mailing list