Changeset 55 in cheroxy
- Timestamp:
- 12/07/12 10:00:01 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main.cpp
r52 r55 9 9 #include <iomanip> 10 10 #include <sstream> 11 #include <string> 11 12 12 13 #include <stdio.h> … … 28 29 #endif 29 30 31 #define PROXY_CONNECTION "Proxy-Connection" 32 #define CONNECTION "Connection" 33 30 34 THREAD_FUNCTION_RETURN 31 35 THREAD_FUNCTION_CALLING_CONVENTION … … 34 38 int ThreadPool (CRXSocket * aProxySocket, 35 39 const int aThreadPoolCount); 40 41 bool gViewRequest = true; 42 bool gViewResponse = false; 36 43 37 44 int main (int argc, char* argv[]) … … 110 117 CRXProxy * aProxy = NULL; 111 118 112 c haraFilterFileExtension[] = "exe|gif|jpg|png|css|js|ico|swf|";119 const char aFilterFileExtension[] = "exe|gif|jpg|png|css|js|ico|swf|"; 113 120 114 121 /*----------------------------------------------------------------*/ … … 140 147 aFilterFileExtension); 141 148 142 aResult = aProxy-> Forward();149 aResult = aProxy->ReceiveRequest (); 143 150 if (aResult < 0) 144 151 { … … 146 153 } 147 154 148 if ( !aFilter.CheckRequestFilter (CRX_FILTER_REQUEST_FILE_EXTENSION, aRequest))155 if (gViewRequest && !aFilter.CheckRequestFilter (CRX_FILTER_REQUEST_FILE_EXTENSION, aRequest)) 149 156 { 157 string aRequestHeader = aRequest.GetHeader (); 158 aRequestHeader.replace (aRequest.GetHeader ().find (PROXY_CONNECTION), strlen (PROXY_CONNECTION), CONNECTION); 159 aRequest.SetHeader (aRequestHeader.c_str ()); 160 150 161 CRX_DEBUG_TRACE ("== Request: \n%s\n", aRequest.GetHeader ().c_str ()); 162 } 163 164 aResult = aProxy->SendRequest (); 165 if (aResult < 0) 166 { 167 cout << aProxy->GetErrorMessage () << endl; 168 } 169 170 aResult = aProxy->ReceiveResponse (); 171 if (aResult < 0) 172 { 173 cout << aProxy->GetErrorMessage () << endl; 174 } 175 176 if (gViewResponse && !aFilter.CheckRequestFilter (CRX_FILTER_REQUEST_FILE_EXTENSION, aRequest)) 177 { 151 178 CRX_DEBUG_TRACE ("== Response: \n%s\n", aResponse.GetHeader ().c_str ()); 152 179 CRX_DEBUG_TRACE_BIN (aResponse.GetContentBody (), 153 180 aResponse.GetContentLength (), 154 181 "== Content-Body: \n"); 182 } 183 184 aResult = aProxy->SendResponse (); 185 if (aResult < 0) 186 { 187 cout << aProxy->GetErrorMessage () << endl; 155 188 } 156 189
Note:
See TracChangeset
for help on using the changeset viewer.