[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [syndication] Syndication Subscription
On Wed, 5 Jul 2000, Aaron Swartz wrote:
> http://my.theinfo.org/changed/add.adp
Whoops. I implemented the Publisher functions, the same stuff you did,
albeit a little bit differently. Maybe later this evening I'll try to
implement the other side so I can test against your implementation.
You can play with
http://www.flutterby.com/archives/syndicatorpublisher.cgi in which I've
tested the "changedPage.getPublications" function with the Perl code at
the end of this message. subscribe and unsubscribe should work but I
haven't tested 'em yet, and I'm waiting for some data to build up in my
change logs before I unleash the job which'll call the notify functions.
> changedPage.unsubscribePublication(integer subscriptionID);
Any chance we can renegotiate on the subscription ID? right now it's a 32
char string in my implementation because...
I thought about implementing it as just an integer, but then realized that
if the numbers had a pattern to 'em (ie: mine are allocated via an SQL
table where they're "AUTO INCREMENT") someone could just do a:
for (i = 0; i < 32768; i++)
{
changedPage.unsubscribePublication(integer subscriptionID);
}
or similar for a fairly effective denial of service attack. So I went to
the scheme that I use with my login accounts, the subscription ID is an
integer record number combined with a slash followed by a random string. I
could cut the size of that string and maybe break the integer into two 16
bit portions, but over-engineering has yet to bite me in the butt.
Perl code to call my changedPage.getPublications function follows, right
now it returns a two dimensional array which we probably wanna change to
an array of structs.
Dan
#!/usr/bin/perl -w
use strict;
use Frontier::Client;
sub PrintReturnValues(@)
{
my($r,$indent) = @_;
$indent = 1 unless (defined($indent));
if (ref($r))
{
if (ref($r) eq 'HASH')
{
print ' 'x$indent."HASH\n";
foreach (keys %$r)
{
print ' 'x$indent."$_ - $r->{$_}\n";
}
}
elsif (ref($r) eq 'ARRAY')
{
print ' 'x$indent."ARRAY\n";
foreach (@$r)
{
PrintReturnValues($_,$indent+1);
}
}
else
{
print ' 'x$indent."ret - ".ref($r)." value ".$r->value()."\n";
PrintReturnValues($r->value,$indent+1);
}
}
else
{
print ' 'x$indent."ret - $r\n";
}
}
my %ghConfigInfo =
(
'url' => 'http://www.flutterby.com/archives/syndicatorpublisher.cgi',
);
my ($gConfigInfo);
$gConfigInfo = \%ghConfigInfo;
my ($server);
$server = Frontier::Client->new('url'=>$gConfigInfo->{'url'}
,'debug'=>1);
if (1)
{
my (@r);
@r = $server->call('changedPage.getPublications');
print "Return @r\n";
PrintReturnValues(\@r);
}