Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/miniupnpc/src/miniwget_private.h
9904 views
1
/* $Id: miniwget_private.h,v 1.1 2018/04/06 10:17:58 nanard Exp $ */
2
/* Project : miniupnp
3
* Author : Thomas Bernard
4
* Copyright (c) 2018-2025 Thomas Bernard
5
* This software is subject to the conditions detailed in the
6
* LICENCE file provided in this distribution.
7
* */
8
#ifndef MINIWGET_INTERNAL_H_INCLUDED
9
#define MINIWGET_INTERNAL_H_INCLUDED
10
11
/*! \file miniwget_private.h
12
* \brief Lightweight HTTP client private API
13
*/
14
#include "miniupnpc_socketdef.h"
15
16
/*! \brief Read a HTTP response from a socket
17
*
18
* Processed HTTP headers :
19
* - `Content-Length`
20
* - `Transfer-encoding`
21
* return a pointer to the content buffer, which length is saved
22
* to the length parameter.
23
* \param[in] s socket
24
* \param[out] size returned content buffer size
25
* \param[out] status_code HTTP Status code
26
* \return malloc'ed content buffer
27
*/
28
void * getHTTPResponse(SOCKET s, int * size, int * status_code);
29
30
/*! \brief parse a HTTP URL
31
*
32
* URL formats supported :
33
* - `http://192.168.1.1/path/xxx`
34
* - `http://192.168.1.1:8080/path/xxx`
35
* - `http://[2a00:1234:5678:90ab::123]/path/xxx`
36
* - `http://[2a00:1234:5678:90ab::123]:8080/path/xxx`
37
* - `http://[fe80::1234:5678:90ab%%eth0]/path/xxx`
38
* - `http://[fe80::1234:5678:90ab%%eth0]:8080/path/xxx`
39
*
40
* `%` may be encoded as `%25`
41
*
42
* \param[in] url URL to parse
43
* \param[out] hostname hostname part of the URL (size of MAXHOSTNAMELEN+1)
44
* \param[out] port set to the port specified in the URL or 80
45
* \param[out] path set to the begining of the path part of the URL
46
* \param[out] scope_id set to the interface id if specified in the
47
* link-local IPv6 address
48
* \return 0 for failure, 1 for success
49
*/
50
int parseURL(const char * url,
51
char * hostname, unsigned short * port, char * * path,
52
unsigned int * scope_id);
53
54
#endif
55
56