Commits

Bryan Fink  committed df553e3

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

  • Participants
  • Parent commits 0cb5109
  • Tags pre-0.10

Comments (0)

Files changed (2)

File 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