applayerprotocols/httpservice/test/httpservicetest/ctestserverstreammanager.cpp
branchRCL_3
changeset 5 337070b4fa18
parent 0 b16258d2340f
child 12 f21293830889
equal deleted inserted replaced
3:5ee1d9ce5878 5:337070b4fa18
    16 #include "ctestserverstreammanager.h"
    16 #include "ctestserverstreammanager.h"
    17 #include <minputstream.h>
    17 #include <minputstream.h>
    18 #include <moutputstream.h>
    18 #include <moutputstream.h>
    19 #include "httptestutils.h"
    19 #include "httptestutils.h"
    20 #include "chttpclienttestparams.h"
    20 #include "chttpclienttestparams.h"
       
    21 #include <escapeutils.h>
    21 
    22 
    22 const TUint KCarriageReturn = '\r';
    23 const TUint KCarriageReturn = '\r';
    23 const TUint KLineFeed       = '\n';
    24 const TUint KLineFeed       = '\n';
    24 const TUint KSpace          = ' ';
    25 const TUint KSpace          = ' ';
    25 
    26 
    66 	    {
    67 	    {
    67 	    iRequestStream = aBuffer.AllocL();
    68 	    iRequestStream = aBuffer.AllocL();
    68 	    }
    69 	    }
    69 	else
    70 	else
    70 	    {
    71 	    {
    71 	    // Check to see if the buffer needs to grow
    72 	    if(aBuffer.CompareF(iCurrentTestParam->EncodedAuthenticationRequest()) != 0)
    72         TInt maxLength  = iRequestStream->Des().MaxLength();
    73 	        {
    73         TInt reqdLength = iRequestStream->Length() + aBuffer.Length();
    74             // Check to see if the buffer needs to grow
    74 	    if (reqdLength > maxLength)
    75             TInt maxLength  = iRequestStream->Des().MaxLength();
    75 	        {
    76             TInt reqdLength = iRequestStream->Length() + aBuffer.Length();
    76 	        HBufC8* largerBuffer = iRequestStream->ReAllocL(maxLength + aBuffer.Length());
    77             if (reqdLength > maxLength)
    77 
    78                 {
    78 	        // Switch buffers. The old one was removed by ReAlloc.
    79                 HBufC8* largerBuffer = iRequestStream->ReAllocL(maxLength + aBuffer.Length());
    79 	        iRequestStream = largerBuffer;
    80     
    80 	        }
    81                 // Switch buffers. The old one was removed by ReAlloc.
    81 
    82                 iRequestStream = largerBuffer;
    82 	    // Can now append confidently
    83                 }
    83 	    iRequestStream->Des().Append(aBuffer);
    84     
       
    85             // Can now append confidently
       
    86             iRequestStream->Des().Append(aBuffer);   
       
    87             }
       
    88 	    else
       
    89 	        {
       
    90 	        iRequestStream = aBuffer.AllocL();
       
    91 	      	iCurrentTestParam->SetAuthReqRes();
       
    92 	        }
    84 	    }
    93 	    }
    85 	   iInputStream->ReceivedDataRes();	    
    94 	   iInputStream->ReceivedDataRes();	    
    86 	ProcessRequestStreamL();
    95 	ProcessRequestStreamL();
    87 	}
    96 	}
    88 	
    97