| 396 | } |
| 397 | |
| 398 | const char* HttpClient::GetErrorMessage(ErrorCode error_code) |
| 399 | { |
| 400 | switch (error_code) { |
| 401 | case SUCCESS: |
| 402 | return "Success"; |
| 403 | case ERROR_INVALID_URI_ADDRESS: |
| 404 | return "Invalid URI address"; |
| 405 | case ERROR_INVALID_PROXY_ADDRESS: |
| 406 | return "Invalid proxy address"; |
| 407 | case ERROR_INVALID_RESPONSE_HEADER: |
| 408 | return "Invalid response header"; |
| 409 | case ERROR_FAIL_TO_RESOLVE_ADDRESS: |
| 410 | return "Failed to resolve address"; |
| 411 | case ERROR_FAIL_TO_SEND_REQUEST: |
| 412 | return "Failed to send request"; |
| 413 | case ERROR_FAIL_TO_GET_RESPONSE: |
| 414 | return "Failed to get response"; |
| 415 | case ERROR_FAIL_TO_CONNECT_SERVER: |
| 416 | return "Failed to connect to server"; |
| 417 | case ERROR_FAIL_TO_READ_CHUNKSIZE: |
| 418 | return "Failed to read chunk size"; |
| 419 | case ERROR_PROTOCAL_NOT_SUPPORTED: |
| 420 | return "Protocal is not supported"; |
| 421 | case ERROR_CONTENT_TYPE_NOT_SUPPORTED: |
| 422 | return "Content type is not supported yet"; |
| 423 | case ERROR_HTTP_STATUS_CODE: |
| 424 | return "Error http status code"; |
| 425 | case ERROR_TOO_MANY_REDIRECTS: |
| 426 | return "Too many redirections"; |
| 427 | // DO NOT ADD default: here, or not handled error_code will be ignored. |
| 428 | } |
| 429 | |
| 430 | return NULL; |
| 431 | } |
| 432 | |
| 433 | HttpClient& HttpClient::SetProxy(const std::string& proxy) |
| 434 | { |