Hey,
So I'm working on making an S3 file backend for E:AWS, but I've run into an issue. FileBackend::doCreateInternal expects an array of options, one of those options should be an array of headers, e.g., Content-Type. Amazon S3 needs the Content-Type header, otherwise it just shows up as a file download. From looking at the upload workflow, it seems the headers are being determined by MediaHandler::getStreamHeaders when it's called from LocalFile::upload().
However, upon inspecting the code for MediaHandler::getStreamHeaders.....the entire function body is "return array()". So, um, was this just never implemented, or am I missing something.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On Sun, Mar 3, 2013 at 5:07 AM, Tyler Romeo tylerromeo@gmail.com wrote:
Hey,
So I'm working on making an S3 file backend for E:AWS, but I've run into an issue. FileBackend::doCreateInternal expects an array of options, one of those options should be an array of headers, e.g., Content-Type. Amazon S3 needs the Content-Type header, otherwise it just shows up as a file download. From looking at the upload workflow, it seems the headers are being determined by MediaHandler::getStreamHeaders when it's called from LocalFile::upload().
However, upon inspecting the code for MediaHandler::getStreamHeaders.....the entire function body is "return array()". So, um, was this just never implemented, or am I missing something.
That's a default implementation, as most handler don't need to add any headers. If you look in some of the file type handler extensions like OggHandler or TimedMediaHandler, you'll see them overriding this function to add things like file duration info.
For a File::upload() implementation I think you'll want to grab $this->getMimeType() and send it as necessary.
-- brion
On Sun, Mar 3, 2013 at 4:37 PM, Brion Vibber brion@pobox.com wrote:
For a File::upload() implementation I think you'll want to grab $this->getMimeType() and send it as necessary.
The only problem is that at that point I don't have a File object to use. When it gets to the FileBackend, it only has a path. Maybe should I try and create a File object from the path?
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
Sounds like https://gerrit.wikimedia.org/r/#/c/41932/
-- View this message in context: http://wikimedia.7.n6.nabble.com/MediaHandler-Stream-Headers-tp4998162p49983... Sent from the Wikipedia Developers mailing list archive at Nabble.com.
Oh wow, that saves a lot of work.
If that doesn't make it into core (which it really shouldn't), that patch would be gladly welcome in Extension:AWS.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On Mon, Mar 4, 2013 at 3:13 PM, Aaron Schulz aschulz4587@gmail.com wrote:
Sounds like https://gerrit.wikimedia.org/r/#/c/41932/
-- View this message in context: http://wikimedia.7.n6.nabble.com/MediaHandler-Stream-Headers-tp4998162p49983... Sent from the Wikipedia Developers mailing list archive at Nabble.com.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org