Jump to content

HTTP Header & Data Separation

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
BackSlash

BackSlash

    Newbie

  • Members
  • PipPip
  • 12 posts
So If you have read my last post about trying to find the length of the HTTP header (because it changes from page to page and what not) This is my next problem.

I would like to seperate the header from the Data and store it in a String[].


        private String[] GetHeader(byte[] rawData)

        {

            String[] temp;

            String delimiterString = "\r";

            char[] delimiter = delimiterString.ToCharArray();

            temp = ASCIIEncoding.ASCII.GetString(rawData).Split(delimiter,11);

            for (int i = 0; i < temp.Length; i++)

            {

                temp[i] = temp[i].TrimStart('\n');

            }

            return temp;

        }


At the moment this is all that I could come up with.

The next part is parsing the data out of the rawData


        private byte[] GetData(byte[] rawData)

        {

            int j = 0;

            int offset = GetContentOffset(rawData);

            int length = rawData.Length - offset;

            Byte[] tempData = new Byte[length];

            for (int i = offset; i < rawData.Length; i++)

            {

                tempData[j] = rawData[i];

                j++;

            }

            return tempData;

        }



Thanks

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
My answer to your other question should help you with this also.