Compare commits
90 Commits
curl-7_17_
...
cares-1_5_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d994a873a4 | ||
|
|
b6575ce0b0 | ||
|
|
e2b2a84497 | ||
|
|
86956c2261 | ||
|
|
ef6dfdc7fd | ||
|
|
f3b85ef79d | ||
|
|
1d7e42ee9f | ||
|
|
6dfb5b4e1f | ||
|
|
930085751c | ||
|
|
258c4686b2 | ||
|
|
600d0b1303 | ||
|
|
2f928797cf | ||
|
|
f3f06e823c | ||
|
|
58292f49c5 | ||
|
|
5376d1047c | ||
|
|
1746b57161 | ||
|
|
0561bffab3 | ||
|
|
968e943eac | ||
|
|
5be00c95a7 | ||
|
|
c80b9c3778 | ||
|
|
536f98a766 | ||
|
|
c4e5613a7d | ||
|
|
bff962398d | ||
|
|
2b15823dab | ||
|
|
59dcc7e191 | ||
|
|
ea3fe98867 | ||
|
|
4f05613fbb | ||
|
|
22e52ddd6e | ||
|
|
1125d45397 | ||
|
|
44d408204a | ||
|
|
50feea3eef | ||
|
|
ca95f58ac0 | ||
|
|
ed636cbe44 | ||
|
|
738e4f410c | ||
|
|
4e731a0189 | ||
|
|
5cf6a539fe | ||
|
|
17fde12fb8 | ||
|
|
5c8b973d4f | ||
|
|
b22e03b2b2 | ||
|
|
a2926ebe7c | ||
|
|
c508d70258 | ||
|
|
f5971f54ff | ||
|
|
c5b16d4468 | ||
|
|
3c71a1bab7 | ||
|
|
3ec322685b | ||
|
|
9a39839a43 | ||
|
|
e87c996fe0 | ||
|
|
32195c673d | ||
|
|
b99a61c5b0 | ||
|
|
c960cd41e8 | ||
|
|
a29471d0f7 | ||
|
|
ba6f20a244 | ||
|
|
61572a1f97 | ||
|
|
dee3844f13 | ||
|
|
cbd1a77ec2 | ||
|
|
33f7ac06c3 | ||
|
|
70f10f1ac9 | ||
|
|
775b60fa09 | ||
|
|
66e4d391d3 | ||
|
|
caf880be18 | ||
|
|
c8355c27e9 | ||
|
|
c2d7e2ae17 | ||
|
|
98ecad0da6 | ||
|
|
bbc4e05434 | ||
|
|
ad6e28073c | ||
|
|
af29dcbafb | ||
|
|
b9a7f4e502 | ||
|
|
51009a40b4 | ||
|
|
2ec8f77f21 | ||
|
|
7f62028d66 | ||
|
|
d34fe06fb0 | ||
|
|
2f3d520571 | ||
|
|
48dd0c5673 | ||
|
|
8be493296d | ||
|
|
6f33531861 | ||
|
|
16897354bc | ||
|
|
823a0454a6 | ||
|
|
6790c559af | ||
|
|
c56c4a0a47 | ||
|
|
45064c5778 | ||
|
|
7aba59f577 | ||
|
|
59b05ac383 | ||
|
|
9b15f1be26 | ||
|
|
38cd2d781f | ||
|
|
2f285b3f16 | ||
|
|
57d2fb41d0 | ||
|
|
0f77fe55b6 | ||
|
|
68ee002ad0 | ||
|
|
1fc3b18592 | ||
|
|
5a5287ef2a |
111
CHANGES
111
CHANGES
@@ -6,6 +6,117 @@
|
||||
|
||||
Changelog
|
||||
|
||||
|
||||
Daniel S (21 Nov 2007)
|
||||
- While inspecting the Negotiate code, I noticed how the proxy auth was using
|
||||
the same state struct as the host auth, so both could never be used at the
|
||||
same time! I fixed it (without being able to check) to use two separate
|
||||
structs to allow authentication using Negotiate on host and proxy
|
||||
simultanouesly.
|
||||
|
||||
Daniel S (20 Nov 2007)
|
||||
- Emil Romanus pointed out a bug that made an easy handle get the cookie
|
||||
engine activated when set to use a share (even if the share doesn't share
|
||||
cookies). I fixed it.
|
||||
|
||||
- Fixed a very long-lasting mprintf() bug that occured when we did "%.*s%s",
|
||||
since the second %s would then wrongly used the numerical precision argument
|
||||
instead and crash.
|
||||
|
||||
- Introuced --data-urlencode to the curl tool for easier url encoding of the
|
||||
data sent in a post.
|
||||
|
||||
Daniel S (18 Nov 2007)
|
||||
- Rob Crittenden fixed SSL connections with NSS done with the multi-interface
|
||||
|
||||
Daniel S (17 Nov 2007)
|
||||
- Michal Marek made the test suite remember what test servers that fail to
|
||||
start so that subsequent tries are simply skipped.
|
||||
|
||||
- Andres Garcia made the examples build fine on Windows (mingw + msys) when
|
||||
the lib was built staticly.
|
||||
|
||||
Daniel S (16 Nov 2007)
|
||||
- Ates Goral identified a problem in http.c:add_buffer_send() when a debug
|
||||
callback was used, as it could wrongly pass on a bad size for the outgoing
|
||||
HTTP header. The bad size would be a very large value as it was a wrapped
|
||||
size_t content. This happened when the whole HTTP request failed to get sent
|
||||
in one single send. http://curl.haxx.se/mail/lib-2007-11/0165.html
|
||||
|
||||
Daniel S (15 Nov 2007)
|
||||
- Fixed yet another remaining problem with doing SFTP directory listings on a
|
||||
re-used persistent connection. Mentioned by Immanuel Gregoire on the mailing
|
||||
list.
|
||||
|
||||
- Michal Marek fixed the test suite to better deal with the case when the HTTP
|
||||
ipv6 server can't run.
|
||||
|
||||
Yang Tse (14 Nov 2007)
|
||||
- Fix a variable potential wrapping in add_buffer() when using absolutely
|
||||
huge send buffer sizes.
|
||||
|
||||
Daniel S (13 Nov 2007)
|
||||
- Fixed a remaining problem with doing SFTP directory listings on a re-used
|
||||
persistent connection. Mentioned by Immanuel Gregoire on the mailing list.
|
||||
|
||||
Daniel S (12 Nov 2007)
|
||||
- Bug report #1830637 (http://curl.haxx.se/bug/view.cgi?id=1830637), which was
|
||||
forwarded from the Gentoo bug tracker by Daniel Black and was originally
|
||||
submitted by Robin Johnson, pointed out that libcurl would do bad memory
|
||||
references when it failed and bailed out before the handler thing was
|
||||
setup. My fix is not done like the provided patch does it, but instead I
|
||||
make sure that there's never any chance for a NULL pointer in that struct
|
||||
member.
|
||||
|
||||
Daniel S (8 Nov 2007)
|
||||
- Bug report #1823487 (http://curl.haxx.se/bug/view.cgi?id=1823487) pointed
|
||||
out that SFTP requests didn't use persistent connections. Neither did SCP
|
||||
ones. I gave the SSH code a good beating and now both SCP and SFTP should
|
||||
use persistent connections fine. I also did a bunch of indent changes as
|
||||
well as a bug fix for the "keyboard interactive" auth.
|
||||
|
||||
Dan F (6 Nov 2007)
|
||||
- Improved telnet support by drastically reducing the number of write
|
||||
callbacks needed to pass a buffer to the user. Instead one per byte it
|
||||
is now as little as one per segment.
|
||||
|
||||
Yang Tse (6 Nov 2007)
|
||||
- Bug report #1824894 (http://curl.haxx.se/bug/view.cgi?id=1824894) pointed
|
||||
out a problem in curl.h when building C++ apps with MSVC. To fix it, the
|
||||
inclusion of header files in curl.h is moved outside of the C++ extern "C"
|
||||
linkage block.
|
||||
|
||||
Daniel S (1 Nov 2007)
|
||||
- Toby Peterson patched a memory problem in the command line tool that
|
||||
happened when a user had a home dir as an empty string. curl would then do
|
||||
free() on a wrong area.
|
||||
|
||||
Dan F (1 Nov 2007)
|
||||
- Fixed curl-config --features to not display libz when it wasn't used
|
||||
due to a missing header file.
|
||||
|
||||
Dan F (31 October 2007)
|
||||
- Fixed the output of curl-config --protocols which showed SCP and SFTP
|
||||
always, except when --without-libssh2 was given
|
||||
|
||||
- Added test cases 1013 and 1014 to check that curl-config --protocols and
|
||||
curl-config --features matches the output of curl --version
|
||||
|
||||
Dan F (30 October 2007)
|
||||
- Fixed an OOM problem with file: URLs
|
||||
|
||||
- Moved Curl_file_connect into the protocol handler struct
|
||||
|
||||
Dan F (29 October 2007)
|
||||
- Added test case 546 to check that subsequent FTP transfers work after a
|
||||
failed one using the multi interface
|
||||
|
||||
Daniel S (29 October 2007)
|
||||
- Based on one of those bug reports that are intercepted by a distro's bug
|
||||
tracker (https://bugzilla.redhat.com/show_bug.cgi?id=316191), I now made
|
||||
curl-config --features and --protocols show the correct output when built
|
||||
with NSS.
|
||||
|
||||
Version 7.17.1 (29 October 2007)
|
||||
|
||||
Dan F (25 October 2007)
|
||||
|
||||
@@ -1,53 +1,31 @@
|
||||
Curl and libcurl 7.17.1
|
||||
Curl and libcurl 7.17.2
|
||||
|
||||
Public curl release number: 102
|
||||
Releases counted from the very beginning: 128
|
||||
Available command line options: 121
|
||||
Available curl_easy_setopt() options: 147
|
||||
Number of public functions in libcurl: 55
|
||||
Amount of public web site mirrors: 43
|
||||
Number of known libcurl bindings: 36
|
||||
Number of contributors: 588
|
||||
Public curl releases: 103
|
||||
Command line options: 122
|
||||
curl_easy_setopt() options: 147
|
||||
Public functions in libcurl: 55
|
||||
Public web site mirrors: 42
|
||||
Known libcurl bindings: 36
|
||||
Contributors: 597
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o automatically append ";type=<a|i>" when using HTTP proxies for FTP urls
|
||||
o improved NSS support
|
||||
o added --proxy-negotiate
|
||||
o added --post301 and CURLOPT_POST301
|
||||
o builds with c-ares 1.5.0
|
||||
o added CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 and --hostpubmd5
|
||||
o renamed CURLE_SSL_PEER_CERTIFICATE to CURLE_PEER_FAILED_VERIFICATION
|
||||
o added CURLOPT_OPENSOCKETFUNCTION and CURLOPT_OPENSOCKETDATA
|
||||
o CULROPT_COOKIELIST supports "FLUSH"
|
||||
o added CURLOPT_COPYPOSTFIELDS
|
||||
o added --static-libs to curl-config
|
||||
o --data-urlencode was added
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o curl-config --protocols now properly reports LDAPS, SCP and SFTP
|
||||
o ldapv3 support on Windows
|
||||
o ldap builds with the MSVC makefiles
|
||||
o no HOME and no key given caused SSH auth failure
|
||||
o Negotiate authentication over proxy
|
||||
o --ftp-method nocwd on directory listings
|
||||
o FTP, CURLOPT_NOBODY enabled and CURLOPT_HEADER disabled now does TYPE
|
||||
before SIZE
|
||||
o re-used handle transfers with SFTP
|
||||
o curl_easy_escape() problem with byte values >= 128
|
||||
o handles chunked-encoded CONNECT responses
|
||||
o misuse of ares_timeout() result
|
||||
o --local-port on TFTP transfers
|
||||
o CURLOPT_POSTFIELDS could fail to send binary data
|
||||
o specifying a proxy with a trailing slash didn't work (unless it also
|
||||
contained a port number)
|
||||
o redirect from HTTP to FTP or TFTP memory problems and leaks
|
||||
o re-used connections a bit too much when using non-SSL protocols tunneled
|
||||
over a HTTP proxy
|
||||
o embed the manifest in VC8 builds
|
||||
o use valgrind in the tests even when the lib is built shared with libtool
|
||||
o libcurl built with NSS can now ignore the peer verification even when the
|
||||
ca cert bundle is absent
|
||||
o curl-config --features and --protocols show the correct output when built
|
||||
with NSS, and also when SCP, SFTP and libz are not available
|
||||
o free problem in the curl tool for users with empty home dir
|
||||
o curl.h version 7.17.1 problem when building C++ apps with MSVC
|
||||
o SFTP and SCP use persistent connections
|
||||
o segfault on bad URL
|
||||
o variable wrapping when using absolutely huge send buffer sizes
|
||||
o variable wrapping when using debug callback and the HTTP request wasn't sent
|
||||
in one go
|
||||
o SSL connections with NSS done with the multi-interface
|
||||
o setting a share no longer activates cookies
|
||||
o Negotiate now works on auth and proxy simultanouesly
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@@ -55,18 +33,18 @@ This release includes the following known bugs:
|
||||
|
||||
Other curl-related news:
|
||||
|
||||
o
|
||||
o TclCurl 7.17.1 => http://personal1.iddeo.es/andresgarci/tclcurl/english/
|
||||
o Ruby Curl::Multi 0.1 => http://curl-multi.rubyforge.org/
|
||||
|
||||
New curl mirrors:
|
||||
|
||||
o http://curl.wetzlmayr.at/ is a new web mirror in Nuremberg, Germany
|
||||
o http://curl.gominet.net/ is new web mirror in Vizcaya, Portugal
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Dan Fandrich, Michal Marek, G<>nter Knauf, Rob Crittenden, Immanuel Gregoire,
|
||||
Mark Davies, Max Katsev, Philip Langdale, Alex Fishman, Johnny Luong,
|
||||
Alexey Pesternikov, Yang Tse, Kim Rinnewitz, Michael Wallner,
|
||||
Patrick Monnerat, Vladimir Lazarenko
|
||||
Dan Fandrich, Gisle Vanem, Toby Peterson, Yang Tse, Daniel Black,
|
||||
Robin Johnson, Michal Marek, Ates Goral, Andres Garcia, Rob Crittenden,
|
||||
Emil Romanus
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
To be addressed before 7.17.1 (planned release: late October 2007)
|
||||
To be addressed before 7.17.2 (planned release: December 2007)
|
||||
=============================
|
||||
|
||||
106 -
|
||||
107 - resolve the type= thing for FTP URLs over HTTP proxies
|
||||
|
||||
108 -
|
||||
|
||||
@@ -300,7 +300,6 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
|
||||
@echo $(DL)#define socklen_t int$(DL) >> $@
|
||||
@echo $(DL)#define strncasecmp strnicmp$(DL) >> $@
|
||||
@echo $(DL)#define strcasecmp stricmp$(DL) >> $@
|
||||
@@ -338,7 +337,6 @@ else
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
||||
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
This is what's new and changed in the c-ares 1.4.1 release:
|
||||
This is what's new and changed in the c-ares 1.5.0 release:
|
||||
|
||||
o
|
||||
o SONAME bump to a few API and ABI breaking changes:
|
||||
- ares_host_callback()
|
||||
- ares_nameinfo_callback()
|
||||
- ares_parse_a_reply()
|
||||
- ares_parse_aaaa_reply()
|
||||
|
||||
o two valgrind reports were silenced
|
||||
o ares_save_options() fix
|
||||
o do DNS retries even on TCP connections
|
||||
o correctly clear sockets from the fd_set in several functions
|
||||
o always wait on TCP events to detect connect closures
|
||||
o new socket options: ARES_OPT_SOCK_SNDBUF and ARES_OPT_SOCK_RCVBUF
|
||||
o made the query callbacks receive the number of timeouts that happened during
|
||||
the execution of a query
|
||||
o don't skip a server if it's the only one
|
||||
o segfault when generating a DNS "Transaction ID" under low memory conditions
|
||||
o ares_strerror() segfault fix
|
||||
o added copyright texts to a few places that were missing them
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions:
|
||||
|
||||
|
||||
Vlad Dinulescu, Brad House, Steinar H. Gunderson, Yang Tse
|
||||
|
||||
Have fun!
|
||||
|
||||
@@ -40,13 +40,6 @@
|
||||
#include "inet_net_pton.h"
|
||||
#include "ares_getopt.h"
|
||||
|
||||
#ifndef HAVE_STRUCT_IN6_ADDR
|
||||
struct in6_addr
|
||||
{
|
||||
unsigned char s6_addr[16];
|
||||
};
|
||||
#endif
|
||||
|
||||
static void callback(void *arg, int status, int timeouts, struct hostent *host);
|
||||
static void usage(void);
|
||||
|
||||
|
||||
46
ares/ares.h
46
ares/ares.h
@@ -18,6 +18,14 @@
|
||||
#ifndef ARES__H
|
||||
#define ARES__H
|
||||
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(_AIX) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
||||
@@ -35,8 +43,12 @@
|
||||
#include <sys/socket.h>
|
||||
#include <tcp.h>
|
||||
#elif defined(WIN32)
|
||||
#include <winsock2.h>
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -232,10 +244,38 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
|
||||
int alen, char **s, long *enclen);
|
||||
int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf,
|
||||
int alen, unsigned char **s, long *enclen);
|
||||
|
||||
#ifndef s6_addr
|
||||
struct in6_addr {
|
||||
union {
|
||||
unsigned char _S6_u8[16];
|
||||
} _S6_un;
|
||||
};
|
||||
#define s6_addr _S6_un._S6_u8
|
||||
#endif
|
||||
|
||||
struct addrttl {
|
||||
struct in_addr ipaddr;
|
||||
int ttl;
|
||||
};
|
||||
struct addr6ttl {
|
||||
struct in6_addr ip6addr;
|
||||
int ttl;
|
||||
};
|
||||
|
||||
/*
|
||||
** Parse the buffer, starting at *abuf and of length alen bytes, previously
|
||||
** obtained from an ares_search call. Put the results in *host, if nonnull.
|
||||
** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with
|
||||
** their TTLs in that array, and set *naddrttls to the number of addresses
|
||||
** so written.
|
||||
*/
|
||||
int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host);
|
||||
struct hostent **host,
|
||||
struct addrttl *addrttls, int *naddrttls);
|
||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host);
|
||||
struct hostent **host,
|
||||
struct addr6ttl *addrttls, int *naddrttls);
|
||||
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
||||
int addrlen, int family, struct hostent **host);
|
||||
int ares_parse_ns_reply(const unsigned char *abuf, int alen,
|
||||
|
||||
@@ -57,7 +57,7 @@ struct host_query {
|
||||
int timeouts;
|
||||
};
|
||||
|
||||
static void next_lookup(struct host_query *hquery, int status);
|
||||
static void next_lookup(struct host_query *hquery, int status_code);
|
||||
static void host_callback(void *arg, int status, int timeouts,
|
||||
unsigned char *abuf, int alen);
|
||||
static void end_hquery(struct host_query *hquery, int status,
|
||||
@@ -111,13 +111,14 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family,
|
||||
hquery->timeouts = 0;
|
||||
|
||||
/* Start performing lookups according to channel->lookups. */
|
||||
next_lookup(hquery, ARES_SUCCESS);
|
||||
next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */);
|
||||
}
|
||||
|
||||
static void next_lookup(struct host_query *hquery, int status)
|
||||
static void next_lookup(struct host_query *hquery, int status_code)
|
||||
{
|
||||
const char *p;
|
||||
struct hostent *host;
|
||||
int status = status_code;
|
||||
|
||||
for (p = hquery->remaining_lookups; *p; p++)
|
||||
{
|
||||
@@ -142,6 +143,7 @@ static void next_lookup(struct host_query *hquery, int status)
|
||||
end_hquery(hquery, status, host);
|
||||
return;
|
||||
}
|
||||
status = status_code; /* Use original status code */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -160,13 +162,13 @@ static void host_callback(void *arg, int status, int timeouts,
|
||||
{
|
||||
if (hquery->family == AF_INET)
|
||||
{
|
||||
status = ares_parse_a_reply(abuf, alen, &host);
|
||||
status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL);
|
||||
if (host && channel->nsort)
|
||||
sort_addresses(host, channel->sortlist, channel->nsort);
|
||||
}
|
||||
else if (hquery->family == AF_INET6)
|
||||
{
|
||||
status = ares_parse_aaaa_reply(abuf, alen, &host);
|
||||
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
|
||||
if (host && channel->nsort)
|
||||
sort6_addresses(host, channel->sortlist, channel->nsort);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
@@ -21,11 +22,13 @@
|
||||
#define PF_INET6 AF_INET6
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRUCT_IN6_ADDR
|
||||
struct in6_addr
|
||||
{
|
||||
unsigned char s6_addr[16];
|
||||
#ifndef s6_addr
|
||||
struct in6_addr {
|
||||
union {
|
||||
unsigned char _S6_u8[16];
|
||||
} _S6_un;
|
||||
};
|
||||
#define s6_addr _S6_un._S6_u8
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRUCT_SOCKADDR_IN6
|
||||
|
||||
@@ -22,24 +22,39 @@ ares_parse_a_reply \- Parse a reply to a DNS query of type A into a hostent
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B struct hostent **\fIhost\fP);
|
||||
.B struct hostent **\fIhost\fP,
|
||||
.B struct addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_a_reply
|
||||
function parses the response to a query of type A into a
|
||||
.BR "struct hostent" .
|
||||
.BR "struct hostent"
|
||||
and/or an array of
|
||||
.BR "struct addrttls" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR host .
|
||||
.IR host ,
|
||||
if host is nonnull.
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.PP
|
||||
If
|
||||
.IR addrttls
|
||||
and
|
||||
.IR naddrttls
|
||||
are both nonnull,
|
||||
then up to *naddrttls
|
||||
.BR "struct addrttl"
|
||||
records are stored in the array pointed to by addrttls,
|
||||
and then *naddrttls is set to the number of records so stored.
|
||||
Note that the memory for these records is supplied by the caller.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_a_reply
|
||||
can return any of the following values:
|
||||
|
||||
@@ -32,24 +32,32 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "ares.h"
|
||||
#include "ares_dns.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host)
|
||||
struct hostent **host,
|
||||
struct addrttl *addrttls, int *naddrttls)
|
||||
{
|
||||
unsigned int qdcount, ancount;
|
||||
int status, i, rr_type, rr_class, rr_len, naddrs;
|
||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
|
||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
|
||||
int naliases;
|
||||
long len;
|
||||
const unsigned char *aptr;
|
||||
char *hostname, *rr_name, *rr_data, **aliases;
|
||||
struct in_addr *addrs;
|
||||
struct hostent *hostent;
|
||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
|
||||
|
||||
/* Set *host to NULL for all failure cases. */
|
||||
if (host)
|
||||
*host = NULL;
|
||||
/* Same with *naddrttls. */
|
||||
if (naddrttls)
|
||||
*naddrttls = 0;
|
||||
|
||||
/* Give up if abuf doesn't have room for a header. */
|
||||
if (alen < HFIXEDSZ)
|
||||
@@ -73,6 +81,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
}
|
||||
aptr += len + QFIXEDSZ;
|
||||
|
||||
if (host)
|
||||
{
|
||||
/* Allocate addresses and aliases; ancount gives an upper bound for both. */
|
||||
addrs = malloc(ancount * sizeof(struct in_addr));
|
||||
if (!addrs)
|
||||
@@ -87,6 +97,13 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
free(addrs);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addrs = NULL;
|
||||
aliases = NULL;
|
||||
}
|
||||
|
||||
naddrs = 0;
|
||||
naliases = 0;
|
||||
|
||||
@@ -106,13 +123,33 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
rr_type = DNS_RR_TYPE(aptr);
|
||||
rr_class = DNS_RR_CLASS(aptr);
|
||||
rr_len = DNS_RR_LEN(aptr);
|
||||
rr_ttl = DNS_RR_TTL(aptr);
|
||||
aptr += RRFIXEDSZ;
|
||||
|
||||
if (rr_class == C_IN && rr_type == T_A
|
||||
&& rr_len == sizeof(struct in_addr)
|
||||
&& strcasecmp(rr_name, hostname) == 0)
|
||||
{
|
||||
if (addrs)
|
||||
{
|
||||
if (aptr + sizeof(struct in_addr) > abuf + alen)
|
||||
{
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
|
||||
}
|
||||
if (naddrs < max_addr_ttls)
|
||||
{
|
||||
struct addrttl * const at = &addrttls[naddrs];
|
||||
if (aptr + sizeof(struct in_addr) > abuf + alen)
|
||||
{
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
memcpy(&at->ipaddr, aptr, sizeof(struct in_addr));
|
||||
at->ttl = rr_ttl;
|
||||
}
|
||||
naddrs++;
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
@@ -120,7 +157,10 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
||||
{
|
||||
/* Record the RR name as an alias. */
|
||||
if (aliases)
|
||||
aliases[naliases] = rr_name;
|
||||
else
|
||||
free(rr_name);
|
||||
naliases++;
|
||||
|
||||
/* Decode the RR data and replace the hostname with it. */
|
||||
@@ -129,6 +169,10 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
break;
|
||||
free(hostname);
|
||||
hostname = rr_data;
|
||||
|
||||
/* Take the min of the TTLs we see in the CNAME chain. */
|
||||
if (cname_ttl > rr_ttl)
|
||||
cname_ttl = rr_ttl;
|
||||
}
|
||||
else
|
||||
free(rr_name);
|
||||
@@ -145,8 +189,23 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
status = ARES_ENODATA;
|
||||
if (status == ARES_SUCCESS)
|
||||
{
|
||||
/* We got our answer. Allocate memory to build the host entry. */
|
||||
/* We got our answer. */
|
||||
if (naddrttls)
|
||||
{
|
||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */
|
||||
if (addrttls[i].ttl > cname_ttl)
|
||||
addrttls[i].ttl = cname_ttl;
|
||||
}
|
||||
*naddrttls = n;
|
||||
}
|
||||
if (aliases)
|
||||
aliases[naliases] = NULL;
|
||||
if (host)
|
||||
{
|
||||
/* Allocate memory to build the host entry. */
|
||||
hostent = malloc(sizeof(struct hostent));
|
||||
if (hostent)
|
||||
{
|
||||
@@ -168,9 +227,13 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
||||
}
|
||||
status = ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
if (aliases)
|
||||
{
|
||||
for (i = 0; i < naliases; i++)
|
||||
free(aliases[i]);
|
||||
free(aliases);
|
||||
}
|
||||
free(addrs);
|
||||
free(hostname);
|
||||
return status;
|
||||
|
||||
@@ -22,24 +22,39 @@ ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA into a hosten
|
||||
.B #include <ares.h>
|
||||
.PP
|
||||
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
||||
.B struct hostent **\fIhost\fP);
|
||||
.B struct hostent **\fIhost\fP,
|
||||
.B struct addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ares_parse_aaaa_reply
|
||||
function parses the response to a query of type AAAA into a
|
||||
.BR "struct hostent" .
|
||||
.BR "struct hostent"
|
||||
and/or an array of
|
||||
.BR "struct addrttls" .
|
||||
The parameters
|
||||
.I abuf
|
||||
and
|
||||
.I alen
|
||||
give the contents of the response. The result is stored in allocated
|
||||
memory and a pointer to it stored into the variable pointed to by
|
||||
.IR host .
|
||||
.IR host ,
|
||||
if host is nonnull.
|
||||
It is the caller's responsibility to free the resulting host structure
|
||||
using
|
||||
.BR ares_free_hostent (3)
|
||||
when it is no longer needed.
|
||||
.PP
|
||||
If
|
||||
.IR addrttls
|
||||
and
|
||||
.IR naddrttls
|
||||
are both nonnull,
|
||||
then up to *naddrttls
|
||||
.BR "struct addr6ttl"
|
||||
records are stored in the array pointed to by addrttls,
|
||||
and then *naddrttls is set to the number of records so stored.
|
||||
Note that the memory for these records is supplied by the caller.
|
||||
.SH RETURN VALUES
|
||||
.B ares_parse_aaaa_reply
|
||||
can return any of the following values:
|
||||
|
||||
@@ -34,25 +34,33 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "ares.h"
|
||||
#include "ares_dns.h"
|
||||
#include "inet_net_pton.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
struct hostent **host)
|
||||
struct hostent **host, struct addr6ttl *addrttls,
|
||||
int *naddrttls)
|
||||
{
|
||||
unsigned int qdcount, ancount;
|
||||
int status, i, rr_type, rr_class, rr_len, naddrs;
|
||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
|
||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
|
||||
int naliases;
|
||||
long len;
|
||||
const unsigned char *aptr;
|
||||
char *hostname, *rr_name, *rr_data, **aliases;
|
||||
struct in6_addr *addrs;
|
||||
struct hostent *hostent;
|
||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
|
||||
|
||||
/* Set *host to NULL for all failure cases. */
|
||||
if (host)
|
||||
*host = NULL;
|
||||
/* Same with *naddrttls. */
|
||||
if (naddrttls)
|
||||
*naddrttls = 0;
|
||||
|
||||
/* Give up if abuf doesn't have room for a header. */
|
||||
if (alen < HFIXEDSZ)
|
||||
@@ -77,6 +85,8 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
aptr += len + QFIXEDSZ;
|
||||
|
||||
/* Allocate addresses and aliases; ancount gives an upper bound for both. */
|
||||
if (host)
|
||||
{
|
||||
addrs = malloc(ancount * sizeof(struct in6_addr));
|
||||
if (!addrs)
|
||||
{
|
||||
@@ -90,6 +100,12 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
free(addrs);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addrs = NULL;
|
||||
aliases = NULL;
|
||||
}
|
||||
naddrs = 0;
|
||||
naliases = 0;
|
||||
|
||||
@@ -109,13 +125,33 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
rr_type = DNS_RR_TYPE(aptr);
|
||||
rr_class = DNS_RR_CLASS(aptr);
|
||||
rr_len = DNS_RR_LEN(aptr);
|
||||
rr_ttl = DNS_RR_TTL(aptr);
|
||||
aptr += RRFIXEDSZ;
|
||||
|
||||
if (rr_class == C_IN && rr_type == T_AAAA
|
||||
&& rr_len == sizeof(struct in6_addr)
|
||||
&& strcasecmp(rr_name, hostname) == 0)
|
||||
{
|
||||
if (addrs)
|
||||
{
|
||||
if (aptr + sizeof(struct in6_addr) > abuf + alen)
|
||||
{
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
memcpy(&addrs[naddrs], aptr, sizeof(struct in6_addr));
|
||||
}
|
||||
if (naddrs < max_addr_ttls)
|
||||
{
|
||||
struct addr6ttl * const at = &addrttls[naddrs];
|
||||
if (aptr + sizeof(struct in6_addr) > abuf + alen)
|
||||
{
|
||||
status = ARES_EBADRESP;
|
||||
break;
|
||||
}
|
||||
memcpy(&at->ip6addr, aptr, sizeof(struct in6_addr));
|
||||
at->ttl = rr_ttl;
|
||||
}
|
||||
naddrs++;
|
||||
status = ARES_SUCCESS;
|
||||
}
|
||||
@@ -123,7 +159,10 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
||||
{
|
||||
/* Record the RR name as an alias. */
|
||||
if (aliases)
|
||||
aliases[naliases] = rr_name;
|
||||
else
|
||||
free(rr_name);
|
||||
naliases++;
|
||||
|
||||
/* Decode the RR data and replace the hostname with it. */
|
||||
@@ -132,6 +171,10 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
break;
|
||||
free(hostname);
|
||||
hostname = rr_data;
|
||||
|
||||
/* Take the min of the TTLs we see in the CNAME chain. */
|
||||
if (cname_ttl > rr_ttl)
|
||||
cname_ttl = rr_ttl;
|
||||
}
|
||||
else
|
||||
free(rr_name);
|
||||
@@ -148,8 +191,23 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
status = ARES_ENODATA;
|
||||
if (status == ARES_SUCCESS)
|
||||
{
|
||||
/* We got our answer. Allocate memory to build the host entry. */
|
||||
/* We got our answer. */
|
||||
if (naddrttls)
|
||||
{
|
||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */
|
||||
if (addrttls[i].ttl > cname_ttl)
|
||||
addrttls[i].ttl = cname_ttl;
|
||||
}
|
||||
*naddrttls = n;
|
||||
}
|
||||
if (aliases)
|
||||
aliases[naliases] = NULL;
|
||||
if (host)
|
||||
{
|
||||
/* Allocate memory to build the host entry. */
|
||||
hostent = malloc(sizeof(struct hostent));
|
||||
if (hostent)
|
||||
{
|
||||
@@ -171,9 +229,13 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||
}
|
||||
status = ARES_ENOMEM;
|
||||
}
|
||||
}
|
||||
if (aliases)
|
||||
{
|
||||
for (i = 0; i < naliases; i++)
|
||||
free(aliases[i]);
|
||||
free(aliases);
|
||||
}
|
||||
free(addrs);
|
||||
free(hostname);
|
||||
return status;
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
|
||||
@@ -159,24 +159,44 @@
|
||||
/* Define this if you have struct timeval */
|
||||
#define HAVE_STRUCT_TIMEVAL 1
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* COMPILER SPECIFIC */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define to avoid VS2005 complaining about portable C functions */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* IPV6 COMPATIBILITY */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Define this if you have address family AF_INET6 */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define HAVE_AF_INET6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have protocol family PF_INET6 */
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#define HAVE_PF_INET6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have struct in6_addr */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_STRUCT_IN6_ADDR 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have struct sockaddr_in6 */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
#endif
|
||||
|
||||
/* Define this if you have sockaddr_in6 with scopeid */
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __ARES_CONFIG_WIN32_H */
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
/* Copyright (C) 2005 by Daniel Stenberg
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
/* Copyright (C) 2005 by Dominick Meglio
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose and without
|
||||
* fee is hereby granted, provided that the above copyright
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
port build */
|
||||
|
||||
#ifndef NETWARE
|
||||
#ifndef __CYGWIN__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <process.h> /* for the _getpid() proto */
|
||||
#endif /* !NETWARE */
|
||||
#include <sys/types.h>
|
||||
|
||||
10
ares/setup.h
10
ares/setup.h
@@ -16,13 +16,11 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#if !defined(WIN32) && defined(__WIN32__)
|
||||
/* Borland fix */
|
||||
#define WIN32
|
||||
#endif
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if !defined(WIN32) && defined(_WIN32)
|
||||
/* VS2005 on x64 fix */
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
|
||||
# ADD BASE LINK32 ws2_32.lib advapi32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 ws2_32.lib advapi32.lib areslib.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "adig - Win32 Debug"
|
||||
|
||||
@@ -73,8 +73,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
|
||||
# ADD BASE LINK32 ws2_32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ws2_32.lib advapi32.lib areslib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ RSC=rc.exe
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
@@ -48,8 +49,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
|
||||
# ADD BASE LINK32 ws2_32.lib advapi32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 ws2_32.lib advapi32.lib areslib.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ahost - Win32 Debug"
|
||||
|
||||
@@ -62,6 +63,7 @@ LINK32=link.exe
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
@@ -71,8 +73,8 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
|
||||
# ADD BASE LINK32 ws2_32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ws2_32.lib advapi32.lib areslib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
12
configure.ac
12
configure.ac
@@ -174,6 +174,7 @@ case $host in
|
||||
esac
|
||||
AC_MSG_RESULT($mimpure)
|
||||
AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
|
||||
AM_CONDITIONAL(STATICLIB, false)
|
||||
|
||||
AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
|
||||
case $host in
|
||||
@@ -185,6 +186,7 @@ case $host in
|
||||
then
|
||||
AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
|
||||
AC_MSG_RESULT(yes)
|
||||
AM_CONDITIONAL(STATICLIB, true)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -1292,6 +1294,7 @@ else
|
||||
if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
|
||||
then
|
||||
AC_MSG_WARN([configure found only the libz lib, not the header file!])
|
||||
HAVE_LIBZ=""
|
||||
elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
|
||||
then
|
||||
AC_MSG_WARN([configure found only the libz header file, not the lib!])
|
||||
@@ -1356,8 +1359,9 @@ if test X"$OPT_LIBSSH2" != Xno; then
|
||||
AC_CHECK_HEADERS(libssh2.h,
|
||||
curl_ssh_msg="enabled (libSSH2)"
|
||||
LIBSSH2_ENABLED=1
|
||||
AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use]))
|
||||
AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
|
||||
AC_SUBST(USE_LIBSSH2, [1])
|
||||
)
|
||||
|
||||
if test X"$OPT_LIBSSH2" != Xoff &&
|
||||
test "$LIBSSH2_ENABLED" != "1"; then
|
||||
@@ -1566,13 +1570,17 @@ fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
|
||||
if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
|
||||
AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
|
||||
AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
|
||||
else
|
||||
# SSL is enabled, genericly
|
||||
AC_SUBST(SSL_ENABLED)
|
||||
SSL_ENABLED="1"
|
||||
fi
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Check for the CA bundle
|
||||
dnl **********************************************************************
|
||||
|
||||
if test X"$USE_NSS$USE_GNUTLS$OPENSSL_ENABLED" != "X"; then
|
||||
if test X"$SSL_ENABLED" != "X"; then
|
||||
|
||||
AC_MSG_CHECKING([CA cert bundle install path])
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ while test $# -gt 0; do
|
||||
if test "@USE_SSLEAY@" = "1"; then
|
||||
echo "SSL"
|
||||
NTLM=1 # OpenSSL implies NTLM
|
||||
elif test -n "@USE_GNUTLS@"; then
|
||||
elif test -n "@SSL_ENABLED@"; then
|
||||
echo "SSL"
|
||||
fi
|
||||
if test "@KRB4_ENABLED@" = "1"; then
|
||||
@@ -113,13 +113,13 @@ while test $# -gt 0; do
|
||||
--protocols)
|
||||
if test "@CURL_DISABLE_HTTP@" != "1"; then
|
||||
echo "HTTP"
|
||||
if test "@USE_SSLEAY@" = "1"; then
|
||||
if test "@SSL_ENABLED@" = "1"; then
|
||||
echo "HTTPS"
|
||||
fi
|
||||
fi
|
||||
if test "@CURL_DISABLE_FTP@" != "1"; then
|
||||
echo "FTP"
|
||||
if test "@USE_SSLEAY@" = "1"; then
|
||||
if test "@SSL_ENABLED@" = "1"; then
|
||||
echo "FTPS"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -143,11 +143,20 @@ Rexx
|
||||
Written Mark Hessling
|
||||
http://rexxcurl.sourceforge.net/
|
||||
|
||||
RPG
|
||||
|
||||
Support for ILE/RPG on OS/400 is included in source distribution
|
||||
http://curl.haxx.se/libcurl/
|
||||
See packages/OS400/README.OS400 and packages/OS400/curl.inc.in
|
||||
|
||||
Ruby
|
||||
|
||||
Written by Ross Bamford
|
||||
curb - written by Ross Bamford
|
||||
http://curb.rubyforge.org/
|
||||
|
||||
ruby-curl-multi - written by Kristjan Petursson and Keith Rarick
|
||||
http://curl-multi.rubyforge.org/
|
||||
|
||||
Scheme
|
||||
|
||||
Bigloo binding by Kirill Lisovsky
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
using spaces only (no tabs) and having the opening brace ({) on the same line
|
||||
as the if() or while().
|
||||
|
||||
Also note that we use if() and while() with no space before the parenthesis.
|
||||
|
||||
2.3 Commenting
|
||||
|
||||
Comment your source code extensively using C comments (/* comment */), DO NOT
|
||||
|
||||
@@ -12,6 +12,7 @@ Albert Chin-A-Young
|
||||
Albert Choy
|
||||
Ale Vesely
|
||||
Aleksandar Milivojevic
|
||||
Alex Fishman
|
||||
Alex Neblett
|
||||
Alex Suykov
|
||||
Alex aka WindEagle
|
||||
@@ -19,6 +20,7 @@ Alexander Kourakos
|
||||
Alexander Krasnostavsky
|
||||
Alexander Lazic
|
||||
Alexander Zhuravlev
|
||||
Alexey Pesternikov
|
||||
Alexey Simak
|
||||
Alexis Carvalho
|
||||
Allen Pulsifer
|
||||
@@ -229,6 +231,7 @@ Ignacio Vazquez-Abrams
|
||||
Igor Polyakov
|
||||
Ilguiz Latypov
|
||||
Ilja van Sprundel
|
||||
Immanuel Gregoire
|
||||
Ingmar Runge
|
||||
Ingo Ralf Blum
|
||||
Ingo Wilken
|
||||
@@ -274,6 +277,7 @@ John Janssen
|
||||
John Kelly
|
||||
John Lask
|
||||
John McGowan
|
||||
Johnny Luong
|
||||
Jon Grubbs
|
||||
Jon Travis
|
||||
Jon Turner
|
||||
@@ -308,6 +312,7 @@ Kent Boortz
|
||||
Kevin Fisk
|
||||
Kevin Lussier
|
||||
Kevin Roth
|
||||
Kim Rinnewitz
|
||||
Kimmo Kinnunen
|
||||
Kjell Ericson
|
||||
Kjetil Jacobsen
|
||||
@@ -348,6 +353,7 @@ Marco G. Salvagno
|
||||
Marcus Webster
|
||||
Mario Schroeder
|
||||
Mark Butler
|
||||
Mark Davies
|
||||
Mark Eichin
|
||||
Mark Lentczner
|
||||
Markus Koetter
|
||||
@@ -368,6 +374,7 @@ Matt Witherspoon
|
||||
Matthew Blain
|
||||
Matthew Clarke
|
||||
Maurice Barnum
|
||||
Max Katsev
|
||||
Mekonikum
|
||||
Mettgut Jamalla
|
||||
Michael Benedict
|
||||
@@ -440,6 +447,7 @@ Peter Wullinger
|
||||
Peteris Krumins
|
||||
Phil Karn
|
||||
Philip Gladstone
|
||||
Philip Langdale
|
||||
Philippe Hameau
|
||||
Philippe Raoult
|
||||
Philippe Vaucher
|
||||
@@ -575,6 +583,7 @@ Vilmos Nebehaj
|
||||
Vincent Bronner
|
||||
Vincent Penquerc'h
|
||||
Vincent Sanders
|
||||
Vladimir Lazarenko
|
||||
Vojtech Janota
|
||||
Vojtech Minarik
|
||||
Walter J. Mack
|
||||
|
||||
16
docs/curl.1
16
docs/curl.1
@@ -21,7 +21,7 @@
|
||||
.\" * $Id$
|
||||
.\" **************************************************************************
|
||||
.\"
|
||||
.TH curl 1 "21 Sep 2007" "Curl 7.17.1" "Curl Manual"
|
||||
.TH curl 1 "20 Nov 2007" "Curl 7.17.2" "Curl Manual"
|
||||
.SH NAME
|
||||
curl \- transfer a URL
|
||||
.SH SYNOPSIS
|
||||
@@ -261,6 +261,20 @@ the \fI--data-ascii\fP option, this is for you.
|
||||
|
||||
If this option is used several times, the ones following the first will
|
||||
append data.
|
||||
.IP "--data-urlencode <data>"
|
||||
(HTTP) This posts data, similar to the other --data options with the exception
|
||||
that this will do partial URL encoding. (Added in 7.17.2)
|
||||
|
||||
The <data> part should be using one of the two following syntaxes:
|
||||
.RS
|
||||
.IP "name=content"
|
||||
This will make curl URL encode the content part and pass that on. Note that
|
||||
the name part is expected to be URL encoded already.
|
||||
.IP "name@filename"
|
||||
This will make curl load data from the given file, URL encode that data and
|
||||
pass it on in the POST like \fIname=urlencoded-data\fP. Note that the name
|
||||
is expected to be URL encoded already.
|
||||
.RE
|
||||
.IP "--digest"
|
||||
(HTTP) Enables HTTP Digest authentication. This is a authentication that
|
||||
prevents the password from being sent over the wire in clear text. Use this in
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <curl/multi.h>
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static const char *urls[] = {
|
||||
"http://www.microsoft.com",
|
||||
@@ -138,7 +141,11 @@ int main(void)
|
||||
L = 100;
|
||||
|
||||
if (M == -1) {
|
||||
#ifdef WIN32
|
||||
Sleep(L);
|
||||
#else
|
||||
sleep(L / 1000);
|
||||
#endif
|
||||
} else {
|
||||
T.tv_sec = L/1000;
|
||||
T.tv_usec = (L%1000)*1000;
|
||||
|
||||
@@ -9,7 +9,13 @@ EXTRA_DIST = README Makefile.example makefile.dj $(COMPLICATED_EXAMPLES)
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
LIBDIR = $(top_builddir)/lib
|
||||
CPPFLAGS = -DCURL_NO_OLDIES
|
||||
|
||||
if STATICLIB
|
||||
# we need this define when building with a static lib on Windows
|
||||
STATICCPPFLAGS = -DCURL_STATICLIB
|
||||
endif
|
||||
|
||||
CPPFLAGS = -DCURL_NO_OLDIES $(STATICCPPFLAGS)
|
||||
|
||||
# Dependencies
|
||||
LDADD = $(LIBDIR)/libcurl.la
|
||||
|
||||
@@ -98,5 +98,8 @@ int main(int argc, char **argv)
|
||||
if(chunk.memory)
|
||||
free(chunk.memory);
|
||||
|
||||
/* we're done with libcurl, so clean it up */
|
||||
curl_global_cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1491,6 +1491,14 @@ this curl handle use the data from the shared handle instead of keeping the
|
||||
data to itself. This enables several curl handles to share data. If the curl
|
||||
handles are used simultaneously, you \fBMUST\fP use the locking methods in the
|
||||
share handle. See \fIcurl_share_setopt(3)\fP for details.
|
||||
|
||||
If you add a share that is set to share cookies, your easy handle will use
|
||||
that cookie cache and get the cookie engine enabled. If you unshare an object
|
||||
that were using cookies (or change to another object that doesn't share
|
||||
cookies), the easy handle will get its cookie engine disabled.
|
||||
|
||||
Data that the share object is not set to share will be dealt with the usual
|
||||
way, as if no share was used.
|
||||
.IP CURLOPT_NEW_FILE_PERMS
|
||||
Pass a long as a parameter, containing the value of the permissions that will
|
||||
be assigned to newly created files on the remote server. The default value is
|
||||
|
||||
@@ -29,6 +29,14 @@
|
||||
|
||||
#include "curlver.h" /* the libcurl version defines */
|
||||
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -41,12 +49,42 @@
|
||||
# include <time.h>
|
||||
#endif /* defined (vms) */
|
||||
|
||||
typedef void CURL;
|
||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
|
||||
!defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
|
||||
/* The check above prevents the winsock2 inclusion if winsock.h already was
|
||||
included, since they can't co-exist without problems */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
||||
libc5-based Linux systems. Only include it on system that are known to
|
||||
require it! */
|
||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || defined(__minix)
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifndef __WATCOMC__
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void CURL;
|
||||
|
||||
/*
|
||||
* Decorate exportable functions for Win32 DLL linking.
|
||||
* This avoids using a .def file for building libcurl.dll.
|
||||
@@ -139,38 +177,6 @@ extern "C" {
|
||||
#undef FILESIZEBITS
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we
|
||||
make this adjustment to catch this. */
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
|
||||
!defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
|
||||
/* The check above prevents the winsock2 inclusion if winsock.h already was
|
||||
included, since they can't co-exist without problems */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
||||
libc5-based Linux systems. Only include it on system that are known to
|
||||
require it! */
|
||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || defined(__minix)
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifndef __WATCOMC__
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifndef curl_socket_typedef
|
||||
/* socket typedef */
|
||||
#ifdef WIN32
|
||||
@@ -1241,10 +1247,6 @@ typedef enum {
|
||||
CURL_TIMECOND_LAST
|
||||
} curl_TimeCond;
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* curl_strequal() and curl_strnequal() are subject for removal in a future
|
||||
libcurl, see lib/README.curlx for details */
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.17.1-CVS"
|
||||
#define LIBCURL_VERSION "7.17.2-CVS"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 17
|
||||
#define LIBCURL_VERSION_PATCH 1
|
||||
#define LIBCURL_VERSION_PATCH 2
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
@@ -51,7 +51,7 @@
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x071101
|
||||
#define LIBCURL_VERSION_NUM 0x071102
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
||||
@@ -12,9 +12,20 @@ CFLAGS = -3r -mf -d3 -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -bt=
|
||||
-d+ -dWIN32 -dCURL_CA_BUNDLE=getenv("CURL_CA_BUNDLE") &
|
||||
-dBUILDING_LIBCURL -dWITHOUT_MM_LIB -dHAVE_SPNEGO=1 -dENABLE_IPV6 &
|
||||
-dDEBUG_THREADING_GETADDRINFO -dDEBUG=1 -dCURLDEBUG -d_WIN32_WINNT=0x0501 &
|
||||
-I. -I..\include -dCURL_DISABLE_LDAP
|
||||
-I. -I..\include -dWINBERAPI=__declspec(cdecl) -dWINLDAPAPI=__declspec(cdecl)
|
||||
|
||||
#
|
||||
# Change to suite.
|
||||
#
|
||||
ZLIB_ROOT = ..\..\..\zlib-1.2.3
|
||||
USE_ZLIB = 0
|
||||
|
||||
!ifeq USE_ZLIB 1
|
||||
CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I$(ZLIB_ROOT)
|
||||
!endif
|
||||
|
||||
OBJ_DIR = Watcom_obj
|
||||
C_ARG = $(OBJ_DIR)\wcc386.arg
|
||||
LIB_ARG = $(OBJ_DIR)\wlib.arg
|
||||
LINK_ARG = $(OBJ_DIR)\wlink.arg
|
||||
|
||||
@@ -50,7 +61,7 @@ OBJS = $(OBJ_DIR)\base64.obj $(OBJ_DIR)\connect.obj &
|
||||
|
||||
RESOURCE = $(OBJ_DIR)\libcurl.res
|
||||
|
||||
all: $(OBJ_DIR) $(TARGETS) .SYMBOLIC
|
||||
all: $(OBJ_DIR) $(C_ARG) $(TARGETS) .SYMBOLIC
|
||||
@echo Welcome to libcurl
|
||||
|
||||
$(OBJ_DIR):
|
||||
@@ -69,7 +80,7 @@ clean: .SYMBOLIC
|
||||
- rm -f $(OBJS) $(RESOURCE)
|
||||
|
||||
vclean realclean: clean .SYMBOLIC
|
||||
- rm -f $(TARGETS) $(LIB_ARG) $(LINK_ARG) libcurl_wc.map
|
||||
- rm -f $(TARGETS) $(C_ARG) $(LIB_ARG) $(LINK_ARG) libcurl_wc.map
|
||||
- rmdir $(OBJ_DIR)
|
||||
|
||||
.ERASE
|
||||
@@ -78,8 +89,11 @@ $(RESOURCE): libcurl.rc
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_DIR)}.obj:
|
||||
$(CC) $[@ $(CFLAGS) -fo=$@
|
||||
@echo .
|
||||
$(CC) $[@ @$(C_ARG) -fo=$@
|
||||
|
||||
$(C_ARG): $(__MAKEFILES__)
|
||||
%create $^@
|
||||
%append $^@ $(CFLAGS)
|
||||
|
||||
$(LIB_ARG): $(__MAKEFILES__)
|
||||
%create $^@
|
||||
@@ -91,7 +105,10 @@ $(LINK_ARG): $(__MAKEFILES__)
|
||||
@%append $^@ file { $(OBJS) }
|
||||
@%append $^@ option quiet, map, caseexact, eliminate, implib=libcurl_wc_imp.lib,
|
||||
@%append $^@ res=$(RESOURCE) libpath $(%watcom)\lib386;$(%watcom)\lib386\nt
|
||||
@%append $^@ library clib3r.lib, ws2_32.lib
|
||||
@%append $^@ library clib3r.lib, wldap32.lib, ws2_32.lib
|
||||
!ifeq USE_ZLIB 1
|
||||
@%append $^@ library $(ZLIB_ROOT)\zlib.lib
|
||||
!endif
|
||||
|
||||
#
|
||||
# Dependencies based on "gcc -MM .."
|
||||
|
||||
@@ -20,12 +20,12 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8e
|
||||
OPENSSL_PATH = ../../openssl-0.9.8g
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
LIBSSH2_PATH = ../../libssh2-0.16
|
||||
LIBSSH2_PATH = ../../libssh2-0.18
|
||||
endif
|
||||
|
||||
ifndef INSTDIR
|
||||
@@ -372,7 +372,6 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define socklen_t int$(DL) >> $@
|
||||
@echo $(DL)#define DL_LDAP_FILE "ldapsdk.nlm"$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
||||
@@ -405,7 +404,6 @@ else
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
||||
@echo $(DL)#define DL_LDAP_FILE "lldapsdk.nlm"$(DL) >> $@
|
||||
ifdef ENABLE_IPV6
|
||||
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
|
||||
endif
|
||||
|
||||
@@ -347,6 +347,12 @@
|
||||
#define HAVE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
/* Define to avoid VS2005 complaining about portable C functions */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* LDAP SUPPORT */
|
||||
/* ---------------------------------------------------------------- */
|
||||
@@ -370,10 +376,6 @@
|
||||
/* ADDITIONAL DEFINITIONS */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Defines set for VS2005 to _not_ deprecate a few functions we use. */
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
|
||||
/* Define cpu-machine-OS */
|
||||
#undef OS
|
||||
#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */
|
||||
|
||||
@@ -308,6 +308,12 @@
|
||||
/* Undef keyword 'const' if it does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to avoid VS2005 complaining about portable C functions */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* LDAP SUPPORT */
|
||||
/* ---------------------------------------------------------------- */
|
||||
@@ -320,10 +326,6 @@
|
||||
/* ADDITIONAL DEFINITIONS */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Defines set for VS2005 to _not_ deprecate a few functions we use. */
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
|
||||
/* Define cpu-machine-OS */
|
||||
#undef OS
|
||||
#define OS "i386-pc-win32ce"
|
||||
|
||||
10
lib/file.c
10
lib/file.c
@@ -97,6 +97,7 @@
|
||||
static CURLcode Curl_file(struct connectdata *, bool *done);
|
||||
static CURLcode Curl_file_done(struct connectdata *conn,
|
||||
CURLcode status, bool premature);
|
||||
static CURLcode Curl_file_connect(struct connectdata *conn, bool *done);
|
||||
|
||||
/*
|
||||
* FILE scheme handler.
|
||||
@@ -108,7 +109,7 @@ const struct Curl_handler Curl_handler_file = {
|
||||
Curl_file, /* do_it */
|
||||
Curl_file_done, /* done */
|
||||
ZERO_NULL, /* do_more */
|
||||
ZERO_NULL, /* connect_it */
|
||||
Curl_file_connect, /* connect_it */
|
||||
ZERO_NULL, /* connecting */
|
||||
ZERO_NULL, /* doing */
|
||||
ZERO_NULL, /* proto_getsock */
|
||||
@@ -123,7 +124,7 @@ const struct Curl_handler Curl_handler_file = {
|
||||
* do protocol-specific actions at connect-time. We emulate a
|
||||
* connect-then-transfer protocol and "connect" to the file here
|
||||
*/
|
||||
CURLcode Curl_file_connect(struct connectdata *conn)
|
||||
static CURLcode Curl_file_connect(struct connectdata *conn, bool *done)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
char *real_path = curl_easy_unescape(data, data->reqdata.path, 0, NULL);
|
||||
@@ -203,6 +204,7 @@ CURLcode Curl_file_connect(struct connectdata *conn)
|
||||
Curl_file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE);
|
||||
return CURLE_FILE_COULDNT_READ_FILE;
|
||||
}
|
||||
*done = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -218,9 +220,6 @@ static CURLcode Curl_file_done(struct connectdata *conn,
|
||||
if(file->fd != -1)
|
||||
close(file->fd);
|
||||
|
||||
free(file);
|
||||
conn->data->reqdata.proto.file= NULL; /* clear it! */
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -379,7 +378,6 @@ static CURLcode Curl_file(struct connectdata *conn, bool *done)
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
|
||||
Curl_readwrite_init(conn);
|
||||
Curl_initinfo(data);
|
||||
Curl_pgrsStartNow(data);
|
||||
|
||||
|
||||
@@ -25,7 +25,5 @@
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
extern const struct Curl_handler Curl_handler_file;
|
||||
|
||||
CURLcode Curl_file_connect(struct connectdata *);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -3525,7 +3525,7 @@ static CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
result = ftp_easy_statemach(conn);
|
||||
}
|
||||
|
||||
if(ftp->transfer != FTPTRANSFER_BODY)
|
||||
if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY))
|
||||
/* no data to transfer. FIX: it feels like a kludge to have this here
|
||||
too! */
|
||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||
|
||||
57
lib/http.c
57
lib/http.c
@@ -932,6 +932,7 @@ CURLcode add_buffer_send(send_buffer *in,
|
||||
struct HTTP *http = conn->data->reqdata.proto.http;
|
||||
size_t sendsize;
|
||||
curl_socket_t sockfd;
|
||||
size_t headersize;
|
||||
|
||||
DEBUGASSERT(socketindex <= SECONDARYSOCKET);
|
||||
|
||||
@@ -943,9 +944,13 @@ CURLcode add_buffer_send(send_buffer *in,
|
||||
ptr = in->buffer;
|
||||
size = in->size_used;
|
||||
|
||||
headersize = size - included_body_bytes; /* the initial part that isn't body
|
||||
is header */
|
||||
|
||||
DEBUGASSERT(size > included_body_bytes);
|
||||
|
||||
#ifdef CURL_DOES_CONVERSIONS
|
||||
if(size - included_body_bytes > 0) {
|
||||
res = Curl_convert_to_network(conn->data, ptr, size - included_body_bytes);
|
||||
res = Curl_convert_to_network(conn->data, ptr, headersize);
|
||||
/* Curl_convert_to_network calls failf if unsuccessful */
|
||||
if(res != CURLE_OK) {
|
||||
/* conversion failed, free memory and return to the caller */
|
||||
@@ -954,7 +959,6 @@ CURLcode add_buffer_send(send_buffer *in,
|
||||
free(in);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
|
||||
if(conn->protocol & PROT_HTTPS) {
|
||||
@@ -981,20 +985,29 @@ CURLcode add_buffer_send(send_buffer *in,
|
||||
res = Curl_write(conn, sockfd, ptr, sendsize, &amount);
|
||||
|
||||
if(CURLE_OK == res) {
|
||||
/*
|
||||
* Note that we may not send the entire chunk at once, and we have a set
|
||||
* number of data bytes at the end of the big buffer (out of which we may
|
||||
* only send away a part).
|
||||
*/
|
||||
/* how much of the header that was sent */
|
||||
size_t headlen = (size_t)amount>headersize?headersize:(size_t)amount;
|
||||
size_t bodylen = amount - headlen;
|
||||
|
||||
if(conn->data->set.verbose) {
|
||||
/* this data _may_ contain binary stuff */
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr,
|
||||
(size_t)(amount-included_body_bytes), conn);
|
||||
if (included_body_bytes)
|
||||
Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen, conn);
|
||||
if((size_t)amount > headlen) {
|
||||
/* there was body data sent beyond the initial header part, pass that
|
||||
on to the debug callback too */
|
||||
Curl_debug(conn->data, CURLINFO_DATA_OUT,
|
||||
ptr+amount-included_body_bytes,
|
||||
(size_t)included_body_bytes, conn);
|
||||
ptr+headlen, bodylen, conn);
|
||||
}
|
||||
if (included_body_bytes)
|
||||
}
|
||||
if(bodylen)
|
||||
/* since we sent a piece of the body here, up the byte counter for it
|
||||
accordingly */
|
||||
http->writebytecount = included_body_bytes;
|
||||
http->writebytecount += bodylen;
|
||||
|
||||
*bytes_written += amount;
|
||||
|
||||
@@ -1083,9 +1096,28 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
|
||||
char *new_rb;
|
||||
size_t new_size;
|
||||
|
||||
if(~size < in->size_used) {
|
||||
/* If resulting used size of send buffer would wrap size_t, cleanup
|
||||
the whole buffer and return error. Otherwise the required buffer
|
||||
size will fit into a single allocatable memory chunk */
|
||||
Curl_safefree(in->buffer);
|
||||
free(in);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if(!in->buffer ||
|
||||
((in->size_used + size) > (in->size_max - 1))) {
|
||||
|
||||
/* If current buffer size isn't enough to hold the result, use a
|
||||
buffer size that doubles the required size. If this new size
|
||||
would wrap size_t, then just use the largest possible one */
|
||||
|
||||
if((size > (size_t)-1/2) || (in->size_used > (size_t)-1/2) ||
|
||||
(~(size*2) < (in->size_used*2)))
|
||||
new_size = (size_t)-1;
|
||||
else
|
||||
new_size = (in->size_used+size)*2;
|
||||
|
||||
if(in->buffer)
|
||||
/* we have a buffer, enlarge the existing one */
|
||||
new_rb = (char *)realloc(in->buffer, new_size);
|
||||
@@ -2035,7 +2067,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
|
||||
if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) ||
|
||||
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )
|
||||
/* If (HTTPS on port 443) OR (non-HTTPS on port 80) then don't include
|
||||
/* if(HTTPS on port 443) OR (non-HTTPS on port 80) then don't include
|
||||
the port number in the host string */
|
||||
conn->allocptr.host = aprintf("Host: %s%s%s\r\n",
|
||||
conn->bits.ipv6_ip?"[":"",
|
||||
@@ -2307,7 +2339,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
|
||||
co = Curl_cookie_getlist(data->cookies,
|
||||
conn->allocptr.cookiehost?
|
||||
conn->allocptr.cookiehost:host, data->reqdata.path,
|
||||
conn->allocptr.cookiehost:host,
|
||||
data->reqdata.path,
|
||||
(bool)(conn->protocol&PROT_HTTPS?TRUE:FALSE));
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
||||
if(*datap == 0x0a) {
|
||||
/* we're now expecting data to come, unless size was zero! */
|
||||
if(0 == ch->datasize) {
|
||||
if (conn->bits.trailerHdrPresent!=TRUE) {
|
||||
if(conn->bits.trailerhdrpresent!=TRUE) {
|
||||
/* No Trailer: header found - revert to original Curl processing */
|
||||
ch->state = CHUNK_STOPCR;
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
static int
|
||||
get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)
|
||||
{
|
||||
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
|
||||
struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
|
||||
&conn->data->state.negotiate;
|
||||
OM_uint32 major_status, minor_status;
|
||||
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
|
||||
char name[2048];
|
||||
@@ -69,11 +70,13 @@ get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)
|
||||
else
|
||||
service = "HTTP";
|
||||
|
||||
token.length = strlen(service) + 1 + strlen(proxy ? conn->proxy.name : conn->host.name) + 1;
|
||||
token.length = strlen(service) + 1 + strlen(proxy ? conn->proxy.name :
|
||||
conn->host.name) + 1;
|
||||
if(token.length + 1 > sizeof(name))
|
||||
return EMSGSIZE;
|
||||
|
||||
snprintf(name, sizeof(name), "%s@%s", service, proxy ? conn->proxy.name : conn->host.name);
|
||||
snprintf(name, sizeof(name), "%s@%s", service, proxy ? conn->proxy.name :
|
||||
conn->host.name);
|
||||
|
||||
token.value = (void *) name;
|
||||
major_status = gss_import_name(&minor_status,
|
||||
@@ -113,9 +116,11 @@ log_gss_error(struct connectdata *conn, OM_uint32 error_status, char *prefix)
|
||||
infof(conn->data, "%s", buf);
|
||||
}
|
||||
|
||||
int Curl_input_negotiate(struct connectdata *conn, bool proxy, const char *header)
|
||||
int Curl_input_negotiate(struct connectdata *conn, bool proxy,
|
||||
const char *header)
|
||||
{
|
||||
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
|
||||
struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
|
||||
&conn->data->state.negotiate;
|
||||
OM_uint32 major_status, minor_status, minor_status2;
|
||||
gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
|
||||
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
|
||||
@@ -165,7 +170,8 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, const char *heade
|
||||
|
||||
len = strlen(header);
|
||||
if(len > 0) {
|
||||
int rawlen = Curl_base64_decode(header, (unsigned char **)&input_token.value);
|
||||
int rawlen = Curl_base64_decode(header,
|
||||
(unsigned char **)&input_token.value);
|
||||
if(rawlen < 0)
|
||||
return -1;
|
||||
input_token.length = rawlen;
|
||||
@@ -247,7 +253,8 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy, const char *heade
|
||||
|
||||
CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
|
||||
{
|
||||
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
|
||||
struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg:
|
||||
&conn->data->state.negotiate;
|
||||
OM_uint32 minor_status;
|
||||
char *encoded = NULL;
|
||||
int len;
|
||||
@@ -299,17 +306,16 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
conn->allocptr.userpwd =
|
||||
aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "", neg_ctx->protocol, encoded);
|
||||
aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "",
|
||||
neg_ctx->protocol, encoded);
|
||||
free(encoded);
|
||||
gss_release_buffer(&minor_status, &neg_ctx->output_token);
|
||||
return (conn->allocptr.userpwd == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
|
||||
}
|
||||
|
||||
void Curl_cleanup_negotiate(struct SessionHandle *data)
|
||||
static void cleanup(struct negotiatedata *neg_ctx)
|
||||
{
|
||||
OM_uint32 minor_status;
|
||||
struct negotiatedata *neg_ctx = &data->state.negotiate;
|
||||
|
||||
if(neg_ctx->context != GSS_C_NO_CONTEXT)
|
||||
gss_delete_sec_context(&minor_status, &neg_ctx->context, GSS_C_NO_BUFFER);
|
||||
|
||||
@@ -322,6 +328,12 @@ void Curl_cleanup_negotiate(struct SessionHandle *data)
|
||||
memset(neg_ctx, 0, sizeof(*neg_ctx));
|
||||
}
|
||||
|
||||
void Curl_cleanup_negotiate(struct SessionHandle *data)
|
||||
{
|
||||
cleanup(&data->state.negotiate);
|
||||
cleanup(&data->state.proxyneg);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -122,12 +122,14 @@ inet_pton4(const char *src, unsigned char *dst)
|
||||
return (0);
|
||||
saw_digit = 1;
|
||||
}
|
||||
} else if (ch == '.' && saw_digit) {
|
||||
}
|
||||
else if(ch == '.' && saw_digit) {
|
||||
if(octets == 4)
|
||||
return (0);
|
||||
*++tp = 0;
|
||||
saw_digit = 0;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
if(octets < 4)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -686,8 +686,11 @@ static int dprintf_formatf(
|
||||
width = p->width;
|
||||
|
||||
/* pick up the specified precision */
|
||||
if(p->flags & FLAGS_PRECPARAM)
|
||||
if(p->flags & FLAGS_PRECPARAM) {
|
||||
prec = vto[p->precision].data.num;
|
||||
param_num++; /* since the precision is extraced from a parameter, we
|
||||
must skip that to get to the next one properly */
|
||||
}
|
||||
else if(p->flags & FLAGS_PREC)
|
||||
prec = p->precision;
|
||||
else
|
||||
|
||||
25
lib/multi.c
25
lib/multi.c
@@ -1057,7 +1057,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
/* protocol-specific connect phase */
|
||||
easy->result = Curl_protocol_connecting(easy->easy_conn,
|
||||
&protocol_connect);
|
||||
if(protocol_connect) {
|
||||
if((easy->result == CURLE_OK) && protocol_connect) {
|
||||
/* after the connect has completed, go WAITDO */
|
||||
multistate(easy, CURLM_STATE_WAITDO);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
@@ -1121,13 +1121,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
}
|
||||
else {
|
||||
/* we're done with the DO, now DO_DONE */
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
if(CURLE_OK == easy->result) {
|
||||
multistate(easy, CURLM_STATE_DO_DONE);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* failure detected */
|
||||
Curl_posttransfer(easy->easy_handle);
|
||||
@@ -1152,12 +1149,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
}
|
||||
else {
|
||||
/* we're done with the DO, now DO_DONE */
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
if(CURLE_OK == easy->result) {
|
||||
multistate(easy, CURLM_STATE_DO_DONE);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
} /* dophase_done */
|
||||
}
|
||||
else {
|
||||
@@ -1179,17 +1173,19 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
*/
|
||||
easy->result = Curl_do_more(easy->easy_conn);
|
||||
|
||||
if(CURLE_OK == easy->result)
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
else
|
||||
/* Remove ourselves from the send pipeline */
|
||||
Curl_removeHandleFromPipeline(easy->easy_handle,
|
||||
easy->easy_conn->send_pipe);
|
||||
/* No need to remove ourselves from the send pipeline here since that
|
||||
is done for us in Curl_done() */
|
||||
|
||||
if(CURLE_OK == easy->result) {
|
||||
multistate(easy, CURLM_STATE_DO_DONE);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
else {
|
||||
/* failure detected */
|
||||
Curl_posttransfer(easy->easy_handle);
|
||||
Curl_done(&easy->easy_conn, easy->result, FALSE);
|
||||
disconnect_conn = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1202,9 +1198,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
easy->easy_conn->recv_pipe);
|
||||
multistate(easy, CURLM_STATE_WAITPERFORM);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
|
||||
Curl_pre_readwrite(easy->easy_conn);
|
||||
|
||||
break;
|
||||
|
||||
case CURLM_STATE_WAITPERFORM:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -154,7 +154,7 @@ static const struct tzinfo tz[]= {
|
||||
0 monday - 6 sunday
|
||||
*/
|
||||
|
||||
static int checkday(char *check, size_t len)
|
||||
static int checkday(const char *check, size_t len)
|
||||
{
|
||||
int i;
|
||||
const char * const *what;
|
||||
@@ -173,7 +173,7 @@ static int checkday(char *check, size_t len)
|
||||
return found?i:-1;
|
||||
}
|
||||
|
||||
static int checkmonth(char *check)
|
||||
static int checkmonth(const char *check)
|
||||
{
|
||||
int i;
|
||||
const char * const *what;
|
||||
@@ -193,7 +193,7 @@ static int checkmonth(char *check)
|
||||
/* return the time zone offset between GMT and the input one, in number
|
||||
of seconds or -1 if the timezone wasn't found/legal */
|
||||
|
||||
static int checktz(char *check)
|
||||
static int checktz(const char *check)
|
||||
{
|
||||
unsigned int i;
|
||||
const struct tzinfo *what;
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
*
|
||||
* Copyright (C) 2001 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -260,10 +263,12 @@ sec_send(struct connectdata *conn, int fd, char *from, int length)
|
||||
block_write(fd, "MIC ", 4);
|
||||
block_write(fd, cmdbuf, bytes);
|
||||
block_write(fd, "\r\n", 2);
|
||||
Curl_infof(conn->data, "%s %s\n", protlevel == prot_private ? "ENC" : "MIC", cmdbuf);
|
||||
Curl_infof(conn->data, "%s %s\n",
|
||||
protlevel == prot_private ? "ENC" : "MIC", cmdbuf);
|
||||
free(cmdbuf);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = htonl(bytes);
|
||||
block_write(fd, &bytes, sizeof(bytes));
|
||||
block_write(fd, buf, ntohl(bytes));
|
||||
|
||||
@@ -40,13 +40,16 @@
|
||||
#undef HAVE_POLL_FINE
|
||||
#define HAVE_POLL_FINE 1
|
||||
#define poll(x,y,z) WSAPoll((x),(y),(z))
|
||||
#if defined(_MSC_VER) && defined(POLLRDNORM)
|
||||
#define HAVE_STRUCT_POLLFD 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definition of pollfd struct and constants for platforms lacking them.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_SYS_POLL_H
|
||||
#if !defined(HAVE_STRUCT_POLLFD) && !defined(HAVE_SYS_POLL_H)
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLPRI 0x02
|
||||
|
||||
10
lib/setup.h
10
lib/setup.h
@@ -32,13 +32,11 @@
|
||||
#define CURL_DISABLE_FILE
|
||||
#endif /* HTTP_ONLY */
|
||||
|
||||
#if !defined(WIN32) && defined(__WIN32__)
|
||||
/* Borland fix */
|
||||
#define WIN32
|
||||
#endif
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if !defined(WIN32) && defined(_WIN32)
|
||||
/* VS2005 on x64 fix */
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1997 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1997 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -243,15 +243,18 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
|
||||
#else
|
||||
#ifdef USE_NSS
|
||||
*done = TRUE; /* fallback to BLOCKING */
|
||||
conn->ssl[sockindex].use = TRUE;
|
||||
return Curl_nss_connect(conn, sockindex);
|
||||
#else
|
||||
#ifdef USE_QSOSSL
|
||||
*done = TRUE; /* fallback to BLOCKING */
|
||||
conn->ssl[sockindex].use = TRUE;
|
||||
return Curl_qsossl_connect(conn, sockindex);
|
||||
#else
|
||||
/* not implemented!
|
||||
fallback to BLOCKING call. */
|
||||
*done = TRUE;
|
||||
conn->ssl[sockindex].use = TRUE;
|
||||
return Curl_ssl_connect(conn, sockindex);
|
||||
#endif /* USE_QSOSSL */
|
||||
#endif /* USE_NSS */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
/* For MSVC7 we can use _strtoi64() which seems to be a strtoll() clone */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
_CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int); /* in <crt/stdlib.h> */
|
||||
#define curlx_strtoofft _strtoi64
|
||||
#else /* MSVC7 or later */
|
||||
curl_off_t curlx_strtoll(const char *nptr, char **endptr, int base);
|
||||
|
||||
63
lib/telnet.c
63
lib/telnet.c
@@ -106,7 +106,7 @@ static CURLcode check_wsock2 ( struct SessionHandle *data );
|
||||
|
||||
static
|
||||
void telrcv(struct connectdata *,
|
||||
unsigned char *inbuf, /* Data received from socket */
|
||||
const unsigned char *inbuf, /* Data received from socket */
|
||||
ssize_t count); /* Number of bytes received */
|
||||
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
@@ -949,104 +949,119 @@ static void suboption(struct connectdata *conn)
|
||||
|
||||
static
|
||||
void telrcv(struct connectdata *conn,
|
||||
unsigned char *inbuf, /* Data received from socket */
|
||||
const unsigned char *inbuf, /* Data received from socket */
|
||||
ssize_t count) /* Number of bytes received */
|
||||
{
|
||||
unsigned char c;
|
||||
int in = 0;
|
||||
int startwrite=-1;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct TELNET *tn = (struct TELNET *)data->reqdata.proto.telnet;
|
||||
|
||||
#define startskipping() \
|
||||
if(startwrite >= 0) \
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&inbuf[startwrite], in-startwrite); \
|
||||
startwrite = -1
|
||||
|
||||
#define writebyte() \
|
||||
if(startwrite < 0) \
|
||||
startwrite = in
|
||||
|
||||
#define bufferflush() startskipping()
|
||||
|
||||
while(count--)
|
||||
{
|
||||
c = inbuf[in++];
|
||||
c = inbuf[in];
|
||||
|
||||
/*infof(data,"In rcv state %d char %d\n", tn->telrcv_state, c);*/
|
||||
switch (tn->telrcv_state)
|
||||
{
|
||||
case CURL_TS_CR:
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
if(c == '\0')
|
||||
{
|
||||
startskipping();
|
||||
break; /* Ignore \0 after CR */
|
||||
}
|
||||
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
writebyte();
|
||||
break;
|
||||
|
||||
case CURL_TS_DATA:
|
||||
if(c == CURL_IAC)
|
||||
{
|
||||
tn->telrcv_state = CURL_TS_IAC;
|
||||
startskipping();
|
||||
break;
|
||||
}
|
||||
else if(c == '\r')
|
||||
{
|
||||
tn->telrcv_state = CURL_TS_CR;
|
||||
}
|
||||
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
continue;
|
||||
writebyte();
|
||||
break;
|
||||
|
||||
case CURL_TS_IAC:
|
||||
process_iac:
|
||||
DEBUGASSERT(startwrite < 0);
|
||||
switch (c)
|
||||
{
|
||||
case CURL_WILL:
|
||||
tn->telrcv_state = CURL_TS_WILL;
|
||||
continue;
|
||||
break;
|
||||
case CURL_WONT:
|
||||
tn->telrcv_state = CURL_TS_WONT;
|
||||
continue;
|
||||
break;
|
||||
case CURL_DO:
|
||||
tn->telrcv_state = CURL_TS_DO;
|
||||
continue;
|
||||
break;
|
||||
case CURL_DONT:
|
||||
tn->telrcv_state = CURL_TS_DONT;
|
||||
continue;
|
||||
break;
|
||||
case CURL_SB:
|
||||
CURL_SB_CLEAR(tn);
|
||||
tn->telrcv_state = CURL_TS_SB;
|
||||
continue;
|
||||
break;
|
||||
case CURL_IAC:
|
||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&c, 1);
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
writebyte();
|
||||
break;
|
||||
case CURL_DM:
|
||||
case CURL_NOP:
|
||||
case CURL_GA:
|
||||
default:
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
printoption(data, "RCVD", CURL_IAC, c);
|
||||
break;
|
||||
}
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_WILL:
|
||||
printoption(data, "RCVD", CURL_WILL, c);
|
||||
tn->please_negotiate = 1;
|
||||
rec_will(conn, c);
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_WONT:
|
||||
printoption(data, "RCVD", CURL_WONT, c);
|
||||
tn->please_negotiate = 1;
|
||||
rec_wont(conn, c);
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_DO:
|
||||
printoption(data, "RCVD", CURL_DO, c);
|
||||
tn->please_negotiate = 1;
|
||||
rec_do(conn, c);
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_DONT:
|
||||
printoption(data, "RCVD", CURL_DONT, c);
|
||||
tn->please_negotiate = 1;
|
||||
rec_dont(conn, c);
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_SB:
|
||||
if(c == CURL_IAC)
|
||||
@@ -1057,7 +1072,7 @@ void telrcv(struct connectdata *conn,
|
||||
{
|
||||
CURL_SB_ACCUM(tn,c);
|
||||
}
|
||||
continue;
|
||||
break;
|
||||
|
||||
case CURL_TS_SE:
|
||||
if(c != CURL_SE)
|
||||
@@ -1097,7 +1112,9 @@ void telrcv(struct connectdata *conn,
|
||||
}
|
||||
break;
|
||||
}
|
||||
++in;
|
||||
}
|
||||
bufferflush();
|
||||
}
|
||||
|
||||
static CURLcode Curl_telnet_done(struct connectdata *conn,
|
||||
@@ -1143,7 +1160,7 @@ static CURLcode Curl_telnet(struct connectdata *conn, bool *done)
|
||||
char *buf = data->state.buffer;
|
||||
struct TELNET *tn;
|
||||
|
||||
*done = TRUE; /* uncontionally */
|
||||
*done = TRUE; /* unconditionally */
|
||||
|
||||
code = init_telnet(conn);
|
||||
if(code)
|
||||
|
||||
22
lib/tftp.c
22
lib/tftp.c
@@ -306,7 +306,8 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
|
||||
if(data->set.upload) {
|
||||
/* If we are uploading, send an WRQ */
|
||||
setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
|
||||
state->conn->data->reqdata.upload_fromhere = (char *)&state->spacket.data[4];
|
||||
state->conn->data->reqdata.upload_fromhere =
|
||||
(char *)&state->spacket.data[4];
|
||||
if(data->set.infilesize != -1)
|
||||
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
||||
}
|
||||
@@ -698,8 +699,7 @@ static CURLcode Curl_tftp_done(struct connectdata *conn, CURLcode status,
|
||||
static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
tftp_state_data_t *state =
|
||||
(tftp_state_data_t *) conn->data->reqdata.proto.tftp;
|
||||
tftp_state_data_t *state;
|
||||
tftp_event_t event;
|
||||
CURLcode code;
|
||||
int rc;
|
||||
@@ -716,16 +716,14 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
make sure we have a good 'struct TFTP' to play with. For new connections,
|
||||
the struct TFTP is allocated and setup in the Curl_tftp_connect() function.
|
||||
*/
|
||||
if(!state) {
|
||||
Curl_reset_reqproto(conn);
|
||||
|
||||
if(!data->reqdata.proto.tftp) {
|
||||
code = Curl_tftp_connect(conn, done);
|
||||
if(code)
|
||||
return code;
|
||||
state = (tftp_state_data_t *)conn->data->reqdata.proto.tftp;
|
||||
}
|
||||
|
||||
code = Curl_readwrite_init(conn);
|
||||
if(code)
|
||||
return code;
|
||||
state = (tftp_state_data_t *)data->reqdata.proto.tftp;
|
||||
|
||||
/* Run the TFTP State Machine */
|
||||
for(code=tftp_state_machine(state, TFTP_EVENT_INIT);
|
||||
@@ -764,7 +762,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
|
||||
/* Sanity check packet length */
|
||||
if(state->rbytes < 4) {
|
||||
failf(conn->data, "Received too short packet\n");
|
||||
failf(data, "Received too short packet\n");
|
||||
/* Not a timeout, but how best to handle it? */
|
||||
event = TFTP_EVENT_TIMEOUT;
|
||||
}
|
||||
@@ -789,14 +787,14 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
|
||||
break;
|
||||
case TFTP_EVENT_ERROR:
|
||||
state->error = (tftp_error_t)getrpacketblock(&state->rpacket);
|
||||
infof(conn->data, "%s\n", (char *)&state->rpacket.data[4]);
|
||||
infof(data, "%s\n", (char *)&state->rpacket.data[4]);
|
||||
break;
|
||||
case TFTP_EVENT_ACK:
|
||||
break;
|
||||
case TFTP_EVENT_RRQ:
|
||||
case TFTP_EVENT_WRQ:
|
||||
default:
|
||||
failf(conn->data, "%s\n", "Internal error: Unexpected packet");
|
||||
failf(data, "%s\n", "Internal error: Unexpected packet");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
171
lib/transfer.c
171
lib/transfer.c
@@ -992,7 +992,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
*
|
||||
* It seems both Trailer: and Trailers: occur in the wild.
|
||||
*/
|
||||
conn->bits.trailerHdrPresent = TRUE;
|
||||
conn->bits.trailerhdrpresent = TRUE;
|
||||
}
|
||||
|
||||
else if(checkprefix("Content-Encoding:", k->p) &&
|
||||
@@ -1640,102 +1640,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Curl_readwrite_init() inits the readwrite session. This is inited each time
|
||||
* for a transfer, sometimes multiple times on the same SessionHandle
|
||||
*/
|
||||
|
||||
CURLcode Curl_readwrite_init(struct connectdata *conn)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct Curl_transfer_keeper *k = &data->reqdata.keep;
|
||||
|
||||
/* NB: the content encoding software depends on this initialization of
|
||||
Curl_transfer_keeper.*/
|
||||
memset(k, 0, sizeof(struct Curl_transfer_keeper));
|
||||
|
||||
k->start = Curl_tvnow(); /* start time */
|
||||
k->now = k->start; /* current time is now */
|
||||
k->header = TRUE; /* assume header */
|
||||
k->httpversion = -1; /* unknown at this point */
|
||||
|
||||
k->size = data->reqdata.size;
|
||||
k->maxdownload = data->reqdata.maxdownload;
|
||||
k->bytecountp = data->reqdata.bytecountp;
|
||||
k->writebytecountp = data->reqdata.writebytecountp;
|
||||
|
||||
k->bytecount = 0;
|
||||
|
||||
k->buf = data->state.buffer;
|
||||
k->uploadbuf = data->state.uploadbuffer;
|
||||
k->maxfd = (conn->sockfd>conn->writesockfd?
|
||||
conn->sockfd:conn->writesockfd)+1;
|
||||
k->hbufp = data->state.headerbuff;
|
||||
k->ignorebody=FALSE;
|
||||
|
||||
Curl_pgrsTime(data, TIMER_PRETRANSFER);
|
||||
Curl_speedinit(data);
|
||||
|
||||
Curl_pgrsSetUploadCounter(data, 0);
|
||||
Curl_pgrsSetDownloadCounter(data, 0);
|
||||
|
||||
if (!conn->bits.getheader) {
|
||||
k->header = FALSE;
|
||||
if(k->size > 0)
|
||||
Curl_pgrsSetDownloadSize(data, k->size);
|
||||
}
|
||||
/* we want header and/or body, if neither then don't do this! */
|
||||
if(conn->bits.getheader || !conn->bits.no_body) {
|
||||
|
||||
if(conn->sockfd != CURL_SOCKET_BAD) {
|
||||
k->keepon |= KEEP_READ;
|
||||
}
|
||||
|
||||
if(conn->writesockfd != CURL_SOCKET_BAD) {
|
||||
/* HTTP 1.1 magic:
|
||||
|
||||
Even if we require a 100-return code before uploading data, we might
|
||||
need to write data before that since the REQUEST may not have been
|
||||
finished sent off just yet.
|
||||
|
||||
Thus, we must check if the request has been sent before we set the
|
||||
state info where we wait for the 100-return code
|
||||
*/
|
||||
if (data->state.expect100header &&
|
||||
(data->reqdata.proto.http->sending == HTTPSEND_BODY)) {
|
||||
/* wait with write until we either got 100-continue or a timeout */
|
||||
k->write_after_100_header = TRUE;
|
||||
k->start100 = k->start;
|
||||
}
|
||||
else {
|
||||
if(data->state.expect100header)
|
||||
/* when we've sent off the rest of the headers, we must await a
|
||||
100-continue */
|
||||
k->wait100_after_headers = TRUE;
|
||||
k->keepon |= KEEP_WRITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_readwrite may get called multiple times. This function is called
|
||||
* immediately before the first Curl_readwrite. Note that this can't be moved
|
||||
* to Curl_readwrite_init since that function can get called while another
|
||||
* pipeline request is in the middle of receiving data.
|
||||
*
|
||||
* We init chunking and trailer bits to their default values here immediately
|
||||
* before receiving any header data for the current request in the pipeline.
|
||||
*/
|
||||
void Curl_pre_readwrite(struct connectdata *conn)
|
||||
{
|
||||
conn->bits.chunk=FALSE;
|
||||
conn->bits.trailerHdrPresent=FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_single_getsock() gets called by the multi interface code when the app
|
||||
* has requested to get the sockets for the current connection. This function
|
||||
@@ -1757,6 +1661,9 @@ int Curl_single_getsock(const struct connectdata *conn,
|
||||
return GETSOCK_BLANK;
|
||||
|
||||
if(data->reqdata.keep.keepon & KEEP_READ) {
|
||||
|
||||
DEBUGASSERT(conn->sockfd != CURL_SOCKET_BAD);
|
||||
|
||||
bitmap |= GETSOCK_READSOCK(sockindex);
|
||||
sock[sockindex] = conn->sockfd;
|
||||
}
|
||||
@@ -1769,6 +1676,9 @@ int Curl_single_getsock(const struct connectdata *conn,
|
||||
one, we increase index */
|
||||
if(data->reqdata.keep.keepon & KEEP_READ)
|
||||
sockindex++; /* increase index if we need two entries */
|
||||
|
||||
DEBUGASSERT(conn->writesockfd != CURL_SOCKET_BAD);
|
||||
|
||||
sock[sockindex] = conn->writesockfd;
|
||||
}
|
||||
|
||||
@@ -1801,15 +1711,6 @@ Transfer(struct connectdata *conn)
|
||||
struct Curl_transfer_keeper *k = &data->reqdata.keep;
|
||||
bool done=FALSE;
|
||||
|
||||
if(!(conn->protocol & (PROT_FILE|PROT_TFTP))) {
|
||||
/* Only do this if we are not transferring FILE or TFTP, since those
|
||||
transfers are treated differently. They do their entire transfers in
|
||||
the DO function and just returns from this. That is ugly indeed.
|
||||
*/
|
||||
Curl_readwrite_init(conn);
|
||||
Curl_pre_readwrite(conn);
|
||||
}
|
||||
|
||||
if((conn->sockfd == CURL_SOCKET_BAD) &&
|
||||
(conn->writesockfd == CURL_SOCKET_BAD))
|
||||
/* nothing to read, nothing to write, we're already OK! */
|
||||
@@ -2523,25 +2424,23 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
*/
|
||||
CURLcode
|
||||
Curl_setup_transfer(
|
||||
struct connectdata *c_conn, /* connection data */
|
||||
struct connectdata *conn, /* connection data */
|
||||
int sockindex, /* socket index to read from or -1 */
|
||||
curl_off_t size, /* -1 if unknown at this point */
|
||||
bool getheader, /* TRUE if header parsing is wanted */
|
||||
curl_off_t *bytecountp, /* return number of bytes read or NULL */
|
||||
int writesockindex, /* socket index to write to, it may very
|
||||
well be the same we read from. -1
|
||||
disables */
|
||||
curl_off_t *writecountp /* return number of bytes written or
|
||||
NULL */
|
||||
int writesockindex, /* socket index to write to, it may very well be
|
||||
the same we read from. -1 disables */
|
||||
curl_off_t *writecountp /* return number of bytes written or NULL */
|
||||
)
|
||||
{
|
||||
struct connectdata *conn = (struct connectdata *)c_conn;
|
||||
struct SessionHandle *data;
|
||||
struct Curl_transfer_keeper *k;
|
||||
|
||||
if(!conn)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
DEBUGASSERT(conn != NULL);
|
||||
|
||||
data = conn->data;
|
||||
k = &data->reqdata.keep;
|
||||
|
||||
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
|
||||
|
||||
@@ -2556,5 +2455,47 @@ Curl_setup_transfer(
|
||||
data->reqdata.bytecountp = bytecountp;
|
||||
data->reqdata.writebytecountp = writecountp;
|
||||
|
||||
/* The code sequence below is placed in this function just because all
|
||||
necessary input is not always known in do_complete() as this function may
|
||||
be called after that */
|
||||
|
||||
if(!conn->bits.getheader) {
|
||||
k->header = FALSE;
|
||||
if(k->size > 0)
|
||||
Curl_pgrsSetDownloadSize(data, k->size);
|
||||
}
|
||||
/* we want header and/or body, if neither then don't do this! */
|
||||
if(conn->bits.getheader || !conn->bits.no_body) {
|
||||
|
||||
if(conn->sockfd != CURL_SOCKET_BAD) {
|
||||
k->keepon |= KEEP_READ;
|
||||
}
|
||||
|
||||
if(conn->writesockfd != CURL_SOCKET_BAD) {
|
||||
/* HTTP 1.1 magic:
|
||||
|
||||
Even if we require a 100-return code before uploading data, we might
|
||||
need to write data before that since the REQUEST may not have been
|
||||
finished sent off just yet.
|
||||
|
||||
Thus, we must check if the request has been sent before we set the
|
||||
state info where we wait for the 100-return code
|
||||
*/
|
||||
if(data->state.expect100header &&
|
||||
(data->reqdata.proto.http->sending == HTTPSEND_BODY)) {
|
||||
/* wait with write until we either got 100-continue or a timeout */
|
||||
k->write_after_100_header = TRUE;
|
||||
k->start100 = k->start;
|
||||
}
|
||||
else {
|
||||
if(data->state.expect100header)
|
||||
/* when we've sent off the rest of the headers, we must await a
|
||||
100-continue */
|
||||
k->wait100_after_headers = TRUE;
|
||||
k->keepon |= KEEP_WRITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
|
||||
int Curl_single_getsock(const struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
int numsocks);
|
||||
CURLcode Curl_readwrite_init(struct connectdata *conn);
|
||||
void Curl_pre_readwrite(struct connectdata *conn);
|
||||
CURLcode Curl_readrewind(struct connectdata *conn);
|
||||
CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp);
|
||||
bool Curl_retry_request(struct connectdata *conn, char **url);
|
||||
|
||||
114
lib/url.c
114
lib/url.c
@@ -121,6 +121,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
|
||||
#include "select.h"
|
||||
#include "multiif.h"
|
||||
#include "easyif.h"
|
||||
#include "speedcheck.h"
|
||||
|
||||
/* And now for the protocols */
|
||||
#include "ftp.h"
|
||||
@@ -164,6 +165,8 @@ static void conn_free(struct connectdata *conn);
|
||||
static void signalPipeClose(struct curl_llist *pipeline);
|
||||
|
||||
static struct SessionHandle* gethandleathead(struct curl_llist *pipeline);
|
||||
static CURLcode do_init(struct connectdata *conn);
|
||||
static void do_complete(struct connectdata *conn);
|
||||
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
static void flush_cookies(struct SessionHandle *data, int cleanup);
|
||||
@@ -351,7 +354,7 @@ static void flush_cookies(struct SessionHandle *data, int cleanup)
|
||||
Curl_cookie_loadfiles(data);
|
||||
}
|
||||
|
||||
/* we have a "destination" for all the cookies to get dumped to */
|
||||
/* if we have a destination file for all the cookies to get dumped to */
|
||||
if(Curl_cookie_output(data->cookies, data->set.str[STRING_COOKIEJAR]))
|
||||
infof(data, "WARNING: failed to save cookies in %s\n",
|
||||
data->set.str[STRING_COOKIEJAR]);
|
||||
@@ -1059,7 +1062,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
else {
|
||||
if(data->set.postfieldsize)
|
||||
memcpy(p, argptr, data->set.postfieldsize);
|
||||
memcpy(p, argptr, (size_t)data->set.postfieldsize);
|
||||
|
||||
data->set.str[STRING_COPYPOSTFIELDS] = p;
|
||||
}
|
||||
@@ -1181,7 +1184,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
if(!cl)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
data->change.cookielist = cl;
|
||||
data->change.cookielist = cl; /* store the list for later use */
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1851,17 +1854,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
/* use shared cookie list, first free own one if any */
|
||||
if(data->cookies)
|
||||
Curl_cookie_cleanup(data->cookies);
|
||||
/* enable cookies since we now use a share that uses cookies! */
|
||||
data->cookies = data->share->cookies;
|
||||
}
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
|
||||
|
||||
}
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
/* check cookie list is set */
|
||||
if(!data->cookies)
|
||||
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE );
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
/* check for host cache not needed,
|
||||
* it will be done by curl_easy_perform */
|
||||
}
|
||||
@@ -2134,7 +2133,7 @@ CURLcode Curl_disconnect(struct connectdata *conn)
|
||||
Curl_ntlm_cleanup(conn);
|
||||
}
|
||||
|
||||
if(conn->handler && conn->handler->disconnect)
|
||||
if(conn->handler->disconnect)
|
||||
/* This is set if protocol-specific cleanups should be made */
|
||||
conn->handler->disconnect(conn);
|
||||
|
||||
@@ -2668,7 +2667,7 @@ int Curl_doing_getsock(struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
int numsocks)
|
||||
{
|
||||
if(conn && conn->handler && conn->handler->doing_getsock)
|
||||
if(conn && conn->handler->doing_getsock)
|
||||
return conn->handler->doing_getsock(conn, socks, numsocks);
|
||||
return GETSOCK_BLANK;
|
||||
}
|
||||
@@ -2684,7 +2683,7 @@ CURLcode Curl_protocol_connecting(struct connectdata *conn,
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(conn && conn->handler && conn->handler->connecting) {
|
||||
if(conn && conn->handler->connecting) {
|
||||
*done = FALSE;
|
||||
result = conn->handler->connecting(conn, done);
|
||||
}
|
||||
@@ -2703,7 +2702,7 @@ CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(conn && conn->handler && conn->handler->doing) {
|
||||
if(conn && conn->handler->doing) {
|
||||
*done = FALSE;
|
||||
result = conn->handler->doing(conn, done);
|
||||
}
|
||||
@@ -3111,8 +3110,9 @@ static CURLcode setup_connection_internals(struct SessionHandle *data,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/* Protocol not found in table. */
|
||||
conn->handler = &Curl_handler_dummy; /* Be sure we have a handler defined. */
|
||||
/* The protocol was not found in the table, but we don't have to assign it
|
||||
to anything since it is already assigned to a dummy-struct in the
|
||||
CreateConnection() function when the connectdata struct is allocated. */
|
||||
failf(data, "Protocol %s not supported or disabled in " LIBCURL_NAME,
|
||||
conn->protostr);
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
@@ -3470,6 +3470,10 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
any failure */
|
||||
*in_connect = conn;
|
||||
|
||||
conn->handler = &Curl_handler_dummy; /* Be sure we have a handler defined
|
||||
already from start to avoid NULL
|
||||
situations and checks */
|
||||
|
||||
/* and we setup a few fields in case we end up actually using this struct */
|
||||
|
||||
conn->data = data; /* Setup the association between this connection
|
||||
@@ -3638,10 +3642,12 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
* file: is a special case in that it doesn't need a network connection
|
||||
***********************************************************************/
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
if (strequal(conn->protostr, "FILE")) {
|
||||
if(conn->protocol & PROT_FILE) {
|
||||
bool done;
|
||||
/* this is supposed to be the connect function so we better at least check
|
||||
that the file is present here! */
|
||||
result = Curl_file_connect(conn);
|
||||
DEBUGASSERT(conn->handler->connect_it);
|
||||
result = conn->handler->connect_it(conn, &done);
|
||||
|
||||
/* Setup a "faked" transfer that'll do nothing */
|
||||
if(CURLE_OK == result) {
|
||||
@@ -3652,8 +3658,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
|
||||
result = setup_range(data);
|
||||
if(result) {
|
||||
if(conn->handler->done)
|
||||
result = conn->handler->done(conn, result, FALSE);
|
||||
DEBUGASSERT(conn->handler->done);
|
||||
conn->handler->done(conn, result, FALSE);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4442,21 +4448,83 @@ CURLcode Curl_done(struct connectdata **connp,
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* do_init() inits the readwrite session. This is inited each time (in the DO
|
||||
* function before the protocol-specific DO functions are invoked) for a
|
||||
* transfer, sometimes multiple times on the same SessionHandle. Make sure
|
||||
* nothing in here depends on stuff that are setup dynamicly for the transfer.
|
||||
*/
|
||||
|
||||
static CURLcode do_init(struct connectdata *conn)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct Curl_transfer_keeper *k = &data->reqdata.keep;
|
||||
|
||||
conn->bits.done = FALSE; /* Curl_done() is not called yet */
|
||||
conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */
|
||||
|
||||
/* NB: the content encoding software depends on this initialization of
|
||||
Curl_transfer_keeper.*/
|
||||
memset(k, 0, sizeof(struct Curl_transfer_keeper));
|
||||
|
||||
k->start = Curl_tvnow(); /* start time */
|
||||
k->now = k->start; /* current time is now */
|
||||
k->header = TRUE; /* assume header */
|
||||
k->httpversion = -1; /* unknown at this point */
|
||||
|
||||
k->bytecount = 0;
|
||||
|
||||
k->buf = data->state.buffer;
|
||||
k->uploadbuf = data->state.uploadbuffer;
|
||||
k->hbufp = data->state.headerbuff;
|
||||
k->ignorebody=FALSE;
|
||||
|
||||
Curl_pgrsTime(data, TIMER_PRETRANSFER);
|
||||
Curl_speedinit(data);
|
||||
|
||||
Curl_pgrsSetUploadCounter(data, 0);
|
||||
Curl_pgrsSetDownloadCounter(data, 0);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* do_complete is called when the DO actions are complete.
|
||||
*
|
||||
* We init chunking and trailer bits to their default values here immediately
|
||||
* before receiving any header data for the current request in the pipeline.
|
||||
*/
|
||||
static void do_complete(struct connectdata *conn)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct Curl_transfer_keeper *k = &data->reqdata.keep;
|
||||
conn->bits.chunk=FALSE;
|
||||
conn->bits.trailerhdrpresent=FALSE;
|
||||
|
||||
k->maxfd = (conn->sockfd>conn->writesockfd?
|
||||
conn->sockfd:conn->writesockfd)+1;
|
||||
|
||||
k->size = data->reqdata.size;
|
||||
k->maxdownload = data->reqdata.maxdownload;
|
||||
k->bytecountp = data->reqdata.bytecountp;
|
||||
k->writebytecountp = data->reqdata.writebytecountp;
|
||||
|
||||
}
|
||||
|
||||
CURLcode Curl_do(struct connectdata **connp, bool *done)
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
struct connectdata *conn = *connp;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
conn->bits.done = FALSE; /* Curl_done() is not called yet */
|
||||
conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */
|
||||
/* setup and init stuff before DO starts, in preparing for the transfer */
|
||||
do_init(conn);
|
||||
|
||||
if(conn->handler->do_it) {
|
||||
/* generic protocol-specific function pointer set in curl_connect() */
|
||||
result = conn->handler->do_it(conn, done);
|
||||
|
||||
/* This was formerly done in transfer.c, but we better do it here */
|
||||
|
||||
if((CURLE_SEND_ERROR == result) && conn->bits.reuse) {
|
||||
/* This was a re-use of a connection and we got a write error in the
|
||||
* DO-phase. Then we DISCONNECT this connection and have another attempt
|
||||
@@ -4506,6 +4574,10 @@ CURLcode Curl_do(struct connectdata **connp, bool *done)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(result == CURLE_OK)
|
||||
/* pre readwrite must be called after the protocol-specific DO function */
|
||||
do_complete(conn);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
132
lib/urldata.h
132
lib/urldata.h
@@ -431,7 +431,8 @@ struct ftp_conn {
|
||||
typedef enum {
|
||||
SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */
|
||||
SSH_STOP = 0, /* do nothing state, stops the state machine */
|
||||
SSH_S_STARTUP, /* Session startup */
|
||||
|
||||
SSH_S_STARTUP, /* Session startup, First state in SSH-CONNECT */
|
||||
SSH_AUTHLIST,
|
||||
SSH_AUTH_PKEY_INIT,
|
||||
SSH_AUTH_PKEY,
|
||||
@@ -443,10 +444,10 @@ typedef enum {
|
||||
SSH_AUTH_KEY,
|
||||
SSH_AUTH_DONE,
|
||||
SSH_SFTP_INIT,
|
||||
SSH_SFTP_REALPATH,
|
||||
SSH_GET_WORKINGPATH,
|
||||
SSH_SFTP_QUOTE_INIT,
|
||||
SSH_SFTP_POSTQUOTE_INIT,
|
||||
SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */
|
||||
|
||||
SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */
|
||||
SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */
|
||||
SSH_SFTP_QUOTE,
|
||||
SSH_SFTP_NEXT_QUOTE,
|
||||
SSH_SFTP_QUOTE_STAT,
|
||||
@@ -467,37 +468,29 @@ typedef enum {
|
||||
SSH_SFTP_READDIR_BOTTOM,
|
||||
SSH_SFTP_READDIR_DONE,
|
||||
SSH_SFTP_DOWNLOAD_INIT,
|
||||
SSH_SFTP_DOWNLOAD_STAT,
|
||||
SSH_SFTP_CLOSE,
|
||||
SSH_SFTP_SHUTDOWN,
|
||||
SSH_SCP_TRANS_INIT,
|
||||
SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
|
||||
SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
|
||||
SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
|
||||
SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
|
||||
SSH_SCP_UPLOAD_INIT,
|
||||
SSH_SCP_DOWNLOAD_INIT,
|
||||
SSH_SCP_DONE,
|
||||
SSH_SCP_SEND_EOF,
|
||||
SSH_SCP_WAIT_EOF,
|
||||
SSH_SCP_WAIT_CLOSE,
|
||||
SSH_SCP_CHANNEL_FREE,
|
||||
SSH_CHANNEL_CLOSE,
|
||||
SSH_SESSION_DISCONECT,
|
||||
SSH_SESSION_FREE,
|
||||
SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
|
||||
SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
|
||||
SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
|
||||
SSH_QUIT,
|
||||
SSH_LAST /* never used */
|
||||
} sshstate;
|
||||
|
||||
/* this struct is used in the HandleData struct which is part of the
|
||||
SessionHandle, which means this is used on a per-easy handle basis.
|
||||
Everything that is strictly related to a connection is banned from this
|
||||
struct. */
|
||||
struct SSHPROTO {
|
||||
curl_off_t *bytecountp;
|
||||
char *user;
|
||||
char *passwd;
|
||||
char *path; /* the path we operate on */
|
||||
char *homedir;
|
||||
char *errorstr;
|
||||
#ifdef USE_LIBSSH2
|
||||
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
|
||||
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
|
||||
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
|
||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||
#endif /* USE_LIBSSH2 */
|
||||
};
|
||||
|
||||
/* ssh_conn is used for struct connection-oriented data in the connectdata
|
||||
@@ -505,25 +498,37 @@ struct SSHPROTO {
|
||||
struct ssh_conn {
|
||||
const char *authlist; /* List of auth. methods, managed by libssh2 */
|
||||
#ifdef USE_LIBSSH2
|
||||
const char *passphrase;
|
||||
char *rsa_pub;
|
||||
char *rsa;
|
||||
bool authed;
|
||||
const char *passphrase; /* passphrase to use */
|
||||
char *rsa_pub; /* path name */
|
||||
char *rsa; /* path name */
|
||||
bool authed; /* the connection has been authenticated fine */
|
||||
sshstate state; /* always use ssh.c:state() to change state! */
|
||||
sshstate nextState; /* the state to goto after stopping */
|
||||
CURLcode actualCode; /* the actual error code */
|
||||
struct curl_slist *quote_item;
|
||||
char *quote_path1;
|
||||
sshstate nextstate; /* the state to goto after stopping */
|
||||
CURLcode actualcode; /* the actual error code */
|
||||
struct curl_slist *quote_item; /* for the quote option */
|
||||
char *quote_path1; /* two generic pointers for the QUOTE stuff */
|
||||
char *quote_path2;
|
||||
LIBSSH2_SFTP_ATTRIBUTES quote_attrs;
|
||||
LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
|
||||
char *homedir; /* when doing SFTP we figure out home dir in the
|
||||
connect phase */
|
||||
|
||||
/* Here's a set of struct members used by the SFTP_READDIR state */
|
||||
LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
|
||||
char *readdir_filename;
|
||||
char *readdir_longentry;
|
||||
int readdir_len, readdir_totalLen, readdir_currLen;
|
||||
char *readdir_line;
|
||||
char *readdir_linkPath;
|
||||
int secondCreateDirs;
|
||||
char *slash_pos;
|
||||
/* end of READDIR stuff */
|
||||
|
||||
int secondCreateDirs; /* counter use by the code to see if the
|
||||
second attempt has been made to change
|
||||
to/create a directory */
|
||||
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
|
||||
LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
|
||||
LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
|
||||
LIBSSH2_SFTP *sftp_session; /* SFTP handle */
|
||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||
#endif /* USE_LIBSSH2 */
|
||||
};
|
||||
|
||||
@@ -595,7 +600,7 @@ struct ConnectBits {
|
||||
requests */
|
||||
bool netrc; /* name+password provided by netrc */
|
||||
|
||||
bool trailerHdrPresent; /* Set when Trailer: header found in HTTP response.
|
||||
bool trailerhdrpresent; /* Set when Trailer: header found in HTTP response.
|
||||
Required to determine whether to look for trailers
|
||||
in case of Transfer-Encoding: chunking */
|
||||
bool done; /* set to FALSE when Curl_do() is called and set to TRUE
|
||||
@@ -1190,16 +1195,16 @@ struct UrlState {
|
||||
#endif
|
||||
bool allow_port; /* Is set.use_port allowed to take effect or not. This
|
||||
is always set TRUE when curl_easy_perform() is called. */
|
||||
|
||||
struct digestdata digest;
|
||||
struct digestdata proxydigest;
|
||||
struct digestdata digest; /* state data for host Digest auth */
|
||||
struct digestdata proxydigest; /* state data for proxy Digest auth */
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
struct negotiatedata negotiate;
|
||||
struct negotiatedata negotiate; /* state data for host Negotiate auth */
|
||||
struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */
|
||||
#endif
|
||||
|
||||
struct auth authhost;
|
||||
struct auth authproxy;
|
||||
struct auth authhost; /* auth details for host */
|
||||
struct auth authproxy; /* auth details for proxy */
|
||||
|
||||
bool authproblem; /* TRUE if there's some problem authenticating */
|
||||
|
||||
@@ -1329,7 +1334,8 @@ struct UserDefined {
|
||||
long followlocation; /* as in HTTP Location: */
|
||||
long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
|
||||
for infinity */
|
||||
bool post301; /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a 301 */
|
||||
bool post301; /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a
|
||||
301 */
|
||||
bool free_referer; /* set TRUE if 'referer' points to a string we
|
||||
allocated */
|
||||
void *postfields; /* if POST, set the fields' values here */
|
||||
@@ -1389,13 +1395,10 @@ struct UserDefined {
|
||||
long httpversion; /* when non-zero, a specific HTTP version requested to
|
||||
be used in the library's request(s) */
|
||||
struct ssl_config_data ssl; /* user defined SSL stuff */
|
||||
|
||||
curl_proxytype proxytype; /* what kind of proxy that is in use */
|
||||
|
||||
long dns_cache_timeout; /* DNS cache timeout */
|
||||
long buffer_size; /* size of receive buffer to use */
|
||||
|
||||
void *private_data; /* Private data */
|
||||
void *private_data; /* application-private data */
|
||||
|
||||
struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi
|
||||
handle, an internal 'Curl_one_easy'
|
||||
@@ -1405,7 +1408,8 @@ struct UserDefined {
|
||||
|
||||
struct curl_slist *http200aliases; /* linked list of aliases for http200 */
|
||||
|
||||
long ip_version;
|
||||
long ip_version; /* the CURL_IPRESOLVE_* defines in the public header file
|
||||
0 - whatever, 1 - v2, 2 - v6 */
|
||||
|
||||
curl_off_t max_filesize; /* Maximum file size to download */
|
||||
|
||||
@@ -1416,26 +1420,26 @@ struct UserDefined {
|
||||
and they don't change during operations. */
|
||||
|
||||
bool printhost; /* printing host name in debug info */
|
||||
bool get_filetime;
|
||||
bool tunnel_thru_httpproxy;
|
||||
bool get_filetime; /* get the time and get of the remote file */
|
||||
bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */
|
||||
bool prefer_ascii; /* ASCII rather than binary */
|
||||
bool ftp_append;
|
||||
bool ftp_list_only;
|
||||
bool ftp_create_missing_dirs;
|
||||
bool ftp_use_port;
|
||||
bool hide_progress;
|
||||
bool http_fail_on_error;
|
||||
bool http_follow_location;
|
||||
bool ftp_append; /* append, not overwrite, on upload */
|
||||
bool ftp_list_only; /* switch FTP command for listing directories */
|
||||
bool ftp_create_missing_dirs; /* create directories that don't exist */
|
||||
bool ftp_use_port; /* use the FTP PORT command */
|
||||
bool hide_progress; /* don't use the progress meter */
|
||||
bool http_fail_on_error; /* fail on HTTP error codes >= 300 */
|
||||
bool http_follow_location; /* follow HTTP redirects */
|
||||
bool http_disable_hostname_check_before_authentication;
|
||||
bool include_header; /* include received protocol headers in data output */
|
||||
bool http_set_referer;
|
||||
bool http_set_referer; /* is a custom referer used */
|
||||
bool http_auto_referer; /* set "correct" referer when following location: */
|
||||
bool opt_no_body; /* as set with CURLOPT_NO_BODY */
|
||||
bool set_port;
|
||||
bool upload;
|
||||
bool set_port; /* custom port number used */
|
||||
bool upload; /* upload request */
|
||||
enum CURL_NETRC_OPTION
|
||||
use_netrc; /* defined in include/curl.h */
|
||||
bool verbose;
|
||||
bool verbose; /* output verbosity */
|
||||
bool krb; /* kerberos connection requested */
|
||||
bool reuse_forbid; /* forbidden to be reused, close after use */
|
||||
bool reuse_fresh; /* do not re-use an existing connection */
|
||||
@@ -1495,8 +1499,10 @@ struct SessionHandle {
|
||||
struct HandleData reqdata; /* Request-specific data */
|
||||
struct UserDefined set; /* values set by the libcurl user */
|
||||
struct DynamicStatic change; /* possibly modified userdefined data */
|
||||
|
||||
struct CookieInfo *cookies; /* the cookies, read from files and servers */
|
||||
struct CookieInfo *cookies; /* the cookies, read from files and servers.
|
||||
NOTE that the 'cookie' field in the
|
||||
UserDefined struct defines if the "engine"
|
||||
is to be used or not. */
|
||||
struct Progress progress; /* for all the progress meter data */
|
||||
struct UrlState state; /* struct for fields used for state info and
|
||||
other dynamic purposes */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
||||
@@ -20,12 +20,12 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8e
|
||||
OPENSSL_PATH = ../../openssl-0.9.8g
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
LIBSSH2_PATH = ../../libssh2-0.16
|
||||
LIBSSH2_PATH = ../../libssh2-0.18
|
||||
endif
|
||||
|
||||
ifndef INSTDIR
|
||||
|
||||
@@ -181,14 +181,16 @@
|
||||
#define HAVE_LONGLONG 1
|
||||
#endif
|
||||
|
||||
/* Define to avoid VS2005 complaining about portable C functions */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* ADDITIONAL DEFINITIONS */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Defines set for VS2005 to _not_ deprecate a few functions we use. */
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
|
||||
/* Define cpu-machine-OS */
|
||||
#ifndef OS
|
||||
#define OS "i386-pc-win32"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -106,6 +106,8 @@ char *homedir(void)
|
||||
#endif
|
||||
if (home && home[0])
|
||||
home = strdup(home);
|
||||
else
|
||||
home = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* PWD-stuff */
|
||||
|
||||
111
src/main.c
111
src/main.c
@@ -357,6 +357,7 @@ struct OutStruct {
|
||||
};
|
||||
|
||||
struct Configurable {
|
||||
CURL *easy; /* once we have one, we keep it here */
|
||||
bool remote_time;
|
||||
char *random_file;
|
||||
char *egd_file;
|
||||
@@ -619,6 +620,7 @@ static void help(void)
|
||||
" -d/--data <data> HTTP POST data (H)",
|
||||
" --data-ascii <data> HTTP POST ASCII data (H)",
|
||||
" --data-binary <data> HTTP POST binary data (H)",
|
||||
" --data-urlencode <name=data/name@filename> HTTP POST data url encoded (H)",
|
||||
" --negotiate Use HTTP Negotiate Authentication (H)",
|
||||
" --digest Use HTTP Digest Authentication (H)",
|
||||
" --disable-eprt Inhibit using EPRT or LPRT (F)",
|
||||
@@ -1532,6 +1534,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
{"d", "data", TRUE},
|
||||
{"da", "data-ascii", TRUE},
|
||||
{"db", "data-binary", TRUE},
|
||||
{"de", "data-urlencode", TRUE},
|
||||
{"D", "dump-header", TRUE},
|
||||
{"e", "referer", TRUE},
|
||||
{"E", "cert", TRUE},
|
||||
@@ -2045,12 +2048,83 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
/* postfield data */
|
||||
{
|
||||
char *postdata=NULL;
|
||||
|
||||
if('@' == *nextarg) {
|
||||
/* the data begins with a '@' letter, it means that a file name
|
||||
or - (stdin) follows */
|
||||
FILE *file;
|
||||
|
||||
if(subletter == 'e') { /* --data-urlencode*/
|
||||
/* [name]=[content], we encode the content part only
|
||||
* [name]@[file name]
|
||||
*
|
||||
* Case 2: we first load the file using that name and then encode
|
||||
* the content.
|
||||
*/
|
||||
char *p = strchr(nextarg, '=');
|
||||
long size = 0;
|
||||
size_t nlen;
|
||||
if(!p)
|
||||
p = strchr(nextarg, '@');
|
||||
if(!p) {
|
||||
warnf(config, "bad use of --data-urlencode\n");
|
||||
return PARAM_BAD_USE;
|
||||
}
|
||||
nlen = p - nextarg; /* length of the name part */
|
||||
if('@' == *p) {
|
||||
/* a '@' letter, it means that a file name or - (stdin) follows */
|
||||
|
||||
p++; /* pass the separator */
|
||||
|
||||
if(curlx_strequal("-", p)) {
|
||||
file = stdin;
|
||||
SET_BINMODE(stdin);
|
||||
}
|
||||
else {
|
||||
file = fopen(p, "rb");
|
||||
if(!file)
|
||||
warnf(config,
|
||||
"Couldn't read data from file \"%s\", this makes "
|
||||
"an empty POST.\n", nextarg);
|
||||
}
|
||||
|
||||
postdata = file2memory(file, &size);
|
||||
|
||||
if(file && (file != stdin))
|
||||
fclose(file);
|
||||
}
|
||||
else {
|
||||
GetStr(&postdata, ++p);
|
||||
size = strlen(postdata);
|
||||
}
|
||||
|
||||
if(!postdata) {
|
||||
/* no data from the file, point to a zero byte string to make this
|
||||
get sent as a POST anyway */
|
||||
postdata=strdup("");
|
||||
}
|
||||
else {
|
||||
char *enc = curl_easy_escape(config->easy, postdata, size);
|
||||
if(enc) {
|
||||
/* now make a string with the name from above and append the
|
||||
encoded string */
|
||||
size_t outlen = nlen + strlen(enc) + 2;
|
||||
char *n = malloc(outlen);
|
||||
if(!n)
|
||||
return PARAM_NO_MEM;
|
||||
|
||||
snprintf(n, outlen, "%.*s=%s", nlen, nextarg, enc);
|
||||
curl_free(enc);
|
||||
free(postdata);
|
||||
if(n) {
|
||||
postdata = n;
|
||||
}
|
||||
else
|
||||
return PARAM_NO_MEM;
|
||||
}
|
||||
else
|
||||
return PARAM_NO_MEM;
|
||||
}
|
||||
}
|
||||
else if('@' == *nextarg) {
|
||||
/* the data begins with a '@' letter, it means that a file name
|
||||
or - (stdin) follows */
|
||||
nextarg++; /* pass the @ */
|
||||
|
||||
if(curlx_strequal("-", nextarg)) {
|
||||
@@ -3334,6 +3408,9 @@ static void free_config_fields(struct Configurable *config)
|
||||
curl_slist_free_all(config->postquote);
|
||||
curl_slist_free_all(config->headers);
|
||||
curl_slist_free_all(config->telnet_options);
|
||||
|
||||
if(config->easy)
|
||||
curl_easy_cleanup(config->easy);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -3422,7 +3499,7 @@ CURLcode _my_setopt(CURL *curl, struct Configurable *config, const char *name,
|
||||
}
|
||||
/* attempt to figure out if it is a string (since the tag numerical doesn't
|
||||
offer this info) and then output it as a string if so */
|
||||
else if(pval && isgraph(ptr[0]) && isgraph(ptr[1]) && isgraph(ptr[2]))
|
||||
else if(pval && ISGRAPH(ptr[0]) && ISGRAPH(ptr[1]) && ISGRAPH(ptr[2]))
|
||||
snprintf(value, sizeof(value), "\"%s\"", (char *)ptr);
|
||||
else if(pval) {
|
||||
snprintf(value, sizeof(value), "%p", pval);
|
||||
@@ -3443,7 +3520,7 @@ CURLcode _my_setopt(CURL *curl, struct Configurable *config, const char *name,
|
||||
if(config->libcurl) {
|
||||
/* we only use this for real if --libcurl was used */
|
||||
|
||||
bufp = curl_maprintf("%scurl_easy_setopt(hnd, %s, %s);%s",
|
||||
bufp = curlx_maprintf("%scurl_easy_setopt(hnd, %s, %s);%s",
|
||||
remark?"/* ":"", name, value,
|
||||
remark?" [REMARK] */":"");
|
||||
|
||||
@@ -3577,6 +3654,17 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Get a curl handle to use for all forthcoming curl transfers. Cleanup
|
||||
* when all transfers are done.
|
||||
*/
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
clean_getout(config);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
config->easy = curl;
|
||||
|
||||
memset(&outs,0,sizeof(outs));
|
||||
|
||||
config->outs = &outs;
|
||||
@@ -3733,16 +3821,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a curl handle to use for all forthcoming curl transfers. Cleanup
|
||||
* when all transfers are done.
|
||||
*/
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
clean_getout(config);
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
/* This is the first entry added to easycode and it initializes the slist */
|
||||
easycode = curl_slist_append(easycode, "CURL *hnd = curl_easy_init();");
|
||||
if(!easycode) {
|
||||
@@ -4663,6 +4741,7 @@ quit_curl:
|
||||
|
||||
/* cleanup the curl handle! */
|
||||
curl_easy_cleanup(curl);
|
||||
config->easy = NULL; /* cleanup now */
|
||||
if (easycode)
|
||||
curl_slist_append(easycode, "curl_easy_cleanup(hnd);");
|
||||
|
||||
|
||||
10
src/setup.h
10
src/setup.h
@@ -25,13 +25,11 @@
|
||||
|
||||
#define CURL_NO_OLDIES
|
||||
|
||||
#if !defined(WIN32) && defined(__WIN32__)
|
||||
/* Borland fix */
|
||||
#define WIN32
|
||||
#endif
|
||||
/*
|
||||
* Define WIN32 when build target is Win32 API
|
||||
*/
|
||||
|
||||
#if !defined(WIN32) && defined(_WIN32)
|
||||
/* VS2005 on x64 fix */
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||
test231 test1000 test1001 test1002 test1003 test1004 test1005 test1006 \
|
||||
test615 test1007 test541 test1010 test1011 test1012 test542 test543 \
|
||||
test536 test1008 test1009 test2000 test2001 test2002 test2003 test35 \
|
||||
test544 test545 test2004
|
||||
test544 test545 test2004 test546 test1013 test1014
|
||||
|
||||
filecheck:
|
||||
@mkdir test-place; \
|
||||
|
||||
37
tests/data/test1013
Normal file
37
tests/data/test1013
Normal file
@@ -0,0 +1,37 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
curl-config
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
none
|
||||
</server>
|
||||
<name>
|
||||
Compare curl --version with curl-config --protocols
|
||||
</name>
|
||||
<command>
|
||||
--version
|
||||
</command>
|
||||
<postcheck>
|
||||
%SRCDIR/libtest/test1013.pl ../curl-config log/stdout1013 protocols
|
||||
</postcheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
2
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
37
tests/data/test1014
Normal file
37
tests/data/test1014
Normal file
@@ -0,0 +1,37 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
curl-config
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
none
|
||||
</server>
|
||||
<name>
|
||||
Compare curl --version with curl-config --features
|
||||
</name>
|
||||
<command>
|
||||
--version
|
||||
</command>
|
||||
<postcheck>
|
||||
%SRCDIR/libtest/test1013.pl ../curl-config log/stdout1014 features
|
||||
</postcheck>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
2
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
70
tests/data/test546
Normal file
70
tests/data/test546
Normal file
@@ -0,0 +1,70 @@
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
FTP
|
||||
PASV
|
||||
RETR
|
||||
multi
|
||||
</keywords>
|
||||
</info>
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="1">
|
||||
data
|
||||
to
|
||||
see
|
||||
that FTP
|
||||
works
|
||||
so does it?
|
||||
</data>
|
||||
|
||||
<servercmd>
|
||||
REPLY RETR 550 the file doesn't exist
|
||||
COUNT RETR 1
|
||||
REPLY SIZE 550 Can't check for file existence
|
||||
COUNT SIZE 1
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
ftp
|
||||
</server>
|
||||
<tool>
|
||||
lib533
|
||||
</tool>
|
||||
<name>
|
||||
FTP RETR a non-existing file then a found one using the multi interface
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/path/546 ftp://%HOSTIP:%FTPPORT/path/546
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
PASS ftp@example.com
|
||||
PWD
|
||||
CWD path
|
||||
EPSV
|
||||
TYPE I
|
||||
SIZE 546
|
||||
RETR 546
|
||||
EPSV
|
||||
SIZE 546
|
||||
RETR 546
|
||||
QUIT
|
||||
</protocol>
|
||||
<stdout>
|
||||
data
|
||||
to
|
||||
see
|
||||
that FTP
|
||||
works
|
||||
so does it?
|
||||
</stdout>
|
||||
</verify>
|
||||
</testcase>
|
||||
@@ -35,7 +35,7 @@ INCLUDES = -I$(top_srcdir)/include/curl \
|
||||
|
||||
LIBDIR = $(top_builddir)/lib
|
||||
|
||||
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl
|
||||
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl
|
||||
|
||||
# files used only in some libcurl test programs
|
||||
TESTUTIL = testutil.c testutil.h
|
||||
|
||||
48
tests/libtest/test1013.pl
Executable file
48
tests/libtest/test1013.pl
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env perl
|
||||
# Determine if curl-config --protocols matches the curl --version protocols
|
||||
if ( $#ARGV != 2 )
|
||||
{
|
||||
print "Usage: $0 curl-config-script curl-features-file features|protocols\n";
|
||||
exit 3;
|
||||
}
|
||||
|
||||
my $what=$ARGV[2];
|
||||
|
||||
# Read the output of curl --version
|
||||
my $curl_protocols="";
|
||||
open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
|
||||
while( <CURL> )
|
||||
{
|
||||
$curl_protocols = lc($_) if ( /$what:/i );
|
||||
}
|
||||
close CURL;
|
||||
|
||||
$curl_protocols =~ /\w+: (.*)$/;
|
||||
@curl = split / /,$1;
|
||||
|
||||
# These features are not supported by curl-config
|
||||
@curl = grep(!/^(Debug|Largefile|CharConv|GSS-Negotiate|SPNEGO)$/i, @curl);
|
||||
@curl = sort @curl;
|
||||
|
||||
# Read the output of curl-config
|
||||
my @curl_config;
|
||||
open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
|
||||
while( <CURLCONFIG> )
|
||||
{
|
||||
chomp;
|
||||
push @curl_config, lc($_);
|
||||
}
|
||||
close CURLCONFIG;
|
||||
|
||||
@curl_config = sort @curl_config;
|
||||
|
||||
my $curlproto = join ' ', @curl;
|
||||
my $curlconfigproto = join ' ', @curl_config;
|
||||
|
||||
my $different = $curlproto ne $curlconfigproto;
|
||||
if ($different) {
|
||||
print "Mismatch in $what lists:\n";
|
||||
print "curl: $curlproto\n";
|
||||
print "curl-config: $curlconfigproto\n";
|
||||
}
|
||||
exit $different;
|
||||
@@ -69,28 +69,32 @@ elsif ($ARGV[0] eq "postprocess")
|
||||
# the one generated on a typical Linux installation):
|
||||
# -r-?r-?r-? 12 U U 47 Dec 31 2000 rofile.txt
|
||||
|
||||
my $newfile = $logfile . ".new";
|
||||
my @canondir;
|
||||
open(IN, "<$logfile") || die "$!";
|
||||
open(OUT, ">$newfile") || die "$!";
|
||||
while (<IN>) {
|
||||
/^(.)(..).(..).(..).\s*(\S+)\s+\S+\s+\S+\s+(\S+)\s+(\S+\s+\S+\s+\S+)(.*)$/;
|
||||
if ($1 eq "d") {
|
||||
# Erase all directory metadata except for the name, as it is not
|
||||
# consistent for across all test systems and filesystems
|
||||
print OUT "d????????? N U U N ??? N NN:NN$8\n";
|
||||
push @canondir, "d????????? N U U N ??? N NN:NN$8\n";
|
||||
} elsif ($1 eq "-") {
|
||||
# Erase user and group names, as they are not consistent across
|
||||
# all test systems
|
||||
printf OUT "%s%s?%s?%s?%5d U U %15d %s%s\n", $1,$2,$3,$4,$5,$6,$7,$8;
|
||||
my $line = sprintf("%s%s?%s?%s?%5d U U %15d %s%s\n", $1,$2,$3,$4,$5,$6,$7,$8);
|
||||
push @canondir, $line;
|
||||
} else {
|
||||
# Unexpected format; just pass it through and let the test fail
|
||||
print OUT $_;
|
||||
push @canondir, $_;
|
||||
}
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
close(IN);
|
||||
|
||||
@canondir = sort {substr($a,57) cmp substr($b,57)} @canondir;
|
||||
my $newfile = $logfile . ".new";
|
||||
open(OUT, ">$newfile") || die "$!";
|
||||
print OUT join('', @canondir);
|
||||
close(OUT);
|
||||
|
||||
unlink $logfile;
|
||||
rename $newfile, $logfile;
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ my $listonly; # only list the tests
|
||||
my $postmortem; # display detailed info about failed tests
|
||||
|
||||
my %run; # running server
|
||||
my %doesntrun; # servers that don't work, identified by pidfile
|
||||
|
||||
# torture test variables
|
||||
my $torture;
|
||||
@@ -708,6 +709,11 @@ sub runhttpserver {
|
||||
$nameext="-ipv6";
|
||||
}
|
||||
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
$pid = checkserver($pidfile);
|
||||
|
||||
if($pid > 0) {
|
||||
@@ -726,8 +732,8 @@ sub runhttpserver {
|
||||
|
||||
if($httppid <= 0 || !kill(0, $httppid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the HTTP server\n";
|
||||
stopservers($verbose);
|
||||
logmsg "RUN: failed to start the HTTP$nameext server\n";
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -736,6 +742,7 @@ sub runhttpserver {
|
||||
logmsg "RUN: HTTP$nameext server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$httppid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -756,6 +763,7 @@ sub runhttpsserver {
|
||||
my $STATUS;
|
||||
my $RUNNING;
|
||||
my $ip = $HOSTIP;
|
||||
my $pidfile = $HTTPSPIDFILE;
|
||||
|
||||
if(!$stunnel) {
|
||||
return 0;
|
||||
@@ -766,7 +774,12 @@ sub runhttpsserver {
|
||||
$ip = $HOST6IP;
|
||||
}
|
||||
|
||||
my $pid=checkserver($HTTPSPIDFILE);
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $pid=checkserver($pidfile);
|
||||
|
||||
if($pid > 0) {
|
||||
# kill previous stunnel!
|
||||
@@ -776,12 +789,13 @@ sub runhttpsserver {
|
||||
my $flag=$debugprotocol?"-v ":"";
|
||||
my $cmd="$perl $srcdir/httpsserver.pl $flag -p https -s \"$stunnel\" -d $srcdir -r $HTTPPORT $HTTPSPORT";
|
||||
|
||||
my ($httpspid, $pid2) = startnew($cmd, $HTTPSPIDFILE,0);
|
||||
my ($httpspid, $pid2) = startnew($cmd, $pidfile,0);
|
||||
|
||||
if($httpspid <= 0 || !kill(0, $httpspid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the HTTPS server\n";
|
||||
stopservers($verbose);
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return(0,0);
|
||||
}
|
||||
|
||||
@@ -790,6 +804,7 @@ sub runhttpsserver {
|
||||
logmsg "RUN: HTTPS server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$httpspid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -824,6 +839,11 @@ sub runftpserver {
|
||||
$nameext="-ipv6";
|
||||
}
|
||||
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $pid = checkserver($pidfile);
|
||||
if($pid >= 0) {
|
||||
stopserver($pid);
|
||||
@@ -851,7 +871,8 @@ sub runftpserver {
|
||||
if($ftppid <= 0 || !kill(0, $ftppid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the FTP$id$nameext server\n";
|
||||
return -1;
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
# Server is up. Verify that we can speak to it.
|
||||
@@ -859,6 +880,7 @@ sub runftpserver {
|
||||
logmsg "RUN: FTP$id$nameext server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$ftppid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -879,6 +901,7 @@ sub runftpsserver {
|
||||
my $STATUS;
|
||||
my $RUNNING;
|
||||
my $ip = $HOSTIP;
|
||||
my $pidfile = $FTPSPIDFILE;
|
||||
|
||||
if(!$stunnel) {
|
||||
return 0;
|
||||
@@ -889,7 +912,12 @@ sub runftpsserver {
|
||||
$ip = $HOST6IP;
|
||||
}
|
||||
|
||||
my $pid=checkserver($FTPSPIDFILE);
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $pid=checkserver($pidfile);
|
||||
|
||||
if($pid > 0) {
|
||||
# kill previous stunnel!
|
||||
@@ -899,12 +927,13 @@ sub runftpsserver {
|
||||
my $flag=$debugprotocol?"-v ":"";
|
||||
my $cmd="$perl $srcdir/httpsserver.pl $flag -p ftps -s \"$stunnel\" -d $srcdir -r $FTPPORT $FTPSPORT";
|
||||
|
||||
my ($ftpspid, $pid2) = startnew($cmd, $FTPSPIDFILE,0);
|
||||
my ($ftpspid, $pid2) = startnew($cmd, $pidfile,0);
|
||||
|
||||
if($ftpspid <= 0 || !kill(0, $ftpspid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the FTPS server\n";
|
||||
stopservers($verbose);
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return(0,0);
|
||||
}
|
||||
|
||||
@@ -913,6 +942,7 @@ sub runftpsserver {
|
||||
logmsg "RUN: FTPS server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$ftpspid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -947,6 +977,11 @@ sub runtftpserver {
|
||||
$nameext="-ipv6";
|
||||
}
|
||||
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $pid = checkserver($pidfile);
|
||||
if($pid >= 0) {
|
||||
stopserver($pid);
|
||||
@@ -969,8 +1004,9 @@ sub runtftpserver {
|
||||
|
||||
if($tftppid <= 0 || !kill(0, $tftppid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the FTP$id$nameext server\n";
|
||||
return -1;
|
||||
logmsg "RUN: failed to start the TFTP$id$nameext server\n";
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
# Server is up. Verify that we can speak to it.
|
||||
@@ -978,6 +1014,7 @@ sub runtftpserver {
|
||||
logmsg "RUN: TFTP$id$nameext server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$tftppid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
@@ -1000,6 +1037,11 @@ sub runsshserver {
|
||||
my $port = $SSHPORT;
|
||||
my $pidfile = $SSHPIDFILE;
|
||||
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $pid = checkserver($pidfile);
|
||||
if($pid > 0) {
|
||||
stopserver($pid);
|
||||
@@ -1015,11 +1057,13 @@ sub runsshserver {
|
||||
logmsg "RUN: failed to start the SSH server\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$sshpid $pid2");
|
||||
return -1;
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
if (!verifyserver('ssh',$ip,$port)) {
|
||||
logmsg "RUN: SSH server failed verification\n";
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
if($verbose) {
|
||||
@@ -1038,6 +1082,11 @@ sub runsocksserver {
|
||||
my $port = $SOCKSPORT;
|
||||
my $pidfile = $SOCKSPIDFILE;
|
||||
|
||||
# don't retry if the server doesn't work
|
||||
if ($doesntrun{$pidfile}) {
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
my $flag=$debugprotocol?"-v ":"";
|
||||
my $cmd="ssh -D ${HOSTIP}:$SOCKSPORT -N -F curl_ssh_config ${USER}\@${HOSTIP} -p ${SSHPORT} -vv >log/ssh.log 2>&1";
|
||||
my ($sshpid, $pid2) =
|
||||
@@ -1048,12 +1097,14 @@ sub runsocksserver {
|
||||
logmsg "RUN: failed to start the SOCKS server\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver("$sshpid $pid2");
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
|
||||
# Ugly hack but ssh doesn't support pid files
|
||||
if (!verifyserver('socks',$ip,$port)) {
|
||||
logmsg "RUN: SOCKS server failed verification\n";
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
if($verbose) {
|
||||
@@ -1832,7 +1883,7 @@ sub singletest {
|
||||
if($cmd) {
|
||||
my $rc = runclient("$cmd");
|
||||
if($rc != 0) {
|
||||
logmsg "postcheck failure\n";
|
||||
logmsg " postcheck FAILED\n";
|
||||
return 1;
|
||||
}
|
||||
logmsg "postchecked $cmd\n" if($verbose);
|
||||
@@ -2329,12 +2380,18 @@ sub startservers {
|
||||
}
|
||||
if(!$run{'socks'}) {
|
||||
my $sshversion=`ssh -V 2>&1`;
|
||||
if ($sshversion =~ /SSH_(\d+)\.(\d+)/i) {
|
||||
if ($1*10+$2 < 37) {
|
||||
if($sshversion =~ /OpenSSH[_-](\d+)\.(\d+)/i) {
|
||||
if ($1*10+$2 < 36) {
|
||||
# need 3.7 for socks5 - http://www.openssh.com/txt/release-3.7
|
||||
return "ssh version ($1.$2) insufficient; need at least 3.7";
|
||||
return "OpenSSH version ($1.$2) insufficient; need at least 3.7";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
elsif($sshversion =~ /Sun[_-]SSH[_-](\d+)\.(\d+)/i) {
|
||||
if ($1*10+$2 < 11) {
|
||||
return "SunSSH version ($1.$2) insufficient; need at least 1.1";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "Unsupported ssh client\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -23,7 +23,7 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
/* This file is a rewrite/clone of the arpa/telnet.h file for systems without
|
||||
/* This file is a rewrite/clone of the arpa/tftp.h file for systems without
|
||||
it. */
|
||||
|
||||
#define SEGSIZE 512 /* data segment size */
|
||||
|
||||
@@ -620,7 +620,7 @@ again:
|
||||
fprintf(server, "filename: %s\n", filename);
|
||||
|
||||
for (cp = mode; *cp; cp++)
|
||||
if (isupper((int)*cp))
|
||||
if(ISUPPER(*cp))
|
||||
*cp = (char)tolower((int)*cp);
|
||||
|
||||
/* store input protocol */
|
||||
|
||||
@@ -26,7 +26,25 @@ if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' || $^O eq 'dos' || $^O
|
||||
}
|
||||
|
||||
# Where to look for sftp-server
|
||||
my @sftppath=qw(/usr/lib/openssh /usr/libexec/openssh /usr/libexec /usr/local/libexec /opt/local/libexec /usr/lib/ssh /usr/libexec/ssh /usr/sbin /usr/lib /usr/lib/ssh/openssh /usr/lib64/ssh /usr/lib64/misc /usr/lib/misc);
|
||||
my @sftppath = qw(
|
||||
/usr/lib/openssh
|
||||
/usr/libexec/openssh
|
||||
/usr/libexec
|
||||
/usr/local/libexec
|
||||
/opt/local/libexec
|
||||
/usr/lib/ssh
|
||||
/usr/libexec/ssh
|
||||
/usr/sbin
|
||||
/usr/lib
|
||||
/usr/lib/ssh/openssh
|
||||
/usr/lib64/ssh
|
||||
/usr/lib64/misc
|
||||
/usr/lib/misc
|
||||
/usr/local/sbin
|
||||
/usr/freeware/bin
|
||||
/opt/ssh/sbin
|
||||
/opt/ssh/libexec
|
||||
);
|
||||
|
||||
my $username = $ENV{USER};
|
||||
|
||||
@@ -43,6 +61,19 @@ sub searchpath {
|
||||
}
|
||||
}
|
||||
|
||||
# Display contents of the given file.
|
||||
sub displayfile {
|
||||
my ($file) = @_;
|
||||
print "=== Start of file $file\n";
|
||||
if(open(SINGLE, "<$file")) {
|
||||
while(my $string = <SINGLE>) {
|
||||
print "$string";
|
||||
}
|
||||
close(SINGLE);
|
||||
}
|
||||
print "=== End of file $file\n";
|
||||
}
|
||||
|
||||
# Parse options
|
||||
do {
|
||||
if($ARGV[0] eq "-v") {
|
||||
@@ -106,6 +137,13 @@ if ($tmpstr =~ /OpenSSH[_-](\d+)\.(\d+)(\.(\d+))*/) {
|
||||
($ssh_ver_major, $ssh_ver_minor, $ssh_ver_patch) = ($1, $2, $4);
|
||||
$ssh_daemon = 'OpenSSH';
|
||||
}
|
||||
if(!$ssh_daemon) {
|
||||
chomp($tmpstr = qx($sshd -V 2>&1 | grep Sun_SSH));
|
||||
if($tmpstr =~ /Sun[_-]SSH[_-](\d+)\.(\d+)/) {
|
||||
($ssh_ver_major, $ssh_ver_minor) = ($1, $2);
|
||||
$ssh_daemon = 'SunSSH';
|
||||
}
|
||||
}
|
||||
if ($verbose) {
|
||||
print STDERR "ssh_daemon: $ssh_daemon\n";
|
||||
print STDERR "ssh_ver_major: $ssh_ver_major\n";
|
||||
@@ -113,8 +151,23 @@ if ($verbose) {
|
||||
print STDERR "ssh_ver_patch: $ssh_ver_patch\n";
|
||||
}
|
||||
|
||||
# Verify minimum OpenSSH version.
|
||||
if (($ssh_daemon !~ /OpenSSH/) || (10 * $ssh_ver_major + $ssh_ver_minor < 37)) {
|
||||
# Verify minimum SSH daemon version.
|
||||
my $sshd_ver_ok = 1;
|
||||
if(($ssh_daemon =~ /OpenSSH/) && (10 * $ssh_ver_major + $ssh_ver_minor < 36)) {
|
||||
print "SSH server daemon found is OpenSSH $ssh_ver_major.$ssh_ver_minor\n";
|
||||
$sshd_ver_ok = 0;
|
||||
}
|
||||
if(($ssh_daemon =~ /SunSSH/) && (10 * $ssh_ver_major + $ssh_ver_minor < 11)) {
|
||||
print "SSH server daemon found is SunSSH $ssh_ver_major.$ssh_ver_minor\n";
|
||||
$sshd_ver_ok = 0;
|
||||
}
|
||||
if(!$ssh_daemon) {
|
||||
print "SSH server daemon found is not OpenSSH nor SunSSH\n";
|
||||
chomp($tmpstr = qx($sshd -V 2>&1));
|
||||
print "$tmpstr\n";
|
||||
$sshd_ver_ok = 0;
|
||||
}
|
||||
if(!$sshd_ver_ok) {
|
||||
print "SCP, SFTP and SOCKS tests require OpenSSH 3.7 or later\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -130,7 +183,8 @@ close CONF;
|
||||
# Check here for possible unsupported options, avoiding its use in sshd.
|
||||
sub sshd_supports_opt($) {
|
||||
my ($option) = @_;
|
||||
my $err = grep /Unsupported .* $option/, qx($sshd -t -f $conffile -o $option=no 2>&1);
|
||||
my $err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/,
|
||||
qx($sshd -t -f $conffile -o $option=no 2>&1);
|
||||
return !$err;
|
||||
}
|
||||
|
||||
@@ -238,20 +292,36 @@ EOFSSH
|
||||
close SSHFILE || die "Could not close $conffile_ssh";
|
||||
|
||||
|
||||
if (system "$sshd -t -q -f $conffile") {
|
||||
# Verify that sshd supports our configuration file
|
||||
if (system "$sshd -t -f $conffile > log/sshd.log 2>&1") {
|
||||
# This is likely due to missing support for UsePam
|
||||
print "$sshd is too old and is not supported\n";
|
||||
displayfile("log/sshd.log");
|
||||
displayfile("$conffile");
|
||||
unlink "log/sshd.log";
|
||||
unlink $conffile;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Start the server
|
||||
my $rc = system "$sshd -e -D -f $conffile > log/sshd.log 2>&1";
|
||||
$rc >>= 8;
|
||||
if($rc && $verbose) {
|
||||
print STDERR "$sshd exited with $rc!\n";
|
||||
my $cmdretval = system "$sshd -e -D -f $conffile > log/sshd.log 2>&1";
|
||||
my $cmdnoexec = $!;
|
||||
if ($cmdretval == -1) {
|
||||
print "$sshd failed with: \n";
|
||||
print "$cmdnoexec \n";
|
||||
displayfile("log/sshd.log");
|
||||
displayfile("$conffile");
|
||||
}
|
||||
elsif ($cmdretval & 127) {
|
||||
printf("$sshd died with signal %d, and %s coredump.\n",
|
||||
($cmdretval & 127), ($cmdretval & 128)?"a":"no");
|
||||
displayfile("log/sshd.log");
|
||||
displayfile("$conffile");
|
||||
}
|
||||
elsif ($verbose && ($cmdretval >> 8)) {
|
||||
printf("$sshd exited with %d \n", $cmdretval >> 8);
|
||||
}
|
||||
|
||||
unlink $conffile;
|
||||
|
||||
exit $rc;
|
||||
exit $cmdretval >> 8;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# $Id$
|
||||
###########################################################################
|
||||
|
||||
use File::Basename;
|
||||
|
||||
sub valgrindparse {
|
||||
my ($srcdir, # the dir in which the runtests script resides
|
||||
$sslenabled,
|
||||
@@ -44,13 +46,13 @@ sub valgrindparse {
|
||||
my $w = $4;
|
||||
if($w =~ /(.*) \(([^:]*):(\d+)/) {
|
||||
my ($func, $source, $line)=($1, $2, $3);
|
||||
|
||||
if(-f "$srcdir/../src/$source" ||
|
||||
-f "$srcdir/../lib/$source") {
|
||||
my $sourcename = basename($source);
|
||||
if(-f "$srcdir/../src/$sourcename" ||
|
||||
-f "$srcdir/../lib/$sourcename") {
|
||||
# this is our source
|
||||
# print "$func() at $source:$line\n";
|
||||
$us++;
|
||||
}
|
||||
} #else {print "Not our source: $func, $source, $line\n";}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user