1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
7 * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL
16 * This enumeration contains properties set on a URL response.
19 enum PP_URLResponseProperty
{
21 * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by
22 * resolving the relative request URL with the absolute document URL. Refer
24 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2">
25 * HTTP Request URI</a> and
26 * <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1">
27 * HTML Resolving Relative URIs</a> documentation for further information.
29 PP_URLRESPONSEPROPERTY_URL
= 0,
32 * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned
33 * in the response header's 'Location' field if this is a redirect response,
34 * an empty string otherwise. Refer to the
35 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
36 * HTTP Status Codes - Redirection</a> documentation for further information.
38 PP_URLRESPONSEPROPERTY_REDIRECTURL
= 1,
41 * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be
42 * used in a new request if this is a redirect response, an empty string
43 * otherwise. Refer to the
44 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
45 * HTTP Status Codes - Redirection</a> documentation for further information.
47 PP_URLRESPONSEPROPERTY_REDIRECTMETHOD
= 2,
50 * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the
51 * response, e.g., 200 if the request was successful. Refer to the
52 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1">
53 * HTTP Status Code and Reason Phrase</a> documentation for further
56 PP_URLRESPONSEPROPERTY_STATUSCODE
= 3,
59 * This corresponds to a string (PP_VARTYPE_STRING); the status line
60 * from the response. Refer to the
61 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1">
62 * HTTP Response Status Line</a> documentation for further information.
64 PP_URLRESPONSEPROPERTY_STATUSLINE
= 4,
67 * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of
68 * header field/value pairs of the form "field: value", returned by the
69 * server. Refer to the
70 * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14">
71 * HTTP Header Field Definitions</a> documentation for further information.
73 PP_URLRESPONSEPROPERTY_HEADERS
= 5
78 * The PPB_URLResponseInfo interface contains APIs for
79 * examining URL responses. Refer to <code>PPB_URLLoader</code> for further
82 interface PPB_URLResponseInfo
{
84 * IsURLResponseInfo() determines if a response is a
85 * <code>URLResponseInfo</code>.
87 * @param[in] resource A <code>PP_Resource</code> corresponding to a
88 * <code>URLResponseInfo</code>.
90 * @return <code>PP_TRUE</code> if the resource is a
91 * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is
92 * invalid or some type other than <code>URLResponseInfo</code>.
94 PP_Bool IsURLResponseInfo
(
95 [in] PP_Resource resource
);
98 * GetProperty() gets a response property.
100 * @param[in] request A <code>PP_Resource</code> corresponding to a
101 * <code>URLResponseInfo</code>.
102 * @param[in] property A <code>PP_URLResponseProperty</code> identifying
103 * the type of property in the response.
105 * @return A <code>PP_Var</code> containing the response property value if
106 * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid.
109 [in] PP_Resource response
,
110 [in] PP_URLResponseProperty property
);
113 * GetBodyAsFileRef() returns a FileRef pointing to the file containing the
114 * response body. This is only valid if
115 * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the
116 * <code>URLRequestInfo</code> used to produce this response. This file
117 * remains valid until the <code>URLLoader</code> associated with this
118 * <code>URLResponseInfo</code> is closed or destroyed.
120 * @param[in] request A <code>PP_Resource</code> corresponding to a
121 * <code>URLResponseInfo</code>.
123 * @return A <code>PP_Resource</code> corresponding to a <code>FileRef</code>
124 * if successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was
125 * not requested or if the <code>URLLoader</code> has not been opened yet.
127 PP_Resource GetBodyAsFileRef
(
128 [in] PP_Resource response
);