Joe Wreschnig (piman) wrote in lj_clients,
Joe Wreschnig
piman
lj_clients

  • Mood:

Problem with getfriends and a Ruby client

I've been messing with Ruby a lot lately, and started working on a highly abstracted OO LJ library in it. However, I've hit a stumbling block with getting friends. The code is available for your perusal.

To use it, load up irb and run
load "lj.rb"
me = LJ::User::new("username", "password")
me.login
me.friends


Right now that will output the HTTP response from the server along with any information relating to the actual function (for debugging purposes).

However, when I log in as myself, it throws an exception (one I made) and the data appears to be truncated.
irb(main):003:0> me.login
access_1
8bittheater
[...]
friend_20_groupmask
3
friend_20_name
Marissa
fri
ProtocolError: ProtocolError


If I log in as test, it works (although test has no friends). It does work on an account with 13 friends, but not on mine with 83 or on another one with 161, so it seems to be related to the number of friends the user has.

I don't think there's a bug in my code, but I'd also be confused if it was a bug in Ruby's HTTP module. Unfortunately I can't (or don't know how to) get the HTTP headers Ruby is seeing. Any ideas? Has anyone else seen something like this?

Update: The location of truncation appears to be "random" - I just got
friend_20_groupmask
3
friend_
and
friend_21_bg
#ffffff
frie
at the end instead. However, it always happens around that area (friend 20), which is a total of about 11 friends down my list (10-19,1,20-21). It happens in at the same place for the account with 161 friends, at friend 110 (100-109, 10, 110). So, whatever the problem is does appear to be tied to the data length somehow.
Subscribe
  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 10 comments