Open Bug 766166 Opened 9 years ago Updated 3 years ago

Have a service protocol to communicate with ssltunnel


(Testing :: General, enhancement)

Not set


(Not tracked)


(Reporter: mayhemer, Unassigned)


(Blocks 1 open bug)



(1 file, 1 obsolete file)

This protocol should provide info and allow modifications of ssltunnel config at run-time like:

- notification about ssltunnel server(s) is (are all) up and connections won't fail
- support for startTLS, meaning after some exact byte start ssl nego
- change certificates on server ports

My suggestion is to have a js implemented server that runs in the host application.  ssltunnel would be told to connect back to that server, the port would be given in the config file.  This way it notifies us about being up and we can then use that socket to communicate.
Blocks: 466524
Attached patch v1 (obsolete) — Splinter Review
Base for a service callback from ssltunnel.  Currently implements only a timeout, startup and shutdown notification.  At this moment ssltunnel doesn't read any commands from the client (controller) but it can be easily updated.

This blocks an important patch for support of ssl in xpcshell tests.  So I don't want to go with anything perfect and complicated right now.

Assignee: nobody → honzab.moz
Ted, I would like to ask for an advice here (instantiating a new component works locally, but not on try).

I have introduced a new js implemented component (';1') that is built along with ssltunnel program and copied to bin/components (.js + .manifest).

This works for me locally, the component can be instantiated and works.  

But doesn't work (cannot be found in classes) on try server: (then interesting changeset is

Changes to are taken from httpd.js

What am I doing wrong?

Flags: needinfo?(ted)
Attached patch v1.1Splinter Review

- very basic communication service protocol between ssltunnel and the host application (test-harness)
- notifies about start of all configured servers and start up timeout
- currently no way to configure ssltunnel remotely, but there is a good base to include such features easily (definitely for a followup)
- ssltunnel-control.js is a test js module, no component
Attachment #678020 - Attachment is obsolete: true
Attachment #681466 - Flags: review?(ted)
I got the necessary info.
Flags: needinfo?(ted)
Comment on attachment 681466 [details] [diff] [review]

Review of attachment 681466 [details] [diff] [review]:

r- for an answer on the JS component question. Otherwise looks pretty good.

::: testing/mochitest/ssltunnel/ssltunnel-control.js
@@ +1,3 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
> + * You can obtain one at */

Is there any reason to prefer writing this as a JS component instead of just a JS module? The IDL doesn't add much value unless you plan on calling it from C++.

@@ +125,5 @@
> +
> +    this._inputstreampump = Cc[";1"].createInstance(
> +                            Ci.nsIInputStreamPump);
> +    this._inputstreampump.init(this._inputstream, -1, -1, 0, 0, false);
> +    this._inputstreampump.asyncRead(this, null);

I think you can probably just use NetUtil.asyncFetch here:

::: testing/mochitest/ssltunnel/ssltunnel.cpp
@@ +277,5 @@
> +{
> +  if ( == 0)
> +    return true; // just ignore
> +
> +  AutoFD fd(PR_NewTCPSocket());

Note the patch in bug 767241 replaces AutoFD with a new class.
Attachment #681466 - Flags: review?(ted) → review-
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #5)
> Is there any reason to prefer writing this as a JS component instead of just
> a JS module? The IDL doesn't add much value unless you plan on calling it
> from C++.

Ted, first, thanks for the review.  

According this question:

My original intention was to have this as a component (hence the iface leftover too) and I put a lot of effort to achieve it, but it really was not that simple to do.  There is also a discussion on dev-platform about this [1].  I was trying hard, but that is really not that simple and people advised to rather have this as a module.

If you can help (or even do) the actual work to turn this to a component, then I'll be very happy.

Assignee: honzab.moz → nobody
Component: ssltunnel → General
You need to log in before you can comment on or make changes to this bug.