| 1026 | |
| 1027 | |
| 1028 | bool HttpSocket::_Redirect |
| 1029 | ( |
| 1030 | std::string loc, |
| 1031 | bool forceGET |
| 1032 | ) |
| 1033 | { |
| 1034 | traceprint("Following HTTP redirect to: %s\n", loc.c_str()); |
| 1035 | if(loc.empty()) |
| 1036 | return false; |
| 1037 | |
| 1038 | Request req; |
| 1039 | req.user = _curRequest.user; |
| 1040 | req.useSSL = _curRequest.useSSL; |
| 1041 | if(!forceGET) |
| 1042 | req.post = _curRequest.post; |
| 1043 | SplitURI(loc, req.protocol, req.host, req.resource, req.port, req.useSSL); |
| 1044 | if(req.protocol.empty()) // assume local resource |
| 1045 | { |
| 1046 | req.host = _curRequest.host; |
| 1047 | req.resource = loc; |
| 1048 | } |
| 1049 | if(req.host.empty()) |
| 1050 | req.host = _curRequest.host; |
| 1051 | if(req.port < 0) |
| 1052 | req.port = _curRequest.port; |
| 1053 | req.extraGetHeaders = _curRequest.extraGetHeaders; |
| 1054 | return SendRequest(req, false); |
| 1055 | } |
| 1056 | |
| 1057 | bool HttpSocket::SendRequest |
| 1058 | ( |