Re: [civetweb] Embedding server: how to return binary file?

335 views
Skip to first unread message

bel

unread,
Aug 16, 2016, 2:38:04 PM8/16/16
to Tim Stevens, civetweb
Using NULL as the last argument will automatically determine the mime type from the file ending, otherwise it will return the file type you specified (in handle_static_file_request). The automatic detection of the mime type will use a list of known file endings (https://github.com/civetweb/civetweb/blob/master/src/civetweb.c#L5348). This list can be extended using the extra_mime_types configuration options. If you always have the same file ending, this might be the easiest option. I do not know the "video/MP2T" mime type - could it be "video/mpeg" or "video/mp4" - I'm not an expert on video types.


On Tue, Aug 16, 2016 at 12:53 PM, Tim Stevens <tim.s....@bt.com> wrote:
Hello,
Just been playing with Civet - thanks for this!
I've manged to embed it in a C++ test app, & return non-binary content. I'm struggling with trying to return binay data via the conn handler:

const char mime[] = "video/MP2T";
mg_send_mime_file(conn, test_file, mime);

my test_file is simply an mpeg2-ts file, which is part of a valis m3u8 (HLS) playlist.  I can post Wireshark captures of the HTTP headers from Apache and from Civet (the former works, the latter doesn't), but before I do, is there anything else I should set, or is there another way I should do this? I can't find any examples of using mg_send_mime_file().

Thanks!

--
Sourceforge
https://sourceforge.net/projects/civetweb/
---
You received this message because you are subscribed to the Google Groups "civetweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to civetweb+unsubscribe@googlegroups.com.
To post to this group, send email to cive...@googlegroups.com.
Visit this group at https://groups.google.com/group/civetweb.
To view this discussion on the web visit https://groups.google.com/d/msgid/civetweb/9e5bfaf4-3170-4561-838f-1a21b80e4154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Stevens

unread,
Aug 17, 2016, 4:11:40 AM8/17/16
to civetweb, tim.s....@bt.com
Thanks. I've got it working for now using mg_write, & not doing anything with the mime types. I may need to look again, depends how fussy some of the video players are.

Regards,
Tim.



On Tuesday, 16 August 2016 19:38:04 UTC+1, bel wrote:
Using NULL as the last argument will automatically determine the mime type from the file ending, otherwise it will return the file type you specified (in handle_static_file_request). The automatic detection of the mime type will use a list of known file endings (https://github.com/civetweb/civetweb/blob/master/src/civetweb.c#L5348). This list can be extended using the extra_mime_types configuration options. If you always have the same file ending, this might be the easiest option. I do not know the "video/MP2T" mime type - could it be "video/mpeg" or "video/mp4" - I'm not an expert on video types.

On Tue, Aug 16, 2016 at 12:53 PM, Tim Stevens <tim.s....@bt.com> wrote:
Hello,
Just been playing with Civet - thanks for this!
I've manged to embed it in a C++ test app, & return non-binary content. I'm struggling with trying to return binay data via the conn handler:

const char mime[] = "video/MP2T";
mg_send_mime_file(conn, test_file, mime);

my test_file is simply an mpeg2-ts file, which is part of a valis m3u8 (HLS) playlist.  I can post Wireshark captures of the HTTP headers from Apache and from Civet (the former works, the latter doesn't), but before I do, is there anything else I should set, or is there another way I should do this? I can't find any examples of using mg_send_mime_file().

Thanks!

--
Sourceforge
https://sourceforge.net/projects/civetweb/
---
You received this message because you are subscribed to the Google Groups "civetweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to civetweb+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages