VirtualBox

source: vbox/trunk/include/iprt/http.h@ 45331

Last change on this file since 45331 was 45331, checked in by vboxsync, 12 years ago

Runtime/http: add new function to set the filename containing the trusted root certificates, plus an extension of the testcase which fetches the root certificates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: http.h 45331 2013-04-04 09:37:00Z vboxsync $ */
2/** @file
3 * IPRT - Simple HTTP Communication API.
4 */
5
6/*
7 * Copyright (C) 2012-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___iprt_http_h
28#define ___iprt_http_h
29
30#include <iprt/types.h>
31
32RT_C_DECLS_BEGIN
33
34/** @defgroup grp_rt_http RTHttp - Simple HTTP API
35 * @ingroup grp_rt
36 * @{
37 */
38
39/** @todo the following three definitions may move the iprt/types.h later. */
40/** RTHTTP interface handle. */
41typedef R3PTRTYPE(struct RTHTTPINTERNAL *) RTHTTP;
42/** Pointer to a RTHTTP interface handle. */
43typedef RTHTTP *PRTHTTP;
44/** Nil RTHTTP interface handle. */
45#define NIL_RTHTTP ((RTHTTP)0)
46
47
48/**
49 * Creates a HTTP interface handle.
50 *
51 * @returns iprt status code.
52 *
53 * @param phHttp Where to store the HTTP handle.
54 */
55RTR3DECL(int) RTHttpCreate(PRTHTTP phHttp);
56
57/**
58 * Destroys a HTTP interface handle.
59 *
60 * @param hHttp Handle to the HTTP interface.
61 */
62RTR3DECL(void) RTHttpDestroy(RTHTTP hHttp);
63
64/**
65 * Perform a simple blocking HTTP request.
66 *
67 * @returns iprt status code.
68 *
69 * @param hHttp HTTP interface handle.
70 * @param pcszUrl URL.
71 * @param ppszResponse HTTP response.
72 */
73RTR3DECL(int) RTHttpGet(RTHTTP hHttp, const char *pcszUrl, char **ppszResponse);
74
75/**
76 * Specify proxy settings.
77 *
78 * @returns iprt status code.
79 *
80 * @param hHttp HTTP interface handle.
81 * @param pcszProxy URL of the proxy
82 * @param uPort port number of the proxy, use 0 for not specifying a port.
83 * @param pcszUser username, pass NULL for no authentication
84 * @param pcszPwd password, pass NULL for no authentication
85 */
86RTR3DECL(int) RTHttpSetProxy(RTHTTP hHttp, const char *pcszProxyUrl, uint32_t uPort,
87 const char *pcszProxyUser, const char *pcszProxyPwd);
88
89/**
90 * Set custom headers.
91 *
92 * @returns iprt status code.
93 *
94 * @param hHttp HTTP interface handle.
95 * @param cHeaders number of custom headers.
96 * @param pcszHeaders array of headers in form "foo: bar".
97 */
98RTR3DECL(int) RTHttpSetHeaders(RTHTTP hHttp, uint32_t cHeaders, const char *pcszHeaders[]);
99
100/**
101 * Set a custom certification authority file, containing root certificates.
102 *
103 * @returns iprt status code.
104 *
105 * @param hHttp HTTP interface handle.
106 * @param pcszCAFile File name containing root certificates.
107 */
108RTR3DECL(int) RTHttpSetCAFile(RTHTTP hHttp, const char *pcszCAFile);
109/** @} */
110
111RT_C_DECLS_END
112
113#endif
114
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette