Menu

#1 Bug: cannot parse remote streams

open
nobody
None
5
2008-04-26
2008-04-26
dB.
No

If the stream is not entirely read, the parser will abort half way. For example, with webcal://dessert.meetup.com/3/calendar/7801237/ical/Cupcake+Social+2.0/

string url = "http://dessert.meetup.com/3/calendar/7801237/ical/Cupcake+Social+2.0/";
SomeICALEmitter emitter = new SomeICALEmitter();
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
Parser parser = new Parser(sr, emitter);
parser.Parse();

The problem is that the parser assumes a TextReader, which assumes that the only time you can get Peek() == -1 is at the end of a stream. A web response stream will Peek() -1 half way through because it didn't get a chance to read a character yet.

There're also two other small fixes consuming tabs and creating class with a filename.

Discussion

  • dB.

    dB. - 2008-04-26

    CVS patch for Scanner.cs

     
  • dB.

    dB. - 2008-04-26

    CVS patch for Parser.cs

     
  • dB.

    dB. - 2008-04-26

    Logged In: YES
    user_id=1518552
    Originator: YES

    File Added: 2008-04-26-Parser.cs.diff

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.