X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuclient.git;a=blobdiff_plain;f=uclient-http.c;h=83eac58f1ea9e24fece60ac7ac259378c0893fa6;hp=05dd3aacf2c676604a79ed004f2ffe0387dbffda;hb=63a984dbdf8a4d1249838e0708a4bed2dfaff476;hpb=316bcc8c62e195a892813b050a922ebd3935eba2;ds=sidebyside diff --git a/uclient-http.c b/uclient-http.c index 05dd3aa..83eac58 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -101,6 +101,7 @@ static const char * const uclient_http_prefix[] = { static int uclient_do_connect(struct uclient_http *uh, const char *port) { + socklen_t sl; int fd; if (uh->uc.url->port) @@ -111,6 +112,14 @@ static int uclient_do_connect(struct uclient_http *uh, const char *port) return -1; ustream_fd_init(&uh->ufd, fd); + + memset(&uh->uc.local_addr, 0, sizeof(uh->uc.local_addr)); + memset(&uh->uc.remote_addr, 0, sizeof(uh->uc.remote_addr)); + + sl = sizeof(uh->uc.local_addr); + getsockname(fd, &uh->uc.local_addr.sa, &sl); + getpeername(fd, &uh->uc.remote_addr.sa, &sl); + return 0; }