Closed Bug 805598 Opened 12 years ago Closed 12 years ago

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

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jmaher, Unassigned)

References

Details

Attachments

(2 files)

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.
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.
Attached patch fixSplinter Review
unless i made a typo or this doesn't work with ancient python, this should do it
Attachment #675289 - Flags: review?(jmaher)
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 create_talos_zip.py should be editted accordingly
Comment on attachment 675289 [details] [diff] [review]
fix

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+
Attachment #675296 - Flags: review?(jmaher)
Attachment #675296 - Flags: review?(jmaher) → review+
filed bug 805633 as a followup; closing this
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 811361
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: