svn commit: r352042 - stable/12/lib/libfetch
Mark Johnston
markj at FreeBSD.org
Sun Sep 8 20:41:01 UTC 2019
Author: markj
Date: Sun Sep 8 20:41:00 2019
New Revision: 352042
URL: https://svnweb.freebsd.org/changeset/base/352042
Log:
MFC r351573:
Document fetchReqHTTP().
Modified:
stable/12/lib/libfetch/Makefile
stable/12/lib/libfetch/fetch.3
stable/12/lib/libfetch/http.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/lib/libfetch/Makefile
==============================================================================
--- stable/12/lib/libfetch/Makefile Sun Sep 8 20:39:55 2019 (r352041)
+++ stable/12/lib/libfetch/Makefile Sun Sep 8 20:41:00 2019 (r352042)
@@ -68,6 +68,7 @@ MLINKS+= fetch.3 fetchPutFTP.3
MLINKS+= fetch.3 fetchPutFile.3
MLINKS+= fetch.3 fetchPutHTTP.3
MLINKS+= fetch.3 fetchPutURL.3
+MLINKS+= fetch.3 fetchReqHTTP.3
MLINKS+= fetch.3 fetchStat.3
MLINKS+= fetch.3 fetchStatFTP.3
MLINKS+= fetch.3 fetchStatFile.3
Modified: stable/12/lib/libfetch/fetch.3
==============================================================================
--- stable/12/lib/libfetch/fetch.3 Sun Sep 8 20:39:55 2019 (r352041)
+++ stable/12/lib/libfetch/fetch.3 Sun Sep 8 20:41:00 2019 (r352042)
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 18, 2016
+.Dd August 28, 2019
.Dt FETCH 3
.Os
.Sh NAME
@@ -53,6 +53,7 @@
.Nm fetchPutHTTP ,
.Nm fetchStatHTTP ,
.Nm fetchListHTTP ,
+.Nm fetchReqHTTP ,
.Nm fetchXGetFTP ,
.Nm fetchGetFTP ,
.Nm fetchPutFTP ,
@@ -112,6 +113,8 @@
.Ft struct url_ent *
.Fn fetchListHTTP "struct url *u" "const char *flags"
.Ft FILE *
+.Fn fetchReqHTTP "struct url *u" "const char *method" "const char *flags" "const char *content_type" "const char *body"
+.Ft FILE *
.Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags"
.Ft FILE *
.Fn fetchGetFTP "struct url *u" "const char *flags"
@@ -355,9 +358,10 @@ and password "anonymous@<hostname>".
.Sh HTTP SCHEME
The
.Fn fetchXGetHTTP ,
-.Fn fetchGetHTTP
-and
+.Fn fetchGetHTTP ,
.Fn fetchPutHTTP
+and
+.Fn fetchReqHTTP
functions implement the HTTP/1.1 protocol.
With a little luck, there is
even a chance that they comply with RFC2616 and RFC2617.
@@ -386,6 +390,18 @@ will send a conditional
.Li If-Modified-Since
HTTP header to only fetch the content if it is newer than
.Va ims_time .
+.Pp
+The function
+.Fn fetchReqHTTP
+can be used to make requests with an arbitrary HTTP verb,
+including POST, DELETE, CONNECT, OPTIONS, TRACE or PATCH.
+This can be done by setting the argument
+.Fa method
+to the intended verb, such as
+.Ql POST ,
+and
+.Fa body
+to the content.
.Pp
Since there seems to be no good way of implementing the HTTP PUT
method in a manner consistent with the rest of the
Modified: stable/12/lib/libfetch/http.c
==============================================================================
--- stable/12/lib/libfetch/http.c Sun Sep 8 20:39:55 2019 (r352041)
+++ stable/12/lib/libfetch/http.c Sun Sep 8 20:41:00 2019 (r352042)
@@ -2093,6 +2093,9 @@ fetchListHTTP(struct url *url __unused, const char *fl
return (NULL);
}
+/*
+ * Arbitrary HTTP verb and content requests
+ */
FILE *
fetchReqHTTP(struct url *URL, const char *method, const char *flags,
const char *content_type, const char *body)
More information about the svn-src-stable
mailing list