projects
/
project
/
uclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http: make ustream_ssl optional, only use provided ssl context
[project/uclient.git]
/
uclient-example.c
diff --git
a/uclient-example.c
b/uclient-example.c
index
64395fa
..
8c9d3e6
100644
(file)
--- a/
uclient-example.c
+++ b/
uclient-example.c
@@
-15,17
+15,28
@@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <libubox/blobmsg.h>
+
#include <unistd.h>
#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
+#include <libubox/blobmsg.h>
+
#include "uclient.h"
#include "uclient.h"
+
static void example_header_done(struct uclient *cl)
{
struct blob_attr *cur;
static void example_header_done(struct uclient *cl)
{
struct blob_attr *cur;
+ char local[INET6_ADDRSTRLEN], remote[INET6_ADDRSTRLEN];
+ int local_port, remote_port;
int rem;
int rem;
+ uclient_get_addr(local, &local_port, &cl->local_addr);
+ uclient_get_addr(remote, &remote_port, &cl->remote_addr);
+
+ fprintf(stderr, "Connected: %s:%d -> %s:%d\n",
+ local, local_port, remote, remote_port);
+
printf("Headers (%d): \n", cl->status_code);
blobmsg_for_each_attr(cur, cl->meta, rem) {
printf("%s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
printf("Headers (%d): \n", cl->status_code);
blobmsg_for_each_attr(cur, cl->meta, rem) {
printf("%s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
@@
-138,13
+149,13
@@
int main(int argc, char **argv)
uloop_init();
uloop_init();
- cl = uclient_new(argv[0], &cb);
+ cl = uclient_new(argv[0],
NULL,
&cb);
if (!cl) {
fprintf(stderr, "Failed to allocate uclient context\n");
return 1;
}
if (!cl) {
fprintf(stderr, "Failed to allocate uclient context\n");
return 1;
}
- uclient_http_set_ssl_ctx(cl, ctx, verify);
+ uclient_http_set_ssl_ctx(cl,
&ustream_ssl_ops,
ctx, verify);
example_request_sm(cl);
uloop_run();
uloop_done();
example_request_sm(cl);
uloop_run();
uloop_done();