Changeset 44 in cheroxy for trunk/src/CRXHttpResponse.cpp
- Timestamp:
- 11/22/12 15:21:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CRXHttpResponse.cpp
r28 r44 12 12 #include <string.h> 13 13 14 #define CRLF "\r\n"15 #define CRLF2 "\r\n\r\n"16 17 14 #define CONTENT_LENGTH "Content-Length: " 18 15 #define TRANSFER_ENCODING "Transfer-Encoding: " … … 56 53 57 54 int 58 CRXHttpResponse::SetResponse (const char * aHttpResponse,59 const intaResponseLength)55 CRXHttpResponse::SetResponseAll (const char * aHttpResponse, 56 const int aResponseLength) 60 57 { 61 58 int aResult = 0; … … 70 67 return ERROR_HTTP_RESPONSE_INVALID_LENGTH; 71 68 72 if (GetHeader (). length () == 0)69 if (GetHeader ().rfind (CRLF2) == std::string::npos) 73 70 { 74 71 aEndOfHeader = strstr (aHttpResponse, CRLF2); … … 80 77 aHeader.assign (aHttpResponse, aHeaderLength); 81 78 82 Set Message(aHeader.c_str ());83 } 84 85 aResult = ParseContent (aHttpResponse + aHeaderLength, aResponseLength - aHeaderLength);79 SetHeader (aHeader.c_str ()); 80 } 81 82 aResult = SetContent (aHttpResponse + aHeaderLength, aResponseLength - aHeaderLength); 86 83 if (aResult) 87 84 { 88 returnERROR_HTTP_RESPONSE_FAILED_TO_PARSE_CONTENT;85 aResult = ERROR_HTTP_RESPONSE_FAILED_TO_PARSE_CONTENT; 89 86 } 90 87 /*----------------------------------------------------------------*/ … … 93 90 } 94 91 95 CRXHttpResponse & 96 CRXHttpResponse:: operator =(const char * aHttpMessage)92 void 93 CRXHttpResponse::SetHeader (const char * aHttpMessage) 97 94 { 98 95 /*----------------------------------------------------------------*/ 99 96 SetMessage (aHttpMessage); 100 97 /*----------------------------------------------------------------*/ 101 102 return *this;103 98 } 104 99 … … 166 161 167 162 int 168 CRXHttpResponse:: ParseContent (const char * aContent,163 CRXHttpResponse::SetContent (const char * aContent, 169 164 const int aLength) 170 165 { … … 207 202 208 203 int CRXHttpResponse::GetStatusCode (void) const { return mStatusCode; } 204 bool CRXHttpResponse::IsChunked (void) const { return mIsChunked; } 209 205 int CRXHttpResponse::GetContentLength (void) const { return mContentLength; } 210 206 const char * CRXHttpResponse::GetContentBody (void) const { return mContent.mBody; }
Note:
See TracChangeset
for help on using the changeset viewer.