Search code examples
javascriptxulrunnergecko

Low level version of transport.openOutputStream?


For load and stress testing a proxy I'm emulating a Firefox browser using XULRunner and Crowbar.

It works quite well and also melds in quite nicely with our (Perl) load+stress tool, which takes a list of destination-URLs and fires of as much HTTP GET load using WWW::Curl as I like.

However, what our perl-script stresstool also does (before I integrated it with crowbar) is choosing a source IP-address from a pool to emulate several different clients. Since crowbar is a proxy itself where you send all the requests to, I wanted to implement a HTTP-param to hand over the IP-address which should be used for outbound connections (let's say like ?ip=4.5.6.7).

Going through crowbar's source code I noticed that it uses the JS-call transport.openOutputStream, which doesn't give you the possibility to chose the outbound IP-address.

Does anyone have an advice which (maybe native Gecko) function I should be using to chose one of the IP-addresses which are configured to the client-machine? I'm kinda lost in all the documentation provided by Mozilla and just need the right nudge or a pointer where to continue.


Solution

  • XULRunner/Firefox doesn't have the functionality to choose the outbound IP address - it will always go by the routing table of the operating system. So the outbound address is determined by the target address only. Best you could do is specifying a proxy in nsISocketTransportService.createTransport().