Changeset 253 for trunk


Ignore:
Timestamp:
07/19/07 16:51:59 (5 years ago)
Author:
marc
Message:

Added server version support.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r246 r253  
    11110.2.1: 
    1212 * Fixed a serious security bug in which /screenshot prompted no auth. Also 
    13  fixed sending the wrong Content-Lenght for the screenshot. 
     13 fixed sending the wrong Content-Lenght for the screenshot. Report Itaka 
     14 version on HTTP headers. 
    1415 
    15160.2 (I've been watching you...): 
  • trunk/server.py

    r249 r253  
    9494        getattr(self, name).putChild(path, resource) 
    9595 
    96     def create_site(self, resource): 
     96    def create_site(self, resource, version_header='TwistedWeb/' + twisted.copyright.version): 
    9797        """ 
    9898        Creates a Twisted.server.Site with a Twisted Resource 
     
    100100        @type resource: instance 
    101101        @param resource: An instance of a Twisted resource created with L{add_static_resource} 
    102         """ 
    103  
     102 
     103        @type version_header: str 
     104        @param version_header: The 'Server: str' that is sent on HTTP headers. Defaults to Twisted's. 
     105        """ 
     106        server.version = version_header 
    104107        self.site = server.Site(resource) 
    105108 
     
    203206        self.add_child_to_resource('root', 'favicon.ico', FileResource(self.gui, self.authresource, os.path.join(self.itaka_globals.image_dir, 'favicon.ico'), 'image/x-icon')) 
    204207 
    205         self.create_site(self.root) 
     208        self.create_site(self.root, 'Itaka/%s (TwistedWeb/%s)' % (self.itaka_globals.__version__, twisted.copyright.version)) 
    206209 
    207210 
     
    340343        """ 
    341344 
     345        self.children = {} 
     346 
    342347        self.gui = gui_instance 
    343348        self.auth = auth_instance 
    344349        self.configuration = self.gui.configuration 
    345350 
    346         # Inherited from the actual code of Twisted's static.Data 
    347         self.children = {} 
    348351        self.data = data 
    349352        self.size = str(len(self.data)) 
     
    394397        """ 
    395398 
     399        self.children = {} 
     400 
    396401        self.gui = gui_instance 
    397402        self.auth = auth_instance 
    398403        self.itaka_globals = self.gui.itaka_globals 
    399  
     404             
    400405        self.type = type 
    401406        self.data = open(path, 'rb').read() 
     
    439444        """ 
    440445 
     446        self.children = {} 
     447 
    441448        self.gui = gui_instance 
    442449        self.auth = auth_instance 
    443450        self.console = self.gui.console 
    444451        self.itaka_globals = self.gui.itaka_globals 
     452 
    445453        self.screenshot = screenshot.Screenshot(self.gui) 
    446454         
Note: See TracChangeset for help on using the changeset viewer.