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/http/http_util_icu.cc | |
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/http/http_util_icu.cc')
-rw-r--r-- | net/http/http_util_icu.cc | 30 |
1 files changed, 30 insertions, 0 deletions
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 |