http:request returns {error, session_remotly_closed}

Soren Gronvald <>
Sun Feb 26 18:15:32 CET 2006


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 



More information about the erlang-questions mailing list