Example #1
0
 int writev( IOVec& iov )
 {
     m_count = !m_count;
     if ( m_count )
     {
         m_buf.append( (char *)(iov.begin()->iov_base), 1 );
         return 1;
     }
     else
         return 0;
 }
Example #2
0
    void CheckIoHeader(IOVec io, char *phBuf)
    {
        IOVec::iterator it;
        unsigned char *p = NULL;
        char *ph = phBuf;

//printf("->&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");


        for (it = io.begin(); it != io.end(); ++it)
        {
            p = (unsigned char *)it->iov_base;
            printf("Check: %.*s, %.*s\n", it->iov_len, p, it->iov_len, ph);
            CHECK(strncasecmp((const char *)p, ph, it->iov_len) == 0);
            if (strncasecmp((const char *)p, ph, it->iov_len) != 0)
                printf("p:\n%.*s\nph:\n%.*s\n", it->iov_len, p, it->iov_len, ph);
            ph += it->iov_len;
        }

//printf("<-&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n");
    }
Example #3
0
    void DisplayBothHeader(IOVec io, int format, short count,
                           HttpRespHeaders * pRespHeaders)
    {
        IOVec::iterator it;
        unsigned char *p = NULL;
        it = io.begin();
        p = (unsigned char *)it->iov_base;
        //return;//comment this out to view header data


        for (it = io.begin(); it != io.end(); ++it)
        {
            p = (unsigned char *)it->iov_base;
            for (unsigned int i = 0; i < it->iov_len; ++i)
            {
                if (format  != 0)
                    printf("%02X ", p[i]);
                else
                    printf("%c", p[i]);
            }
        }
        printf("\r\nplain http Count = %d\r\n======================================================\r\n",
               count);

        displaySpdyHeaders(pRespHeaders);

//     if (format != 0)
//     {
//         AutoBuf buf;
//         for (it = io.begin(); it != io.end(); ++it)
//         {
//             buf.append( (const char *)it->iov_base, it->iov_len);
//         }
//
//         if (format ==  1)
//         {
//             char *p = buf.begin();
//             short *tempNumS;
//             short tempNum;
//
//             for (int j=0; j<count; ++j)
//             {
//                 tempNumS = (short *)p;
//                 tempNum = ntohs(*tempNumS);
//                 p += 2;
//                 for (int n=0; n<tempNum; ++n){
//                     printf("%c", *(p + n));
//                 }
//                 printf(": ");
//                 p += tempNum;
//
//                 tempNumS = (short *)p;
//                 tempNum = ntohs(*tempNumS);
//                 p += 2;
//                 for (int n=0; n<tempNum; ++n){
//                     if (*(p + n) != 0)
//                         printf("%c", *(p + n));
//                     else
//                         printf("\r\n\t");
//                 }
//                 printf("\r\n");
//                 p += tempNum;
//             }
//         }
//         else
//         {
//             char *p = buf.begin();
//             int32_t *tempNumS;
//             int32_t tempNum;
//
//             for (int j=0; j<count; ++j)
//             {
//                 tempNumS = (int32_t *)p;
//                 tempNum = ntohl(*tempNumS);
//                 p += 4;
//                 for (int n=0; n<tempNum; ++n){
//                     printf("%c", *(p + n));
//                 }
//                 printf(": ");
//                 p += tempNum;
//
//                 tempNumS = (int32_t *)p;
//                 tempNum = ntohl(*tempNumS);
//                 p += 4;
//                 for (int n=0; n<tempNum; ++n){
//                     if (*(p + n) != 0)
//                         printf("%c", *(p + n));
//                     else
//                         printf("\r\n\t");
//                 }
//                 printf("\r\n");
//                 p += tempNum;
//             }
//         }
//
//         printf("\r\n*******************************************************************\r\n\r\n");
//
//     }

    }