Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Side by Side Diff: net/url_request/url_request.cc

Issue 51004: Respect cookies set in a 401 responses when restarting the http transaction.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address rest of wtc's comments (had missed some in previous patchset) Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/stats_counters.h" 10 #include "base/stats_counters.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 // static 346 // static
347 std::string URLRequest::StripPostSpecificHeaders(const std::string& headers) { 347 std::string URLRequest::StripPostSpecificHeaders(const std::string& headers) {
348 // These are headers that may be attached to a POST. 348 // These are headers that may be attached to a POST.
349 static const char* const kPostHeaders[] = { 349 static const char* const kPostHeaders[] = {
350 "content-type", 350 "content-type",
351 "content-length", 351 "content-length",
352 "origin" 352 "origin"
353 }; 353 };
354 354 return net::HttpUtil::StripHeaders(
355 std::string stripped_headers; 355 headers, kPostHeaders, arraysize(kPostHeaders));
356 net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n");
357
358 while (it.GetNext()) {
359 bool is_post_specific = false;
360 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPostHeaders); ++i) {
361 if (LowerCaseEqualsASCII(it.name_begin(), it.name_end(),
362 kPostHeaders[i])) {
363 is_post_specific = true;
364 break;
365 }
366 }
367 if (!is_post_specific) {
368 // Assume that name and values are on the same line.
369 stripped_headers.append(it.name_begin(), it.values_end());
370 stripped_headers.append("\r\n");
371 }
372 }
373 return stripped_headers;
374 } 356 }
375 357
376 int URLRequest::Redirect(const GURL& location, int http_status_code) { 358 int URLRequest::Redirect(const GURL& location, int http_status_code) {
377 if (redirect_limit_ <= 0) { 359 if (redirect_limit_ <= 0) {
378 DLOG(INFO) << "disallowing redirect: exceeds limit"; 360 DLOG(INFO) << "disallowing redirect: exceeds limit";
379 return net::ERR_TOO_MANY_REDIRECTS; 361 return net::ERR_TOO_MANY_REDIRECTS;
380 } 362 }
381 363
382 if (!job_->IsSafeRedirect(location)) { 364 if (!job_->IsSafeRedirect(location)) {
383 DLOG(INFO) << "disallowing redirect: unsafe protocol"; 365 DLOG(INFO) << "disallowing redirect: unsafe protocol";
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 422 }
441 423
442 #ifndef NDEBUG 424 #ifndef NDEBUG
443 425
444 URLRequestMetrics::~URLRequestMetrics() { 426 URLRequestMetrics::~URLRequestMetrics() {
445 DLOG_IF(WARNING, object_count != 0) << 427 DLOG_IF(WARNING, object_count != 0) <<
446 "Leaking " << object_count << " URLRequest object(s)"; 428 "Leaking " << object_count << " URLRequest object(s)";
447 } 429 }
448 430
449 #endif 431 #endif
OLDNEW
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698