Ticket #5911: support_httponly_flag.diff

File support_httponly_flag.diff, 1.3 KB (added by Reed Loden, 7 years ago)

Add support for HttpOnly flag in cookies

  • twisted/web/http.py

     
    952952            else:
    953953                self.transport.write(data)
    954954
    955     def addCookie(self, k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):
     955    def addCookie(self, k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None, httponly=None):
    956956        """
    957957        Set an outgoing HTTP cookie.
    958958
     
    973973            cookie = cookie +"; Comment=%s" % comment
    974974        if secure:
    975975            cookie = cookie +"; Secure"
     976        if httponly:
     977            cookie = cookie +"; HttpOnly"
    976978        self.cookies.append(cookie)
    977979
    978980    def setResponseCode(self, code, message=None):
  • twisted/web/iweb.py

     
    218218        """
    219219
    220220
    221     def addCookie(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None):
     221    def addCookie(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None, httponly=None):
    222222        """
    223223        Set an outgoing HTTP cookie.
    224224