On Jul 20, 2007, at 1:52 PM, James Howison wrote:

>
> On Jul 20, 2007, at 1:32 PM, Adam R. Maxwell wrote:
>
>>
>> On Friday, July 20, 2007, at 10:16AM, "James Howison"
>> <[EMAIL PROTECTED]> wrote:
>>> I think the WoS searching is great, but for me it only works when  
>>> I'm
>>> 'on-campus' since ISI's web-services do IP based authentication.
>>> Unfortunately my universities VPN won't route off-campus traffic for
>>> me, so that doesn't work.  Is there a way to handle this that I'm
>>> missing?
>>
>> Switch universities?  I haven't tried using it over the lab's VPN,
>> but that sounds really lame.
>
> It is. I'll switch universities just as soon as I finish this
> dissertation ;)
>
>>> If not, then I think that on release there will be a lot of 'can I
>>> use it through my proxy' requests, since most schools give access to
>>> 'on-campus' resources through a proxy.  I've tried messing around
>>> with that but the way ours is configured I'd have to get the library
>>> to add the URL for the service (hassle++), then there would have to
>>> be some UI for logging in.
>>>
>>> Another option, perhaps easier to configure, is to let BibDesk use a
>>> SOCKS5 proxy for WoS (or all) access.  Those without access via an
>>> actual on-campus SOCKS5 proxy, but have an ssh server on campus can
>>> use the ssh -ND option to simulate one.
>>
>> Well, I can't even ssh into my systems at work, so I have no hope
>> of using or testing such a proxy.  I also have a correspondingly
>> low desire of learning what you are talking about ;).  We'll need a
>> motivated user or developer to figure this out, and make it work
>> with Apple's web services code, or it won't happen.  Sorry.
>
> Understood.  I'll see what I can do.

So I had a go at this but don't think I've cracked it.  It is "meant  
to be easy":

First things first, a working SOCKS proxy server.  I used ssh -D  
25000 server.syr.edu where server is an on-campus comp that I have  
access to, and tested the proxy to be working using Firefox with  
SwitchProxy.  With that on I see that my IP address is an on-campus one.

Now to get BibDesk to use it for the ISI searches.

The Web Services documentation:

http://developer.apple.com/documentation/Networking/Conceptual/ 
UsingWebservices/Web_Services.pdf

says:

> SOCKS Proxy Support
> WSMethodInvocation uses the same flags as CFSocketStream.h in  
> configuring SOCKS proxy support.
> You can set the kCFStreamPropertySOCKSProxy property on the  
> invocation and the value will be
> applied to the underlying stream. See CFSocketStream.h for more  
> information and valid keys.

Some digging shows that the code to do such setting should look a lot  
like this the code below. First you build a Dictionary with the keys/ 
values you want for your SOCKS proxy.  Then you are meant to use  
WSMethodInvocationSetProperty() (a c-method) to send this dictionary  
to your stream (or in this case the WSMethodInvocation.)  Note: I  
tried for ages using CFReadStreamSetProperty because of the reference  
to CFSocketStream, I was confused and thought WSMethodInvocation  
implemented that, but as I read the WS pdf more closely I found  
WSMethodInvocationSetProperty.

It was a bit tricky to find where the WSMethodInvocation is, because  
the Web Services code is a bit of a 'factory pattern' mystery to me.   
But it seems like the Invocation gets created in WSGeneratedObj.m:getRef

I added this code in between creating and returning the  
WSMethodInvocationRef (ie around line 70).

NSString *proxyHost = @"localhost";
NSNumber *proxyPort = [NSNumber numberWithInt:25000];

NSMutableDictionary *settings = [[NSMutableDictionary  
allocWithZone:nil] init];

[settings setObject:proxyHost forKey:(NSString *) 
kCFStreamPropertySOCKSProxyHost];
[settings setObject:proxyPort forKey:(NSString *) 
kCFStreamPropertySOCKSProxyPort];

CFStringRef proxyKey =  CFSTR("kCFStreamPropertySOCKSProxy");

WSMethodInvocationSetProperty( fRef, proxyKey, (CFDictionaryRef)  
settings );

[settings release];

It compiles fine, but testing it still produces the "you may not have  
permission" message.

Not sure how to check whether the property actually gets set.  I've  
put a breakpoint in around my new code, but a search executes without  
triggering it.  I guess I'm working in the wrong part of the code?

Any ideas on debugging this appreciated.

Thanks,
James

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to