Commits

Dmitry Grebeniuk committed 24506cb

fixed handling of Connection:close and Content-length

  • Participants
  • Parent commits 199759f

Comments (0)

Files changed (1)

src/amall_http.ml

       (
         (* todo: chunked t.e. *)
         let h = request.rq_headers in
-        if List.exists ((=) `Close) h.connection
-        then
-          I.return `Till_eof
-        else
         if h.transfer_encoding <> []
         then
           fail "non-identity transfer encodings are not implemented"
         else
           match h.content_length with
-          [ None -> fail "411 Length required"
-          | Some len -> I.return & `Content_length len
+          [ Some len -> I.return & `Content_length len
+	  | None ->
+              if List.exists ((=) `Close) h.connection
+              then
+                I.return `Till_eof
+              else
+                fail "411 Length required"
           ]
       ) >>= fun bounds ->
       match bounds with