hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: Application Use Case: How to set HTTP-headers in body-parts of a multipart request?
Date Mon, 14 Feb 2005 10:44:25 GMT
Hello Edwin,

1. RFC 2068 is obsoleted by RFC 2616. The section you quoted
   is not in RFC 2616, or at least I couldn't find it.

2. RFC 2616 states in section 3.7.2, page 27:

>  In general, HTTP treats a multipart message-body no differently than
>  any other media type: strictly as payload.

3. The multipart code in HttpClient is not a generic multipart
   implementation. It is meant to support the specific media type
   multipart/form-data, as specified by RFC 1867, section 7.
   You currently can't set arbitrary headers for each part
   because RFC 1867 does not indicate a need for that.

4. Because of 2., you can use a generic multipart implementation
   which supports arbitrary part headers, generate the message body,
   and send that message body in a plain POST method.

5. Transfer-Encoding is a bad example for this use case, since
   transfer encoding of the whole HTTP message is handled automatically
   on the transport level with the help of this header. This example
   offers a huge potential for confusion.


We will consider adding custom part headers as a feature in 4.0, when
we get working on the multipart code. But the multipart stuff was meant
to be factored out and moved to commons-codec, so I wouldn't bet my
money on it. From the HTTP perspective, the current implementation
offers all we have to offer.

cheers,
  Roland






"Kempin, Edwin" <edwin.kempin@sap.com> 
14.02.2005 10:41
Please respond to
"HttpClient Project"


To
<httpclient-dev@jakarta.apache.org>
cc

Subject
Application Use Case: How to set HTTP-headers in body-parts of a multipart 
request?






Hi,

I wonder how I can add HTTP-header to the body-parts of a multipart
request by using the Jakarta Commons HttpClient.

When I create a body-part (StringPart, FilePart) I have only methods to
set Content-Transfer-Encoding, Content-Type and char-set. How can I add
other HTTP-headers (e.g.  I want to set the Transfer-Encoding header).

In principle this should be possible, since RFC 2068
(http://www.faqs.org/rfcs/rfc2068.html) says in 19.4.5: "In HTTP/1.1,
multipart body-parts may contain any HTTP header fields which are
significant to the meaning of that part."

Any ideas?

Thanks and regards
Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message