~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/inets/src/http_server/httpd_request_handler.erl

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
 
%%
4
 
%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
5
 
%%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
 
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
162
162
%%                                      {stop, Reason, State}
163
163
%% Description: Handling call messages
164
164
%%--------------------------------------------------------------------
165
 
handle_call(Request, From, State) ->
 
165
handle_call(Request, From, #state{mod = ModData} = State) ->
 
166
    Error = 
 
167
        lists:flatten(
 
168
          io_lib:format("Unexpected request: "
 
169
                        "~n~p"
 
170
                        "~nto request handler (~p) from ~p"
 
171
                        "~n", [Request, self(), From])),
 
172
    error_log(Error, ModData),
166
173
    {stop, {call_api_violation, Request, From}, State}.
167
174
 
168
175
%%--------------------------------------------------------------------
171
178
%%                                      {stop, Reason, State}
172
179
%% Description: Handling cast messages
173
180
%%--------------------------------------------------------------------
174
 
handle_cast(Msg, State) ->
175
 
    {reply, {cast_api_violation, Msg}, State}.
 
181
handle_cast(Msg, #state{mod = ModData} = State) ->
 
182
    Error = 
 
183
        lists:flatten(
 
184
          io_lib:format("Unexpected message: "
 
185
                        "~n~p"
 
186
                        "~nto request handler (~p)"
 
187
                        "~n", [Msg, self()])),
 
188
    error_log(Error, ModData),
 
189
    {noreply, State}.
176
190
 
177
191
%%--------------------------------------------------------------------
178
192
%% handle_info(Info, State) -> {noreply, State} |
240
254
 
241
255
%% Timeouts
242
256
handle_info(timeout, #state{mod = ModData, mfa = {_, parse, _}} = State) ->
243
 
    error_log("No request received on keep-alive connection" 
 
257
    error_log("No request received on keep-alive connection "
244
258
              "before server side timeout", ModData),
245
259
    %% No response should be sent!
246
260
    {stop, normal, State#state{response_sent = true}}; 
247
261
handle_info(timeout, #state{mod = ModData} = State) ->
248
262
    httpd_response:send_status(ModData, 408, "Request timeout"),
249
 
    error_log("The client did not send the whole request before the"
 
263
    error_log("The client did not send the whole request before the "
250
264
              "server side timeout", ModData),
251
265
    {stop, normal, State#state{response_sent = true}};
252
266
 
253
267
%% Default case
254
268
handle_info(Info, #state{mod = ModData} = State) ->
255
269
    Error = lists:flatten(
256
 
              io_lib:format("Unexpected message received: ~n~p~n", [Info])),
 
270
              io_lib:format("Unexpected info: "
 
271
                            "~n~p"
 
272
                            "~nto request handler (~p)"
 
273
                            "~n", [Info, self()])),
257
274
    error_log(Error, ModData),
258
275
    {noreply, State}.
259
276
 
355
372
            Reason = io_lib:format("Forbidden URI: ~p~n", [URI]),
356
373
            error_log(Reason, ModData),
357
374
            {stop, normal, State#state{response_sent = true}};
358
 
        {error,{bad_request, {malformed_syntax, URI}}} ->
 
375
        {error, {bad_request, {malformed_syntax, URI}}} ->
359
376
            ?hdrd("validation failed: bad request - malformed syntax", 
360
377
                  [{uri, URI}]),
361
378
            httpd_response:send_status(ModData#mod{http_version = Version},