Exemple #1
0
    def disconnect(self, socket, request):

        max_length = self.remote_info.max_packet_length

        response = responses.Success()
        header_list = []
        self._send_headers(socket, response, header_list, max_length)
Exemple #2
0
    def _handle_get(self, sock, mime=None, name=None):
        body = None
        response = responses.Not_Found()
        header_list = []

        if callable(self.get_listener):
            body = self.get_listener(mime=mime, name=name, conn=sock)
            print body

        if hasattr(self, "remote_info"):
            max_length = self.remote_info.max_packet_length
        else:
            max_length = self.max_packet_length

        if body:
            response = responses.Success()
            if not name:
                name = "vCard.vcf"
            response.add_header(headers.Name(name), max_length)
            response.add_header(headers.Length(len(body)), max_length)
            response.add_header(headers.End_Of_Body(body), max_length)
            #header_list.append(headers.Length(len(body)))
            #header_list.append(headers.End_Of_Body(body))

        self._send_headers(sock, response, header_list, max_length)
Exemple #3
0
    def _handle_put(self, sock, *args, **kwargs):
        if callable(self.put_listener):
            self.put_listener(conn=sock, *args, **kwargs)

        response = responses.Success()
        header_list = []
        max_length = self.max_packet_length

        self._send_headers(sock, response, header_list, max_length)