1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine http request parse. 2.0.132.

This commit is contained in:
winlin 2015-03-06 11:36:26 +08:00
parent 4325809daf
commit 3982ec1d87
9 changed files with 234 additions and 134 deletions

View file

@ -62,6 +62,16 @@ SrsFastBuffer::SrsFastBuffer()
p = end = buffer;
}
int SrsFastBuffer::size()
{
return end - p;
}
char* SrsFastBuffer::bytes()
{
return p;
}
void SrsFastBuffer::set_buffer(int buffer_size)
{
// the user-space buffer size limit to a max value.

View file

@ -85,6 +85,16 @@ public:
SrsFastBuffer();
virtual ~SrsFastBuffer();
public:
/**
* get the size of current bytes in buffer.
*/
virtual int size();
/**
* get the current bytes in buffer.
* @remark user should use read_slice() if possible,
* the bytes() is used to test bytes, for example, to detect the bytes schema.
*/
virtual char* bytes();
/**
* create buffer with specifeid size.
* @param buffer the size of buffer.
@ -110,6 +120,8 @@ public:
* skip some bytes in buffer.
* @param size the bytes to skip. positive to next; negative to previous.
* @remark assert buffer already grow(size).
* @remark always use read_slice to consume bytes, which will reset for EOF.
* while skip never consume bytes.
*/
virtual void skip(int size);
public: