Skip to content
This repository

This makes it build on newer erlangs.. #7

Open
wants to merge 4 commits into from

2 participants

Wade Mealing SHIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  .gitignore
... ...
@@ -0,0 +1,2 @@
  1
+*.beam
  2
+*.app
4  src/beepbeep_skel.erl
@@ -65,7 +65,7 @@ skel() ->
65 65
     "skel".
66 66
 
67 67
 skelcopy(Src, DestDir, Name, LDst) ->
68  
-    {ok, Dest, _} = regexp:gsub(filename:basename(Src), skel(), Name),
  68
+    Dest = re:replace(filename:basename(Src),skel(), Name,  [global, {return, list}]),
69 69
     case file:read_file_info(Src) of
70 70
         {ok, #file_info{type=directory, mode=Mode}} ->
71 71
             Dir = DestDir ++ "/" ++ Dest,
@@ -86,7 +86,7 @@ skelcopy(Src, DestDir, Name, LDst) ->
86 86
         {ok, #file_info{type=regular, mode=Mode}} ->
87 87
             OutFile = filename:join(DestDir, Dest),
88 88
             {ok, B} = file:read_file(Src),
89  
-            {ok, S, _} = regexp:gsub(binary_to_list(B), skel(), Name),
  89
+            S = re:replace(binary_to_list(B), skel(), Name, [global, {return, list}] ),
90 90
             ok = file:write_file(OutFile, list_to_binary(S)),
91 91
             ok = file:write_file_info(OutFile, #file_info{mode=Mode}),
92 92
             io:format("    ~s~n", [filename:basename(Src)]),
11  src/mochiweb_env.erl
@@ -75,7 +75,10 @@ parse_element(beepbeep_params,Req) ->
75 75
 	Method when Method =:= 'GET'; Method =:= 'HEAD' ->
76 76
 	    Req:parse_qs(); 
77 77
 	_ ->
78  
-	    Req:parse_post()
  78
+            case check_multipart_form_data(Req) of
  79
+                true -> mochiweb_multipart:parse_form(Req);
  80
+                false -> Req:parse_post()
  81
+            end
79 82
     end;
80 83
 parse_element(content_type, Req) ->
81 84
     Req:get_header_value("content-type");
@@ -106,3 +109,9 @@ parse_headers(Req) ->
106 109
                 mochiweb_headers:to_list(Hdrs)).
107 110
     
108 111
 			       
  112
+check_multipart_form_data(Req) ->
  113
+    ContentType = Req:get_header_value("content-type"),
  114
+    case re:run(ContentType, "multipart/form-data") of
  115
+        {match, _} -> true;
  116
+        nomatch -> false
  117
+    end.
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.