You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Benoit Chesneau <bc...@gmail.com> on 2011/12/21 22:35:47 UTC

couch_httpd inconsistency ?

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?

- benoît

Re: couch_httpd inconsistency ?

Posted by Robert Newson <rn...@apache.org>.
pretty sure you can run both.

On 22 December 2011 23:08, Randall Leeds <ra...@gmail.com> wrote:
> On Wed, Dec 21, 2011 at 13:35, Benoit Chesneau <bc...@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

Re: couch_httpd inconsistency ?

Posted by Randall Leeds <ra...@gmail.com>.
On Wed, Dec 21, 2011 at 13:35, Benoit Chesneau <bc...@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