VLC  3.0.15
message.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * message.h: HTTP request/response
3  *****************************************************************************
4  * Copyright (C) 2015 RĂ©mi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20 
21 #include <stdint.h>
22 
23 /**
24  * \defgroup http_msg Messages
25  * HTTP messages, header formatting and parsing
26  * \ingroup http
27  * @{
28  * \file message.h
29  */
30 
31 struct vlc_http_msg;
32 struct block_t;
34 
35 /**
36  * Creates an HTTP request.
37  *
38  * Allocates an HTTP request message.
39  *
40  * @param method request method (e.g. "GET")
41  * @param scheme protocol scheme (e.g. "https")
42  * @param authority target host (e.g. "www.example.com:8080")
43  * @param path request path (e.g. "/dir/page.html")
44  * @return an HTTP stream or NULL on allocation failure
45  */
46 struct vlc_http_msg *
47 vlc_http_req_create(const char *method, const char *scheme,
48  const char *authority, const char *path) VLC_USED;
49 
50 /**
51  * Creates an HTTP response.
52  *
53  * Allocates an HTTP response message.
54  *
55  * @param status HTTP status code
56  * @return an HTTP stream or NULL on allocation failure
57  */
59 
60 /**
61  * Destroys an HTTP message.
62  */
63 void vlc_http_msg_destroy(struct vlc_http_msg *);
64 
65 /**
66  * Formats a header field.
67  *
68  * Adds an HTTP message header to an HTTP request or response.
69  * All headers must be formatted before the message is sent.
70  *
71  * @param name header field name
72  * @param fmt printf-style format string
73  * @return 0 on success, -1 on error (out of memory)
74  */
75 int vlc_http_msg_add_header(struct vlc_http_msg *, const char *name,
76  const char *fmt, ...) VLC_FORMAT(3,4);
77 
78 /**
79  * Sets the agent field.
80  *
81  * Sets the User-Agent or Server header field.
82  */
83 int vlc_http_msg_add_agent(struct vlc_http_msg *, const char *);
84 
85 /**
86  * Gets the agent field.
87  *
88  * Gets the User-Agent or Server header field.
89  */
90 const char *vlc_http_msg_get_agent(const struct vlc_http_msg *);
91 
92 /**
93  * Parses a timestamp header field.
94  *
95  * @param name header field name
96  * @return a timestamp value, or -1 on error.
97  */
98 time_t vlc_http_msg_get_time(const struct vlc_http_msg *, const char *name);
99 
100 /**
101  * Adds a timestamp header field.
102  *
103  * @param name header field name
104  * @param t pointer to timestamp
105  * @return 0 on success, -1 on error (errno is set accordingly)
106  */
107 int vlc_http_msg_add_time(struct vlc_http_msg *, const char *name,
108  const time_t *t);
109 
110 /**
111  * Adds a Date header field.
112  */
114 
115 /**
116  * Gets message date.
117  *
118  * Extracts the original date of the message from the HTTP Date header.
119  *
120  * @return a time value on success, -1 on error.
121  */
122 time_t vlc_http_msg_get_atime(const struct vlc_http_msg *);
123 
124 /**
125  * Gets resource date.
126  *
127  * Extracts the last modification date of the message content from the HTTP
128  * Last-Modified header.
129  *
130  * @return a time value on success, -1 on error.
131  */
132 time_t vlc_http_msg_get_mtime(const struct vlc_http_msg *);
133 
134 /**
135  * Gets retry timeout.
136  *
137  * Extracts the time (in seconds) until the expiration of the "retry-after"
138  * time-out in the HTTP message. If the header value is an absolute date, it
139  * is converted relative to the current time.
140  *
141  * @return the time in seconds, zero if the date is overdue or on error.
142  */
143 unsigned vlc_http_msg_get_retry_after(const struct vlc_http_msg *);
144 
145 void vlc_http_msg_get_cookies(const struct vlc_http_msg *,
146  struct vlc_http_cookie_jar_t *,
147  const char *host, const char *path);
149  struct vlc_http_cookie_jar_t *);
150 
151 char *vlc_http_msg_get_basic_realm(const struct vlc_http_msg *);
152 
153 /**
154  * Adds Basic credentials.
155  *
156  * Formats a plain username and password pair using HTTP Basic (RFC7617)
157  * syntax.
158  *
159  * @param proxy true for proxy authentication,
160  * false for origin server authentication
161  * @param username null-terminated username
162  * @param password null-terminated password
163  * @return 0 on success, -1 on out-of-memory (ENOMEM) or if username or
164  * password are invalid (EINVAL).
165  */
166 int vlc_http_msg_add_creds_basic(struct vlc_http_msg *, bool proxy,
167  const char *username, const char *password);
168 
169 
170 /**
171  * Looks up an header field.
172  *
173  * Finds an HTTP header field by (case-insensitive) name inside an HTTP
174  * message header. If the message has more than one matching field, their value
175  * are folded (as permitted by protocol specifications).
176  *
177  * @return header field value (valid until message is destroyed),
178  * or NULL if no fields matched
179  */
180 const char *vlc_http_msg_get_header(const struct vlc_http_msg *,
181  const char *name);
182 
183 /**
184  * Gets response status code.
185  *
186  * @return status code (e.g. 404), or negative if request
187  */
188 int vlc_http_msg_get_status(const struct vlc_http_msg *m);
189 
190 /**
191  * Gets request method.
192  *
193  * @return request method (e.g. "GET"), or NULL if response
194  */
195 const char *vlc_http_msg_get_method(const struct vlc_http_msg *);
196 
197 /**
198  * Gets request scheme.
199  *
200  * @return request scheme (e.g. "https"), or NULL if absent
201  */
202 const char *vlc_http_msg_get_scheme(const struct vlc_http_msg *);
203 
204 /**
205  * Gets request authority.
206  *
207  * @return request authority (e.g. "www.example.com:8080"),
208  * or NULL if response
209  */
210 const char *vlc_http_msg_get_authority(const struct vlc_http_msg *);
211 
212 /**
213  * Gets request absolute path.
214  *
215  * @return request absolute path (e.g. "/index.html"), or NULL if absent
216  */
217 const char *vlc_http_msg_get_path(const struct vlc_http_msg *);
218 
219 /**
220  * Looks up a token in a header field.
221  *
222  * Finds the first occurence of a token within a HTTP field header.
223  *
224  * @param field HTTP header field name
225  * @param token HTTP token name
226  * @return the first byte of the token if found, NULL if not found.
227  */
228 const char *vlc_http_msg_get_token(const struct vlc_http_msg *,
229  const char *field, const char *token);
230 
231 /**
232  * Finds next token.
233  *
234  * Finds the following token in a HTTP header field value.
235  *
236  * @return First character of the following token,
237  * or NULL if there are no further tokens
238  */
239 const char *vlc_http_next_token(const char *);
240 
241 /**
242  * Gets HTTP payload length.
243  *
244  * Determines the total length (in bytes) of the payload associated with the
245  * HTTP message.
246  *
247  * @return byte length, or (uintmax_t)-1 if unknown.
248  */
249 uintmax_t vlc_http_msg_get_size(const struct vlc_http_msg *);
250 
251 /**
252  * Gets next response headers.
253  *
254  * Discards the current response headers and gets the next set of response
255  * headers for the same request. This is intended for HTTP 1xx continuation
256  * responses and for message trailers.
257  *
258  * @param m current response headers (destroyed by the call)
259  *
260  * @return next response headers or NULL on error
261  */
263 
264 /**
265  * Gets final response headers.
266  *
267  * Skips HTTP 1xx continue headers until a final set of response headers is
268  * received. This is a convenience wrapper around vlc_http_msg_iterate() for
269  * use when continuation headers are not useful (e.g. GET or CONNECT).
270  *
271  * @param m current response headers or NULL
272  *
273  * @return the final response headers (m if it was already final),
274  * NULL if the parameter was NULL, or NULL on error
275  */
277 
278 /**
279  * Receives HTTP data.
280  *
281  * Dequeues the next block of data from an HTTP message. If no pending data has
282  * been received, waits until data is received, the stream ends or the
283  * underlying connection fails.
284  *
285  * @return data block
286  * @retval NULL on end-of-stream
287  * @retval vlc_http_error on fatal error
288  */
290 
291 /** @} */
292 
293 /**
294  * \defgroup http_stream Streams
295  * \ingroup http_connmgr
296  *
297  * HTTP request/response streams
298  *
299  * A stream is initiated by a client-side request header. It includes a
300  * final response header, possibly preceded by one or more continuation
301  * response headers. After the response header, a stream usually carries
302  * a response payload.
303  *
304  * A stream may also carry a request payload (this is not supported so far).
305  *
306  * The HTTP stream constitutes the interface between an HTTP connection and
307  * the higher-level HTTP messages layer.
308  * @{
309  */
310 
311 struct vlc_http_stream;
312 
313 /**
314  * Error pointer value
315  *
316  * This is an error value for some HTTP functions that can return NULL in
317  * non-error circumstances. Another return value is necessary to express
318  * error/failure, which this is.
319  * This compares different to NULL and to any valid pointer.
320  *
321  * @warning Dereferencing this pointer is undefined.
322  */
323 extern void *const vlc_http_error;
324 
325 void vlc_http_msg_attach(struct vlc_http_msg *m, struct vlc_http_stream *s);
327 VLC_USED;
328 
329 /** HTTP stream callbacks
330  *
331  * Connection-specific callbacks for stream manipulation
332  */
333 struct vlc_http_stream_cbs
334 {
335  struct vlc_http_msg *(*read_headers)(struct vlc_http_stream *);
336  struct block_t *(*read)(struct vlc_http_stream *);
337  void (*close)(struct vlc_http_stream *, bool abort);
338 };
339 
340 /** HTTP stream */
341 struct vlc_http_stream
342 {
343  const struct vlc_http_stream_cbs *cbs;
344 };
345 
346 /**
347  * Reads one message header.
348  *
349  * Reads the next message header of an HTTP stream from the network.
350  * There is always exactly one request header per stream. There is usually
351  * one response header per stream, except for continuation (1xx) headers.
352  *
353  * @warning The caller is responsible for reading headers at appropriate
354  * times as intended by the protocol. Failure to do so may result in protocol
355  * dead lock, and/or (HTTP 1.x) connection failure.
356  */
357 static inline
359 {
360  return s->cbs->read_headers(s);
361 }
362 
363 /**
364  * Reads message payload data.
365  *
366  * Reads the next block of data from the message payload of an HTTP stream.
367  *
368  * @return a block of data (use block_Release() to free it)
369  * @retval NULL The end of the stream was reached.
370  * @retval vlc_http_error The stream encountered a fatal error.
371  */
372 static inline struct block_t *vlc_http_stream_read(struct vlc_http_stream *s)
373 {
374  return s->cbs->read(s);
375 }
376 
377 /**
378  * Closes an HTTP stream.
379  *
380  * Releases all resources associated or held by an HTTP stream. Any unread
381  * header or data is discarded.
382  */
383 static inline void vlc_http_stream_close(struct vlc_http_stream *s, bool abort)
384 {
385  s->cbs->close(s, abort);
386 }
387 
388 /** @} */
389 
390 /**
391  * Formats an HTTP 1.1 message header.
392  *
393  * Formats an message header in HTTP 1.x format, using HTTP version 1.1.
394  *
395  * @param m message to format/serialize
396  * @param lenp location to write the length of the formatted message in bytes
397  * [OUT]
398  * @param proxied whether the message is meant for sending to a proxy rather
399  * than an origin (only relevant for requests)
400  * @return A heap-allocated nul-terminated string or *lenp bytes,
401  * or NULL on error
402  */
403 char *vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp,
404  bool proxied) VLC_USED;
405 
406 /**
407  * Parses an HTTP 1.1 message header.
408  */
409 struct vlc_http_msg *vlc_http_msg_headers(const char *msg) VLC_USED;
410 
411 struct vlc_h2_frame;
412 
413 /**
414  * Formats an HTTP 2.0 HEADER frame.
415  */
416 struct vlc_h2_frame *vlc_http_msg_h2_frame(const struct vlc_http_msg *m,
417  uint_fast32_t stream_id, bool eos);
418 
419 /**
420  * Parses an HTTP 2.0 header table.
421  */
423  const char *const headers[][2]);
vlc_http_msg_get_retry_after
unsigned vlc_http_msg_get_retry_after(const struct vlc_http_msg *m)
Gets retry timeout.
Definition: message.c:835
VLC_FORMAT
#define VLC_FORMAT(x, y)
Definition: vlc_common.h:100
count
size_t count
Definition: core.c:461
vlc_http_msg_get_path
const char * vlc_http_msg_get_path(const struct vlc_http_msg *m)
Gets request absolute path.
Definition: message.c:186
vlc_http_msg_get_basic_realm
char * vlc_http_msg_get_basic_realm(const struct vlc_http_msg *m)
Definition: message.c:940
vlc_memstream
Definition: vlc_memstream.h:27
vlc_http_error_loc
static const char vlc_http_error_loc
Definition: message.c:53
vlc_http_istoken
static int vlc_http_istoken(int c)
Definition: message.c:538
vlc_http.h
strcasecmp
int strcasecmp(const char *, const char *)
vlc_http_token_length
static size_t vlc_http_token_length(const char *str)
Definition: message.c:553
vlc_http_msg_h2_frame
struct vlc_h2_frame * vlc_http_msg_h2_frame(const struct vlc_http_msg *m, uint_fast32_t stream_id, bool eos)
Formats an HTTP 2.0 HEADER frame.
Definition: message.c:390
vlc_http_stream::cbs
const struct vlc_http_stream_cbs * cbs
Definition: message.h:342
vlc_common.h
vlc_http_stream_read_headers
static struct vlc_http_msg * vlc_http_stream_read_headers(struct vlc_http_stream *s)
Reads one message header.
Definition: message.h:357
vlc_http_msg_get_method
const char * vlc_http_msg_get_method(const struct vlc_http_msg *m)
Gets request method.
Definition: message.c:171
vlc_http_msg_h2_headers
struct vlc_http_msg * vlc_http_msg_h2_headers(unsigned n, const char *const hdrs[][2])
Parses an HTTP 2.0 header table.
Definition: message.c:452
vlc_http_msg_add_creds_basic
int vlc_http_msg_add_creds_basic(struct vlc_http_msg *m, bool proxy, const char *username, const char *password)
Adds Basic credentials.
Definition: message.c:958
gmtime_r
struct tm * gmtime_r(const time_t *, struct tm *)
vlc_http_msg_destroy
void vlc_http_msg_destroy(struct vlc_http_msg *m)
Destroys an HTTP message.
Definition: message.c:191
vlc_http_msg_h2_headers
struct vlc_http_msg * vlc_http_msg_h2_headers(unsigned count, const char *const headers[][2])
Parses an HTTP 2.0 header table.
Definition: message.c:452
vlc_http_msg::count
unsigned count
Definition: message.c:65
vlc_http_comment_length
static size_t vlc_http_comment_length(const char *str)
Definition: message.c:668
vlc_http_msg_iterate
struct vlc_http_msg * vlc_http_msg_iterate(struct vlc_http_msg *m)
Gets next response headers.
Definition: message.c:263
vlc_http_stream_cbs::read_headers
struct vlc_http_msg *(* read_headers)(struct vlc_http_stream *)
Definition: message.h:334
vlc_http_stream_read
static struct block_t * vlc_http_stream_read(struct vlc_http_stream *s)
Reads message payload data.
Definition: message.h:371
vlc_http_get_token
static const char * vlc_http_get_token(const char *value, const char *token)
Definition: message.c:605
vlc_http_quoted_length
static size_t vlc_http_quoted_length(const char *str)
Definition: message.c:562
vlc_http_cookies_fetch
char * vlc_http_cookies_fetch(vlc_http_cookie_jar_t *p_jar, bool secure, const char *host, const char *path)
Returns a cookie value that match the given URL.
Definition: httpcookies.c:353
vlc_http_next_token
const char * vlc_http_next_token(const char *value)
Finds next token.
Definition: message.c:595
vlc_http_msg_add_header
int vlc_http_msg_add_header(struct vlc_http_msg *m, const char *name, const char *fmt,...)
Definition: message.c:142
asprintf
int asprintf(char **, const char *,...)
vlc_http_stream_cbs
HTTP stream callbacks.
Definition: message.h:332
vlc_http_msg_h2_frame
struct vlc_h2_frame * vlc_http_msg_h2_frame(const struct vlc_http_msg *m, uint_fast32_t stream_id, bool eos)
Formats an HTTP 2.0 HEADER frame.
Definition: message.c:390
vlc_b64_encode_binary
char * vlc_b64_encode_binary(const uint8_t *src, size_t i_src)
Definition: strings.c:349
vlc_http_msg_add_header
int vlc_http_msg_add_header(struct vlc_http_msg *, const char *name, const char *fmt,...) VLC_FORMAT(3
Formats a header field.
strndup
char * strndup(const char *, size_t)
vlc_memstream_open
int vlc_memstream_open(struct vlc_memstream *ms)
Definition: memstream.c:104
vlc_http_msg_add_atime
int vlc_http_msg_add_atime(struct vlc_http_msg *m)
Adds a Date header field.
Definition: message.c:779
vlc_http_msg_get_atime
time_t vlc_http_msg_get_atime(const struct vlc_http_msg *m)
Gets message date.
Definition: message.c:825
vlc_http_cookies_store
bool vlc_http_cookies_store(vlc_http_cookie_jar_t *p_jar, const char *cookies, const char *host, const char *path)
Parse a value of an incoming Set-Cookie header and append the cookie to the cookie jar if appropriate...
Definition: httpcookies.c:298
vlc_http_msg::payload
struct vlc_http_stream * payload
Definition: message.c:66
vlc_http_msg_get_cookies
void vlc_http_msg_get_cookies(const struct vlc_http_msg *m, vlc_http_cookie_jar_t *jar, const char *host, const char *path)
Definition: message.c:887
vlc_http_days
static const char vlc_http_days[7][4]
Definition: message.c:756
vlc_http_msg_get_agent
const char * vlc_http_msg_get_agent(const struct vlc_http_msg *m)
Gets the agent field.
Definition: message.c:748
vlc_http_msg_get_scheme
const char * vlc_http_msg_get_scheme(const struct vlc_http_msg *m)
Gets request scheme.
Definition: message.c:176
vlc_memstream::stream
FILE * stream
Definition: vlc_memstream.h:65
vlc_http_msg_get_initial
struct vlc_http_msg * vlc_http_msg_get_initial(struct vlc_http_stream *s)
Definition: message.c:274
message.h
vlc_http_req_create
struct vlc_http_msg * vlc_http_req_create(const char *method, const char *scheme, const char *authority, const char *path)
Creates an HTTP request.
Definition: message.c:211
vlc_http_msg::scheme
char * scheme
Definition: message.c:61
vlc_http_msg_get_final
struct vlc_http_msg * vlc_http_msg_get_final(struct vlc_http_msg *m)
Gets final response headers.
Definition: message.c:282
vlc_memstream.h
vlc_http_mktime
static time_t vlc_http_mktime(const char *str)
Definition: message.c:787
vlc_strings.h
vlc_http_msg_get_token
const char * vlc_http_msg_get_token(const struct vlc_http_msg *msg, const char *field, const char *token)
Looks up a token in a header field.
Definition: message.c:662
vlc_http_msg::status
short status
Definition: message.c:59
vlc_http_months
static const char vlc_http_months[12][4]
Definition: message.c:759
VLC_H2_DEFAULT_MAX_FRAME
#define VLC_H2_DEFAULT_MAX_FRAME
Definition: h2frame.h:96
vlc_http_is_token
static bool vlc_http_is_token(const char *)
Definition: message.c:589
vlc_http_msg::headers
char *(* headers)[2]
Definition: message.c:64
max_align_t
Definition: vlc_fixups.h:133
vlc_http_msg_headers
struct vlc_http_msg * vlc_http_msg_headers(const char *msg) VLC_USED
Parses an HTTP 1.1 message header.
Definition: message.c:331
vlc_http_stream
HTTP stream.
Definition: message.h:340
vlc_http_error
void *const vlc_http_error
Error pointer value.
Definition: message.c:55
vlc_http_msg_get_time
time_t vlc_http_msg_get_time(const struct vlc_http_msg *m, const char *name)
Parses a timestamp header field.
Definition: message.c:817
vlc_http_stream_cbs::close
void(* close)(struct vlc_http_stream *, bool abort)
Definition: message.h:336
vlc_http_msg_headers
struct vlc_http_msg * vlc_http_msg_headers(const char *msg)
Parses an HTTP 1.1 message header.
Definition: message.c:331
vlc_http_msg_get_authority
const char * vlc_http_msg_get_authority(const struct vlc_http_msg *m)
Gets request authority.
Definition: message.c:181
vlc_http_msg_attach
void vlc_http_msg_attach(struct vlc_http_msg *m, struct vlc_http_stream *s)
Definition: message.c:257
vlc_http_get_token_value
static char * vlc_http_get_token_value(const char *value, const char *token)
Definition: message.c:621
strdup
char * strdup(const char *)
vlc_http_msg_vadd_header
static int vlc_http_msg_vadd_header(struct vlc_http_msg *m, const char *name, const char *fmt, va_list ap)
Definition: message.c:68
VLC_USED
#define VLC_USED
Definition: fourcc_gen.c:31
vlc_http_msg_add_agent
int vlc_http_msg_add_agent(struct vlc_http_msg *m, const char *str)
Sets the agent field.
Definition: message.c:736
vlc_memstream_puts
int() vlc_memstream_puts(struct vlc_memstream *ms, const char *str)
Definition: memstream.c:149
vlc_h2_frame
Definition: h2frame.h:29
name
const char name[16]
Definition: httpd.c:1249
vlc_http_msg::method
char * method
Definition: message.c:60
vlc_http_msg::path
char * path
Definition: message.c:63
vlc_http_resp_create
struct vlc_http_msg * vlc_http_resp_create(unsigned status)
Creates an HTTP response.
Definition: message.c:239
vlc_http_stream_cbs::read
struct block_t *(* read)(struct vlc_http_stream *)
Definition: message.h:335
vlc_http_msg_get_mtime
time_t vlc_http_msg_get_mtime(const struct vlc_http_msg *m)
Gets resource date.
Definition: message.c:830
unlikely
#define unlikely(p)
Definition: vlc_common.h:114
vlc_memstream_printf
int vlc_memstream_printf(struct vlc_memstream *ms, const char *fmt,...)
Definition: memstream.c:184
vlc_h2_frame_headers
struct vlc_h2_frame * vlc_h2_frame_headers(uint_fast32_t stream_id, uint_fast32_t mtu, bool eos, unsigned count, const char *const headers[][2])
Definition: h2frame.c:155
timegm
time_t timegm(struct tm *)
vlc_http_is_agent
static bool vlc_http_is_agent(const char *s)
Definition: message.c:698
vlc_http_msg_get_header
const char * vlc_http_msg_get_header(const struct vlc_http_msg *m, const char *name)
Looks up an header field.
Definition: message.c:154
vlc_http_msg_get_status
int vlc_http_msg_get_status(const struct vlc_http_msg *m)
Gets response status code.
Definition: message.c:166
vlc_http_msg_read
block_t * vlc_http_msg_read(struct vlc_http_msg *m)
Receives HTTP data.
Definition: message.c:289
vlc_http_msg_add_time
int vlc_http_msg_add_time(struct vlc_http_msg *m, const char *hname, const time_t *t)
Adds a timestamp header field.
Definition: message.c:764
vlc_http_msg_find_header
static ssize_t vlc_http_msg_find_header(const struct vlc_http_msg *m, const char *name)
Definition: message.c:59
vlc_alloc
static void * vlc_alloc(size_t count, size_t size)
Definition: vlc_common.h:948
vlc_http_msg_format
char * vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp, bool proxied) VLC_USED
Formats an HTTP 1.1 message header.
Definition: message.c:299
vlc_http_msg_get_size
uintmax_t vlc_http_msg_get_size(const struct vlc_http_msg *m)
Gets HTTP payload length.
Definition: message.c:858
vlc_http_msg
Definition: message.c:40
vlc_http_msg::authority
char * authority
Definition: message.c:62
vlc_http_msg_format
char * vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp, bool proxied)
Formats an HTTP 1.1 message header.
Definition: message.c:299
h2frame.h
block_t
Definition: vlc_block.h:111
vlc_memstream_close
int vlc_memstream_close(struct vlc_memstream *ms)
Definition: memstream.c:119
vasprintf
int vasprintf(char **, const char *, va_list)
vlc_http_isctext
static int vlc_http_isctext(int c)
Definition: message.c:546
vlc_http_msg_add_cookies
int vlc_http_msg_add_cookies(struct vlc_http_msg *m, vlc_http_cookie_jar_t *jar)
Definition: message.c:899
p
#define p(t)
vlc_http_stream_close
static void vlc_http_stream_close(struct vlc_http_stream *s, bool abort)
Closes an HTTP stream.
Definition: message.h:382