1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
/* Copyright (c) 2012 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.
*/
/* From ppb_url_response_info.idl modified Mon Nov 14 10:36:01 2011. */
#ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_
#define PPAPI_C_PPB_URL_RESPONSE_INFO_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
#define PPB_URLRESPONSEINFO_INTERFACE_1_0 "PPB_URLResponseInfo;1.0"
#define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_1_0
/**
* @file
* This file defines the <code>PPB_URLResponseInfo</code> API for examining URL
* responses.
*/
/**
* @addtogroup Enums
* @{
*/
/**
* This enumeration contains properties set on a URL response.
*/
typedef enum {
/**
* This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by
* resolving the relative request URL with the absolute document URL. Refer
* to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2">
* HTTP Request URI</a> and
* <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1">
* HTML Resolving Relative URIs</a> documentation for further information.
*/
PP_URLRESPONSEPROPERTY_URL = 0,
/**
* This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned
* in the response header's 'Location' field if this is a redirect response,
* an empty string otherwise. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
* HTTP Status Codes - Redirection</a> documentation for further information.
*/
PP_URLRESPONSEPROPERTY_REDIRECTURL = 1,
/**
* This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be
* used in a new request if this is a redirect response, an empty string
* otherwise. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
* HTTP Status Codes - Redirection</a> documentation for further information.
*/
PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2,
/**
* This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the
* response, e.g., 200 if the request was successful. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1">
* HTTP Status Code and Reason Phrase</a> documentation for further
* information.
*/
PP_URLRESPONSEPROPERTY_STATUSCODE = 3,
/**
* This corresponds to a string (PP_VARTYPE_STRING); the status line
* from the response. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1">
* HTTP Response Status Line</a> documentation for further information.
*/
PP_URLRESPONSEPROPERTY_STATUSLINE = 4,
/**
* This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of
* header field/value pairs of the form "field: value", returned by the
* server. Refer to the
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14">
* HTTP Header Field Definitions</a> documentation for further information.
*/
PP_URLRESPONSEPROPERTY_HEADERS = 5
} PP_URLResponseProperty;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4);
/**
* @}
*/
/**
* @addtogroup Interfaces
* @{
*/
/**
* The PPB_URLResponseInfo interface contains APIs for
* examining URL responses. Refer to <code>PPB_URLLoader</code> for further
* information.
*/
struct PPB_URLResponseInfo_1_0 {
/**
* IsURLResponseInfo() determines if a response is a
* <code>URLResponseInfo</code>.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to a
* <code>URLResponseInfo</code>.
*
* @return <code>PP_TRUE</code> if the resource is a
* <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is
* invalid or some type other than <code>URLResponseInfo</code>.
*/
PP_Bool (*IsURLResponseInfo)(PP_Resource resource);
/**
* GetProperty() gets a response property.
*
* @param[in] request A <code>PP_Resource</code> corresponding to a
* <code>URLResponseInfo</code>.
* @param[in] property A <code>PP_URLResponseProperty</code> identifying
* the type of property in the response.
*
* @return A <code>PP_Var</code> containing the response property value if
* successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid.
*/
struct PP_Var (*GetProperty)(PP_Resource response,
PP_URLResponseProperty property);
/**
* GetBodyAsFileRef() returns a FileRef pointing to the file containing the
* response body. This is only valid if
* <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the
* <code>URLRequestInfo</code> used to produce this response. This file
* remains valid until the <code>URLLoader</code> associated with this
* <code>URLResponseInfo</code> is closed or destroyed.
*
* @param[in] request A <code>PP_Resource</code> corresponding to a
* <code>URLResponseInfo</code>.
*
* @return A <code>PP_Resource</code> corresponding to a <code>FileRef</code>
* if successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was
* not requested or if the <code>URLLoader</code> has not been opened yet.
*/
PP_Resource (*GetBodyAsFileRef)(PP_Resource response);
};
typedef struct PPB_URLResponseInfo_1_0 PPB_URLResponseInfo;
/**
* @}
*/
#endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */
|