diff options
| author | Matthias Thomae <matthias.thomae@teleca.com> | 2010-10-20 10:28:58 +0200 |
|---|---|---|
| committer | Matthias Thomae <matthias.thomae@teleca.com> | 2010-11-02 13:26:24 +0100 |
| commit | bdb0896ba5078a09d667482c4c91ee279fa2f0e6 (patch) | |
| tree | 0fe73f26f628de6c68f0101841e2b85e33c45c49 /core/java/android/webkit/FrameLoader.java | |
| parent | c1c45a4dc950865a7f5f76d8aab56be0cc8e0e91 (diff) | |
Add support for UAProf header in HTTP requests
Each HTTP request sent from a mobile handset is usually required to
include a x-wap-profile header following the UAProf specification. The
value of this header is a URL that points to the location of a
document which specifies relevant capabilities of the phone, e.g.
supported network bearers, video formats or screen size. This change
defines a global string resource that holds this URL, and also adds
the necessary code in the web widget to include this header in HTTP
requests.
Diffstat (limited to 'core/java/android/webkit/FrameLoader.java')
| -rw-r--r-- | core/java/android/webkit/FrameLoader.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java index 7fd993a209e9..021b53ca9ff3 100644 --- a/core/java/android/webkit/FrameLoader.java +++ b/core/java/android/webkit/FrameLoader.java @@ -18,6 +18,7 @@ package android.webkit; import android.net.http.EventHandler; import android.net.http.RequestHandle; +import android.os.Build; import android.util.Log; import android.webkit.CacheManager.CacheResult; @@ -35,6 +36,7 @@ class FrameLoader { private int mCacheMode; private String mReferrer; private String mContentType; + private final String mUaprofHeader; private static final int URI_PROTOCOL = 0x100; @@ -57,6 +59,8 @@ class FrameLoader { mMethod = method; mCacheMode = WebSettings.LOAD_NORMAL; mSettings = settings; + mUaprofHeader = mListener.getContext().getResources().getString( + com.android.internal.R.string.config_useragentprofile_url, Build.MODEL); } public void setReferrer(String ref) { @@ -356,6 +360,11 @@ class FrameLoader { } mHeaders.put("User-Agent", mSettings.getUserAgentString()); + + // Set the x-wap-profile header + if (mUaprofHeader != null && mUaprofHeader.length() > 0) { + mHeaders.put("x-wap-profile", mUaprofHeader); + } } /** |
