From owner-svn-src-stable@FreeBSD.ORG Sun Jul 20 01:03:09 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 632C3E25; Sun, 20 Jul 2014 01:03:09 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id A4C972FEA; Sun, 20 Jul 2014 01:03:08 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 5960520E7088C; Sun, 20 Jul 2014 01:03:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.multiplay.co.uk X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=8.0 tests=AWL,BAYES_00,DOS_OE_TO_MX, FSL_HELO_NON_FQDN_1,HELO_NO_DOMAIN,RDNS_DYNAMIC,STOX_REPLY_TYPE autolearn=no version=3.3.1 Received: from r2d2 (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTPS id 5A1D620E7088A; Sun, 20 Jul 2014 01:02:57 +0000 (UTC) Message-ID: <32EEE9A6E8FE4D6FBE0E8CD53F2709CE@multiplay.co.uk> From: "Steven Hartland" To: "Baptiste Daroussin" , , , , References: <201407200029.s6K0TgEU074162@svn.freebsd.org> Subject: Re: svn commit: r268900 - stable/10/lib/libfetch Date: Sun, 20 Jul 2014 02:02:48 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 01:03:09 -0000 poll isnt documented as ever returning EAGAIN, are the docs for poll incorrect or does that part of this patch require reverting? Regards Steve ----- Original Message ----- From: "Baptiste Daroussin" To: ; ; ; Sent: Sunday, July 20, 2014 1:29 AM Subject: svn commit: r268900 - stable/10/lib/libfetch > Author: bapt > Date: Sun Jul 20 00:29:41 2014 > New Revision: 268900 > URL: http://svnweb.freebsd.org/changeset/base/268900 > > Log: > MFC: r267131, r267132, r267133, r268493, r268671 > > Use NULL instead of 0 (Patch by Sascha Wildner for Dragonfly) > Remove unnecessary semicolons (Patch by Sascha Wildner for Dragonfly) > Add support for arbitrary http requests [1] > Support EAGAIN in fetch_writev > > Submitted by: Alex Hornung [1] > Reviewed by: des > > Modified: > stable/10/lib/libfetch/common.c > stable/10/lib/libfetch/common.h > stable/10/lib/libfetch/fetch.h > stable/10/lib/libfetch/http.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/lib/libfetch/common.c > ============================================================================== > --- stable/10/lib/libfetch/common.c Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/common.c Sun Jul 20 00:29:41 2014 (r268900) > @@ -1110,6 +1110,9 @@ fetch_writev(conn_t *conn, struct iovec > errno = 0; > pfd.revents = 0; > if (poll(&pfd, 1, deltams) < 0) { > + /* POSIX compliance */ > + if (errno == EAGAIN) > + continue; > if (errno == EINTR && fetchRestartCalls) > continue; > return (-1); > > Modified: stable/10/lib/libfetch/common.h > ============================================================================== > --- stable/10/lib/libfetch/common.h Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/common.h Sun Jul 20 00:29:41 2014 (r268900) > @@ -117,6 +117,9 @@ int fetch_no_proxy_match(const char *) > */ > FILE *http_request(struct url *, const char *, > struct url_stat *, struct url *, const char *); > +FILE *http_request_body(struct url *, const char *, > + struct url_stat *, struct url *, const char *, > + const char *, const char *); > FILE *ftp_request(struct url *, const char *, > struct url_stat *, struct url *, const char *); > > > Modified: stable/10/lib/libfetch/fetch.h > ============================================================================== > --- stable/10/lib/libfetch/fetch.h Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/fetch.h Sun Jul 20 00:29:41 2014 (r268900) > @@ -102,6 +102,8 @@ FILE *fetchGetHTTP(struct url *, const > FILE *fetchPutHTTP(struct url *, const char *); > int fetchStatHTTP(struct url *, struct url_stat *, const char *); > struct url_ent *fetchListHTTP(struct url *, const char *); > +FILE *fetchReqHTTP(struct url *, const char *, const char *, > + const char *, const char *); > > /* FTP-specific functions */ > FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); > > Modified: stable/10/lib/libfetch/http.c > ============================================================================== > --- stable/10/lib/libfetch/http.c Sun Jul 20 00:21:38 2014 (r268899) > +++ stable/10/lib/libfetch/http.c Sun Jul 20 00:29:41 2014 (r268900) > @@ -1030,7 +1030,7 @@ typedef struct { > static void > init_http_auth_params(http_auth_params_t *s) > { > - s->scheme = s->realm = s->user = s->password = 0; > + s->scheme = s->realm = s->user = s->password = NULL; > } > > static void > @@ -1129,7 +1129,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) > Hex[i*2] = hexchars[j]; > j = Bin[i] & 0xf; > Hex[i*2+1] = hexchars[j]; > - }; > + } > Hex[HASHHEXLEN] = '\0'; > }; > > @@ -1164,7 +1164,7 @@ DigestCalcHA1( > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); > MD5Final(HA1, &Md5Ctx); > - }; > + } > CvtHex(HA1, SessionKey); > } > > @@ -1198,7 +1198,7 @@ DigestCalcResponse( > if (strcasecmp(pszQop, "auth-int") == 0) { > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, HEntity, HASHHEXLEN); > - }; > + } > MD5Final(HA2, &Md5Ctx); > CvtHex(HA2, HA2Hex); > > @@ -1215,7 +1215,7 @@ DigestCalcResponse( > MD5Update(&Md5Ctx, ":", 1); > MD5Update(&Md5Ctx, pszQop, strlen(pszQop)); > MD5Update(&Md5Ctx, ":", 1); > - }; > + } > MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN); > MD5Final(RespHash, &Md5Ctx); > CvtHex(RespHash, Response); > @@ -1249,7 +1249,7 @@ http_digest_auth(conn_t *conn, const cha > int r; > char noncecount[10]; > char cnonce[40]; > - char *options = 0; > + char *options = NULL; > > if (!c->realm || !c->nonce) { > DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); > @@ -1494,6 +1494,14 @@ http_print_html(FILE *out, FILE *in) > * Core > */ > > +FILE * > +http_request(struct url *URL, const char *op, struct url_stat *us, > + struct url *purl, const char *flags) > +{ > + > + return (http_request_body(URL, op, us, purl, flags, NULL, NULL)); > +} > + > /* > * Send a request and process the reply > * > @@ -1501,8 +1509,9 @@ http_print_html(FILE *out, FILE *in) > * XXX off into a separate function. > */ > FILE * > -http_request(struct url *URL, const char *op, struct url_stat *us, > - struct url *purl, const char *flags) > +http_request_body(struct url *URL, const char *op, struct url_stat *us, > + struct url *purl, const char *flags, const char *content_type, > + const char *body) > { > char timebuf[80]; > char hbuf[MAXHOSTNAMELEN + 7], *host; > @@ -1519,6 +1528,7 @@ http_request(struct url *URL, const char > http_headerbuf_t headerbuf; > http_auth_challenges_t server_challenges; > http_auth_challenges_t proxy_challenges; > + size_t body_len; > > /* The following calls don't allocate anything */ > init_http_headerbuf(&headerbuf); > @@ -1690,8 +1700,19 @@ http_request(struct url *URL, const char > if (url->offset > 0) > http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); > http_cmd(conn, "Connection: close"); > + > + if (body) { > + body_len = strlen(body); > + http_cmd(conn, "Content-Length: %zu", body_len); > + if (content_type != NULL) > + http_cmd(conn, "Content-Type: %s", content_type); > + } > + > http_cmd(conn, ""); > > + if (body) > + fetch_write(conn, body, body_len); > + > /* > * Force the queued request to be dispatched. Normally, one > * would do this with shutdown(2) but squid proxies can be > @@ -2042,3 +2063,12 @@ fetchListHTTP(struct url *url __unused, > warnx("fetchListHTTP(): not implemented"); > return (NULL); > } > + > +FILE * > +fetchReqHTTP(struct url *URL, const char *method, const char *flags, > + const char *content_type, const char *body) > +{ > + > + return (http_request_body(URL, method, NULL, http_get_proxy(URL, flags), > + flags, content_type, body)); > +} > >