couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <randall.le...@gmail.com>
Subject Re: couch_httpd inconsistency ?
Date Thu, 22 Dec 2011 23:08:47 GMT
On Wed, Dec 21, 2011 at 13:35, Benoit Chesneau <bchesneau@gmail.com> wrote:
> Hi,
>
> I notice that we register the http server as `couch_httpd` instead of
> `http` in processes while for https we are registering it as `https`.
> Are teher any reason for that? It's a little inconsistent
>
> I propose this patch to fix that:
>
>    diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
>    index 97475c5..51e2a11 100644
>    --- a/src/couchdb/couch_httpd.erl
>    +++ b/src/couchdb/couch_httpd.erl
>    @@ -35,7 +35,7 @@ start_link() ->
>         start_link(http).
>     start_link(http) ->
>         Port = couch_config:get("httpd", "port", "5984"),
>    -    start_link(?MODULE, [{port, Port}]);
>    +    start_link(http, [{port, Port}]);
>     start_link(https) ->
>         Port = couch_config:get("ssl", "port", "6984"),
>         CertFile = couch_config:get("ssl", "cert_file", nil),
>
>
> thoughts?

I noticed this the other day, too. +1.
I did the searching for you; here are the other things that need to be changed:

src/couchdb/couch_server_sup.erl calls get_uri with couch_httpd as an atom.
The get_scheme call could maybe do a mochiweb_socket_server:get(ssl)
instead of hard-coding it.

couch_replicator_utils:replication_id/2 needs to change. It hard codes
couch_httpd, which also means it can possibly generate the wrong ID
for replications when running on https.
Seems like some thought needs to go into this. Maybe there's a better
way we can handle this info?

A bunch of etap tests call mochiweb_socket_server:get(couch_httpd).

Is it still not possible to run both ssl and non-ssl on the same
couch? I'm feeling like perhaps its better to pass a list like [http]
or [http, https] to couch_httpd:start_link/1 from the [daemons] config
section. But maybe I'm complicating things too much. That's a separate
issue.

-R

Mime
View raw message