anchor.diff:          _ -> % We have a host
               Hdrs
       end.
  +
  +is_chunked(Hdrs) ->
  +    case header_value("transfer-encoding", Hdrs) of
  +        undefined -> false;
  +        _ -> true %% chunked is mandatory with Transfer-Enncoding
  +    end.
  +
  
positive.code: format_hdrs([], Acc) ->
      [Acc, "\r\n"].
  
  add_mandatory_hdrs(Method, Hdrs, Host, Body) ->
      add_host(add_content_length(Method, Hdrs, Body), Host).
  
  add_content_length("POST", Hdrs, Body) ->
      add_content_length(Hdrs, Body);
  add_content_length("PUT", Hdrs, Body) ->
      add_content_length(Hdrs, Body);
  add_content_length(_, Hdrs, _) ->
      Hdrs.
  
  add_content_length(Hdrs, Body) ->
      case header_value("content-length", Hdrs) of
          undefined ->
              ContentLength = integer_to_list(iolist_size(Body)),
              [{"Content-Length", ContentLength} | Hdrs];
          _ -> % We have a content length
              Hdrs
      end.
  
  add_host(Hdrs, Host) ->
      case header_value("host", Hdrs) of
  
negative.code: split_port(Scheme, [P | T], Port) ->
      split_port(Scheme, T, [P | Port]).
  
  %% @spec (Path, Method, Headers, Host, Body, PartialUpload) -> Request
  %% Path = iolist()
  %% Method = atom() | string()
  %% Headers = [{atom() | string(), string()}]
  %% Host = string()
  %% Body = iolist()
  %% PartialUpload = true | false
  -spec format_request(iolist(), atom() | string(), headers(), string(),
      iolist(), true | false ) -> {true | false, iolist()}.
  format_request(Path, Method, Hdrs, Host, Body, PartialUpload) ->
      FormatedMethod = format_method(Method),
      AllHdrs = add_mandatory_hdrs(
                     FormatedMethod, Hdrs, Host, Body, PartialUpload),
      {is_chunked(AllHdrs),
      [
          FormatedMethod, " ", Path, " HTTP/1.1\r\n",
          format_hdrs(AllHdrs),
          Body
      ]}.
  
  format_method(Method) when is_atom(Method) ->
      string:to_upper(atom_to_list(Method));
  