-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide MimeEntity.Load with a contentType parameter #26
Comments
Are you using System.Net.WebResponse? I'm just thinking that having a MimeEntity.Load (WebResponse) might be a nicer API than passing in a contentType string and a stream if the assumption is that people will be using WebResponses. Otherwise, if you are using a 3rd party http stack, then it probably makes sense that I should have an API that takes a stream and content-type parameter. |
hmmm, just found that link you sent me with your example usage and it does not appear that you are using System.Net.WebRequest/Response, so I'll probably need to have a contentType parameter. |
…e,Stream) This patch better reflects what is needed in issue #26
I dropped the WebResponse parameter and went with ContentType and Stream, which I think is closer to what you need. I hesitate to use string contentType because it's less obvious what is needed, although maybe it's not so bad. |
Yeah, System.Net.WebRequest/Response is the old HTTP stack. Best not to write new code/APIs around that. Load(ContentType, Stream) is great. Thanks! |
When using MimeKit for parsing HTTP content, the
Content-Type
header will have been removed from the stream already as part of the HTTP header parsing, leaving only the request body data in the stream to consume (at least in all sane/popular frameworks).This is problematic because MimeKit needs this particular header when parsing. While easy to work around (especially thanks to
ChainedStream
to avoid copying the entire request body into memory first), it is very non-obvious what the problem is when one might first decide to mix HTTP and MimeKit.I suggest an API overload for
MimeEntity.Load
:As a workaround, I have done the following in my production code for now:
The text was updated successfully, but these errors were encountered: