From ae1912cb0d494b48d514d937826c9fe83ec96c4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 29 Dec 1999 14:20:26 +0000 Subject: Initial revision --- lib/dict.c | 245 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 lib/dict.c (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c new file mode 100644 index 000000000..e26437022 --- /dev/null +++ b/lib/dict.c @@ -0,0 +1,245 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Curl. + * + * The Initial Developer of the Original Code is Daniel Stenberg. + * + * Portions created by the Initial Developer are Copyright (C) 1998. + * All Rights Reserved. + * + * ------------------------------------------------------------ + * Main author: + * - Daniel Stenberg + * + * http://curl.haxx.nu + * + * $Source$ + * $Revision$ + * $Date$ + * $Author$ + * $State$ + * $Locker$ + * + * ------------------------------------------------------------ + ****************************************************************************/ + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "setup.h" + +#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) +#include +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#include +#include + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + + +#endif + +#include "urldata.h" +#include +#include "download.h" +#include "sendf.h" + +#include "progress.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + + +UrgError dict(struct UrlData *data, char *path, long *bytecount) +{ + int nth; + char *word; + char *ppath; + char *database = NULL; + char *strategy = NULL; + char *nthdef = NULL; /* This is not part of the protocol, but required + by RFC 2229 */ + UrgError result=URG_OK; + + if(data->conf & CONF_USERPWD) { + /* AUTH is missing */ + } + + if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || + strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || + strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { + + word = strchr(path, ':'); + if (word) { + word++; + database = strchr(word, ':'); + if (database) { + *database++ = (char)0; + strategy = strchr(database, ':'); + if (strategy) { + *strategy++ = (char)0; + nthdef = strchr(strategy, ':'); + if (nthdef) { + *nthdef++ = (char)0; + } + } + } + } + + if ((word == NULL) || (*word == (char)0)) { + failf(data, "lookup word is missing\n"); + } + if ((database == NULL) || (*database == (char)0)) { + database = "!"; + } + if ((strategy == NULL) || (*strategy == (char)0)) { + strategy = "."; + } + if ((nthdef == NULL) || (*nthdef == (char)0)) { + nth = 0; + } + else { + nth = atoi(nthdef); + } + + sendf(data->firstsocket, data, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "MATCH " + "%s " /* database */ + "%s " /* strategy */ + "%s\n" /* word */ + "QUIT\n", + + database, + strategy, + word + ); + + result = Download(data, data->firstsocket, -1, FALSE, bytecount); + + if(result) + return result; + + } + else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || + strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || + strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { + + word = strchr(path, ':'); + if (word) { + word++; + database = strchr(word, ':'); + if (database) { + *database++ = (char)0; + nthdef = strchr(database, ':'); + if (nthdef) { + *nthdef++ = (char)0; + } + } + } + + if ((word == NULL) || (*word == (char)0)) { + failf(data, "lookup word is missing\n"); + } + if ((database == NULL) || (*database == (char)0)) { + database = "!"; + } + if ((nthdef == NULL) || (*nthdef == (char)0)) { + nth = 0; + } + else { + nth = atoi(nthdef); + } + + sendf(data->firstsocket, data, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "DEFINE " + "%s " /* database */ + "%s\n" /* word */ + "QUIT\n", + + database, + word + ); + + result = Download(data, data->firstsocket, -1, FALSE, bytecount); + + if(result) + return result; + + } + else { + + ppath = strchr(path, '/'); + if (ppath) { + int i; + + ppath++; + for (i = 0; (i < URL_MAX_LENGTH) && (ppath[i]); i++) { + if (ppath[i] == ':') + ppath[i] = ' '; + } + sendf(data->firstsocket, data, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "%s\n" + "QUIT\n", + ppath); + + result = Download(data, data->firstsocket, -1, FALSE, bytecount); + + if(result) + return result; + + } + } + + ProgressEnd(data); + return URG_OK; +} -- cgit v1.2.1 From 15755b3fd8744e1ff7d2cda5f2db9477a84e5c88 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 1 Feb 2000 23:52:11 +0000 Subject: Adjusted to use the new Transfer() instead of the old Download() --- lib/dict.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index e26437022..99abf49f6 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -162,7 +162,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) word ); - result = Download(data, data->firstsocket, -1, FALSE, bytecount); + result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; @@ -209,7 +210,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) word ); - result = Download(data, data->firstsocket, -1, FALSE, bytecount); + result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; @@ -232,7 +234,8 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) "QUIT\n", ppath); - result = Download(data, data->firstsocket, -1, FALSE, bytecount); + result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + -1, NULL); if(result) return result; -- cgit v1.2.1 From 5a99be254566758d8ff42d905cad98b1ee7a2e87 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 Feb 2000 22:57:42 +0000 Subject: updated to use the new set of progress-functions --- lib/dict.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 99abf49f6..cf604ec5b 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -243,6 +243,10 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) } } +#if 0 ProgressEnd(data); +#endif + pgrsDone(data); + return URG_OK; } -- cgit v1.2.1 From 96dde76b99897352aa3d0877a0b621a9e605733e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 22 May 2000 14:12:12 +0000 Subject: moved here from the newlib branch --- lib/dict.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index cf604ec5b..c9721bd85 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -92,12 +92,17 @@ #include "sendf.h" #include "progress.h" +#include "strequal.h" #define _MPRINTF_REPLACE /* use our functions only */ #include +CURLcode dict_done(struct connectdata *conn) +{ + return CURLE_OK; +} -UrgError dict(struct UrlData *data, char *path, long *bytecount) +CURLcode dict(struct connectdata *conn) { int nth; char *word; @@ -106,9 +111,13 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) char *strategy = NULL; char *nthdef = NULL; /* This is not part of the protocol, but required by RFC 2229 */ - UrgError result=URG_OK; - - if(data->conf & CONF_USERPWD) { + CURLcode result=CURLE_OK; + struct UrlData *data=conn->data; + + char *path = conn->path; + long *bytecount = &conn->bytecount; + + if(data->bits.user_passwd) { /* AUTH is missing */ } @@ -162,7 +171,7 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) word ); - result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -210,7 +219,7 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) word ); - result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -234,7 +243,7 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) "QUIT\n", ppath); - result = Transfer(data, data->firstsocket, -1, FALSE, bytecount, + result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); if(result) @@ -243,10 +252,5 @@ UrgError dict(struct UrlData *data, char *path, long *bytecount) } } -#if 0 - ProgressEnd(data); -#endif - pgrsDone(data); - - return URG_OK; + return CURLE_OK; } -- cgit v1.2.1 From 1ef3600a0731fef8f59563a1e49981f1b64b9746 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 Jun 2000 15:31:26 +0000 Subject: haxx.nu => haxx.se --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c9721bd85..c76553556 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -24,9 +24,9 @@ * * ------------------------------------------------------------ * Main author: - * - Daniel Stenberg + * - Daniel Stenberg * - * http://curl.haxx.nu + * http://curl.haxx.se * * $Source$ * $Revision$ -- cgit v1.2.1 From b6e18f2f665f16910c04cb52bdc7b90270ab7c9b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 24 Aug 2000 14:26:33 +0000 Subject: #include "setup.h" moved first of all includes --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c76553556..b592266cd 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -38,6 +38,8 @@ * ------------------------------------------------------------ ****************************************************************************/ +#include "setup.h" + /* -- WIN32 approved -- */ #include #include @@ -49,8 +51,6 @@ #include -#include "setup.h" - #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #include #include -- cgit v1.2.1 From 42280e95bf159c4db89e3d9ea3d2e77f32cf800f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 20 Nov 2000 08:53:21 +0000 Subject: removed URL size restrictions --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index b592266cd..a012dc1cf 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -233,7 +233,7 @@ CURLcode dict(struct connectdata *conn) int i; ppath++; - for (i = 0; (i < URL_MAX_LENGTH) && (ppath[i]); i++) { + for (i = 0; ppath[i]; i++) { if (ppath[i] == ':') ppath[i] = ' '; } -- cgit v1.2.1 From 24dee483e9e925c2ab79dd582f70c9a55ab9ba4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 3 Jan 2001 09:29:33 +0000 Subject: dual-license fix --- lib/dict.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index a012dc1cf..d6de23aa6 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,38 +5,21 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Copyright (C) 2000, Daniel Stenberg, , et al. * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. + * In order to be useful for every potential user, curl and libcurl are + * dual-licensed under the MPL and the MIT/X-derivate licenses. * - * The Original Code is Curl. + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the MPL or the MIT/X-derivate + * licenses. You may pick one of these licenses. * - * The Initial Developer of the Original Code is Daniel Stenberg. + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. * - * Portions created by the Initial Developer are Copyright (C) 1998. - * All Rights Reserved. - * - * ------------------------------------------------------------ - * Main author: - * - Daniel Stenberg - * - * http://curl.haxx.se - * - * $Source$ - * $Revision$ - * $Date$ - * $Author$ - * $State$ - * $Locker$ - * - * ------------------------------------------------------------ - ****************************************************************************/ + * $Id$ + *****************************************************************************/ #include "setup.h" -- cgit v1.2.1 From 4031104404c6ceed5e57134125dcdb6cac51c564 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 5 Jan 2001 10:11:41 +0000 Subject: Internal symbols that aren't static are now prefixed with 'Curl_' --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index d6de23aa6..2e3dd7ab0 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -80,12 +80,12 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include -CURLcode dict_done(struct connectdata *conn) +CURLcode Curl_dict_done(struct connectdata *conn) { return CURLE_OK; } -CURLcode dict(struct connectdata *conn) +CURLcode Curl_dict(struct connectdata *conn) { int nth; char *word; -- cgit v1.2.1 From ae0a6835bdd6c54e56ce16b7a2727ada3adcccaf Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 17 Jan 2001 13:23:01 +0000 Subject: Transfer is now Curl_Tranfer() and transfer.h is used instead of highlevel.h and download.h --- lib/dict.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 2e3dd7ab0..6c4a60857 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -71,7 +71,7 @@ #include "urldata.h" #include -#include "download.h" +#include "transfer.h" #include "sendf.h" #include "progress.h" @@ -154,7 +154,7 @@ CURLcode Curl_dict(struct connectdata *conn) word ); - result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -202,7 +202,7 @@ CURLcode Curl_dict(struct connectdata *conn) word ); - result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -226,7 +226,7 @@ CURLcode Curl_dict(struct connectdata *conn) "QUIT\n", ppath); - result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, -1, NULL); if(result) -- cgit v1.2.1 From 1a329b98a34c34f46c62a7d4d3d12eb25a313452 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 25 Jan 2001 12:13:35 +0000 Subject: replaced sendf() calls with Curl_sendf() --- lib/dict.c | 60 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 6c4a60857..0dd9dbb9c 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -141,21 +141,21 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - sendf(data->firstsocket, data, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "MATCH " - "%s " /* database */ - "%s " /* strategy */ - "%s\n" /* word */ - "QUIT\n", + Curl_sendf(data->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "MATCH " + "%s " /* database */ + "%s " /* strategy */ + "%s\n" /* word */ + "QUIT\n", - database, - strategy, - word - ); + database, + strategy, + word + ); result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, - -1, NULL); /* no upload */ + -1, NULL); /* no upload */ if(result) return result; @@ -191,20 +191,20 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - sendf(data->firstsocket, data, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "DEFINE " - "%s " /* database */ - "%s\n" /* word */ - "QUIT\n", - - database, - word - ); + Curl_sendf(data->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "DEFINE " + "%s " /* database */ + "%s\n" /* word */ + "QUIT\n", + + database, + word + ); result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - + -1, NULL); /* no upload */ + if(result) return result; @@ -220,14 +220,14 @@ CURLcode Curl_dict(struct connectdata *conn) if (ppath[i] == ':') ppath[i] = ' '; } - sendf(data->firstsocket, data, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "%s\n" - "QUIT\n", - ppath); + Curl_sendf(data->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "%s\n" + "QUIT\n", + ppath); result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, - -1, NULL); + -1, NULL); if(result) return result; -- cgit v1.2.1 From a1d6ad26100bc493c7b04f1301b1634b7f5aa8b4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 Feb 2001 17:35:51 +0000 Subject: multiple connection support initial commit --- lib/dict.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 0dd9dbb9c..893ef256e 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -141,7 +141,7 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - Curl_sendf(data->firstsocket, conn, + Curl_sendf(conn->firstsocket, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "MATCH " "%s " /* database */ @@ -154,7 +154,7 @@ CURLcode Curl_dict(struct connectdata *conn) word ); - result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -191,7 +191,7 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - Curl_sendf(data->firstsocket, conn, + Curl_sendf(conn->firstsocket, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "DEFINE " "%s " /* database */ @@ -202,7 +202,7 @@ CURLcode Curl_dict(struct connectdata *conn) word ); - result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -220,13 +220,13 @@ CURLcode Curl_dict(struct connectdata *conn) if (ppath[i] == ':') ppath[i] = ' '; } - Curl_sendf(data->firstsocket, conn, + Curl_sendf(conn->firstsocket, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "%s\n" "QUIT\n", ppath); - result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, -1, NULL); if(result) -- cgit v1.2.1 From f8e1fc32de60c5f4c30d20d2bc8c55ac13405752 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 14 Mar 2001 14:11:11 +0000 Subject: Edin Kadribaic's bug report #408488 forced a rearrange of two struct fields from urldata to connectdata, quite correctly. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 893ef256e..53c245947 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -100,7 +100,7 @@ CURLcode Curl_dict(struct connectdata *conn) char *path = conn->path; long *bytecount = &conn->bytecount; - if(data->bits.user_passwd) { + if(conn->bits.user_passwd) { /* AUTH is missing */ } -- cgit v1.2.1 From 1603f64771d09d43ef58bca455f5f18e4dc65cae Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Aug 2001 08:18:35 +0000 Subject: removed the *done() function as it served no purpose, added type casts when converting from 'const char *' to 'char *' to please my picky compiler options --- lib/dict.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 53c245947..ff0e90541 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -80,11 +80,6 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include -CURLcode Curl_dict_done(struct connectdata *conn) -{ - return CURLE_OK; -} - CURLcode Curl_dict(struct connectdata *conn) { int nth; @@ -129,10 +124,10 @@ CURLcode Curl_dict(struct connectdata *conn) failf(data, "lookup word is missing\n"); } if ((database == NULL) || (*database == (char)0)) { - database = "!"; + database = (char *)"!"; } if ((strategy == NULL) || (*strategy == (char)0)) { - strategy = "."; + strategy = (char *)"."; } if ((nthdef == NULL) || (*nthdef == (char)0)) { nth = 0; @@ -182,7 +177,7 @@ CURLcode Curl_dict(struct connectdata *conn) failf(data, "lookup word is missing\n"); } if ((database == NULL) || (*database == (char)0)) { - database = "!"; + database = (char *)"!"; } if ((nthdef == NULL) || (*nthdef == (char)0)) { nth = 0; -- cgit v1.2.1 From 0ece1b5c34c049a3226f7dd793cf75e470c46e4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 30 Aug 2001 22:48:34 +0000 Subject: Major rename and redesign of the internal "backbone" structs. Details will be posted in a minute to the libcurl list. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index ff0e90541..f8763e29a 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -90,7 +90,7 @@ CURLcode Curl_dict(struct connectdata *conn) char *nthdef = NULL; /* This is not part of the protocol, but required by RFC 2229 */ CURLcode result=CURLE_OK; - struct UrlData *data=conn->data; + struct SessionHandle *data=conn->data; char *path = conn->path; long *bytecount = &conn->bytecount; -- cgit v1.2.1 From 6147879837a53d22c9be04e7a4fc315a297ba2b3 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Fri, 7 Sep 2001 04:01:32 +0000 Subject: Added formatting sections for emacs and vim --- lib/dict.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index f8763e29a..2bc350b31 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -232,3 +232,11 @@ CURLcode Curl_dict(struct connectdata *conn) return CURLE_OK; } + +/* + * local variables: + * eval: (load-file "../curl-mode.el") + * end: + * vim600: et sw=2 ts=2 sts=2 tw=78 fdm=marker + * vim<600: et sw=2 ts=2 sts=2 tw=78 + */ -- cgit v1.2.1 From 8e91d5de8e4e17ce3d4936cc91171d09726e7bb3 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Thu, 11 Oct 2001 09:32:19 +0000 Subject: looks nicer and is better compatible with older vim versions --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 2bc350b31..98f705cac 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -237,6 +237,6 @@ CURLcode Curl_dict(struct connectdata *conn) * local variables: * eval: (load-file "../curl-mode.el") * end: - * vim600: et sw=2 ts=2 sts=2 tw=78 fdm=marker - * vim<600: et sw=2 ts=2 sts=2 tw=78 + * vim600: fdm=marker + * vim: et sw=2 ts=2 sts=2 tw=78 */ -- cgit v1.2.1 From 6878c0b88f0f30084ca0ab899ac3fec172fe1813 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 31 Oct 2001 14:48:10 +0000 Subject: check return code when issuing the request --- lib/dict.c | 79 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 40 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 98f705cac..bbb5fe146 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -136,25 +136,25 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - Curl_sendf(conn->firstsocket, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "MATCH " - "%s " /* database */ - "%s " /* strategy */ - "%s\n" /* word */ - "QUIT\n", - - database, - strategy, - word - ); - - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - + result = Curl_sendf(conn->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "MATCH " + "%s " /* database */ + "%s " /* strategy */ + "%s\n" /* word */ + "QUIT\n", + + database, + strategy, + word + ); + if(result) + failf(data, "Failed sending DICT request"); + else + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; - } else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || @@ -186,19 +186,19 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - Curl_sendf(conn->firstsocket, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "DEFINE " - "%s " /* database */ - "%s\n" /* word */ - "QUIT\n", - - database, - word - ); - - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, - -1, NULL); /* no upload */ + result = Curl_sendf(conn->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "DEFINE " + "%s " /* database */ + "%s\n" /* word */ + "QUIT\n", + database, + word); + if(result) + failf(data, "Failed sending DICT request"); + else + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; @@ -215,18 +215,17 @@ CURLcode Curl_dict(struct connectdata *conn) if (ppath[i] == ':') ppath[i] = ' '; } - Curl_sendf(conn->firstsocket, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "%s\n" - "QUIT\n", - ppath); - - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, - -1, NULL); - + result = Curl_sendf(conn->firstsocket, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "%s\n" + "QUIT\n", ppath); + if(result) + failf(data, "Failed sending DICT request"); + else + result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + -1, NULL); if(result) return result; - } } -- cgit v1.2.1 From e1922617883d5a70a282ed0e9e756a27eeed6bba Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 11 Dec 2001 13:13:01 +0000 Subject: failf() calls should not have newlines in the message string! --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index bbb5fe146..79b5a7786 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -121,7 +121,7 @@ CURLcode Curl_dict(struct connectdata *conn) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing\n"); + failf(data, "lookup word is missing"); } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; @@ -174,7 +174,7 @@ CURLcode Curl_dict(struct connectdata *conn) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing\n"); + failf(data, "lookup word is missing"); } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; -- cgit v1.2.1 From 974f314f5785156af6983675aeb28313cc8ba2ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 19 Mar 2002 07:54:55 +0000 Subject: copyright string (year) update --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 79b5a7786..c7720d65f 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2000, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * * In order to be useful for every potential user, curl and libcurl are * dual-licensed under the MPL and the MIT/X-derivate licenses. -- cgit v1.2.1 From ba4e69bebc8f7f32f3bc7faa1e13e7580754075b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Sep 2002 11:52:59 +0000 Subject: updated source code boilerplate/header --- lib/dict.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c7720d65f..ddf45e646 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -1,4 +1,4 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | @@ -7,19 +7,19 @@ * * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. * - * In order to be useful for every potential user, curl and libcurl are - * dual-licensed under the MPL and the MIT/X-derivate licenses. - * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the MPL or the MIT/X-derivate - * licenses. You may pick one of these licenses. + * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * * $Id$ - *****************************************************************************/ + ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From f26a338a54e04d0a6907f5d2479d8b0fa9daf297 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Jan 2003 21:08:12 +0000 Subject: copyright year update in the source header --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index ddf45e646..f1cee4dcd 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2002, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From a7c72b7abf1213c471f3fd11e6b8e3a37d526f60 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 29 Jan 2003 10:14:20 +0000 Subject: removed the local variables for emacs and vim, use the new sample.emacs way for emacs, and vim users should provide a similar non-polluting style --- lib/dict.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index f1cee4dcd..073814089 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -231,11 +231,3 @@ CURLcode Curl_dict(struct connectdata *conn) return CURLE_OK; } - -/* - * local variables: - * eval: (load-file "../curl-mode.el") - * end: - * vim600: fdm=marker - * vim: et sw=2 ts=2 sts=2 tw=78 - */ -- cgit v1.2.1 From f0278ca114b266bfc1edd399e463e89f653e1ec8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 25 Jul 2003 08:30:58 +0000 Subject: Removed #include , as pointed out by Henry Bland we don't need it. --- lib/dict.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 073814089..540d872c0 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -44,7 +44,6 @@ #endif #include #include -#include #ifdef HAVE_UNISTD_H #include #endif -- cgit v1.2.1 From 749f5387c19449209615b282ac738032f2a890e7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Oct 2003 12:00:45 +0000 Subject: Gisle Vanem's IPv6-on-Windows patch applied! --- lib/dict.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 540d872c0..1c85a1081 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -35,7 +35,6 @@ #include #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) -#include #include #include #else -- cgit v1.2.1 From 1e98727c552ced5f8c7587f64ab69c6eaab743dd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 24 Nov 2003 07:15:37 +0000 Subject: FTPS support added as RFC2228 and the murray-ftp-auth-ssl draft describe it --- lib/dict.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1c85a1081..86c864cf5 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -89,6 +89,7 @@ CURLcode Curl_dict(struct connectdata *conn) by RFC 2229 */ CURLcode result=CURLE_OK; struct SessionHandle *data=conn->data; + int sockfd = conn->sock[FIRSTSOCKET]; char *path = conn->path; long *bytecount = &conn->bytecount; @@ -134,7 +135,7 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - result = Curl_sendf(conn->firstsocket, conn, + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "MATCH " "%s " /* database */ @@ -149,7 +150,7 @@ CURLcode Curl_dict(struct connectdata *conn) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) return result; @@ -184,7 +185,7 @@ CURLcode Curl_dict(struct connectdata *conn) nth = atoi(nthdef); } - result = Curl_sendf(conn->firstsocket, conn, + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "DEFINE " "%s " /* database */ @@ -195,7 +196,7 @@ CURLcode Curl_dict(struct connectdata *conn) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -213,14 +214,14 @@ CURLcode Curl_dict(struct connectdata *conn) if (ppath[i] == ':') ppath[i] = ' '; } - result = Curl_sendf(conn->firstsocket, conn, + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "%s\n" "QUIT\n", ppath); if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, conn->firstsocket, -1, FALSE, bytecount, + result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, -1, NULL); if(result) return result; -- cgit v1.2.1 From 8f0abd31c5f3e21c15bfac529f362fc9d7c8e279 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 10 Dec 2003 15:27:59 +0000 Subject: Use Curl_transfer() properly. Fixes the bug Gisle Vanem found! --- lib/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 86c864cf5..e9308ae8d 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -150,7 +150,7 @@ CURLcode Curl_dict(struct connectdata *conn) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, + result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) return result; @@ -196,7 +196,7 @@ CURLcode Curl_dict(struct connectdata *conn) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, + result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); /* no upload */ if(result) @@ -221,7 +221,7 @@ CURLcode Curl_dict(struct connectdata *conn) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, sockfd, -1, FALSE, bytecount, + result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); if(result) return result; -- cgit v1.2.1 From b60e0fa97ed7ddc66d0ad6d00dfd78319bb6ad36 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 5 Jan 2004 22:29:29 +0000 Subject: David J Meyer's large file support. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index e9308ae8d..30137b6fd 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -92,7 +92,7 @@ CURLcode Curl_dict(struct connectdata *conn) int sockfd = conn->sock[FIRSTSOCKET]; char *path = conn->path; - long *bytecount = &conn->bytecount; + off_t *bytecount = &conn->bytecount; if(conn->bits.user_passwd) { /* AUTH is missing */ -- cgit v1.2.1 From 053f6c85efd0bf698f73343989474d672d0563a8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Jan 2004 09:19:33 +0000 Subject: updated year in the copyright string --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 30137b6fd..af3298327 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2003, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From b791e158f0e04a518dea19fdaf0bfbf71b343c64 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 22 Jan 2004 12:45:50 +0000 Subject: use curl_off_t instead of off_t! --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index af3298327..62d629821 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -92,7 +92,7 @@ CURLcode Curl_dict(struct connectdata *conn) int sockfd = conn->sock[FIRSTSOCKET]; char *path = conn->path; - off_t *bytecount = &conn->bytecount; + curl_off_t *bytecount = &conn->bytecount; if(conn->bits.user_passwd) { /* AUTH is missing */ -- cgit v1.2.1 From 4d17d6876e4b2f08380812c4ec113073b0a14639 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 29 Jan 2004 13:56:45 +0000 Subject: Dan Fandrich's cleanup patch to make pedantic compiler options cause less warnings. Minor edits by me. --- lib/dict.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 62d629821..a22fa5a4d 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -74,6 +74,7 @@ #include "progress.h" #include "strequal.h" +#include "dict.h" #define _MPRINTF_REPLACE /* use our functions only */ #include -- cgit v1.2.1 From ad1a70205fa24bf1664969c5d3b3f67d7cebecb4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Feb 2004 09:50:44 +0000 Subject: removed the nth variable, it was only set and never used anyway --- lib/dict.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index a22fa5a4d..a07760bbd 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -81,7 +81,6 @@ CURLcode Curl_dict(struct connectdata *conn) { - int nth; char *word; char *ppath; char *database = NULL; @@ -129,12 +128,6 @@ CURLcode Curl_dict(struct connectdata *conn) if ((strategy == NULL) || (*strategy == (char)0)) { strategy = (char *)"."; } - if ((nthdef == NULL) || (*nthdef == (char)0)) { - nth = 0; - } - else { - nth = atoi(nthdef); - } result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" @@ -179,12 +172,6 @@ CURLcode Curl_dict(struct connectdata *conn) if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; } - if ((nthdef == NULL) || (*nthdef == (char)0)) { - nth = 0; - } - else { - nth = atoi(nthdef); - } result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" -- cgit v1.2.1 From ce5805a955c5a79d85792caad47594987f0e0b26 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 9 Mar 2004 22:52:50 +0000 Subject: Use curl_socket_t instead of int for holding sockets. The typedefs and defines are in setup.h. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index a07760bbd..2a7ad22c7 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -89,7 +89,7 @@ CURLcode Curl_dict(struct connectdata *conn) by RFC 2229 */ CURLcode result=CURLE_OK; struct SessionHandle *data=conn->data; - int sockfd = conn->sock[FIRSTSOCKET]; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; char *path = conn->path; curl_off_t *bytecount = &conn->bytecount; -- cgit v1.2.1 From 39af394a1c3ae1d8ac71ad263a7c524988702c2e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 6 Oct 2004 07:50:18 +0000 Subject: removed tabs and trailing whitespace from source --- lib/dict.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 2a7ad22c7..1b3f00452 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -1,8 +1,8 @@ /*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. @@ -10,7 +10,7 @@ * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. - * + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. @@ -101,7 +101,7 @@ CURLcode Curl_dict(struct connectdata *conn) if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { - + word = strchr(path, ':'); if (word) { word++; @@ -118,7 +118,7 @@ CURLcode Curl_dict(struct connectdata *conn) } } } - + if ((word == NULL) || (*word == (char)0)) { failf(data, "lookup word is missing"); } @@ -128,7 +128,7 @@ CURLcode Curl_dict(struct connectdata *conn) if ((strategy == NULL) || (*strategy == (char)0)) { strategy = (char *)"."; } - + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "MATCH " @@ -136,7 +136,7 @@ CURLcode Curl_dict(struct connectdata *conn) "%s " /* strategy */ "%s\n" /* word */ "QUIT\n", - + database, strategy, word @@ -145,14 +145,14 @@ CURLcode Curl_dict(struct connectdata *conn) failf(data, "Failed sending DICT request"); else result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ + -1, NULL); /* no upload */ if(result) return result; } else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { - + word = strchr(path, ':'); if (word) { word++; @@ -165,14 +165,14 @@ CURLcode Curl_dict(struct connectdata *conn) } } } - + if ((word == NULL) || (*word == (char)0)) { failf(data, "lookup word is missing"); } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; } - + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" "DEFINE " @@ -186,17 +186,17 @@ CURLcode Curl_dict(struct connectdata *conn) else result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); /* no upload */ - + if(result) return result; - + } else { - + ppath = strchr(path, '/'); if (ppath) { int i; - + ppath++; for (i = 0; ppath[i]; i++) { if (ppath[i] == ':') -- cgit v1.2.1 From 24d47a6e07304cf0921f2d30734b3c64360773c3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 2 Nov 2004 10:12:22 +0000 Subject: Paul Nolan fix to make libcurl build nicely on Windows CE --- lib/dict.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1b3f00452..f8e402bcf 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -29,8 +29,12 @@ #include #include #include +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif #include -- cgit v1.2.1 From 8e2f57c82e3e9cbd33f5be6cae4d96329c8a360b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Nov 2004 23:13:06 +0000 Subject: Dan Fandrich: make --disable-dict actually disable dict --- lib/dict.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index f8e402bcf..baddc40de 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -23,6 +23,8 @@ #include "setup.h" +#ifndef CURL_DISABLE_DICT + /* -- WIN32 approved -- */ #include #include @@ -222,3 +224,4 @@ CURLcode Curl_dict(struct connectdata *conn) return CURLE_OK; } +#endif /*CURL_DISABLE_DICT*/ -- cgit v1.2.1 From 120f17ce04794f55603a1edcd8ec8f89a09fe4ca Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Wed, 9 Feb 2005 11:50:41 +0000 Subject: Replace LF with CRLF. Ref RFC-2229, sec 2.3: "Each command line must be terminated by a CRLF". --- lib/dict.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index baddc40de..ef82e0b85 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -136,12 +136,12 @@ CURLcode Curl_dict(struct connectdata *conn) } result = Curl_sendf(sockfd, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "MATCH " "%s " /* database */ "%s " /* strategy */ - "%s\n" /* word */ - "QUIT\n", + "%s\r\n" /* word */ + "QUIT\r\n", database, strategy, @@ -180,11 +180,11 @@ CURLcode Curl_dict(struct connectdata *conn) } result = Curl_sendf(sockfd, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "DEFINE " "%s " /* database */ - "%s\n" /* word */ - "QUIT\n", + "%s\r\n" /* word */ + "QUIT\r\n", database, word); if(result) @@ -209,9 +209,9 @@ CURLcode Curl_dict(struct connectdata *conn) ppath[i] = ' '; } result = Curl_sendf(sockfd, conn, - "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n" - "%s\n" - "QUIT\n", ppath); + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" + "%s\r\n" + "QUIT\r\n", ppath); if(result) failf(data, "Failed sending DICT request"); else -- cgit v1.2.1 From 6a2e21ec8cbaf7c719902e06953d9dbec629ad4f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 9 Feb 2005 13:06:40 +0000 Subject: FTP code turned into state machine. Not completely yet, but a good start. The tag 'before_ftp_statemachine' was set just before this commit in case of future need. --- lib/dict.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index ef82e0b85..1c687292f 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -85,7 +85,7 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include -CURLcode Curl_dict(struct connectdata *conn) +CURLcode Curl_dict(struct connectdata *conn, bool *done) { char *word; char *ppath; @@ -100,6 +100,8 @@ CURLcode Curl_dict(struct connectdata *conn) char *path = conn->path; curl_off_t *bytecount = &conn->bytecount; + *done = TRUE; /* unconditionally */ + if(conn->bits.user_passwd) { /* AUTH is missing */ } -- cgit v1.2.1 From e85e30546c89e17b6fb0cf383de25b7ed7f3bf3d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 4 May 2006 22:39:47 +0000 Subject: Roland Blom filed bug report #1481217 (http://curl.haxx.se/bug/view.cgi?id=1481217), with follow-ups by Michele Bini and David Byron. libcurl previously wrongly used GetLastError() on windows to get error details after socket-related function calls, when it really should use WSAGetLastError() instead. When changing to this, the former function Curl_ourerrno() is now instead called Curl_sockerrno() as it is necessary to only use it to get errno from socket-related functions as otherwise it won't work as intended on Windows. --- lib/dict.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1c687292f..b7efa02a1 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -38,8 +38,6 @@ #include #endif -#include - #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #include #include -- cgit v1.2.1 From 3c6d3b69c2f9da4107ad5ca68fc06cc91ed225c1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 10 May 2006 11:44:31 +0000 Subject: 1 - allow DICT with properly URL-escaped words, like using %20 for spaces 2 - properly escape certain letters within a DICT word to comply to the RFC2229 --- lib/dict.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index b7efa02a1..d5a2400ca 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -83,9 +83,46 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +/* The last #include file should be: */ +#include "memdebug.h" + +static char *unescape_word(struct SessionHandle *data, char *inp) +{ + char *newp; + char *dictp; + char *ptr; + int len; + unsigned char byte; + int olen=0; + + newp = curl_easy_unescape(data, inp, 0, &len); + if(!newp) + return NULL; + + dictp = malloc(len*2 + 1); /* add one for terminating zero */ + if(dictp) { + /* According to RFC2229 section 2.2, these letters need to be escaped with + \[letter] */ + for(ptr = newp; + (byte = (unsigned char)*ptr); + ptr++) { + if ((byte <= 32) || (byte == 127) || + (byte == '\'') || (byte == '\"') || (byte == '\\')) { + dictp[olen++] = '\\'; + } + dictp[olen++] = byte; + } + dictp[olen]=0; + + free(newp); + } + return dictp; +} + CURLcode Curl_dict(struct connectdata *conn, bool *done) { char *word; + char *eword; char *ppath; char *database = NULL; char *strategy = NULL; @@ -135,6 +172,10 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) strategy = (char *)"."; } + eword = unescape_word(data, word); + if(!eword) + return CURLE_OUT_OF_MEMORY; + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "MATCH " @@ -145,8 +186,11 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) database, strategy, - word + eword ); + + free(eword); + if(result) failf(data, "Failed sending DICT request"); else @@ -179,6 +223,10 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) database = (char *)"!"; } + eword = unescape_word(data, word); + if(!eword) + return CURLE_OUT_OF_MEMORY; + result = Curl_sendf(sockfd, conn, "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "DEFINE " @@ -186,7 +234,10 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) "%s\r\n" /* word */ "QUIT\r\n", database, - word); + eword); + + free(eword); + if(result) failf(data, "Failed sending DICT request"); else -- cgit v1.2.1 From 59cf6fd4f058917839a407f5a206f5f1c1a004a6 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Tue, 29 Aug 2006 18:45:55 +0000 Subject: Watcom lacks . --- lib/dict.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index d5a2400ca..86d00c961 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -46,7 +46,9 @@ #include #endif #include +#ifndef __WATCOMC__ #include +#endif #ifdef HAVE_UNISTD_H #include #endif -- cgit v1.2.1 From 4031eb1d91936610ccff8df0e92a51d1ec11d3b5 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Tue, 29 Aug 2006 21:11:55 +0000 Subject: Avoid Metaware's High-C warning "'=' encountered where '==' may have been intended." --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 86d00c961..6a5697952 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -106,7 +106,7 @@ static char *unescape_word(struct SessionHandle *data, char *inp) /* According to RFC2229 section 2.2, these letters need to be escaped with \[letter] */ for(ptr = newp; - (byte = (unsigned char)*ptr); + (byte = (unsigned char)*ptr) != 0; ptr++) { if ((byte <= 32) || (byte == 127) || (byte == '\'') || (byte == '\"') || (byte == '\\')) { -- cgit v1.2.1 From c7aae1030004da71c7c046fd6af259f91bbfa991 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Wed, 30 Aug 2006 16:17:06 +0000 Subject: Removed "#ifndef__WATCOMC__". Use "#ifdef HAVE_SYS_TIME_H" instead. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 6a5697952..1f130ad15 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -46,7 +46,7 @@ #include #endif #include -#ifndef __WATCOMC__ +#ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_UNISTD_H -- cgit v1.2.1 From 4f4277d9c73b876d0054474d1f696a555c5c9966 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Sun, 3 Sep 2006 13:52:07 +0000 Subject: Simplified #ifdef on WIN32; the statement " !defined(__GNUC__) || defined(__MINGW32__)" implies CygWin. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1f130ad15..c83301c30 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -38,7 +38,7 @@ #include #endif -#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) +#if defined(WIN32) && !defined(__CYGWIN__) #include #include #else -- cgit v1.2.1 From b7eeb6e67fca686f840eacd6b8394edb58b07482 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 7 Sep 2006 21:49:20 +0000 Subject: Major overhaul introducing http pipelining support and shared connection cache within the multi handle. --- lib/dict.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c83301c30..b14426a28 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -134,8 +134,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) struct SessionHandle *data=conn->data; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; - char *path = conn->path; - curl_off_t *bytecount = &conn->bytecount; + char *path = data->reqdata.path; + curl_off_t *bytecount = &data->reqdata.keep.bytecount; *done = TRUE; /* unconditionally */ @@ -196,8 +196,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ + result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; } @@ -243,8 +243,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ + result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ if(result) return result; @@ -268,8 +268,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) if(result) failf(data, "Failed sending DICT request"); else - result = Curl_Transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); + result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); if(result) return result; } -- cgit v1.2.1 From e150150d9f1e0578c85af05de15ab6336066cec1 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 11 Oct 2006 16:01:16 +0000 Subject: Remove redundant __CYGWIN__ symbol check --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index b14426a28..d6443f4b9 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -38,7 +38,7 @@ #include #endif -#if defined(WIN32) && !defined(__CYGWIN__) +#ifdef WIN32 #include #include #else -- cgit v1.2.1 From c514a2a89aa1c1e06b70405eedb4e1f70b27fd10 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Mon, 26 Feb 2007 04:24:26 +0000 Subject: Removed inclusion of and in .c-files since they're already included through "setup.h". --- lib/dict.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index d6443f4b9..c302cd034 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -31,12 +31,6 @@ #include #include #include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif #ifdef WIN32 #include -- cgit v1.2.1 From 7ea90c46eb16e5cabed2fa29ce514634a2e879ee Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 31 Mar 2007 21:06:40 +0000 Subject: avoid dereferencing a NULL pointer by setting a default word to lookup in case it is missing CID 5 in the coverity.com scan --- lib/dict.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c302cd034..c1da557e2 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -159,7 +159,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing"); + infof(data, "lookup word is missing"); + word=(char *)"default"; } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; @@ -213,7 +214,8 @@ CURLcode Curl_dict(struct connectdata *conn, bool *done) } if ((word == NULL) || (*word == (char)0)) { - failf(data, "lookup word is missing"); + infof(data, "lookup word is missing"); + word=(char *)"default"; } if ((database == NULL) || (*database == (char)0)) { database = (char *)"!"; -- cgit v1.2.1 From 523767660c05cf359091694fcaccb763ebb7b2d7 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sun, 26 Aug 2007 05:53:26 +0000 Subject: Fixed some minor mismatched types found by splint. --- lib/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c1da557e2..43bc72ebf 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -82,13 +82,13 @@ /* The last #include file should be: */ #include "memdebug.h" -static char *unescape_word(struct SessionHandle *data, char *inp) +static char *unescape_word(struct SessionHandle *data, const char *inp) { char *newp; char *dictp; char *ptr; int len; - unsigned char byte; + char byte; int olen=0; newp = curl_easy_unescape(data, inp, 0, &len); @@ -100,7 +100,7 @@ static char *unescape_word(struct SessionHandle *data, char *inp) /* According to RFC2229 section 2.2, these letters need to be escaped with \[letter] */ for(ptr = newp; - (byte = (unsigned char)*ptr) != 0; + (byte = *ptr) != 0; ptr++) { if ((byte <= 32) || (byte == 127) || (byte == '\'') || (byte == '\"') || (byte == '\\')) { -- cgit v1.2.1 From 07b6e7363d910ad4828376d568a2f19fd8d64661 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Fri, 12 Oct 2007 13:36:37 +0000 Subject: Added per-protocol callback static tables, replacing callback ptr storage in the connectdata structure by a single handler table ptr. --- lib/dict.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 43bc72ebf..8266e2bb6 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -82,6 +82,33 @@ /* The last #include file should be: */ #include "memdebug.h" + +/* + * Forward declarations. + */ + +static CURLcode Curl_dict(struct connectdata *conn, bool *done); + +/* + * DICT protocol handler. + */ + +const struct Curl_handler Curl_handler_dict = { + "DICT", /* scheme */ + NULL, /* setup_connection */ + Curl_dict, /* do_it */ + NULL, /* done */ + NULL, /* do_more */ + NULL, /* connect_it */ + NULL, /* connecting */ + NULL, /* doing */ + NULL, /* proto_getsock */ + NULL, /* doing_getsock */ + NULL, /* disconnect */ + PORT_DICT, /* defport */ + PROT_DICT /* protocol */ +}; + static char *unescape_word(struct SessionHandle *data, const char *inp) { char *newp; @@ -115,7 +142,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inp) return dictp; } -CURLcode Curl_dict(struct connectdata *conn, bool *done) +static CURLcode Curl_dict(struct connectdata *conn, bool *done) { char *word; char *eword; -- cgit v1.2.1 From 92433e596b7fbfa5c75926705dcfef0080ebf012 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 17 Oct 2007 16:58:32 +0000 Subject: We use this ZERO_NULL to avoid picky compiler warnings, when assigning a NULL pointer to a function pointer var. --- lib/dict.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 8266e2bb6..f0efab373 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -95,16 +95,16 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done); const struct Curl_handler Curl_handler_dict = { "DICT", /* scheme */ - NULL, /* setup_connection */ + ZERO_NULL, /* setup_connection */ Curl_dict, /* do_it */ - NULL, /* done */ - NULL, /* do_more */ - NULL, /* connect_it */ - NULL, /* connecting */ - NULL, /* doing */ - NULL, /* proto_getsock */ - NULL, /* doing_getsock */ - NULL, /* disconnect */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* disconnect */ PORT_DICT, /* defport */ PROT_DICT /* protocol */ }; -- cgit v1.2.1 From cbd1a77ec24e397d05f20c6de106625676343c9d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Nov 2007 09:21:35 +0000 Subject: if () => if() while () => while() and some other minor re-indentings --- lib/dict.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index f0efab373..dc078ff38 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -129,7 +129,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inp) for(ptr = newp; (byte = *ptr) != 0; ptr++) { - if ((byte <= 32) || (byte == 127) || + if((byte <= 32) || (byte == 127) || (byte == '\'') || (byte == '\"') || (byte == '\\')) { dictp[olen++] = '\\'; } @@ -164,35 +164,35 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done) /* AUTH is missing */ } - if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || + if(strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { word = strchr(path, ':'); - if (word) { + if(word) { word++; database = strchr(word, ':'); - if (database) { + if(database) { *database++ = (char)0; strategy = strchr(database, ':'); - if (strategy) { + if(strategy) { *strategy++ = (char)0; nthdef = strchr(strategy, ':'); - if (nthdef) { + if(nthdef) { *nthdef++ = (char)0; } } } } - if ((word == NULL) || (*word == (char)0)) { + if((word == NULL) || (*word == (char)0)) { infof(data, "lookup word is missing"); word=(char *)"default"; } - if ((database == NULL) || (*database == (char)0)) { + if((database == NULL) || (*database == (char)0)) { database = (char *)"!"; } - if ((strategy == NULL) || (*strategy == (char)0)) { + if((strategy == NULL) || (*strategy == (char)0)) { strategy = (char *)"."; } @@ -223,28 +223,28 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done) if(result) return result; } - else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || + else if(strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { word = strchr(path, ':'); - if (word) { + if(word) { word++; database = strchr(word, ':'); - if (database) { + if(database) { *database++ = (char)0; nthdef = strchr(database, ':'); - if (nthdef) { + if(nthdef) { *nthdef++ = (char)0; } } } - if ((word == NULL) || (*word == (char)0)) { + if((word == NULL) || (*word == (char)0)) { infof(data, "lookup word is missing"); word=(char *)"default"; } - if ((database == NULL) || (*database == (char)0)) { + if((database == NULL) || (*database == (char)0)) { database = (char *)"!"; } @@ -276,12 +276,12 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done) else { ppath = strchr(path, '/'); - if (ppath) { + if(ppath) { int i; ppath++; for (i = 0; ppath[i]; i++) { - if (ppath[i] == ':') + if(ppath[i] == ':') ppath[i] = ' '; } result = Curl_sendf(sockfd, conn, -- cgit v1.2.1 From 13648f8ccda6f99674ac407640474634e856804c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 24 Nov 2007 23:16:55 +0000 Subject: struct HandleData is now called struct SingleRequest, and is only for data that is inited at the start of the DO action. I removed the Curl_transfer_keeper struct completely, and I had to move out a few struct members (that had to be set before DO or used after DONE) to the UrlState struct. The SingleRequest struct is accessed with SessionHandle->req. One of the biggest reasons for doing this was the bunch of duplicate struct members in HandleData and Curl_transfer_keeper since it was really messy to keep track of two variables with the same name and basically the same purpose! --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index dc078ff38..0838909bd 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -155,8 +155,8 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done) struct SessionHandle *data=conn->data; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; - char *path = data->reqdata.path; - curl_off_t *bytecount = &data->reqdata.keep.bytecount; + char *path = data->state.path; + curl_off_t *bytecount = &data->req.bytecount; *done = TRUE; /* unconditionally */ -- cgit v1.2.1 From 662bee71930fc30ef3fe43077bf696def44c5c7b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 8 Dec 2007 22:50:55 +0000 Subject: All static functions that were previously name Curl_* something no longer use that prefix as we use that prefix only for library-wide internal global symbols. --- lib/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 0838909bd..cf5d7d674 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -87,7 +87,7 @@ * Forward declarations. */ -static CURLcode Curl_dict(struct connectdata *conn, bool *done); +static CURLcode dict_do(struct connectdata *conn, bool *done); /* * DICT protocol handler. @@ -96,7 +96,7 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done); const struct Curl_handler Curl_handler_dict = { "DICT", /* scheme */ ZERO_NULL, /* setup_connection */ - Curl_dict, /* do_it */ + dict_do, /* do_it */ ZERO_NULL, /* done */ ZERO_NULL, /* do_more */ ZERO_NULL, /* connect_it */ @@ -142,7 +142,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inp) return dictp; } -static CURLcode Curl_dict(struct connectdata *conn, bool *done) +static CURLcode dict_do(struct connectdata *conn, bool *done) { char *word; char *eword; -- cgit v1.2.1 From 8f467b4288b69e0cd2355cdb8d4dd8356950e447 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 29 Sep 2008 21:44:50 +0000 Subject: Removed unneeded includes of signal.h and setjmp.h --- lib/dict.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index cf5d7d674..b1f5b6810 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -54,7 +54,6 @@ #include #endif #include -#include #ifdef HAVE_SYS_PARAM_H #include -- cgit v1.2.1 From bab5183820dbd2e0ea9ee4f0442844291d05c90e Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 23 Oct 2008 01:20:57 +0000 Subject: Created Curl_raw_nequal() which does a C-locale string case comparison. Changed checkprefix() to use it and those instances of strnequal() that compare host names or other protocol strings that are defined to be independent of case in the C locale. This should fix a few more Turkish locale problems. --- lib/dict.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index b1f5b6810..f9ce50efc 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -163,9 +163,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) /* AUTH is missing */ } - if(strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || - strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || - strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { + if(Curl_raw_nequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || + Curl_raw_nequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || + Curl_raw_nequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { word = strchr(path, ':'); if(word) { @@ -222,9 +222,9 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) if(result) return result; } - else if(strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || - strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || - strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { + else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || + Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || + Curl_raw_nequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { word = strchr(path, ':'); if(word) { -- cgit v1.2.1 From b701ea36a723b2d7700e23ae53e2c3145dfe7bda Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 23 Oct 2008 11:49:19 +0000 Subject: moved the Curl_raw_ functions into the new lib/rawstr.c file for easier curlx_ inclusion by the curl tool without colliding with the curl_strequal functions. --- lib/dict.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index f9ce50efc..6bd75f6dc 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -74,6 +74,7 @@ #include "progress.h" #include "strequal.h" #include "dict.h" +#include "rawstr.h" #define _MPRINTF_REPLACE /* use our functions only */ #include -- cgit v1.2.1 From ea8fbb5233b24745177871a7e1e9105a137f94f9 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 14 Nov 2008 23:17:32 +0000 Subject: Added some #ifdefs around header files and change the EAGAIN test to fix compilation on Cell (reported by Jeff Curley). --- lib/dict.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 6bd75f6dc..7fadfe892 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -53,7 +53,9 @@ #ifdef HAVE_NET_IF_H #include #endif +#ifdef HAVE_SYS_IOCTL_H #include +#endif #ifdef HAVE_SYS_PARAM_H #include -- cgit v1.2.1 From 07416b61e3c403ea56370858a618f877dcaee57d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 19 Dec 2008 21:14:52 +0000 Subject: - Using the libssh2 0.19 function libssh2_session_block_directions(), libcurl now has an improved ability to do right when the multi interface (both "regular" and multi_socket) is used for SCP and SFTP transfers. This should result in (much) less busy-loop situations and thus less CPU usage with no speed loss. --- lib/dict.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 7fadfe892..aa13ebdc9 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -106,6 +106,7 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* doing */ ZERO_NULL, /* proto_getsock */ ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ PORT_DICT, /* defport */ PROT_DICT /* protocol */ -- cgit v1.2.1 From 1c2947581b8694b3e8ab447c5c7c2c9dbb43bf8b Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 4 Jun 2009 23:55:56 +0000 Subject: fix shadowing of a global declaration --- lib/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index aa13ebdc9..acf7ef689 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -112,7 +112,7 @@ const struct Curl_handler Curl_handler_dict = { PROT_DICT /* protocol */ }; -static char *unescape_word(struct SessionHandle *data, const char *inp) +static char *unescape_word(struct SessionHandle *data, const char *inputbuff) { char *newp; char *dictp; @@ -121,7 +121,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inp) char byte; int olen=0; - newp = curl_easy_unescape(data, inp, 0, &len); + newp = curl_easy_unescape(data, inputbuff, 0, &len); if(!newp) return NULL; -- cgit v1.2.1 From 352177090f710fd155d22a79d11f621482c09640 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 10 Jun 2009 21:26:11 +0000 Subject: - Fabian Keil ran clang on the (lib)curl code, found a bunch of warnings and contributed a range of patches to fix them. --- lib/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index acf7ef689..223eddc0e 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -182,7 +182,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) *strategy++ = (char)0; nthdef = strchr(strategy, ':'); if(nthdef) { - *nthdef++ = (char)0; + *nthdef = (char)0; } } } @@ -238,7 +238,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) *database++ = (char)0; nthdef = strchr(database, ':'); if(nthdef) { - *nthdef++ = (char)0; + *nthdef = (char)0; } } } -- cgit v1.2.1 From 4798f4e65258afb6935d0b471e7d1b5a0d5edf1e Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 8 Oct 2009 00:02:32 +0000 Subject: Fix compiler warning: addition result could be truncated before cast to bigger sized type --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 223eddc0e..1c7d5c9f8 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -125,7 +125,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inputbuff) if(!newp) return NULL; - dictp = malloc(len*2 + 1); /* add one for terminating zero */ + dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */ if(dictp) { /* According to RFC2229 section 2.2, these letters need to be escaped with \[letter] */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/dict.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1c7d5c9f8..1deab76ec 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -18,7 +18,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From c0111460b0689d74731cc56ff019cc869a0d16a8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 16 Apr 2010 23:43:04 +0200 Subject: Curl_setup_transfer: no longer returns anything This function could only return CURLE_OK and by changing it to a void instead, we can simplify code all over. --- lib/dict.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 1deab76ec..d86923a9f 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -217,13 +217,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) free(eword); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - if(result) return result; + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ } else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || @@ -265,15 +264,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) free(eword); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - - if(result) return result; - + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ } else { @@ -290,13 +286,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "%s\r\n" "QUIT\r\n", ppath); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); - if(result) return result; + } + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); } } -- cgit v1.2.1 From 8831000bc07de463d277975a3ddfb6a31dcf14b4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 Mar 2011 22:22:22 +0100 Subject: protocol handler: added flags field The protocol handler struct got a 'flags' field for special information and characteristics of the given protocol. This now enables us to move away central protocol information such as CLOSEACTION and DUALCHANNEL from single defines in a central place, out to each protocol's definition. It also made us stop abusing the protocol field for other info than the protocol, and we could start cleaning up other protocol-specific things by adding flags bits to set in the handler struct. The "protocol" field connectdata struct was removed as well and the code now refers directly to the conn->handler->protocol field instead. To make things work properly, the code now always store a conn->given pointer that points out the original handler struct so that the code can learn details from the original protocol even if conn->handler is modified along the way - for example when switching to go over a HTTP proxy. --- lib/dict.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index d86923a9f..750f728e9 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -108,7 +108,8 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ PORT_DICT, /* defport */ - PROT_DICT /* protocol */ + PROT_DICT, /* protocol */ + PROTOPT_NONE /* flags */ }; static char *unescape_word(struct SessionHandle *data, const char *inputbuff) -- cgit v1.2.1 From 13b64d75589647f8d151e035bd2c5d340a1c37ee Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 Mar 2011 22:52:14 +0100 Subject: protocols: use CURLPROTO_ internally The PROT_* set of internal defines for the protocols is no longer used. We now use the same bits internally as we have defined in the public header using the CURLPROTO_ prefix. This is for simplicity and because the PROT_* prefix was already used duplicated internally for a set of KRB4 values. The PROTOPT_* defines were moved up to just below the struct definition within which they are used. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 750f728e9..e079fd188 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -108,7 +108,7 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ PORT_DICT, /* defport */ - PROT_DICT, /* protocol */ + CURLPROTO_DICT, /* protocol */ PROTOPT_NONE /* flags */ }; -- cgit v1.2.1 From b903186fa0189ff241d756d25d07fdfe9885ae49 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 20 Apr 2011 15:17:42 +0200 Subject: source cleanup: unify look, style and indent levels By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index e079fd188..c296bd998 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -279,7 +279,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) int i; ppath++; - for (i = 0; ppath[i]; i++) { + for(i = 0; ppath[i]; i++) { if(ppath[i] == ':') ppath[i] = ' '; } -- cgit v1.2.1 From f0612f166a5fa51d09498baa19a327c5cf36941f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 5 May 2011 16:27:03 +0200 Subject: RTSP: convert protocol-specific checks to generic Add a 'readwrite' function to the protocol handler struct and use that for the extra readwrite functionality RTSP needs. --- lib/dict.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index c296bd998..0baaeec3a 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -107,6 +107,7 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* doing_getsock */ ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ + ZERO_NULL, /* readwrite */ PORT_DICT, /* defport */ CURLPROTO_DICT, /* protocol */ PROTOPT_NONE /* flags */ -- cgit v1.2.1 From 0337b871975ab515c513d2c5d596feb9a489494d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 25 Jul 2011 04:08:08 +0200 Subject: time.h and sys/time.h inclusion conditionally done in setup_once.h --- lib/dict.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 0baaeec3a..8c5540264 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -32,16 +32,12 @@ #include #ifdef WIN32 -#include #include #else #ifdef HAVE_SYS_SOCKET_H #include #endif #include -#ifdef HAVE_SYS_TIME_H -#include -#endif #ifdef HAVE_UNISTD_H #include #endif -- cgit v1.2.1 From 983f3d70f9610a35f279b656a3322087e272f2a6 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 25 Jul 2011 05:30:14 +0200 Subject: WIN32 io.h and fcntl.h inclusion done in setup_once.h --- lib/dict.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 8c5540264..241781ab9 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -31,17 +31,18 @@ #include #include -#ifdef WIN32 -#include -#else #ifdef HAVE_SYS_SOCKET_H #include #endif +#ifdef HAVE_NETINET_IN_H #include +#endif #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_NETDB_H #include +#endif #ifdef HAVE_ARPA_INET_H #include #endif @@ -60,9 +61,6 @@ #include #endif - -#endif - #include "urldata.h" #include #include "transfer.h" -- cgit v1.2.1 From f1586cb4775681810afd8e6626e7842d459f3b85 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 26 Jul 2011 17:23:27 +0200 Subject: stdio.h, stdlib.h, string.h, stdarg.h and ctype.h inclusion done in setup_once.h --- lib/dict.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 241781ab9..36bb28923 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -24,13 +24,6 @@ #ifndef CURL_DISABLE_DICT -/* -- WIN32 approved -- */ -#include -#include -#include -#include -#include - #ifdef HAVE_SYS_SOCKET_H #include #endif -- cgit v1.2.1 From d7934b8bd49114cbb54f7401742f7fb088e2f796 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 21 Oct 2011 23:36:54 +0200 Subject: curl_multi_fdset: correct fdset with FTP PORT use After a PORT has been issued, and the multi handle would switch to the CURLM_STATE_DO_MORE state (which is unique for FTP), libcurl would return the wrong fdset to wait for when curl_multi_fdset() is called. The code would blindly assume that it was waiting for a connect of the second connection, while that isn't true immediately after the PORT command. Also, the function multi.c:domore_getsock() was highly FTP-centric and therefore ugly to keep in protocol-agnostic code. I solved this problem by introducing a new function pointer in the Curl_handler struct called domore_getsock() which is only called during the DOMORE state for protocols that set that pointer. The new ftp.c:ftp_domore_getsock() function now returns fdset info about the control connection's command/response handling while such a state is in use, and goes over to waiting for a writable second connection first once the commands are done. The original problem could be seen by running test 525 and checking the time stamps in the FTP server log. I can verify that this fix at least fixes this problem. Bug: http://curl.haxx.se/mail/lib-2011-10/0250.html Reported by: Gokhan Sengun --- lib/dict.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 36bb28923..b326054d1 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -92,6 +92,7 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* doing */ ZERO_NULL, /* proto_getsock */ ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* domore_getsock */ ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ ZERO_NULL, /* readwrite */ -- cgit v1.2.1 From 2c905fd1f8200349667dc990a17daf37214700bf Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Thu, 24 Nov 2011 23:28:54 +0100 Subject: query-part: ignore the URI part for given protocols By setting PROTOPT_NOURLQUERY in the protocol handler struct, the protocol will get the "query part" of the URL cut off before the data is handled by the protocol-specific code. This makes libcurl adhere to RFC3986 section 2.2. Test 1220 is added to verify a file:// URL with query-part. --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index b326054d1..0fad32bfa 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -98,7 +98,7 @@ const struct Curl_handler Curl_handler_dict = { ZERO_NULL, /* readwrite */ PORT_DICT, /* defport */ CURLPROTO_DICT, /* protocol */ - PROTOPT_NONE /* flags */ + PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */ }; static char *unescape_word(struct SessionHandle *data, const char *inputbuff) -- cgit v1.2.1 From 0ce2bca741ae596a346b2ab767dfbf5be9bc7dae Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 16 Jan 2012 21:14:05 +0100 Subject: add LF termination to infof() trace string --- lib/dict.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 0fad32bfa..8c083736a 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -178,7 +178,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) } if((word == NULL) || (*word == (char)0)) { - infof(data, "lookup word is missing"); + infof(data, "lookup word is missing\n"); word=(char *)"default"; } if((database == NULL) || (*database == (char)0)) { @@ -232,7 +232,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) } if((word == NULL) || (*word == (char)0)) { - infof(data, "lookup word is missing"); + infof(data, "lookup word is missing\n"); word=(char *)"default"; } if((database == NULL) || (*database == (char)0)) { -- cgit v1.2.1 From ee588fe088077785d9ad9263e03e1e525b074261 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 17 Nov 2012 00:59:42 +0100 Subject: mem-include-scan: verify memory #includes If we use memory functions (malloc, free, strdup etc) in C sources in libcurl and we fail to include curl_memory.h or memdebug.h we either fail to properly support user-provided memory callbacks or the memory leak system of the test suite fails. After Ajit's report of a failure in the first category in http_proxy.c, I spotted a few in the second category as well. These problems are now tested for by test 1132 which runs a perl program that scans for and attempts to check that we use the correct include files if a memory related function is used in the source code. Reported by: Ajit Dhumale Bug: http://curl.haxx.se/mail/lib-2012-11/0125.html --- lib/dict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/dict.c') diff --git a/lib/dict.c b/lib/dict.c index 8c083736a..beebf4a23 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -67,10 +67,10 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include +#include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" - /* * Forward declarations. */ -- cgit v1.2.1