question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for verbatim multipart/related S/MIME uploads

See original GitHub issue

The library already supports 2 variants of multipart uploads, which covers most use-cases.

I have a third use-case now and wonder if this can be already done with the library or would become a feature request.

I have to upload S/MIME multipart/related bodies which I already prepare myself and place them in the apps storage folder like this YYYYMMDDHHMMSSMS-<guid>.upload The content of this file is the multipart/related body that needs to be uploaded. It must not be base64 encoded or anything.

Does this already work when pointing the request to this local file and setting the Content-Type header to multipart/related?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
edeckerscommented, Mar 21, 2021

I decided to implement both discussed solutions (#137 and #138); #137 will probably be the first one I’ll work on.

1reaction
edeckerscommented, Mar 20, 2021

Your comment makes total sense to me, and I think it would be a nice feature to add to the library. I’m still pondering what solution to go with though.

As for your suggested workaround: every upload request is mapped to a multipart body, so this won’t work. This is what happens:

const request0 = {
  absoluteFilePath,
  method: 'POST',
  mimeType: 'multipart/related; boundary="===============smime.parts=="',
  url: 'http://192.168.0.147:8080',
};

const uploadResult = await BlobCourier.uploadBlob(request0)
ely@xps-ely ~ nc -l 8080
POST / HTTP/1.1
Content-Type: multipart/form-data; boundary=b3e08e48-cfca-4423-a141-e1386c4bd0bb
Content-Length: 1015
Host: 192.168.0.147:8080
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/3.14.9

--b3e08e48-cfca-4423-a141-e1386c4bd0bb
Content-Disposition: form-data; name="file"; filename="test.upload"
Content-Type: multipart/related; boundary="===============smime.parts=="
Content-Length: 765

(...)

It makes a good point for the verbatimBody or rawBody solution we talked about earlier in this thread though, because that would definitely solve your problem right now.

I’ll let you know what I decide on soon!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 2387: The MIME Multipart/Related Content-type
Multipart /Related MIME entities may contain Content-Disposition headers that ... RFC 2387 Multipart/Related August 1998 Responsibility for the display or ...
Read more >
MultipartStream (Apache Commons FileUpload 1.4 API)
Low level API for processing file uploads. This class can be used to process data streams conforming to MIME 'multipart' format as defined...
Read more >
Wiremock support for multipart/related #1047
An open PR exists to update Wiremock to "Recognize multipart/related and multipart/mixed" (https://github.com/tomakehurst/wiremock/pull/1415).
Read more >
PROJECT DOCUMENTATION MeF Submission ...
1.3 Purpose. The purpose of this document is to describe the structure of a Submission and a Transmission file supported by MeF (Modernized...
Read more >
Spring boot multipart/related mime type support
If you do name the form-data then you can use the second example ("/uploadParts"). I didn't do the example with the image or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found