Home > Software engineering >  Through CHttpFile read read out data have duplicate content is how to return a responsibility?
Through CHttpFile read read out data have duplicate content is how to return a responsibility?

Time:09-20

Read the content part code is as follows:
 do 
{
BYTE pbData [1024] 10 *={} '\ 0';
IReaded=pHttpFile - & gt; Read (pbData, _countof (pbData) - 2);
If (0==iReaded)
{
break;
}
StrOut +=pwData;
} the while (TRUE);

The content of the code above read, finally appeared at the end of a duplicate data, detailed as follows:
Through wireShark capturing packet content is as follows:

But see the above code in windbg read read back the data content is as follows:

As you can see, in the end how out entREQ> this seven characters,
Why is this?

Wireshark to see the data content is large, the server of data USES is chunked mode,

CodePudding user response:

PbData [iReaded]=0;//try to add an ending sign
StrOut +=pbData;

CodePudding user response:

reference 1st floor zgl7903 response:
pbData [iReaded]=0;//try to add an ending sign
StrOut +=pbData;

Watch windbg is the content of the pbData, pbData itself is wrong,

CodePudding user response:

refer to the second floor danxuezx response:
Quote: refer to 1st floor zgl7903 response:

PbData [iReaded]=0;//try to add an ending sign
StrOut +=pbData;

Watch windbg is the content of the pbData, pbData itself is wrong,

If receive, shorter than the last, the length of the pbData is likely to contain the data made data, so add a truncated symbols, in order to avoid this problem, pay attention to the length of the received under

CodePudding user response:

Use fidder caught look, packet data should be there won't be wrong, be sure it is your dealing with read wrong

CodePudding user response:

Main or receiving data fields, print it and see more, see if length is correct, processing is also the corresponding array
  • Related