Skip to content

Commit

Permalink
fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
janl committed Dec 5, 2012
1 parent b90e402 commit 8e88885
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion etc/couchdb/default.ini.tpl.in
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ socket_options = [{keepalive, true}, {nodelay, false}]
;cert_file = /full/path/to/server_cert.pem
; Path to file containing user's private PEM encoded key.
;key_file = /full/path/to/server_key.pem
; String containing the user's password. Only used if the private keyfile is password protected.
; String containing the user's password. Only used if the private keyfile is password protected.
;password = somepassword
; Set to true to validate peer certificates.
verify_ssl_certificates = false
Expand Down
2 changes: 1 addition & 1 deletion src/couchdb/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ source_files = \
couch_work_queue.erl \
json_stream_parse.erl

EXTRA_DIST = $(source_files) couch_db.hrl couch_js_functions.hrl
EXTRA_DIST = $(source_files) couch_db.hrl couch_js_functions.hrl

compiled_files = \
couch.app \
Expand Down
10 changes: 5 additions & 5 deletions src/couchdb/couch_httpd.erl
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ handle_request_int(MochiReq, DefaultFun,
try
case couch_httpd_cors:is_preflight_request(HttpReq) of
#httpd{} ->
case authenticate_request(HttpReq, AuthHandlers) of
#httpd{} = Req ->
HandlerFun(Req);
Response ->
Response
case authenticate_request(HttpReq, AuthHandlers) of
#httpd{} = Req ->
HandlerFun(Req);
Response ->
Response
end;
Response ->
Response
Expand Down
30 changes: 15 additions & 15 deletions src/couchdb/couch_httpd_vhost.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
%% doc the vhost manager.
%% This gen_server keep state of vhosts added to the ini and try to
%% match the Host header (or forwarded) against rules built against
%% vhost list.
%% vhost list.
%%
%% Declaration of vhosts take place in the configuration file :
%%
Expand All @@ -51,7 +51,7 @@
%% "*.db.example.com = /" will match all cname on top of db
%% examples to the root of the machine.
%%
%%
%%
%% Rewriting Hosts to path
%% -----------------------
%%
Expand All @@ -75,7 +75,7 @@
%% redirect_vhost_handler = {Module, Fun}
%%
%% The function take 2 args : the mochiweb request object and the target
%%% path.
%%% path.

start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
Expand Down Expand Up @@ -125,14 +125,14 @@ append_path("/"=_Target, "/"=_Path) ->
append_path(Target, Path) ->
Target ++ Path.

% default redirect vhost handler
% default redirect vhost handler
redirect_to_vhost(MochiReq, VhostTarget) ->
Path = MochiReq:get(raw_path),
Target = append_path(VhostTarget, Path),

?LOG_DEBUG("Vhost Target: '~p'~n", [Target]),

Headers = mochiweb_headers:enter("x-couchdb-vhost-path", Path,
Headers = mochiweb_headers:enter("x-couchdb-vhost-path", Path,
MochiReq:get(headers)),

% build a new mochiweb request
Expand All @@ -146,7 +146,7 @@ redirect_to_vhost(MochiReq, VhostTarget) ->
MochiReq1.

%% if so, then it will not be rewritten, but will run as a normal couchdb request.
%* normally you'd use this for _uuids _utils and a few of the others you want to
%* normally you'd use this for _uuids _utils and a few of the others you want to
%% keep available on vhosts. You can also use it to make databases 'global'.
vhost_global( VhostGlobals, MochiReq) ->
RawUri = MochiReq:get(raw_path),
Expand All @@ -167,14 +167,14 @@ try_bind_vhost([], _HostParts, _Port, _PathParts) ->
try_bind_vhost([VhostSpec|Rest], HostParts, Port, PathParts) ->
{{VHostParts, VPort, VPath}, Path} = VhostSpec,
case bind_port(VPort, Port) of
ok ->
ok ->
case bind_vhost(lists:reverse(VHostParts), HostParts, []) of
{ok, Bindings, Remainings} ->
case bind_path(VPath, PathParts) of
{ok, PathParts1} ->
Path1 = make_target(Path, Bindings, Remainings, []),
{make_path(Path1), make_path(PathParts1)};
fail ->
fail ->
try_bind_vhost(Rest, HostParts, Port,
PathParts)
end;
Expand All @@ -185,7 +185,7 @@ try_bind_vhost([VhostSpec|Rest], HostParts, Port, PathParts) ->

%% doc: build new patch from bindings. bindings are query args
%% (+ dynamic query rewritten if needed) and bindings found in
%% bind_path step.
%% bind_path step.
%% TODO: merge code with rewrite. But we need to make sure we are
%% in string here.
make_target([], _Bindings, _Remaining, Acc) ->
Expand Down Expand Up @@ -215,7 +215,7 @@ bind_vhost([],[], Bindings) -> {ok, Bindings, []};
bind_vhost([?MATCH_ALL], [], _Bindings) -> fail;
bind_vhost([?MATCH_ALL], Rest, Bindings) -> {ok, Bindings, Rest};
bind_vhost([], _HostParts, _Bindings) -> fail;
bind_vhost([{bind, Token}|Rest], [Match|RestHost], Bindings) ->
bind_vhost([{bind, Token}|Rest], [Match|RestHost], Bindings) ->
bind_vhost(Rest, RestHost, [{{bind, Token}, Match}|Bindings]);
bind_vhost([Cname|Rest], [Cname|RestHost], Bindings) ->
bind_vhost(Rest, RestHost, Bindings);
Expand Down Expand Up @@ -272,15 +272,15 @@ parse_vhost(Vhost) ->
H1 = make_spec(H, []),
{H1, P, string:tokens(Path, "/")}
end.


split_host_port(HostAsString) ->
case string:rchr(HostAsString, $:) of
0 ->
{split_host(HostAsString), '*'};
N ->
HostPart = string:substr(HostAsString, 1, N-1),
case (catch erlang:list_to_integer(string:substr(HostAsString,
HostPart = string:substr(HostAsString, 1, N-1),
case (catch erlang:list_to_integer(string:substr(HostAsString,
N+1, length(HostAsString)))) of
{'EXIT', _} ->
{split_host(HostAsString), '*'};
Expand Down Expand Up @@ -308,7 +308,7 @@ make_spec([P|R], Acc) ->


parse_var(P) ->
case P of
case P of
":" ++ Var ->
{bind, Var};
_ -> P
Expand All @@ -328,7 +328,7 @@ make_path(Parts) ->

init(_) ->
ok = couch_config:register(fun ?MODULE:config_change/2),

%% load configuration
{VHostGlobals, VHosts, Fun} = load_conf(),
State = #vhosts_state{
Expand Down

0 comments on commit 8e88885

Please sign in to comment.