Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  certfile bug in yaws_server.erl

Guest
Posted: Wed Feb 27, 2008 10:38 pm Reply with quote
Guest
Hello.

(System info: Yaws-1.75; Erlang OTP R12B1; Windows XP)

I use a certfile path (in yaws.conf) with spaces in the name, like this:

certfile = "C:/Program Files/Yaws/ssl/yaws-cert.pem"

Functions in ssl library will then try to use this path in a command
line argument, which causes Yaws to crash with error message {error,
ecertfile}.

"-certfile C:/Program Files/Yaws/ssl/yaws-cert.pem"

I've made a bug fix that puts "\"" around file paths in
yaws_server:ssl_opts/1 (see code below). I guess that most people use
Yaws on Unix since I haven't seen this reported before? Also, does
this fix work on Unix too?

/Andreas

CODE:

ssl_opts(SSL) ->
L = [if SSL#ssl.keyfile /= undefined ->
%% <FIX_BEGIN>
%% {keyfile, SSL#ssl.keyfile};
{keyfile, "\"" ++ SSL#ssl.keyfile ++ "\""};
%% <FIX_END>
true ->
false
end,

if SSL#ssl.certfile /= undefined ->
%% <FIX_BEGIN>
%% {certfile, SSL#ssl.certfile};
{certfile, "\"" ++ SSL#ssl.certfile ++ "\""};
%% <FIX_END>
true ->
false
end,

if SSL#ssl.cacertfile /= undefined ->
%% <FIX_BEGIN>
%% {cacertfile, SSL#ssl.cacertfile};
{cacertfile, "\"" ++ SSL#ssl.cacertfile ++ "\""};
%% <FIX_END>
true ->
false
end,

[rest of code omitted]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Thu Feb 28, 2008 11:43 am Reply with quote
Guest
Andreas wrote:
> Hello.
>
> (System info: Yaws-1.75; Erlang OTP R12B1; Windows XP)
>
> I use a certfile path (in yaws.conf) with spaces in the name, like this:
>
> certfile = "C:/Program Files/Yaws/ssl/yaws-cert.pem"
>
> Functions in ssl library will then try to use this path in a command
> line argument, which causes Yaws to crash with error message {error,
> ecertfile}.
>

No this fix cannot be applied - it breaks on UNIX. Furthermore I
find the fix more than weird. E.g what happens on windows if you do

file:list_dir("C:/Program Files").

Does that work or do you have to do

file:list_dir("\"C:Program Fioles\"").

Don't think so - so the error lies elsewhere.

Add a printout in yaws_server printing out the filename
that is being opened and then try to open the same file
from the erlang prompt.

/klacke

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum