From: nishi Date: Wed, 17 Jan 2024 12:39:27 +0000 (+0000) Subject: fetch X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=fea8ffda70144ed4c27f97ceea36c161bbfd020f;p=libw3.git fetch git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@24 d27a3e52-49c5-7645-884c-6793ebffc270 --- diff --git a/Example/fetch.c b/Example/fetch.c index aa5f942..b8b7dd7 100644 --- a/Example/fetch.c +++ b/Example/fetch.c @@ -1,7 +1,7 @@ -/* $Id$ +/* + * $Id$ * * Fetch a file using libw3. - * */ #include @@ -10,15 +10,14 @@ #include int main(int argc, char** argv){ - if(argc < 2){ - fprintf(stderr, "Usage: %s URL\n", argv[0]); + if(argc < 3){ + fprintf(stderr, "Usage: %s URL Path\n", argv[0]); return 1; } W3_Library_Init(); struct W3* w3 = W3_Create("http", argv[1], 80); W3_Set_Method(w3, "GET"); - W3_Set_Path(w3, "/sunhttpd"); - //W3_Set_Header(w3, "User-Agent", "W3-Fetch"); + W3_Set_Path(w3, argv[2]); W3_Send_Request(w3); W3_Free(w3); } diff --git a/Library/HTTP.c b/Library/HTTP.c index 6e7ca02..8e9deeb 100644 --- a/Library/HTTP.c +++ b/Library/HTTP.c @@ -5,6 +5,7 @@ #include "W3Util.h" #include +#include void __W3_HTTP_Request(struct W3* w3){ __W3_Debug("LibW3-HTTP", "Sending the request");