3 * Copyright 2004--2005, Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "talk/base/httpcommon-inl.h"
32 #include "talk/base/asyncsocket.h"
33 #include "talk/base/common.h"
34 #include "talk/base/diskcache.h"
35 #include "talk/base/httpclient.h"
36 #include "talk/base/logging.h"
37 #include "talk/base/pathutils.h"
38 #include "talk/base/socketstream.h"
39 #include "talk/base/stringencode.h"
40 #include "talk/base/stringutils.h"
41 #include "talk/base/thread.h"
45 //////////////////////////////////////////////////////////////////////
47 //////////////////////////////////////////////////////////////////////
51 const size_t kCacheHeader = 0;
52 const size_t kCacheBody = 1;
54 // Convert decimal string to integer
55 bool HttpStringToUInt(const std::string& str, size_t* val) {
58 *val = strtoul(str.c_str(), &eos, 10);
59 return (*eos == '\0');
62 bool HttpShouldCache(const HttpTransaction& t) {
63 bool verb_allows_cache = (t.request.verb == HV_GET)
64 || (t.request.verb == HV_HEAD);
65 bool is_range_response = t.response.hasHeader(HH_CONTENT_RANGE, NULL);
66 bool has_expires = t.response.hasHeader(HH_EXPIRES, NULL);
67 bool request_allows_cache =
68 has_expires || (std::string::npos != t.request.path.find('?'));
69 bool response_allows_cache =
70 has_expires || HttpCodeIsCacheable(t.response.scode);
72 bool may_cache = verb_allows_cache
73 && request_allows_cache
74 && response_allows_cache
75 && !is_range_response;
78 if (t.response.hasHeader(HH_CACHE_CONTROL, &value)) {
79 HttpAttributeList directives;
80 HttpParseAttributes(value.data(), value.size(), directives);
81 // Response Directives Summary:
82 // public - always cacheable
83 // private - do not cache in a shared cache
84 // no-cache - may cache, but must revalidate whether fresh or stale
85 // no-store - sensitive information, do not cache or store in any way
86 // max-age - supplants Expires for staleness
87 // s-maxage - use as max-age for shared caches, ignore otherwise
88 // must-revalidate - may cache, but must revalidate after stale
89 // proxy-revalidate - shared cache must revalidate
90 if (HttpHasAttribute(directives, "no-store", NULL)) {
92 } else if (HttpHasAttribute(directives, "public", NULL)) {
100 HCS_FRESH, // In cache, may use
101 HCS_STALE, // In cache, must revalidate
102 HCS_NONE // Not in cache
105 HttpCacheState HttpGetCacheState(const HttpTransaction& t) {
111 size_t now = time(0);
113 HttpAttributeList cache_control;
114 if (t.response.hasHeader(HH_CACHE_CONTROL, &s_temp)) {
115 HttpParseAttributes(s_temp.data(), s_temp.size(), cache_control);
118 // Compute age of cache document
120 if (!t.response.hasHeader(HH_DATE, &s_temp)
121 || !HttpDateToSeconds(s_temp, &date))
124 // TODO: Timestamp when cache request sent and response received?
125 time_t request_time = date;
126 time_t response_time = date;
128 time_t apparent_age = 0;
129 if (response_time > date) {
130 apparent_age = response_time - date;
133 size_t corrected_received_age = apparent_age;
135 if (t.response.hasHeader(HH_AGE, &s_temp)
136 && HttpStringToUInt(s_temp, (&i_temp))) {
137 u_temp = static_cast<time_t>(i_temp);
138 corrected_received_age = stdmax(apparent_age, u_temp);
141 size_t response_delay = response_time - request_time;
142 size_t corrected_initial_age = corrected_received_age + response_delay;
143 size_t resident_time = now - response_time;
144 size_t current_age = corrected_initial_age + resident_time;
146 // Compute lifetime of document
148 if (HttpHasAttribute(cache_control, "max-age", &s_temp)) {
149 lifetime = atoi(s_temp.c_str());
150 } else if (t.response.hasHeader(HH_EXPIRES, &s_temp)
151 && HttpDateToSeconds(s_temp, &u_temp)) {
152 lifetime = u_temp - date;
153 } else if (t.response.hasHeader(HH_LAST_MODIFIED, &s_temp)
154 && HttpDateToSeconds(s_temp, &u_temp)) {
155 // TODO: Issue warning 113 if age > 24 hours
156 lifetime = static_cast<size_t>(now - u_temp) / 10;
161 return (lifetime > current_age) ? HCS_FRESH : HCS_STALE;
164 enum HttpValidatorStrength {
170 HttpValidatorStrength
171 HttpRequestValidatorLevel(const HttpRequestData& request) {
172 if (HV_GET != request.verb)
174 return request.hasHeader(HH_RANGE, NULL) ? HVS_STRONG : HVS_WEAK;
177 HttpValidatorStrength
178 HttpResponseValidatorLevel(const HttpResponseData& response) {
180 if (response.hasHeader(HH_ETAG, &value)) {
181 bool is_weak = (strnicmp(value.c_str(), "W/", 2) == 0);
182 return is_weak ? HVS_WEAK : HVS_STRONG;
184 if (response.hasHeader(HH_LAST_MODIFIED, &value)) {
185 time_t last_modified, date;
186 if (HttpDateToSeconds(value, &last_modified)
187 && response.hasHeader(HH_DATE, &value)
188 && HttpDateToSeconds(value, &date)
189 && (last_modified + 60 < date)) {
197 std::string GetCacheID(const HttpRequestData& request) {
199 id.append(ToString(request.verb));
201 request.getAbsoluteUri(&url);
206 } // anonymous namespace
208 //////////////////////////////////////////////////////////////////////
210 //////////////////////////////////////////////////////////////////////
212 bool HttpWriteCacheHeaders(const HttpResponseData* response,
213 StreamInterface* output, size_t* size) {
215 // Write all unknown and end-to-end headers to a cache file
216 for (HttpData::const_iterator it = response->begin();
217 it != response->end(); ++it) {
219 if (FromString(header, it->first) && !HttpHeaderIsEndToEnd(header))
221 length += it->first.length() + 2 + it->second.length() + 2;
224 std::string formatted_header(it->first);
225 formatted_header.append(": ");
226 formatted_header.append(it->second);
227 formatted_header.append("\r\n");
228 StreamResult result = output->WriteAll(formatted_header.data(),
229 formatted_header.length(),
231 if (SR_SUCCESS != result) {
235 if (output && (SR_SUCCESS != output->WriteAll("\r\n", 2, NULL, NULL))) {
244 bool HttpReadCacheHeaders(StreamInterface* input, HttpResponseData* response,
245 HttpData::HeaderCombine combine) {
247 std::string formatted_header;
248 StreamResult result = input->ReadLine(&formatted_header);
249 if ((SR_EOS == result) || (1 == formatted_header.size())) {
252 if (SR_SUCCESS != result) {
255 size_t end_of_name = formatted_header.find(':');
256 if (std::string::npos == end_of_name) {
257 LOG_F(LS_WARNING) << "Malformed cache header";
260 size_t start_of_value = end_of_name + 1;
261 size_t end_of_value = formatted_header.length();
262 while ((start_of_value < end_of_value)
263 && isspace(formatted_header[start_of_value]))
265 while ((start_of_value < end_of_value)
266 && isspace(formatted_header[end_of_value-1]))
268 size_t value_length = end_of_value - start_of_value;
270 std::string name(formatted_header.substr(0, end_of_name));
271 std::string value(formatted_header.substr(start_of_value, value_length));
272 response->changeHeader(name, value, combine);
277 //////////////////////////////////////////////////////////////////////
279 //////////////////////////////////////////////////////////////////////
281 const size_t kDefaultRetries = 1;
282 const size_t kMaxRedirects = 5;
284 HttpClient::HttpClient(const std::string& agent, StreamPool* pool,
285 HttpTransaction* transaction)
286 : agent_(agent), pool_(pool),
287 transaction_(transaction), free_transaction_(false),
288 retries_(kDefaultRetries), attempt_(0), redirects_(0),
289 redirect_action_(REDIRECT_DEFAULT),
290 uri_form_(URI_DEFAULT), cache_(NULL), cache_state_(CS_READY),
293 if (NULL == transaction_) {
294 free_transaction_ = true;
295 transaction_ = new HttpTransaction;
299 HttpClient::~HttpClient() {
301 base_.abort(HE_SHUTDOWN);
303 resolver_->Destroy(false);
306 if (free_transaction_)
310 void HttpClient::reset() {
312 request().clear(true);
313 response().clear(true);
316 base_.abort(HE_OPERATION_CANCELLED);
319 void HttpClient::OnResolveResult(AsyncResolverInterface* resolver) {
320 if (resolver != resolver_) {
323 int error = resolver_->GetError();
324 server_ = resolver_->address();
325 resolver_->Destroy(false);
328 LOG(LS_ERROR) << "Error " << error << " resolving name: "
330 onHttpComplete(HM_CONNECT, HE_CONNECT_FAILED);
336 void HttpClient::StartDNSLookup() {
337 resolver_ = new AsyncResolver();
338 resolver_->SignalDone.connect(this, &HttpClient::OnResolveResult);
339 resolver_->Start(server_);
342 void HttpClient::set_server(const SocketAddress& address) {
344 // Setting 'Host' here allows it to be overridden before starting the request,
346 request().setHeader(HH_HOST, HttpAddress(server_, false), true);
349 StreamInterface* HttpClient::GetDocumentStream() {
350 return base_.GetDocumentStream();
353 void HttpClient::start() {
354 if (base_.mode() != HM_NONE) {
355 // call reset() to abort an in-progress request
360 ASSERT(!IsCacheActive());
362 if (request().hasHeader(HH_TRANSFER_ENCODING, NULL)) {
363 // Exact size must be known on the client. Instead of using chunked
364 // encoding, wrap data with auto-caching file or memory stream.
371 // If no content has been specified, using length of 0.
372 request().setHeader(HH_CONTENT_LENGTH, "0", false);
374 if (!agent_.empty()) {
375 request().setHeader(HH_USER_AGENT, agent_, false);
378 UriForm uri_form = uri_form_;
379 if (PROXY_HTTPS == proxy_.type) {
380 // Proxies require absolute form
381 uri_form = URI_ABSOLUTE;
382 request().version = HVER_1_0;
383 request().setHeader(HH_PROXY_CONNECTION, "Keep-Alive", false);
385 request().setHeader(HH_CONNECTION, "Keep-Alive", false);
388 if (URI_ABSOLUTE == uri_form) {
389 // Convert to absolute uri form
391 if (request().getAbsoluteUri(&url)) {
392 request().path = url;
394 LOG(LS_WARNING) << "Couldn't obtain absolute uri";
396 } else if (URI_RELATIVE == uri_form) {
397 // Convert to relative uri form
398 std::string host, path;
399 if (request().getRelativeUri(&host, &path)) {
400 request().setHeader(HH_HOST, host);
401 request().path = path;
403 LOG(LS_WARNING) << "Couldn't obtain relative uri";
407 if ((NULL != cache_) && CheckCache()) {
414 void HttpClient::connect() {
416 if (server_.IsUnresolvedIP()) {
420 StreamInterface* stream = pool_->RequestConnectedStream(server_, &stream_err);
421 if (stream == NULL) {
422 ASSERT(0 != stream_err);
423 LOG(LS_ERROR) << "RequestConnectedStream error: " << stream_err;
424 onHttpComplete(HM_CONNECT, HE_CONNECT_FAILED);
426 base_.attach(stream);
427 if (stream->GetState() == SS_OPEN) {
428 base_.send(&transaction_->request);
433 void HttpClient::prepare_get(const std::string& url) {
436 set_server(SocketAddress(purl.host(), purl.port()));
437 request().verb = HV_GET;
438 request().path = purl.full_path();
441 void HttpClient::prepare_post(const std::string& url,
442 const std::string& content_type,
443 StreamInterface* request_doc) {
446 set_server(SocketAddress(purl.host(), purl.port()));
447 request().verb = HV_POST;
448 request().path = purl.full_path();
449 request().setContent(content_type, request_doc);
452 void HttpClient::release() {
453 if (StreamInterface* stream = base_.detach()) {
454 pool_->ReturnConnectedStream(stream);
458 bool HttpClient::ShouldRedirect(std::string* location) const {
459 // TODO: Unittest redirection.
460 if ((REDIRECT_NEVER == redirect_action_)
461 || !HttpCodeIsRedirection(response().scode)
462 || !response().hasHeader(HH_LOCATION, location)
463 || (redirects_ >= kMaxRedirects))
465 return (REDIRECT_ALWAYS == redirect_action_)
466 || (HC_SEE_OTHER == response().scode)
467 || (HV_HEAD == request().verb)
468 || (HV_GET == request().verb);
471 bool HttpClient::BeginCacheFile() {
472 ASSERT(NULL != cache_);
473 ASSERT(CS_READY == cache_state_);
475 std::string id = GetCacheID(request());
476 CacheLock lock(cache_, id, true);
477 if (!lock.IsLocked()) {
478 LOG_F(LS_WARNING) << "Couldn't lock cache";
482 if (HE_NONE != WriteCacheHeaders(id)) {
486 scoped_ptr<StreamInterface> stream(cache_->WriteResource(id, kCacheBody));
488 LOG_F(LS_ERROR) << "Couldn't open body cache";
493 // Let's secretly replace the response document with Folgers Crystals,
494 // er, StreamTap, so that we can mirror the data to our cache.
495 StreamInterface* output = response().document.release();
497 output = new NullStream;
499 StreamTap* tap = new StreamTap(output, stream.release());
500 response().document.reset(tap);
504 HttpError HttpClient::WriteCacheHeaders(const std::string& id) {
505 scoped_ptr<StreamInterface> stream(cache_->WriteResource(id, kCacheHeader));
507 LOG_F(LS_ERROR) << "Couldn't open header cache";
511 if (!HttpWriteCacheHeaders(&transaction_->response, stream.get(), NULL)) {
512 LOG_F(LS_ERROR) << "Couldn't write header cache";
519 void HttpClient::CompleteCacheFile() {
520 // Restore previous response document
521 StreamTap* tap = static_cast<StreamTap*>(response().document.release());
522 response().document.reset(tap->Detach());
525 StreamResult result = tap->GetTapResult(&error);
527 // Delete the tap and cache stream (which completes cache unlock)
530 if (SR_SUCCESS != result) {
531 LOG(LS_ERROR) << "Cache file error: " << error;
532 cache_->DeleteResource(GetCacheID(request()));
536 bool HttpClient::CheckCache() {
537 ASSERT(NULL != cache_);
538 ASSERT(CS_READY == cache_state_);
540 std::string id = GetCacheID(request());
541 if (!cache_->HasResource(id)) {
542 // No cache file available
546 HttpError error = ReadCacheHeaders(id, true);
548 if (HE_NONE == error) {
549 switch (HttpGetCacheState(*transaction_)) {
551 // Cache content is good, read from cache
554 // Cache content may be acceptable. Issue a validation request.
555 if (PrepareValidate()) {
558 // Couldn't validate, fall through.
560 // Cache content is not useable. Issue a regular request.
561 response().clear(false);
566 if (HE_NONE == error) {
567 error = ReadCacheBody(id);
568 cache_state_ = CS_READY;
571 if (HE_CACHE == error) {
572 LOG_F(LS_WARNING) << "Cache failure, continuing with normal request";
573 response().clear(false);
577 SignalHttpClientComplete(this, error);
581 HttpError HttpClient::ReadCacheHeaders(const std::string& id, bool override) {
582 scoped_ptr<StreamInterface> stream(cache_->ReadResource(id, kCacheHeader));
587 HttpData::HeaderCombine combine =
588 override ? HttpData::HC_REPLACE : HttpData::HC_AUTO;
590 if (!HttpReadCacheHeaders(stream.get(), &transaction_->response, combine)) {
591 LOG_F(LS_ERROR) << "Error reading cache headers";
595 response().scode = HC_OK;
599 HttpError HttpClient::ReadCacheBody(const std::string& id) {
600 cache_state_ = CS_READING;
602 HttpError error = HE_NONE;
605 scoped_ptr<StreamInterface> stream(cache_->ReadResource(id, kCacheBody));
606 if (!stream || !stream->GetAvailable(&data_size)) {
607 LOG_F(LS_ERROR) << "Unavailable cache body";
610 error = OnHeaderAvailable(false, false, data_size);
613 if ((HE_NONE == error)
614 && (HV_HEAD != request().verb)
615 && response().document) {
616 char buffer[1024 * 64];
617 StreamResult result = Flow(stream.get(), buffer, ARRAY_SIZE(buffer),
618 response().document.get());
619 if (SR_SUCCESS != result) {
627 bool HttpClient::PrepareValidate() {
628 ASSERT(CS_READY == cache_state_);
629 // At this point, request() contains the pending request, and response()
630 // contains the cached response headers. Reformat the request to validate
631 // the cached content.
632 HttpValidatorStrength vs_required = HttpRequestValidatorLevel(request());
633 HttpValidatorStrength vs_available = HttpResponseValidatorLevel(response());
634 if (vs_available < vs_required) {
638 if (response().hasHeader(HH_ETAG, &value)) {
639 request().addHeader(HH_IF_NONE_MATCH, value);
641 if (response().hasHeader(HH_LAST_MODIFIED, &value)) {
642 request().addHeader(HH_IF_MODIFIED_SINCE, value);
644 response().clear(false);
645 cache_state_ = CS_VALIDATING;
649 HttpError HttpClient::CompleteValidate() {
650 ASSERT(CS_VALIDATING == cache_state_);
652 std::string id = GetCacheID(request());
654 // Merge cached headers with new headers
655 HttpError error = ReadCacheHeaders(id, false);
656 if (HE_NONE != error) {
657 // Rewrite merged headers to cache
658 CacheLock lock(cache_, id);
659 error = WriteCacheHeaders(id);
661 if (HE_NONE != error) {
662 error = ReadCacheBody(id);
667 HttpError HttpClient::OnHeaderAvailable(bool ignore_data, bool chunked,
669 // If we are ignoring the data, this is an intermediate header.
670 // TODO: don't signal intermediate headers. Instead, do all header-dependent
671 // processing now, and either set up the next request, or fail outright.
672 // TODO: by default, only write response documents with a success code.
673 SignalHeaderAvailable(this, !ignore_data, ignore_data ? 0 : data_size);
674 if (!ignore_data && !chunked && (data_size != SIZE_UNKNOWN)
675 && response().document) {
676 // Attempt to pre-allocate space for the downloaded data.
677 if (!response().document->ReserveSize(data_size)) {
685 // HttpBase Implementation
688 HttpError HttpClient::onHttpHeaderComplete(bool chunked, size_t& data_size) {
689 if (CS_VALIDATING == cache_state_) {
690 if (HC_NOT_MODIFIED == response().scode) {
691 return CompleteValidate();
693 // Should we remove conditional headers from request?
694 cache_state_ = CS_READY;
695 cache_->DeleteResource(GetCacheID(request()));
696 // Continue processing response as normal
699 ASSERT(!IsCacheActive());
700 if ((request().verb == HV_HEAD) || !HttpCodeHasBody(response().scode)) {
701 // HEAD requests and certain response codes contain no body
704 if (ShouldRedirect(NULL)
705 || ((HC_PROXY_AUTHENTICATION_REQUIRED == response().scode)
706 && (PROXY_HTTPS == proxy_.type))) {
707 // We're going to issue another request, so ignore the incoming data.
708 base_.set_ignore_data(true);
711 HttpError error = OnHeaderAvailable(base_.ignore_data(), chunked, data_size);
712 if (HE_NONE != error) {
717 && !base_.ignore_data()
718 && HttpShouldCache(*transaction_)) {
719 if (BeginCacheFile()) {
720 cache_state_ = CS_WRITING;
726 void HttpClient::onHttpComplete(HttpMode mode, HttpError err) {
727 if (((HE_DISCONNECTED == err) || (HE_CONNECT_FAILED == err)
728 || (HE_SOCKET_ERROR == err))
729 && (HC_INTERNAL_SERVER_ERROR == response().scode)
730 && (attempt_ < retries_)) {
731 // If the response code has not changed from the default, then we haven't
732 // received anything meaningful from the server, so we are eligible for a
735 if (request().document && !request().document->Rewind()) {
736 // Unable to replay the request document.
743 } else if (err != HE_NONE) {
745 } else if (mode == HM_CONNECT) {
746 base_.send(&transaction_->request);
748 } else if ((mode == HM_SEND) || HttpCodeIsInformational(response().scode)) {
749 // If you're interested in informational headers, catch
750 // SignalHeaderAvailable.
751 base_.recv(&transaction_->response);
754 if (!HttpShouldKeepAlive(response())) {
755 LOG(LS_VERBOSE) << "HttpClient: closing socket";
756 base_.stream()->Close();
758 std::string location;
759 if (ShouldRedirect(&location)) {
760 Url<char> purl(location);
761 set_server(SocketAddress(purl.host(), purl.port()));
762 request().path = purl.full_path();
763 if (response().scode == HC_SEE_OTHER) {
764 request().verb = HV_GET;
765 request().clearHeader(HH_CONTENT_TYPE);
766 request().clearHeader(HH_CONTENT_LENGTH);
767 request().document.reset();
768 } else if (request().document && !request().document->Rewind()) {
769 // Unable to replay the request document.
770 ASSERT(REDIRECT_ALWAYS == redirect_action_);
773 if (err == HE_NONE) {
776 response().clear(false);
781 } else if ((HC_PROXY_AUTHENTICATION_REQUIRED == response().scode)
782 && (PROXY_HTTPS == proxy_.type)) {
783 std::string authorization, auth_method;
784 HttpData::const_iterator begin = response().begin(HH_PROXY_AUTHENTICATE);
785 HttpData::const_iterator end = response().end(HH_PROXY_AUTHENTICATE);
786 for (HttpData::const_iterator it = begin; it != end; ++it) {
787 HttpAuthContext *context = context_.get();
788 HttpAuthResult res = HttpAuthenticate(
789 it->second.data(), it->second.size(),
791 ToString(request().verb), request().path,
792 proxy_.username, proxy_.password,
793 context, authorization, auth_method);
794 context_.reset(context);
795 if (res == HAR_RESPONSE) {
796 request().setHeader(HH_PROXY_AUTHORIZATION, authorization);
797 if (request().document && !request().document->Rewind()) {
800 // Explicitly do not reset the HttpAuthContext
801 response().clear(false);
802 // TODO: Reuse socket when authenticating?
807 } else if (res == HAR_IGNORE) {
808 LOG(INFO) << "Ignoring Proxy-Authenticate: " << auth_method;
816 if (CS_WRITING == cache_state_) {
818 cache_state_ = CS_READY;
819 } else if (CS_READING == cache_state_) {
820 cache_state_ = CS_READY;
823 SignalHttpClientComplete(this, err);
826 void HttpClient::onHttpClosed(HttpError err) {
827 // This shouldn't occur, since we return the stream to the pool upon command
832 //////////////////////////////////////////////////////////////////////
834 //////////////////////////////////////////////////////////////////////
836 HttpClientDefault::HttpClientDefault(SocketFactory* factory,
837 const std::string& agent,
838 HttpTransaction* transaction)
839 : ReuseSocketPool(factory ? factory : Thread::Current()->socketserver()),
840 HttpClient(agent, NULL, transaction) {
844 //////////////////////////////////////////////////////////////////////
846 } // namespace talk_base