Commits

Anonymous committed df553e3

proper newlines (CRLF, not just LF) in multipart responses (thanks Sami, bug 86)

Comments (0)

Files changed (2)

apps/riak/src/raw_http_resource.erl

 %%      document.
 produce_multipart_body(RD, Ctx=#ctx{doc={ok, Doc}, bucket=B, prefix=P}) ->
     Boundary = riak_util:unique_id_62(),
-    {[[["\n--",Boundary,"\n",
+    {[[["\r\n--",Boundary,"\r\n",
         multipart_encode_body(P, B, Content)]
        || Content <- riak_object:get_contents(Doc)],
-      "\n--",Boundary,"--\n"],
+      "\r\n--",Boundary,"--\r\n"],
      wrq:set_resp_header(?HEAD_CTYPE,
                          "multipart/mixed; boundary="++Boundary,
                          encode_vclock_header(RD, Ctx)),
          {ok, CS} -> ["; charset=",CS];
          error -> []
      end,
-     "\n",
+     "\r\n",
      case dict:find(?MD_ENCODING, MD) of
-         {ok, Enc} -> [?HEAD_ENCODING,": ",Enc,"\n"];
+         {ok, Enc} -> [?HEAD_ENCODING,": ",Enc,"\r\n"];
          error -> []
      end,
-     LHead,": ",Links,"\n",
-     "Etag: ",dict:fetch(?MD_VTAG, MD),"\n",
+     LHead,": ",Links,"\r\n",
+     "Etag: ",dict:fetch(?MD_VTAG, MD),"\r\n",
      "Last-Modified: ",
      case dict:fetch(?MD_LASTMOD, MD) of
          Now={_,_,_} ->
          Rfc1123 when is_list(Rfc1123) ->
              Rfc1123
      end,
-     "\n",
+     "\r\n",
      case dict:find(?MD_USERMETA, MD) of
          {ok, M} ->
             lists:foldl(fun({Hdr,Val},Acc) ->
-                            [Acc|[Hdr,": ",Val,"\n"]]
+                            [Acc|[Hdr,": ",Val,"\r\n"]]
                         end,
                         [], M);
          error -> []
      end,
-     "\n",V].
+     "\r\n",V].
 
 
 %% @spec select_doc(context()) -> {metadata(), value()}|multiple_choices
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.