Skip to content

Instantly share code, notes, and snippets.

View rlovtangen's full-sized avatar

Ronny Løvtangen rlovtangen

View GitHub Profile
@alternatex
alternatex / ExtSimpleHTTPServer.py
Created December 7, 2012 23:03
SimpleHTTPServer with custom content-type mappings
import sys, BaseHTTPServer, SimpleHTTPServer
class ExtHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""content-type extension for tunnelx configuration files"""
def guess_type(self, path):
mimetype = SimpleHTTPServer.SimpleHTTPRequestHandler.guess_type(self, path)
if mimetype == 'application/octet-stream':
if path.endswith('tunnelx'):
mimetype = 'web+tunnelx/conf'