]> Nishi Git Mirror - libw3.git/commitdiff
format and nntp
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Wed, 14 Feb 2024 05:59:11 +0000 (05:59 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Wed, 14 Feb 2024 05:59:11 +0000 (05:59 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@219 d27a3e52-49c5-7645-884c-6793ebffc270

Example/nntp-list/nntp-list.c
Library/FTP.c
Library/URL.c
W3Version.h.p

index 10201b7fdd5a565af3295a4c28c2465d9e571a4f..7fd4acf357e868b65c2c1723416c15ebdd140b35 100644 (file)
@@ -22,11 +22,7 @@ struct W3URL* w3url;
 void resp_handler(struct W3* w3, int status, char* data) {
        printf("%d\n%s\n", status, data);
        if(status == 230) {
-               W3_Set_Method(w3, "CWD");
-               W3_Set_Path(w3, w3url->path);
-               W3_FTP_Send_Request(w3);
                W3_Set_Method(w3, "LIST");
-               W3_Set_Path(w3, "/");
                W3_FTP_Send_Request(w3);
        } else if(status == 226) {
                W3_FTP_Disconnect(w3);
@@ -43,22 +39,7 @@ int main(int argc, char** argv) {
        W3_Library_Init();
        w3url = W3_Parse_URL(argv[1]);
        if(w3url != NULL) {
-               bool err = false;
-               if(w3url->username == NULL) {
-                       err = true;
-                       fprintf(stderr, "%s: missing username\n", argv[0]);
-               }
-               if(w3url->password == NULL) {
-                       err = true;
-                       fprintf(stderr, "%s: missing password\n", argv[0]);
-               }
-               if(err) {
-                       W3_Free_URL(w3url);
-                       return 1;
-               }
-               struct W3* w3 = W3_Create("ftp", w3url->host, w3url->port);
-               W3_FTP_Set_Username(w3, w3url->username);
-               W3_FTP_Set_Password(w3, w3url->password);
+               struct W3* w3 = W3_Create("nntp", w3url->host, w3url->port);
                W3_On(w3, "ftpresp", resp_handler);
                W3_On(w3, "data", data_handler);
                W3_Send_Request(w3);
index b4b2157404ab81c9868015d18694e378b7aabf74..930c05b4f33229e376f21e51a9a319f9f7466f28 100644 (file)
@@ -136,7 +136,8 @@ void __W3_FTP_Request(struct W3* w3) {
                                                        free(numbuf);
                                                        pasvsock = __W3_DNS_Connect(addr, false, port
 #ifdef SSL_SUPPORT
-                                                                       ,NULL, NULL
+                                                                                   ,
+                                                                                   NULL, NULL
 #endif
                                                        );
                                                        free(addr);
index cf214b6ba89bc0449e7e67b2df6906157060e25e..9f31c1a3cb69e4394ba1520963746be0242e66a9 100644 (file)
@@ -128,6 +128,8 @@ struct W3URL* W3_Parse_URL(const char* _url) {
                                        r->port = 1900;
                                } else if(strcmp(r->protocol, "ftp") == 0) {
                                        r->port = 21;
+                               } else if(strcmp(r->protocol, "nntp") == 0) {
+                                       r->port = 119;
                                }
                        }
                        r->host = __W3_Strdup(url + start + (atmark == 0 ? 0 : (atmark - 1)));
index 00c99186ce99081b6486a2ff7f5e7c5beeb742d0..0b0ff38e3e9bc19b506a349a6e69dba7b9870c8f 100644 (file)
@@ -6,7 +6,7 @@
 extern "C" {
 #endif
 
-#define LIBW3_VERSION "2.12C" \
+#define LIBW3_VERSION "2.12D" \
 SUFFIX
 
 #ifdef __cplusplus