From: <Hs...@gm...> - 2007-10-05 12:20:27
|
Hello all, I'm an Erlang newbie, so please don't hit me too hard if I fail in my beginning, baby steps into this wonderful new world. :-) I'm developing web services with Yaws, and I've found some code in the soap server module that can be (mis-) used to crash the web server. If a soap client sends a request for a web service that's not started on the server, yaws will crash instead of returning a nice error message. The functions involved are request/5 and handle_call/3 in yaws_soap_srv module. I've written my own code to handle this. My code might not be the perfect solution, but anyway, the problem perhaps should be fixed in the next version of Yaws? My code (original code are commented out): handle_call( {request, Id, Payload, SessionValue, SoapAction}, _From, State) -> % Reply = request(State, Id, Payload, SessionValue, SoapAction), % {reply, Reply, State}. try request(State, Id, Payload, SessionValue, SoapAction) of Reply -> {reply, Reply, State} catch throw: model_error -> {reply, cli_error("Model error."), State}; throw: _ -> {reply, srv_error("Unknown server error."), State} end. request(State, {M,F} = Id, Payload, SessionValue, Action) -> % {ok, Model} = get_model(State, Id), {Status, Model} = get_model(State, Id), case Status of ok -> ok; error -> throw(model_error); _ -> throw(other_error) end, [remaining code left out] Regards, Andreas |