diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-08-31 23:08:50 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2016-08-31 23:08:50 +0000 |
commit | b452e6673418529cb58308526eb6dfd320147e24 (patch) | |
tree | eee9c31b487b68b0360b1e14973dae290ef0af63 /usr.sbin | |
parent | c4f1c6f04393c27a5333533c5fdfb3f78bc669e3 (diff) |
whitespace
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/acme-client/http.c | 49 | ||||
-rw-r--r-- | usr.sbin/acme-client/http.h | 10 |
2 files changed, 30 insertions, 29 deletions
diff --git a/usr.sbin/acme-client/http.c b/usr.sbin/acme-client/http.c index 5decd0db66f..cae7c743279 100644 --- a/usr.sbin/acme-client/http.c +++ b/usr.sbin/acme-client/http.c @@ -1,4 +1,4 @@ -/* $Id: http.c,v 1.3 2016/08/31 23:00:17 benno Exp $ */ +/* $Id: http.c,v 1.4 2016/08/31 23:08:49 benno Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -41,28 +41,28 @@ * A buffer for transferring HTTP/S data. */ struct httpxfer { - char *hbuf; /* header transfer buffer */ - size_t hbufsz; /* header buffer size */ - int headok; /* header has been parsed */ - char *bbuf; /* body transfer buffer */ - size_t bbufsz; /* body buffer size */ - int bodyok; /* body has been parsed */ + char *hbuf; /* header transfer buffer */ + size_t hbufsz; /* header buffer size */ + int headok; /* header has been parsed */ + char *bbuf; /* body transfer buffer */ + size_t bbufsz; /* body buffer size */ + int bodyok; /* body has been parsed */ char *headbuf; /* lookaside buffer for headers */ - struct httphead *head; /* parsed headers */ - size_t headsz; /* number of headers */ + struct httphead *head; /* parsed headers */ + size_t headsz; /* number of headers */ }; /* * An HTTP/S connection object. */ struct http { - int fd; /* connected socket */ - short port; /* port number */ - struct source src; /* endpoint (raw) host */ - char *path; /* path to request */ - char *host; /* name of endpoint host */ - struct tls_config *cfg; /* if TLS */ - struct tls *ctx; /* if TLS */ + int fd; /* connected socket */ + short port; /* port number */ + struct source src; /* endpoint (raw) host */ + char *path; /* path to request */ + char *host; /* name of endpoint host */ + struct tls_config *cfg; /* if TLS */ + struct tls *ctx; /* if TLS */ writefp writer; /* write function */ readfp reader; /* read function */ }; @@ -375,7 +375,7 @@ again: tls_config_insecure_noverifycert(http->cfg); if (-1 == tls_config_set_ciphers(http->cfg, "compat")) { - warn("tls_config_set_ciphers"); + warn("tls_config_set_ciphers"); goto err; } else if (NULL == (http->ctx = tls_client())) { warn("tls_client"); @@ -612,7 +612,7 @@ http_head_parse(const struct http *http, hsz = 0; cp = buf; - do { + do { if (NULL != (ep = strstr(cp, "\r\n"))) { *ep = '\0'; ep += 2; @@ -651,7 +651,7 @@ http_head_parse(const struct http *http, * You must not free the returned pointer. */ char * -http_head_read(const struct http *http, +http_head_read(const struct http *http, struct httpxfer *trans, size_t *sz) { char buf[BUFSIZ]; @@ -775,10 +775,10 @@ http_get(const struct source *addrs, size_t addrsz, http_close(x); http_free(h); return (NULL); - } + } http_disconnect(h); - + if (NULL == (head = http_head_parse(h, x, &headsz))) { http_close(x); http_free(h); @@ -833,16 +833,17 @@ main(void) #if 0 g = http_get(addrs, addrsz, "localhost", 80, "/index.html"); #else - g = http_get(addrs, addrsz, "www.google.ch", 80, "/index.html", NULL, 0); + g = http_get(addrs, addrsz, "www.google.ch", 80, "/index.html", + NULL, 0); #endif - if (NULL == g) + if (NULL == g) errx(EXIT_FAILURE, "http_get"); httph = http_head_parse(g->http, g->xfer, &httphsz); warnx("code: %d", g->code); - for (i = 0; i < httphsz; i++) + for (i = 0; i < httphsz; i++) warnx("head: [%s]=[%s]", httph[i].key, httph[i].val); http_get_free(g); diff --git a/usr.sbin/acme-client/http.h b/usr.sbin/acme-client/http.h index 9ed1d163595..53bb91c65d9 100644 --- a/usr.sbin/acme-client/http.h +++ b/usr.sbin/acme-client/http.h @@ -1,4 +1,4 @@ -/* $Id: http.h,v 1.1 2016/08/31 22:01:42 florian Exp $ */ +/* $Id: http.h,v 1.2 2016/08/31 23:08:49 benno Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -33,7 +33,7 @@ struct http; typedef ssize_t (*writefp)(const void *, size_t, const struct http *); typedef ssize_t (*readfp)(char *, size_t, const struct http *); -/* +/* * HTTP/S header pair. * There's also a cooked-up pair, "Status", with the status code. * Both strings are nil-terminated. @@ -70,7 +70,7 @@ struct httpget *http_get(const struct source *, size_t, void http_get_free(struct httpget *); /* Allocation and release. */ -struct http *http_alloc(const struct source *, size_t, +struct http *http_alloc(const struct source *, size_t, const char *, short, const char *); void http_free(struct http *); struct httpxfer *http_open(const struct http *, const void *, size_t); @@ -78,11 +78,11 @@ void http_close(struct httpxfer *); void http_disconnect(struct http *); /* Access. */ -char *http_head_read(const struct http *, +char *http_head_read(const struct http *, struct httpxfer *, size_t *); struct httphead *http_head_parse(const struct http *, struct httpxfer *, size_t *); -char *http_body_read(const struct http *, +char *http_body_read(const struct http *, struct httpxfer *, size_t *); int http_head_status(const struct http *, struct httphead *, size_t); |