Skip to content
This repository
Browse code

adding b968bdc to this branch

  • Loading branch information...
commit 9354d0cf26b2503ad2cba253b2ad1ce4aaf9dff8 1 parent 176487d
Jordan West jrwest authored

Showing 1 changed file with 14 additions and 9 deletions. Show diff stats Hide diff stats

  1. +14 9 src/webmachine.erl
23 src/webmachine.erl
@@ -37,16 +37,21 @@ stop() ->
37 37 application:stop(webmachine).
38 38
39 39 new_request(mochiweb, Request) ->
  40 + Method = Request:get(method),
  41 + Scheme = Request:get(scheme),
  42 + Version = Request:get(version),
40 43 {Headers, RawPath} = case application:get_env(webmachine, rewrite_module) of
41 44 {ok, RewriteMod} ->
42   - do_rewrite(RewriteMod, Request);
  45 + do_rewrite(RewriteMod,
  46 + Method,
  47 + Scheme,
  48 + Version,
  49 + Request:get(headers),
  50 + Request:get(raw_path));
43 51 undefined ->
44 52 {Request:get(headers), Request:get(raw_path)}
45 53 end,
46 54 Socket = Request:get(socket),
47   - Method = Request:get(method),
48   - Scheme = Request:get(scheme),
49   - Version = Request:get(version),
50 55 InitState = #wm_reqstate{socket=Socket,
51 56 reqdata=wrq:create(Method,Scheme,Version,RawPath,Headers)},
52 57
@@ -64,13 +69,13 @@ new_request(mochiweb, Request) ->
64 69 response_length=0},
65 70 webmachine_request:new(PeerState#wm_reqstate{log_data=LogData}).
66 71
67   -do_rewrite(RewriteMod, Request) ->
68   - case RewriteMod:rewrite(Request:get(headers), Request:get(raw_path)) of
  72 +do_rewrite(RewriteMod, Method, Scheme, Version, Headers, RawPath) ->
  73 + case RewriteMod:rewrite(Method, Scheme, Version, Headers, RawPath) of
69 74 %% only raw path has been rewritten (older style rewriting)
70   - RawPath when is_list(RawPath) ->
71   - {Request:get(headers), RawPath};
  75 + NewPath when is_list(NewPath) -> {Headers, NewPath};
  76 +
72 77 %% headers and raw path rewritten (new style rewriting)
73   - {Headers, RawPath} -> {Headers,RawPath}
  78 + {NewHeaders, NewPath} -> {NewHeaders,NewPath}
74 79 end.
75 80
76 81

0 comments on commit 9354d0c

Please sign in to comment.
Something went wrong with that request. Please try again.