diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 03:47:01 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 03:47:01 +0000 |
commit | e6547c10d0e66c56545e929f66ecd6e779e05814 (patch) | |
tree | 9fa942f71ebfe16ec817b3bb6f3fe78f53a744e7 /net | |
parent | 413c1e842c1a632dd33bbf1c2a63fc0dfc2e0375 (diff) | |
download | chromium_src-e6547c10d0e66c56545e929f66ecd6e779e05814.zip chromium_src-e6547c10d0e66c56545e929f66ecd6e779e05814.tar.gz chromium_src-e6547c10d0e66c56545e929f66ecd6e779e05814.tar.bz2 |
Moving two http utility functions to a separate source file due to dependency on icu.
This allows usage of e.g. HeadersIterator without pulling in all of icu.
TEST=no code change.
BUG=none
Review URL: http://codereview.chromium.org/213017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_util.cc | 18 | ||||
-rw-r--r-- | net/http/http_util_icu.cc | 30 | ||||
-rw-r--r-- | net/net.gyp | 1 |
3 files changed, 33 insertions, 16 deletions
diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 41aa554..811d7b0 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -54,20 +54,6 @@ static size_t FindStringEnd(const string& line, size_t start, char delim) { //----------------------------------------------------------------------------- // static -std::string HttpUtil::PathForRequest(const GURL& url) { - DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); - if (url.has_query()) - return url.path() + "?" + url.query(); - return url.path(); -} - -// static -std::string HttpUtil::SpecForRequest(const GURL& url) { - DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); - return SimplifyUrlForRequest(url).spec(); -} - -// static size_t HttpUtil::FindDelimiter(const string& line, size_t search_start, char delimiter) { do { @@ -453,7 +439,7 @@ int HttpUtil::LocateStartOfStatusLine(const char* buf, int buf_len) { return i; } } - return -1; // Not found + return -1; // Not found } int HttpUtil::LocateEndOfHeaders(const char* buf, int buf_len, int i) { @@ -512,7 +498,7 @@ static const char* FindFirstNonLWS(const char* begin, const char* end) { if (!HttpUtil::IsLWS(*cur)) return cur; } - return end; // Not found. + return end; // Not found. } std::string HttpUtil::AssembleRawHeaders(const char* input_begin, diff --git a/net/http/http_util_icu.cc b/net/http/http_util_icu.cc new file mode 100644 index 0000000..9e2c520 --- /dev/null +++ b/net/http/http_util_icu.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The rules for parsing content-types were borrowed from Firefox: +// http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 + +#include "net/http/http_util.h" + +#include "base/logging.h" + +#include "net/base/net_util.h" + +namespace net { + +// static +std::string HttpUtil::PathForRequest(const GURL& url) { + DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); + if (url.has_query()) + return url.path() + "?" + url.query(); + return url.path(); +} + +// static +std::string HttpUtil::SpecForRequest(const GURL& url) { + DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); + return SimplifyUrlForRequest(url).spec(); +} + +} // namespace net diff --git a/net/net.gyp b/net/net.gyp index c456d98..84cabc1 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -246,6 +246,7 @@ 'http/http_transaction.h', 'http/http_transaction_factory.h', 'http/http_util.cc', + 'http/http_util_icu.cc', 'http/http_util.h', 'http/http_vary_data.cc', 'http/http_vary_data.h', |