-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTinyHTTP.h
More file actions
38 lines (28 loc) · 863 Bytes
/
Copy pathTinyHTTP.h
File metadata and controls
38 lines (28 loc) · 863 Bytes
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
/*
* mbed Tiny HTTP Client
* Copyright (c) 2011 Hiroshi Suga
* Released under the MIT License: http://mbed.org/license/mit
*/
/** @file
* @brief Tiny HTTP Client
*/
#ifndef TinyHTTP_h
#define TinyHTTP_h
#define DEBUG
#define HTTP_PORT 80
#define HTTP_TIMEOUT 15000 // ms
#define METHOD_GET 0
#define METHOD_POST 1
/** send http request
* @param method METHOD_GET or METHOD_POST
* @param host http server
* @param uri URI
* @param head http header (CR+LF) (or NULL)
* @param body POST body (or NULL)
* @return http code, -1:failue
*/
int httpRequest (int method, Host *host, char *uri, char *head, char *body);
void createauth (char *user, char *pwd, char *buf, int len);
int base64enc(const char *input, unsigned int length, char *output, int len);
int urlencode(char *str, char *buf, int len);
#endif