Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Feed when passing a URI to Feed.from_url #11

Open
gregkare opened this issue Sep 27, 2012 · 3 comments
Open

Crash in Feed when passing a URI to Feed.from_url #11

gregkare opened this issue Sep 27, 2012 · 3 comments

Comments

@gregkare
Copy link

I was investigating an issue I had on rstat.us in production: 500 Error when trying to add a remote user as an URI instead of something like [email protected]. I didn't know the ostatus protocol used identifiers that look like emails so I foolishly pasted an identi.ca URI. I've installed rstat.us on my machine and found an issue in ostatus, in lib/ostatus/feed.rb:54.

It's easy enough to reproduce by itself:

$ irb -r ./lib/ostatus
>> OStatus::Feed.from_url('http://example.com/uri')
NoMethodError: undefined method `new' for URI:Module
        from /Users/user/code/ostatus/lib/ostatus/feed.rb:54:in `rescue in initialize'
        from /Users/user/code/ostatus/lib/ostatus/feed.rb:54:in `initialize'
        from /Users/user/code/ostatus/lib/ostatus/feed.rb:86:in `new'
        from /Users/user/code/ostatus/lib/ostatus/feed.rb:86:in `from_url'
        from (irb):1
        from /Users/user/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>'

URI is a module and doesn't have a constructor. This rescue is not covered by a unit test, removing it doesn't break any test. It's getting late here so I'm not going to be able to fix this tonight, just wanted to let you know about the issue. Thanks.

@chrismdp
Copy link

@wilkie what should be the desired behaviour here? Should we simply reject, or attempt to discover the user's information somehow via part of webfinger? Happy to work on this given some direction.

@Nakort
Copy link

Nakort commented Oct 23, 2012

What is the expected behavior for this? I am trying to fix this error hotsh/rstat.us#661 but it seems we to raise some sort of error given an invalid url here.

@wilkie
Copy link
Contributor

wilkie commented Oct 24, 2012

@chrismdp @Nakort tl;dr: It should discover the feed's atom url using the Link information, if possible.

The OStatus::Feed.from_url method expects the input to be a URI to an Atom stream... but I'd accept a fallback mechanism to check for a with a rel='alternate' and a type='application/atom+xml' in either the HTTP header or a link tag in the . The thing explodes because URI.new is the fallback, which is bizarre. I don't think I wrote that. :)

So, we need to add both the behavior to discover the feed into the OStatus gem, and a more appropriate fail condition, and write appropriate unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants