mozhttpd fails to serve svg files on linux and windows buildbot slaves



6 years ago
6 years ago


(Reporter: jmaher, Unassigned)


Firefox Tracking Flags

(Not tracked)



(2 attachments)

while running with --develop in production (try server) I found that tsvg failed on linux and windows builds consistently, but passed on osx.  Odd, but true.

In debugging locally, it passes on my local linux box but fails on a windows 7 vm that I have.  When pageloader sends the http://localhost:15707/page_load_test/svg/gearflowers.svg to the browser, we get a popup to download the SVG file.  Looking into this we have a header type of application/octet-stream.

Comment 1

6 years ago
Looking into this a bit, it looks like a mimetype issue.  Reading the help for SimpleHTTPServer.SimpleHTTPRequestHandler which mozhttpd.RequestHandler inherits from, the mimetype is guessed from .guess_type():

     |  guess_type(self, path)
     |      Guess the type of a file.
     |      Argument is a PATH (a filename).
     |      Return value is a string of the form type/subtype,
     |      usable for a MIME Content-type header.
     |      The default implementation looks the file's extension
     |      up in the table self.extensions_map, using application/octet-stream
     |      as a default; however it would be permissible (if
     |      slow) to look inside the data to make a better guess.

Mind you, this is python 2.7 documentation.  But if this is accurate, we should be able to add:

'.svg': 'image/svg+xml'

to self.extensions_map and this will work.

Comment 2

6 years ago
Created attachment 675289 [details] [diff] [review]

unless i made a typo or this doesn't work with ancient python, this should do it
Attachment #675289 - Flags: review?(jmaher)

Comment 3

6 years ago
Following this:

- a new version of mozhttpd should be released to pypi and probably m-c
- talos should be pegged to use this version and should be editted accordingly
Comment on attachment 675289 [details] [diff] [review]

Review of attachment 675289 [details] [diff] [review]:

this works in local testing on windows 7.  If we could add some unittests for this it would rock.
Attachment #675289 - Flags: review?(jmaher) → review+

Comment 7

6 years ago
Created attachment 675296 [details] [diff] [review]
fix talos to mozhttpd 0.5
Attachment #675296 - Flags: review?(jmaher)
Attachment #675296 - Flags: review?(jmaher) → review+

Comment 9

6 years ago
filed bug 805633 as a followup; closing this
Last Resolved: 6 years ago
Resolution: --- → FIXED


6 years ago
Depends on: 811361
You need to log in before you can comment on or make changes to this bug.