Changeset 26 in cheroxy


Ignore:
Timestamp:
11/14/12 14:28:59 (12 years ago)
Author:
cheese
Message:

#1 add function to reset request and response

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/CRXHttpMessage.h

    r24 r26  
    2020
    2121protected:
    22     virtual void    Parse       (void);
     22    virtual void    Parse           (void);
     23    virtual void    Reset           (void);
    2324
    2425public:
    25     void            SetMessage  (const char * aHttpMessage);
    26     std::string     GetMessage  (void) const;
     26    void            SetMessage      (const char * aHttpMessage);
     27    std::string     GetMessage      (void) const;
    2728
    28     void            Reset       (void);
     29    void            ResetMessage    (void);
    2930
    3031    virtual CRXHttpMessage &    operator =  (const char * aHttpMessage);
  • trunk/include/CRXHttpRequest.h

    r24 r26  
    1919public:
    2020    CRXHttpRequest                  (void);
     21    ~CRXHttpRequest                 (void);
    2122
    2223private:
    2324    void                Parse       (void);
     25    void                Reset       (void);
    2426
    2527public:
  • trunk/include/CRXHttpResponse.h

    r24 r26  
    3434    int                 ParseContent        (const char * aContent,
    3535                                             const int  aLength);
     36    void                Reset               (void);
    3637    void                ResetContent        (void);
    3738
  • trunk/src/CRXHttpMessage.cpp

    r24 r26  
    1010CRXHttpMessage::CRXHttpMessage (void)
    1111{
     12    /*----------------------------------------------------------------*/
     13    /*----------------------------------------------------------------*/
    1214}
    1315
    1416CRXHttpMessage::~CRXHttpMessage (void)
    1517{
     18    /*----------------------------------------------------------------*/
     19    /*----------------------------------------------------------------*/
     20}
     21
     22void
     23CRXHttpMessage::Parse (void)
     24{
     25    /*----------------------------------------------------------------*/
     26    /*----------------------------------------------------------------*/
     27}
     28
     29void
     30CRXHttpMessage::Reset (void)
     31{
     32    /*----------------------------------------------------------------*/
     33    /*----------------------------------------------------------------*/
    1634}
    1735
     
    1937CRXHttpMessage::SetMessage (const char * aHttpMessage)
    2038{
     39    /*----------------------------------------------------------------*/
    2140    if (aHttpMessage == NULL)
    2241        return ;
     
    2544
    2645    this->Parse ();
     46    /*----------------------------------------------------------------*/
    2747}
    2848
     
    3050CRXHttpMessage::GetMessage (void) const
    3151{
     52    /*----------------------------------------------------------------*/
     53    /*----------------------------------------------------------------*/
     54
    3255    return mHttpMessage;
    3356}
    3457
    3558void
    36 CRXHttpMessage::Reset (void)
     59CRXHttpMessage::ResetMessage (void)
    3760{
     61    /*----------------------------------------------------------------*/
    3862    mHttpMessage.clear ();
    39 }
    40 
    41 void
    42 CRXHttpMessage::Parse (void)
    43 {
     63    /*----------------------------------------------------------------*/
    4464}
    4565
     
    4767CRXHttpMessage::operator = (const char * aHttpMessage)
    4868{
     69    /*----------------------------------------------------------------*/
    4970    SetMessage (aHttpMessage);
     71    /*----------------------------------------------------------------*/
     72
    5073    return *this;
    5174}
  • trunk/src/CRXHttpRequest.cpp

    r24 r26  
    1414    : mPort (0)
    1515{
     16    /*----------------------------------------------------------------*/
     17    /*----------------------------------------------------------------*/
     18}
     19
     20CRXHttpRequest::~CRXHttpRequest (void)
     21{
     22    /*----------------------------------------------------------------*/
     23    Reset ();
     24    /*----------------------------------------------------------------*/
     25}
     26
     27void
     28CRXHttpRequest::Reset (void)
     29{
     30    /*----------------------------------------------------------------*/
     31    ResetMessage ();
     32    /*----------------------------------------------------------------*/
    1633}
    1734
     
    1936CRXHttpRequest::SetHeader (const char * aHttpRequest)
    2037{
     38    /*----------------------------------------------------------------*/
    2139    SetMessage (aHttpRequest);
     40    /*----------------------------------------------------------------*/
    2241}
    2342
     
    2544CRXHttpRequest::GetHeader (void) const
    2645{
     46    /*----------------------------------------------------------------*/
     47    /*----------------------------------------------------------------*/
     48
    2749    return GetMessage ();
    2850}
     
    3153CRXHttpRequest::GetURL (void) const
    3254{
     55    /*----------------------------------------------------------------*/
     56    /*----------------------------------------------------------------*/
     57
    3358    return mUrl;
    3459}
     
    3762CRXHttpRequest::GetHost (void) const
    3863{
     64    /*----------------------------------------------------------------*/
     65    /*----------------------------------------------------------------*/
     66
    3967    return mHost;
    4068}
     
    4371CRXHttpRequest::GetPort (void) const
    4472{
     73    /*----------------------------------------------------------------*/
     74    /*----------------------------------------------------------------*/
     75
    4576    return mPort;
    4677}
     
    4980CRXHttpRequest::operator = (const char * aHttpMessage)
    5081{
     82    /*----------------------------------------------------------------*/
    5183    SetHeader (aHttpMessage);
     84    /*----------------------------------------------------------------*/
     85
    5286    return *this;
    5387}
  • trunk/src/CRXHttpResponse.cpp

    r25 r26  
    2323      mContentLength (0)
    2424{
     25    /*----------------------------------------------------------------*/
    2526    memset (&mContent, 0x00, sizeof (mContent));
     27    /*----------------------------------------------------------------*/
    2628}
    2729
    2830CRXHttpResponse::~CRXHttpResponse (void)
    2931{
     32    /*----------------------------------------------------------------*/
     33    Reset ();
     34    /*----------------------------------------------------------------*/
     35}
     36
     37void
     38CRXHttpResponse::Reset (void)
     39{
     40    /*----------------------------------------------------------------*/
     41    ResetMessage ();
    3042    ResetContent ();
     43    /*----------------------------------------------------------------*/
    3144}
    3245
     
    3447CRXHttpResponse::ResetContent (void)
    3548{
     49    /*----------------------------------------------------------------*/
    3650    if (mContent.mBody)
    3751        free (mContent.mBody);
    3852
    3953    memset (&mContent, 0x00, sizeof (mContent));
     54    /*----------------------------------------------------------------*/
    4055}
    4156
     
    8196CRXHttpResponse::operator = (const char * aHttpMessage)
    8297{
     98    /*----------------------------------------------------------------*/
    8399    SetMessage (aHttpMessage);
     100    /*----------------------------------------------------------------*/
     101
    84102    return *this;
    85103}
     
    88106CRXHttpResponse::GetHeader (void) const
    89107{
     108    /*----------------------------------------------------------------*/
     109    /*----------------------------------------------------------------*/
     110
    90111    return GetMessage ();
    91112}
     
    94115CRXHttpResponse::GetStatusCode (void) const
    95116{
     117    /*----------------------------------------------------------------*/
     118    /*----------------------------------------------------------------*/
     119
    96120    return mStatusCode;
    97121}
     
    100124CRXHttpResponse::GetContentLength (void) const
    101125{
     126    /*----------------------------------------------------------------*/
     127    /*----------------------------------------------------------------*/
     128
    102129    return mContentLength;
    103130}
     
    106133CRXHttpResponse::GetContentBody (void) const
    107134{
     135    /*----------------------------------------------------------------*/
     136    /*----------------------------------------------------------------*/
     137
    108138    return mContent.mBody;
    109139}
     
    171201
    172202    /*----------------------------------------------------------------*/
    173 
    174203    if (!mIsChunked)
    175204    {
Note: See TracChangeset for help on using the changeset viewer.