'raw data to HTTP request
need to send a request anyway in case of empty data (for pulling purpose !)'

def upstream_recv(self, data):

    try:
        d = data.peek()
        if (data.cookie is not None):
            self.headers['Cookie'] = ('PHPSESSID=%s' % data.cookie)
        request = ('%s    %s%s    HTTP/1.1\r\n' % (self.method, self.path, base64.b64encode(d)))
        for (name, value) in self.headers.iteritems():
            request += ('%s:    %s\r\n' % (name, value))
        if self.keep_alive:
            request += 'Connection:    keep-alive\r\n'
        request += '\r\n'
        data.drain(len(d))
        self.downstream.write(request)
    except Exception as e:
        logging.debug(e)
