| 170 | } |
| 171 | |
| 172 | void |
| 173 | Request::setHost(std::string const &host) |
| 174 | { |
| 175 | static const std::string HOST_FIELD_NAME(TS_MIME_FIELD_HOST, TS_MIME_LEN_HOST); |
| 176 | |
| 177 | if (state_->hdr_buf_ && state_->hdr_loc_) { |
| 178 | Url &url = this->getUrl(); |
| 179 | |
| 180 | // Update the URL if it has a host currently. |
| 181 | if (!url.getHost().empty()) { |
| 182 | url.setHost(host); |
| 183 | } |
| 184 | |
| 185 | // Force a HOST field. |
| 186 | this->getHeaders().set(HOST_FIELD_NAME, host); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | Request::~Request() |
| 191 | { |