예제 #1
0
ANSC_HANDLE
HttpBmoCreateMessageBody
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus             = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject                = (PHTTP_BASIC_MESSAGE_OBJECT)hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf                   = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PHTTP_MESSAGE_BODY_OBJECT       pMessageBody             = NULL;
    PHTTP_HFO_TRANSFER_ENCODING     pHttpHfoTransferEncoding = NULL;
    ULONG                           ulIndex                  = 0;
    ULONG                           ulEncodingType           = IANA_TCODING_CODE_IDENTITY;

    pHttpHfoTransferEncoding =
        (PHTTP_HFO_TRANSFER_ENCODING)pMyObject->GetHeaderField
            (
                (ANSC_HANDLE)pMyObject,
                HTTP_HEADER_ID_TRANSFER_ENCODING
            );

    if ( pHttpHfoTransferEncoding && (pHttpHfoTransferEncoding->EncodingCount > 0) )
    {
        ulIndex        = pHttpHfoTransferEncoding->EncodingCount - 1;
        ulEncodingType = pHttpHfoTransferEncoding->EncodingArray[ulIndex].Type;
    }

    switch ( ulEncodingType )
    {
        case    IANA_TCODING_CODE_IDENTITY :

                pMessageBody =
                    (PHTTP_MESSAGE_BODY_OBJECT)HttpCreateMboIdentity
                        (
                            pMyObject->hContainerContext,
                            (ANSC_HANDLE)pMyObject,
                            (ANSC_HANDLE)NULL
                        );

                break;

        case    IANA_TCODING_CODE_CHUNKED :

                pMessageBody =
                    (PHTTP_MESSAGE_BODY_OBJECT)HttpCreateMboChunked
                        (
                            pMyObject->hContainerContext,
                            (ANSC_HANDLE)pMyObject,
                            (ANSC_HANDLE)NULL
                        );

                break;

        default :

                break;
    }

    return  (ANSC_HANDLE)pMessageBody;
}
예제 #2
0
ANSC_HANDLE
HttpBmoBccGetHeaderField
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       ulHeaderId
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject    = (PHTTP_BASIC_MESSAGE_OBJECT)hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;

    return  pMyObject->GetHeaderField((ANSC_HANDLE)pMyObject, ulHeaderId);
}
char*
HttpBmoGetHeaderValueById
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       ulHeaderId
    )
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PHTTP_BASIC_MESSAGE_OBJECT      pMyObject    = (PHTTP_BASIC_MESSAGE_OBJECT   )hThisObject;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE          )pMyObject->hHfpIf;
#ifndef _CCSP_CWMP_TCP_CONNREQ_HANDLER
    PHTTP_HELPER_CONTAINER_OBJECT   pHttpHco     = (PHTTP_HELPER_CONTAINER_OBJECT)pMyObject->hContainerContext;
#endif
    PHTTP_HEADER_FIELD              pHttpHfo     = NULL;
    char*                           pHttpHfValue = NULL;

    pHttpHfo =
        (PHTTP_HEADER_FIELD)pMyObject->GetHeaderField
            (
                (ANSC_HANDLE)pMyObject,
                ulHeaderId
            );

    if ( !pHttpHfo )
    {
        return  NULL;
    }
    else if ( !(pHttpHfo->Flags & HTTP_FIELD_FLAG_LINE_PRESENT) )
    {
        returnStatus =
            pHfpIf->BuildHeader
                (
                    pHfpIf->hOwnerContext,
                    (ANSC_HANDLE)pHttpHfo,
                    NULL,
                    0
                );
    }

    AnscHttpGetHfValue(pHttpHfo->HeaderLine, AnscSizeOfString(pHttpHfo->HeaderLine), pHttpHfValue);

    return  pHttpHfValue;
}