forked from atiti/pam_cas-reloaded
-
Notifications
You must be signed in to change notification settings - Fork 0
/
url.h
39 lines (31 loc) · 888 Bytes
/
url.h
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
#ifndef _H_URL_
#define _H_URL_
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <string.h>
#include <syslog.h>
#ifndef LOG_MSG
// Lets do some syslogging
#define LOG_MSG(DEST, FORMAT, ...) \
syslog(DEST, "%s:%d: " FORMAT, __FILE__, __LINE__, ##__VA_ARGS__)
#endif
struct string {
char *ptr;
size_t len;
};
struct URL_Request {
CURL *curl;
CURLcode res;
struct curl_httppost *formpost;
struct curl_httppost *lastptr;
struct curl_slist *headerlist;
};
void URL_init(struct URL_Request *u);
void init_string(struct string *s);
void URL_add_form(struct URL_Request *u, char *name, char *val);
void URL_add_header(struct URL_Request *u, char *header);
int URL_GET_request(struct URL_Request *u, char *url, struct string *s);
int URL_POST_request(struct URL_Request *u, char *url, struct string *s);
void URL_cleanup(struct URL_Request *u);
#endif