mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Minor header tweaks.
This commit is contained in:
parent
ec07b0c59d
commit
463439283a
4 changed files with 31 additions and 25 deletions
20
http.c
20
http.c
|
@ -11,19 +11,19 @@
|
|||
|
||||
#include "snac.h"
|
||||
|
||||
d_char *http_signed_request(snac *snac, char *method, char *url,
|
||||
d_char *headers,
|
||||
d_char *body, int b_size,
|
||||
int *status, d_char **payload, int *p_size,
|
||||
xs_dict *http_signed_request(snac *snac, const char *method, const char *url,
|
||||
xs_dict *headers,
|
||||
const char *body, int b_size,
|
||||
int *status, xs_str **payload, int *p_size,
|
||||
int timeout)
|
||||
/* does a signed HTTP request */
|
||||
{
|
||||
xs *l1;
|
||||
xs *date;
|
||||
xs *digest;
|
||||
xs *s64;
|
||||
xs *signature;
|
||||
xs *hdrs;
|
||||
xs *l1 = NULL;
|
||||
xs *date = NULL;
|
||||
xs *digest = NULL;
|
||||
xs *s64 = NULL;
|
||||
xs *signature = NULL;
|
||||
xs *hdrs = NULL;
|
||||
char *host;
|
||||
char *target;
|
||||
char *seckey;
|
||||
|
|
6
snac.c
6
snac.c
|
@ -138,8 +138,10 @@ int check_password(const char *uid, const char *passwd, const char *hash)
|
|||
}
|
||||
|
||||
|
||||
void srv_archive(char *direction, char *req, char *payload, int p_size,
|
||||
int status, char *headers, char *body, int b_size)
|
||||
void srv_archive(const char *direction, xs_dict *req,
|
||||
const char *payload, int p_size,
|
||||
int status, xs_dict *headers,
|
||||
const char *body, int b_size)
|
||||
/* archives a connection */
|
||||
{
|
||||
/* obsessive archiving */
|
||||
|
|
14
snac.h
14
snac.h
|
@ -46,8 +46,10 @@ int validate_uid(const char *uid);
|
|||
d_char *hash_password(const char *uid, const char *passwd, const char *nonce);
|
||||
int check_password(const char *uid, const char *passwd, const char *hash);
|
||||
|
||||
void srv_archive(char *direction, char *req, char *payload, int p_size,
|
||||
int status, char *headers, char *body, int b_size);
|
||||
void srv_archive(const char *direction, xs_dict *req,
|
||||
const char *payload, int p_size,
|
||||
int status, xs_dict *headers,
|
||||
const char *body, int b_size);
|
||||
|
||||
double mtime_nl(const char *fn, int *n_link);
|
||||
#define mtime(fn) mtime_nl(fn, NULL)
|
||||
|
@ -133,10 +135,10 @@ d_char *dequeue(snac *snac, char *fn);
|
|||
void purge(snac *snac);
|
||||
void purge_all(void);
|
||||
|
||||
d_char *http_signed_request(snac *snac, char *method, char *url,
|
||||
d_char *headers,
|
||||
d_char *body, int b_size,
|
||||
int *status, d_char **payload, int *p_size,
|
||||
xs_dict *http_signed_request(snac *snac, const char *method, const char *url,
|
||||
xs_dict *headers,
|
||||
const char *body, int b_size,
|
||||
int *status, xs_str **payload, int *p_size,
|
||||
int timeout);
|
||||
int check_signature(snac *snac, char *req);
|
||||
|
||||
|
|
14
xs_curl.h
14
xs_curl.h
|
@ -4,8 +4,9 @@
|
|||
|
||||
#define _XS_CURL_H
|
||||
|
||||
xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
|
||||
xs_str *body, int b_size, int *status,
|
||||
xs_dict *xs_http_request(const char *method, const char *url,
|
||||
const xs_dict *headers,
|
||||
const xs_str *body, int b_size, int *status,
|
||||
xs_str **payload, int *p_size, int timeout);
|
||||
|
||||
#ifdef XS_IMPLEMENTATION
|
||||
|
@ -83,8 +84,9 @@ static int _post_callback(char *buffer, size_t size,
|
|||
}
|
||||
|
||||
|
||||
xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
|
||||
xs_str *body, int b_size, int *status,
|
||||
xs_dict *xs_http_request(const char *method, const char *url,
|
||||
const xs_dict *headers,
|
||||
const xs_str *body, int b_size, int *status,
|
||||
xs_str **payload, int *p_size, int timeout)
|
||||
/* does an HTTP request */
|
||||
{
|
||||
|
@ -136,7 +138,7 @@ xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
|
|||
sprintf(tmp, "content-length: %d", b_size);
|
||||
list = curl_slist_append(list, tmp);
|
||||
|
||||
pd.data = body;
|
||||
pd.data = (char *)body;
|
||||
pd.size = b_size;
|
||||
pd.offset = 0;
|
||||
|
||||
|
@ -146,7 +148,7 @@ xs_dict *xs_http_request(char *method, char *url, xs_dict *headers,
|
|||
}
|
||||
|
||||
/* fill the request headers */
|
||||
p = headers;
|
||||
p = (xs_dict *)headers;
|
||||
while (xs_dict_iter(&p, &k, &v)) {
|
||||
xs *h = xs_fmt("%s: %s", k, v);
|
||||
|
||||
|
|
Loading…
Reference in a new issue