VLC  4.0.0-dev
outfile.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * outfile.h: HTTP write-only file
3  *****************************************************************************
4  * Copyright (C) 2015, 2020 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_outfile Output files
25  * HTTP write-only files
26  * \ingroup http
27  * @{
28  */
29 
30 struct vlc_http_mgr;
31 struct vlc_http_outfile;
32 struct block_t;
33 
34 /**
35  * Creates an HTTP output file.
36  *
37  * @param url URL of the file to write
38  * @param ua user-agent string (NULL to ignore)
39  * @param user username for authentication (NULL to skip)
40  * @param pwd password for authentication (NULL to skip)
41  *
42  * @return an HTTP resource object pointer, or NULL on error
43  */
44 struct vlc_http_outfile *vlc_http_outfile_create(struct vlc_http_mgr *mgr,
45  const char *url, const char *ua, const char *user, const char *pwd);
46 
47 /**
48  * Writes data.
49  */
50 ssize_t vlc_http_outfile_write(struct vlc_http_outfile *, block_t *b);
51 int vlc_http_outfile_close(struct vlc_http_outfile *);
52 
53 /** @} */
vlc_http_authority
char * vlc_http_authority(const char *host, unsigned port)
Formats an authority.
Definition: message.c:573
unlikely
#define unlikely(p)
Predicted false condition.
Definition: vlc_common.h:227
vlc_common.h
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:1005
vlc_http_msg_destroy
void vlc_http_msg_destroy(struct vlc_http_msg *m)
Destroys an HTTP message.
Definition: message.c:193
vlc_http_outfile_close
int vlc_http_outfile_close(struct vlc_http_outfile *f)
Definition: outfile.c:108
vlc_http_msg_iterate
struct vlc_http_msg * vlc_http_msg_iterate(struct vlc_http_msg *m)
Gets next response headers.
Definition: message.c:265
vlc_http_mgr
Definition: connmgr.c:99
vlc_UrlClean
void vlc_UrlClean(vlc_url_t *restrict url)
Definition: url.c:598
vlc_ascii_strcasecmp
static int vlc_ascii_strcasecmp(const char *psz1, const char *psz2)
Compare two ASCII strings ignoring case.
Definition: vlc_strings.h:60
outfile.h
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:783
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:144
vlc_url_t::psz_host
char * psz_host
Definition: vlc_url.h:150
vlc_url_t::psz_protocol
char * psz_protocol
Definition: vlc_url.h:147
vlc_UrlParse
int vlc_UrlParse(vlc_url_t *url, const char *str)
Parses an URI or IRI.
Definition: url.c:558
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:213
vlc_strings.h
vlc_http_msg::status
short status
Definition: message.c:62
vlc_url.h
vlc_url_t
Definition: vlc_url.h:145
vlc_http_mgr_get_jar
struct vlc_http_cookie_jar_t * vlc_http_mgr_get_jar(struct vlc_http_mgr *mgr)
Definition: connmgr.c:285
connmgr.h
vlc_url_t::i_port
unsigned i_port
Definition: vlc_url.h:151
vlc_http_outfile_write
ssize_t vlc_http_outfile_write(struct vlc_http_outfile *f, block_t *b)
Writes data.
Definition: outfile.c:101
vlc_http_msg_get_status
int vlc_http_msg_get_status(const struct vlc_http_msg *m)
Gets response status code.
Definition: message.c:168
vlc_http_msg
Definition: message.c:42
vlc_http_msg::authority
char * authority
Definition: message.c:65
vlc_url_t::psz_path
char * psz_path
Definition: vlc_url.h:152
block_t
Definition: vlc_block.h:117
vlc_http_mgr_request
struct vlc_http_msg * vlc_http_mgr_request(struct vlc_http_mgr *mgr, bool https, const char *host, unsigned port, const struct vlc_http_msg *m, bool idempotent, bool payload)
Sends an HTTP request.
Definition: connmgr.c:273
vlc_http_msg_write
int vlc_http_msg_write(struct vlc_http_msg *m, block_t *block, bool eos)
Sends HTTP data.
Definition: message.c:299
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:946
vlc_http_outfile_create
struct vlc_http_outfile * vlc_http_outfile_create(struct vlc_http_mgr *mgr, const char *uri, const char *ua, const char *user, const char *pwd)
Creates an HTTP output file.
Definition: outfile.c:36