swift/proxy/controllers/obj.py
def connect(cls, node, part, req, headers, conn_timeout, node_timeout,
                logger=None, need_multiphase=True, **kwargs):
        """
        Connect to a backend node and send the headers.

        Override superclass method to notify object of need for support for
        multipart body with footers and optionally multiphase commit, and
        verify object server's capabilities.

        :param need_multiphase: if True then multiphase support is required of
                                the object server
        :raises FooterNotSupported: if need_metadata_footer is set but
                 backend node can't process footers
        :raises MultiphasePUTNotSupported: if need_multiphase is set but
                 backend node can't handle multiphase PUT
        """
        mime_boundary = "%.64x" % random.randint(0, 16 ** 64)
        headers = HeaderKeyDict(headers)
        # when using a multipart mime request to backend the actual
        # content-length is not equal to the object content size, so move the
        # object content size to X-Backend-Obj-Content-Length if that has not
        # already been set by the EC PUT path.
        headers.setdefault('X-Backend-Obj-Content-Length',
                           headers.pop('Content-Length', None))
        # We're going to be adding some unknown amount of data to the
        # request, so we can't use an explicit content length, and thus
        # we must use chunked encoding.
        headers['Transfer-Encoding'] = 'chunked'
        headers['Expect'] = '100-continue'

        headers['X-Backend-Obj-Multipart-Mime-Boundary'] = mime_boundary

        headers['X-Backend-Obj-Metadata-Footer'] = 'yes'

        if need_multiphase:
            headers['X-Backend-Obj-Multiphase-Commit'] = 'yes'

        conn, expect_resp, final_resp, connect_duration = cls._make_connection(
            node, part, req, headers, conn_timeout, node_timeout)

        if is_informational(expect_resp.status):
            continue_headers = HeaderKeyDict(expect_resp.getheaders())
            can_send_metadata_footer = config_true_value(
                continue_headers.get('X-Obj-Metadata-Footer', 'no'))
            can_handle_multiphase_put = config_true_value(
                continue_headers.get('X-Obj-Multiphase-Commit', 'no'))

            if not can_send_metadata_footer:
                raise FooterNotSupported()

            if need_multiphase and not can_handle_multiphase_put:
                raise MultiphasePUTNotSupported()

        return cls(conn, node, final_resp, req, connect_duration, logger,
                   mime_boundary, multiphase=need_multiphase)

        Connect to a backend node and send the headers.

        Override superclass method to notify object of need for support for
        multipart body with footers and optionally multiphase commit, and
        verify object server's capabilities.

        :param need_multiphase: if True then multiphase support is required of
                                the object server
        :raises FooterNotSupported: if need_metadata_footer is set but
                 backend node can't process footers
        :raises MultiphasePUTNotSupported: if need_multiphase is set but
                 backend node can't handle multiphase PUT
        
Connect to a backend node and send the headers.
Override superclass method to notify object of need for support for
multipart body with footers and optionally multiphase commit, and
verify object server's capabilities.
Connect to a backend node and send the headers . Override superclass method to notify object of need for support for multipart body with footers and optionally multiphase commit and verify object server ' s capabilities .
def connect(cls, node, part, req, headers, conn_timeout, node_timeout,
                logger=None, need_multiphase=True, **kwargs):
        mime_boundary = "%.64x" % random.randint(0, 16 ** 64)
        headers = HeaderKeyDict(headers)
        headers.setdefault('X-Backend-Obj-Content-Length',
                           headers.pop('Content-Length', None))
        headers['Transfer-Encoding'] = 'chunked'
        headers['Expect'] = '100-continue'
        headers['X-Backend-Obj-Multipart-Mime-Boundary'] = mime_boundary
        headers['X-Backend-Obj-Metadata-Footer'] = 'yes'
        if need_multiphase:
            headers['X-Backend-Obj-Multiphase-Commit'] = 'yes'
        conn, expect_resp, final_resp, connect_duration = cls._make_connection(
            node, part, req, headers, conn_timeout, node_timeout)
        if is_informational(expect_resp.status):
            continue_headers = HeaderKeyDict(expect_resp.getheaders())
            can_send_metadata_footer = config_true_value(
                continue_headers.get('X-Obj-Metadata-Footer', 'no'))
            can_handle_multiphase_put = config_true_value(
                continue_headers.get('X-Obj-Multiphase-Commit', 'no'))
            if not can_send_metadata_footer:
                raise FooterNotSupported()
            if need_multiphase and not can_handle_multiphase_put:
                raise MultiphasePUTNotSupported()
        return cls(conn, node, final_resp, req, connect_duration, logger,
                   mime_boundary, multiphase=need_multiphase)
def connect ( cls , node , part , req , headers , conn_timeout , node_timeout , logger = None , need_multiphase = True , ** kwargs ) : mime_boundary = "%.64x" % random . randint ( 0 , 16 ** 64 ) headers = HeaderKeyDict ( headers ) headers . setdefault ( 'X-Backend-Obj-Content-Length' , headers . pop ( 'Content-Length' , None ) ) headers [ 'Transfer-Encoding' ] = 'chunked' headers [ 'Expect' ] = '100-continue' headers [ 'X-Backend-Obj-Multipart-Mime-Boundary' ] = mime_boundary headers [ 'X-Backend-Obj-Metadata-Footer' ] = 'yes' if need_multiphase : headers [ 'X-Backend-Obj-Multiphase-Commit' ] = 'yes' conn , expect_resp , final_resp , connect_duration = cls . _make_connection ( node , part , req , headers , conn_timeout , node_timeout ) if is_informational ( expect_resp . status ) : continue_headers = HeaderKeyDict ( expect_resp . getheaders ( ) ) can_send_metadata_footer = config_true_value ( continue_headers . get ( 'X-Obj-Metadata-Footer' , 'no' ) ) can_handle_multiphase_put = config_true_value ( continue_headers . get ( 'X-Obj-Multiphase-Commit' , 'no' ) ) if not can_send_metadata_footer : raise FooterNotSupported ( ) if need_multiphase and not can_handle_multiphase_put : raise MultiphasePUTNotSupported ( ) return cls ( conn , node , final_resp , req , connect_duration , logger , mime_boundary , multiphase = need_multiphase )
Connect to a backend node and send the headers.
Connect to a backend node and send the headers .
"""
        Connect to a backend node and send the headers.

        Override superclass method to notify object of need for support for
        multipart body with footers and optionally multiphase commit, and
        verify object server's capabilities.

        :param need_multiphase: if True then multiphase support is required of
                                the object server
        :raises FooterNotSupported: if need_metadata_footer is set but
                 backend node can't process footers
        :raises MultiphasePUTNotSupported: if need_multiphase is set but
                 backend node can't handle multiphase PUT
        """ # when using a multipart mime request to backend the actual # content-length is not equal to the object content size, so move the # object content size to X-Backend-Obj-Content-Length if that has not # already been set by the EC PUT path. # We're going to be adding some unknown amount of data to the # request, so we can't use an explicit content length, and thus # we must use chunked encoding.
if need_metadata_footer is set but
backend node can't process footers
if need_metadata_footer is set but backend node can ' t process footers
FooterNotSupported
if need_multiphase is set but
backend node can't handle multiphase PUT
if need_multiphase is set but backend node can ' t handle multiphase PUT
MultiphasePUTNotSupported
cls
node
part
req
headers
conn_timeout
node_timeout
logger
need_multiphase
if True then multiphase support is required of
the object server
if True then multiphase support is required of the object server