Hi all!

 

I tackled with the multipart issue in a library I wrote that provides extensions to the HTTP client including multipart support (please see https://github.com/mizosoft/methanol).

I was wondering if I could provide a patch for this issue in the light of  MultipartBodyPublisher.java to be included in java.net.http. Flow control can be rewritten

against the module using jdk.internal.net.http.common.SequentialScheduler. I haven’t found any of the available RequestPublishers impls that can be

efficiently reused for such flow control.

 

If that is possible, please consider if I could also provide other complementary patches such as:

 

  • FormBodyPublisher (similarly in the light of FormBodyPublisher.java). This implements the application/x-www-form-urlencoded format. As with the linked class,

this can make use of  the already available jdk.internal.net.http.RequestPublishers.StringPublisher.

 

  • Add an internal trusted MimeBodyPublisher interface that attaches the correct media type info to the body:

 

public interface MimeBodyPublisher extends BodyPublisher {

 String contentType();

}

 

The HttpClient can use that to transparently add a Content-Type header for the request. In case of MultipartBodyPublisher, this ensures a Content-Type header with the

correct boundary (which might be randomly generated) is used instead of being explicitly specified by the user. Similarly, this ensures the correct Content-Type is used in

case of FormBodyPublisher.

 

 

Please tell me which patches I can start working on. If any, this will be my first contribution so I believe I will need a sponsor.

 

Thanks in advance!

Moataz

Reply via email to