GSoC2k9 - Torbutton Feature Fulfillment - Kory Kirk
nsIProtocolHandler and nsIIOService correct implementation for Torbutton 
Tuesday, June 2, 2009, 03:19 PM
Posted by Administrator
Thanks to some direction from my mentor, Mike, I feel much more comfortable with this step of the project. I have rewritten the newURI and newChannel functions:

newURI: function(spec, charset, baseURI)
const nsIStandardURL = Components.interfaces.nsIStandardURL;
var uri = Components.classes[";1"].createInstance(nsIStandardURL);
uri.init(nsIStandardURL.URLTYPE_STANDARD, 80, spec, charset, baseURI);

return uri.QueryInterface(Components.interfaces.nsIURI);


newChannel: function(aURI)
/*The protocol has been called, therefore we want to enable tor, wait for it to activate return the new channel with the scheme of http.*/
var ios = Components.classes[kIOSERVICE_CONTRACTID].getService(nsIIOService);
if (!ios.allowPort(aURI.port, aURI.scheme))
throw Components.results.NS_ERROR_FAILURE;

//this is where I need to turn tor on, I am going to wait to talk to Mike a little to add these parts

//if tor is turned on then, else we should throw exception of some sort.
aURI.scheme = "http";
return ios.newChannelFromURI(aURI);

Instead of parsing the uri by hand, nsIStandarURL does that for us. The nsIURI MDC page says that the proper way to parse a uri is through the IOService function, newURI(), but that method just calls the newURI() function from the scheme's protocol handler, so it would have caused an infinite loop. The newChannel code is not finished, I want to learn a little bit more about the 3 step Tor activation process that Torbutton uses before I go ahead and fill that part in. But the channel just makes sure that the scheme allows the port, and then changes the scheme to http and creates the channel based upon that. I believe this will work, because the newChannelFromURI uses the newChannel method for the scheme's protocol handler - which in this case will be http.

The updates are reflected in

p.s. the format of that code is ugly, sorry
1 comment ( 19 views )
tor-protocol component 
Saturday, May 30, 2009, 02:18 PM
Posted by Administrator
For the tor-protocol component, I had the help of a confusing tutorial and its corrections. I have a good start on it, I believe everything I need for this component is there. I took the skeleton code from the example, appropriately changed variables - got a new CID and a few other tweeks. I also fixed some things in the code mentioned in the corrections. - here is my first version.

add comment ( 21 views )
Part 1: The plan 
Thursday, May 28, 2009, 03:21 PM
Posted by Administrator
Rough start, as I have been extremely busy with non-GSoC stuff the past few days, had to move out of my house and take care of some other stuff. But luckily from the depths of that business came the outline of the development plan for the feature that I am going to implement in Torbutton. That is the tor:// protocol association.

In order to do this, I am going to utilize the XPCom interface NSIProtocolHandler. Which is Mozilla's way of incorporating a protocol into its framework. So first of all I need to create a component that implements this interface.It seems I will only have to implement 3 methods from NSIProtocolHandler - newURI(), newChannel(), allowPort(). The implementation of this object seems pretty straight forward.

I will then make an observer to take action anytime the tor:// protocol is called. When it is called, we are going to have a dialogue box come up for confirmation. If the user says that it is okay to enable tor, then tor will start up, and after it has been enabled the extension will request and view the uri.

This is just a brief outline, and I imagine there will be many unforeseen complications - I will be filling in the gaps as I go along.

1 comment ( 24 views )
GSoC and Torbutton 
Monday, May 25, 2009, 12:46 PM
Posted by Administrator
This is my Torbutton blog to track my progress of my 2009 Google Summer of Code project with The Tor Project. I am working on adding some new features to the Torbutton Firefox plug in, to help me through this process - I have my mentor, Mike. I am hoping to update this page frequently to keep a log of my progress. For any details regarding my project, please consult my proposal.
add comment ( 13 views )

<<First <Back | 1 | 2 |