Compare commits
84 Commits
curl-7_9_5
...
curl-7_9_5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c2d4fd876c | ||
![]() |
58cad04bbb | ||
![]() |
9bb64d6827 | ||
![]() |
4441df90c1 | ||
![]() |
f51f2417c5 | ||
![]() |
aad617647d | ||
![]() |
49c0d62dda | ||
![]() |
f752098ba5 | ||
![]() |
a4477b9e4b | ||
![]() |
ad3cef0fc8 | ||
![]() |
d89dbe5bd6 | ||
![]() |
b0475dbdbc | ||
![]() |
60b2e74fa3 | ||
![]() |
cda16297d1 | ||
![]() |
d6c9a72e15 | ||
![]() |
4d7b1512c1 | ||
![]() |
d8a35d745e | ||
![]() |
e22657ea13 | ||
![]() |
d06d6b5534 | ||
![]() |
cec8ab1fde | ||
![]() |
9fc62a8dd0 | ||
![]() |
61540b98c2 | ||
![]() |
465ae39e86 | ||
![]() |
01f04b9a41 | ||
![]() |
34f9ab1046 | ||
![]() |
699876778b | ||
![]() |
8fc5a0d19e | ||
![]() |
62b5926d58 | ||
![]() |
4d1037f385 | ||
![]() |
e4addb3975 | ||
![]() |
2aef351980 | ||
![]() |
d88c153c7d | ||
![]() |
9e9883082e | ||
![]() |
71440df4c7 | ||
![]() |
80b004a57d | ||
![]() |
ea8476a2dc | ||
![]() |
cb85ca18ab | ||
![]() |
f1103b95cf | ||
![]() |
aa5ff53bcf | ||
![]() |
907dabed5d | ||
![]() |
0cacbc892c | ||
![]() |
6753c3c715 | ||
![]() |
36e1363e3d | ||
![]() |
d1a711eb6a | ||
![]() |
d8dea4dcc7 | ||
![]() |
ca161737bc | ||
![]() |
3612c3774e | ||
![]() |
e6a65bb3ef | ||
![]() |
ff291eee48 | ||
![]() |
66b8f48a88 | ||
![]() |
634760cbdc | ||
![]() |
a23a897ad2 | ||
![]() |
d9c244278d | ||
![]() |
b6c4185b27 | ||
![]() |
5896d35e72 | ||
![]() |
b4dfdd8bbc | ||
![]() |
e6ed3478ea | ||
![]() |
db08d9c6b9 | ||
![]() |
9490278ece | ||
![]() |
fd8bf5f171 | ||
![]() |
c9bc14a222 | ||
![]() |
63708cbfb0 | ||
![]() |
d9f307623c | ||
![]() |
540f77a627 | ||
![]() |
71bb2d0b8b | ||
![]() |
87dc44e434 | ||
![]() |
29e0fcd091 | ||
![]() |
2e9a798f09 | ||
![]() |
b32a39f44f | ||
![]() |
d86f9611b3 | ||
![]() |
6a62fc4a40 | ||
![]() |
7cdd6455d7 | ||
![]() |
e4fefd088d | ||
![]() |
95e601e2b1 | ||
![]() |
b1ffe7b74a | ||
![]() |
417c8fb602 | ||
![]() |
85efa64c31 | ||
![]() |
d8cb026e80 | ||
![]() |
41dd5121f0 | ||
![]() |
94482d7ca5 | ||
![]() |
4d0e51aead | ||
![]() |
ae8a8c8ba4 | ||
![]() |
7d043f46d5 | ||
![]() |
cbca19d6c2 |
1957
CHANGES.2001
Normal file
1957
CHANGES.2001
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
|
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
|
||||||
@@ -10,7 +10,7 @@ EXTRA_DIST = \
|
|||||||
|
|
||||||
bin_SCRIPTS = curl-config
|
bin_SCRIPTS = curl-config
|
||||||
|
|
||||||
SUBDIRS = docs lib src include tests packages multi
|
SUBDIRS = docs lib src include tests packages
|
||||||
|
|
||||||
# create a root makefile in the distribution:
|
# create a root makefile in the distribution:
|
||||||
dist-hook:
|
dist-hook:
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
# Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
#
|
#
|
||||||
# In order to be useful for every potential user, curl and libcurl are
|
# In order to be useful for every potential user, curl and libcurl are
|
||||||
# dual-licensed under the MPL and the MIT/X-derivate licenses.
|
# dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
|
@@ -8,7 +8,7 @@ AC_PREREQ(2.50)
|
|||||||
dnl First some basic init macros
|
dnl First some basic init macros
|
||||||
AC_INIT
|
AC_INIT
|
||||||
AC_CONFIG_SRCDIR([lib/urldata.h])
|
AC_CONFIG_SRCDIR([lib/urldata.h])
|
||||||
AM_CONFIG_HEADER(lib/config.h src/config.h)
|
AM_CONFIG_HEADER(lib/config.h src/config.h tests/server/config.h)
|
||||||
|
|
||||||
dnl figure out the libcurl version
|
dnl figure out the libcurl version
|
||||||
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
|
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
|
||||||
@@ -594,13 +594,14 @@ dnl AC_SUBST(RANLIB)
|
|||||||
AC_CONFIG_FILES([Makefile \
|
AC_CONFIG_FILES([Makefile \
|
||||||
docs/Makefile \
|
docs/Makefile \
|
||||||
docs/examples/Makefile \
|
docs/examples/Makefile \
|
||||||
|
docs/libcurl/Makefile \
|
||||||
include/Makefile \
|
include/Makefile \
|
||||||
include/curl/Makefile \
|
include/curl/Makefile \
|
||||||
src/Makefile \
|
src/Makefile \
|
||||||
multi/Makefile \
|
|
||||||
lib/Makefile \
|
lib/Makefile \
|
||||||
tests/Makefile \
|
tests/Makefile \
|
||||||
tests/data/Makefile \
|
tests/data/Makefile \
|
||||||
|
tests/server/Makefile \
|
||||||
packages/Makefile \
|
packages/Makefile \
|
||||||
packages/Win32/Makefile \
|
packages/Win32/Makefile \
|
||||||
packages/Win32/cygwin/Makefile \
|
packages/Win32/cygwin/Makefile \
|
||||||
@@ -609,6 +610,8 @@ AC_CONFIG_FILES([Makefile \
|
|||||||
packages/Linux/RPM/curl.spec \
|
packages/Linux/RPM/curl.spec \
|
||||||
packages/Linux/RPM/curl-ssl.spec \
|
packages/Linux/RPM/curl-ssl.spec \
|
||||||
packages/Solaris/Makefile \
|
packages/Solaris/Makefile \
|
||||||
|
packages/EPM/curl.list \
|
||||||
|
packages/EPM/Makefile \
|
||||||
curl-config
|
curl-config
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@@ -408,6 +408,7 @@ PORTS
|
|||||||
- HP-PA Linux
|
- HP-PA Linux
|
||||||
- MIPS IRIX 6.2, 6.5
|
- MIPS IRIX 6.2, 6.5
|
||||||
- MIPS Linux
|
- MIPS Linux
|
||||||
|
- Pocket PC/Win CE 3.0
|
||||||
- Power AIX 4.2, 4.3.1, 4.3.2
|
- Power AIX 4.2, 4.3.1, 4.3.2
|
||||||
- PowerPC Darwin 1.0
|
- PowerPC Darwin 1.0
|
||||||
- PowerPC Linux
|
- PowerPC Linux
|
||||||
|
@@ -54,7 +54,7 @@ Windows vs Unix
|
|||||||
Inside the source code, We make an effort to avoid '#ifdef [Your OS]'. All
|
Inside the source code, We make an effort to avoid '#ifdef [Your OS]'. All
|
||||||
conditionals that deal with features *should* instead be in the format
|
conditionals that deal with features *should* instead be in the format
|
||||||
'#ifdef HAVE_THAT_WEIRD_FUNCTION'. Since Windows can't run configure scripts,
|
'#ifdef HAVE_THAT_WEIRD_FUNCTION'. Since Windows can't run configure scripts,
|
||||||
we maintain two config-win32.h files (one in / and one in src/) that are
|
we maintain two config-win32.h files (one in lib/ and one in src/) that are
|
||||||
supposed to look exactly as a config.h file would have looked like on a
|
supposed to look exactly as a config.h file would have looked like on a
|
||||||
Windows machine!
|
Windows machine!
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ Library
|
|||||||
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
|
||||||
put in the lib/easy.c file.
|
put in the lib/easy.c file.
|
||||||
|
|
||||||
Starting with libcurl 7.8, curl_global_init_() and curl_global_cleanup() were
|
curl_global_init_() and curl_global_cleanup() should be called by the
|
||||||
introduced. They should be called by the application to initialize and clean
|
application to initialize and clean up global stuff in the library. As of
|
||||||
up global stuff in the library. As of today, they just do the global SSL
|
today, it can handle the global SSL initing if SSL is enabled and it can init
|
||||||
initing if SSL is enabled. libcurl itself has no "global" scope.
|
the socket layer on windows machines. libcurl itself has no "global" scope.
|
||||||
|
|
||||||
All printf()-style functions use the supplied clones in lib/mprintf.c. This
|
All printf()-style functions use the supplied clones in lib/mprintf.c. This
|
||||||
makes sure we stay absolutely platform independent.
|
makes sure we stay absolutely platform independent.
|
||||||
|
14
docs/KNOWN_BUGS
Normal file
14
docs/KNOWN_BUGS
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
These are problems known to exist at the time of this release. Feel free to
|
||||||
|
join in and help us correct one or more of these! Also be sure to check the
|
||||||
|
changelog of the current development status, as one or more of these problems
|
||||||
|
may have been fixed since this was written!
|
||||||
|
|
||||||
|
* curl_formadd() fails on OSF1. Why? Fix! Need help from OSF1 dudes.
|
||||||
|
https://sourceforge.net/tracker/index.php?func=detail&aid=524433&group_id=976&atid=100976
|
||||||
|
|
||||||
|
* Running 'make test' on Mac OS X gives 4 errors. This seems to be related
|
||||||
|
to some kind of libtool problem:
|
||||||
|
http://curl.haxx.se/mail/archive-2002-03/0029.html and
|
||||||
|
http://curl.haxx.se/mail/archive-2002-03/0033.html
|
||||||
|
|
||||||
|
* libcurl does not deal nicely with files larger than 2GB
|
18
docs/MANUAL
18
docs/MANUAL
@@ -246,25 +246,25 @@ POST (HTTP)
|
|||||||
-F accepts parameters like -F "name=contents". If you want the contents to
|
-F accepts parameters like -F "name=contents". If you want the contents to
|
||||||
be read from a file, use <@filename> as contents. When specifying a file,
|
be read from a file, use <@filename> as contents. When specifying a file,
|
||||||
you can also specify the file content type by appending ';type=<mime type>'
|
you can also specify the file content type by appending ';type=<mime type>'
|
||||||
to the file name. You can also post the contents of several files in one field.
|
to the file name. You can also post the contents of several files in one
|
||||||
For example, the field name 'coolfiles' is used to send three files, with
|
field. For example, the field name 'coolfiles' is used to send three files,
|
||||||
different content types using the following syntax:
|
with different content types using the following syntax:
|
||||||
|
|
||||||
curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \
|
curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \
|
||||||
http://www.post.com/postit.cgi
|
http://www.post.com/postit.cgi
|
||||||
|
|
||||||
If the content-type is not specified, curl will try to guess from the file
|
If the content-type is not specified, curl will try to guess from the file
|
||||||
extension (it only knows a few), or use the previously specified type
|
extension (it only knows a few), or use the previously specified type (from
|
||||||
(from an earlier file if several files are specified in a list) or else it
|
an earlier file if several files are specified in a list) or else it will
|
||||||
will using the default type 'text/plain'.
|
using the default type 'text/plain'.
|
||||||
|
|
||||||
Emulate a fill-in form with -F. Let's say you fill in three fields in a
|
Emulate a fill-in form with -F. Let's say you fill in three fields in a
|
||||||
form. One field is a file name which to post, one field is your name and one
|
form. One field is a file name which to post, one field is your name and one
|
||||||
field is a file description. We want to post the file we have written named
|
field is a file description. We want to post the file we have written named
|
||||||
"cooltext.txt". To let curl do the posting of this data instead of your
|
"cooltext.txt". To let curl do the posting of this data instead of your
|
||||||
favourite browser, you have to read the HTML source of the form page and find
|
favourite browser, you have to read the HTML source of the form page and
|
||||||
the names of the input fields. In our example, the input field names are
|
find the names of the input fields. In our example, the input field names
|
||||||
'file', 'yourname' and 'filedescription'.
|
are 'file', 'yourname' and 'filedescription'.
|
||||||
|
|
||||||
curl -F "file=@cooltext.txt" -F "yourname=Daniel" \
|
curl -F "file=@cooltext.txt" -F "yourname=Daniel" \
|
||||||
-F "filedescription=Cool text file with cool text inside" \
|
-F "filedescription=Cool text file with cool text inside" \
|
||||||
|
@@ -6,69 +6,24 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
|
|||||||
|
|
||||||
man_MANS = \
|
man_MANS = \
|
||||||
curl.1 \
|
curl.1 \
|
||||||
curl-config.1 \
|
curl-config.1
|
||||||
curl_easy_cleanup.3 \
|
|
||||||
curl_easy_getinfo.3 \
|
|
||||||
curl_easy_init.3 \
|
|
||||||
curl_easy_perform.3 \
|
|
||||||
curl_easy_setopt.3 \
|
|
||||||
curl_easy_duphandle.3 \
|
|
||||||
curl_formparse.3 \
|
|
||||||
curl_formadd.3 \
|
|
||||||
curl_formfree.3 \
|
|
||||||
curl_getdate.3 \
|
|
||||||
curl_getenv.3 \
|
|
||||||
curl_slist_append.3 \
|
|
||||||
curl_slist_free_all.3 \
|
|
||||||
curl_version.3 \
|
|
||||||
curl_escape.3 \
|
|
||||||
curl_unescape.3 \
|
|
||||||
curl_strequal.3 \
|
|
||||||
curl_strnequal.3 \
|
|
||||||
curl_mprintf.3 \
|
|
||||||
curl_global_init.3 \
|
|
||||||
curl_global_cleanup.3 \
|
|
||||||
libcurl.3
|
|
||||||
|
|
||||||
SUBDIRS = examples
|
|
||||||
|
|
||||||
HTMLPAGES = \
|
HTMLPAGES = \
|
||||||
curl.html \
|
curl.html \
|
||||||
curl-config.html \
|
curl-config.html
|
||||||
curl_easy_cleanup.html \
|
|
||||||
curl_easy_getinfo.html \
|
|
||||||
curl_easy_init.html \
|
|
||||||
curl_easy_perform.html \
|
|
||||||
curl_easy_setopt.html \
|
|
||||||
curl_easy_duphandle.html \
|
|
||||||
curl_formadd.html \
|
|
||||||
curl_formparse.html \
|
|
||||||
curl_formfree.html \
|
|
||||||
curl_getdate.html \
|
|
||||||
curl_getenv.html \
|
|
||||||
curl_slist_append.html \
|
|
||||||
curl_slist_free_all.html \
|
|
||||||
curl_version.html \
|
|
||||||
curl_escape.html \
|
|
||||||
curl_unescape.html \
|
|
||||||
curl_strequal.html \
|
|
||||||
curl_strnequal.html \
|
|
||||||
curl_mprintf.html \
|
|
||||||
curl_global_init.html \
|
|
||||||
curl_global_cleanup.html \
|
|
||||||
libcurl.html \
|
|
||||||
index.html
|
|
||||||
|
|
||||||
EXTRA_DIST = $(man_MANS) \
|
SUBDIRS = examples libcurl
|
||||||
MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
|
|
||||||
|
EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
|
||||||
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS \
|
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS \
|
||||||
VERSIONS $(HTMLPAGES)
|
VERSIONS KNOWN_BUGS $(man_MANS) $(HTMLPAGES)
|
||||||
|
|
||||||
MAN2HTML= gnroff -man $< | man2html >$@
|
MAN2HTML= gnroff -man $< | man2html >$@
|
||||||
|
|
||||||
SUFFIXES = .1 .3 .html
|
SUFFIXES = .1 .3 .html
|
||||||
|
|
||||||
html: $(HTMLPAGES)
|
html: $(HTMLPAGES)
|
||||||
|
cd libcurl; make html
|
||||||
|
|
||||||
.3.html:
|
.3.html:
|
||||||
$(MAN2HTML)
|
$(MAN2HTML)
|
||||||
|
@@ -78,6 +78,9 @@ TODO
|
|||||||
|
|
||||||
HTTP
|
HTTP
|
||||||
|
|
||||||
|
* Make it possible to supply normal POST data through the ordinary read data
|
||||||
|
callback.
|
||||||
|
|
||||||
* HTTP PUT for files passed on stdin *OR* when the --crlf option is
|
* HTTP PUT for files passed on stdin *OR* when the --crlf option is
|
||||||
used. Requires libcurl to send the file with chunked content
|
used. Requires libcurl to send the file with chunked content
|
||||||
encoding. [http://curl.haxx.se/dev/HTTP-PUT-stdin.txt] When the filter
|
encoding. [http://curl.haxx.se/dev/HTTP-PUT-stdin.txt] When the filter
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man curl.1
|
.\" nroff -man curl.1
|
||||||
.\" Written by Daniel Stenberg
|
.\" Written by Daniel Stenberg
|
||||||
.\"
|
.\"
|
||||||
.TH curl 1 "30 Nov 2001" "Curl 7.9.2" "Curl Manual"
|
.TH curl 1 "25 Feb 2002" "Curl 7.9.5" "Curl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl \- transfer a URL
|
curl \- transfer a URL
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -594,6 +594,9 @@ The average download speed that curl measured for the complete download.
|
|||||||
.TP
|
.TP
|
||||||
.B speed_upload
|
.B speed_upload
|
||||||
The average upload speed that curl measured for the complete upload.
|
The average upload speed that curl measured for the complete upload.
|
||||||
|
.TP
|
||||||
|
.B content_type
|
||||||
|
The Content-Type of the requested document, if there was any. (Added in 7.9.5)
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
If this option is used several times, the last one will be used.
|
If this option is used several times, the last one will be used.
|
||||||
|
@@ -1,29 +0,0 @@
|
|||||||
.\" You can view this file with:
|
|
||||||
.\" nroff -man [file]
|
|
||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.TH curl_easy_cleanup 3 "5 March 2001" "libcurl 7.7" "libcurl Manual"
|
|
||||||
.SH NAME
|
|
||||||
curl_easy_cleanup - End a libcurl session
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B #include <curl/curl.h>
|
|
||||||
.sp
|
|
||||||
.BI "void curl_easy_cleanup(CURL *" handle ");"
|
|
||||||
.ad
|
|
||||||
.SH DESCRIPTION
|
|
||||||
This function must be the last function to call for a curl session. It is the
|
|
||||||
opposite of the
|
|
||||||
.I curl_easy_init
|
|
||||||
function and must be called with the same
|
|
||||||
.I handle
|
|
||||||
as input as the curl_easy_init call returned.
|
|
||||||
|
|
||||||
This will effectively close all connections libcurl has been used and possibly
|
|
||||||
has kept open until now. Don't call this function if you intend to transfer
|
|
||||||
more files (libcurl 7.7 or later).
|
|
||||||
.SH RETURN VALUE
|
|
||||||
None
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
.BR curl_easy_init "(3), "
|
|
||||||
.SH BUGS
|
|
||||||
Surely there are some, you tell me!
|
|
@@ -1,34 +0,0 @@
|
|||||||
.\" You can view this file with:
|
|
||||||
.\" nroff -man [file]
|
|
||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.TH curl_easy_init 3 "14 August 2001" "libcurl 7.8.1" "libcurl Manual"
|
|
||||||
.SH NAME
|
|
||||||
curl_easy_init - Start a libcurl session
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B #include <curl/curl.h>
|
|
||||||
.sp
|
|
||||||
.BI "CURL *curl_easy_init( );"
|
|
||||||
.ad
|
|
||||||
.SH DESCRIPTION
|
|
||||||
This function must be the first function to call, and it returns a CURL handle
|
|
||||||
that you shall use as input to the other easy-functions. The init calls
|
|
||||||
intializes curl and this call MUST have a corresponding call to
|
|
||||||
.I curl_easy_cleanup
|
|
||||||
when the operation is complete.
|
|
||||||
|
|
||||||
On win32 systems, if you want to init the winsock stuff manually, libcurl will
|
|
||||||
not do that for you. WSAStartup() and WSACleanup() should then be called
|
|
||||||
accordingly. If you want libcurl to handle this, use the CURL_GLOBAL_WIN32
|
|
||||||
flag in the initial curl_global_init() call.
|
|
||||||
|
|
||||||
Using libcurl 7.7 and later, you should perform all your sequential file
|
|
||||||
transfers using the same curl handle. This enables libcurl to use persistant
|
|
||||||
connections where possible.
|
|
||||||
.SH RETURN VALUE
|
|
||||||
If this function returns NULL, something went wrong and you cannot use the
|
|
||||||
other curl functions.
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
.BR curl_easy_cleanup "(3), " curl_global_init "(3)
|
|
||||||
.SH BUGS
|
|
||||||
Surely there are some, you tell me!
|
|
@@ -114,7 +114,7 @@ Global Preparation
|
|||||||
call initialized.
|
call initialized.
|
||||||
|
|
||||||
Repeated calls to curl_global_init() and curl_global_cleanup() should be
|
Repeated calls to curl_global_init() and curl_global_cleanup() should be
|
||||||
avoided. They should be called once each.
|
avoided. They should only be called once each.
|
||||||
|
|
||||||
Handle the Easy libcurl
|
Handle the Easy libcurl
|
||||||
|
|
||||||
@@ -470,7 +470,30 @@ HTTP POSTing
|
|||||||
|
|
||||||
Showing Progress
|
Showing Progress
|
||||||
|
|
||||||
[ built-in progress meter, progress callback ]
|
For historical and traditional reasons, libcurl has a built-in progress meter
|
||||||
|
that can be switched on and then makes it presents a progress meter in your
|
||||||
|
terminal.
|
||||||
|
|
||||||
|
Switch on the progress meter by, oddly enough, set CURLOPT_NOPROGRESS to
|
||||||
|
FALSE. This option is set to TRUE by default.
|
||||||
|
|
||||||
|
For most applications however, the built-in progress meter is useless and
|
||||||
|
what instead is interesting is the ability to specify a progress
|
||||||
|
callback. The function pointer you pass to libcurl will then be called on
|
||||||
|
irregular intervals with information about the current transfer.
|
||||||
|
|
||||||
|
Set the progress callback by using CURLOPT_PROGRESSFUNCTION. And pass a
|
||||||
|
pointer to a function that matches this prototype:
|
||||||
|
|
||||||
|
int progress_callback(void *clientp,
|
||||||
|
double dltotal,
|
||||||
|
double dlnow,
|
||||||
|
double ultotal,
|
||||||
|
double ulnow);
|
||||||
|
|
||||||
|
If any of the input arguments is unknown, a 0 will be passed. The first
|
||||||
|
argument, the 'clientp' is the pointer you pass to libcurl with
|
||||||
|
CURLOPT_PROGRESSDATA. libcurl won't touch it.
|
||||||
|
|
||||||
|
|
||||||
libcurl with C++
|
libcurl with C++
|
||||||
@@ -741,6 +764,15 @@ Customizing Operations
|
|||||||
consideration and you should be aware that you may violate the HTTP protocol
|
consideration and you should be aware that you may violate the HTTP protocol
|
||||||
when doing so.
|
when doing so.
|
||||||
|
|
||||||
|
There's only one aspect left in the HTTP requests that we haven't yet
|
||||||
|
mentioned how to modify: the version field. All HTTP requests includes the
|
||||||
|
version number to tell the server which version we support. libcurl speak
|
||||||
|
HTTP 1.1 by default. Some very old servers don't like getting 1.1-requests
|
||||||
|
and when dealing with stubborn old things like that, you can tell libcurl to
|
||||||
|
use 1.0 instead by doing something like this:
|
||||||
|
|
||||||
|
curl_easy_setopt(easyhandle, CURLOPT_HTTP_VERSION, CURLHTTP_VERSION_1_0);
|
||||||
|
|
||||||
Not all protocols are HTTP-like, and thus the above may not help you when you
|
Not all protocols are HTTP-like, and thus the above may not help you when you
|
||||||
want to make for example your FTP transfers to behave differently.
|
want to make for example your FTP transfers to behave differently.
|
||||||
|
|
||||||
@@ -770,16 +802,71 @@ Customizing Operations
|
|||||||
instead be called CURLOPT_POSTQUOTE and used the exact same way.
|
instead be called CURLOPT_POSTQUOTE and used the exact same way.
|
||||||
|
|
||||||
The custom FTP command will be issued to the server in the same order they
|
The custom FTP command will be issued to the server in the same order they
|
||||||
are built in the list, and if a command gets an error code returned back from
|
are added to the list, and if a command gets an error code returned back from
|
||||||
the server no more commands will be issued and libcurl will bail out with an
|
the server, no more commands will be issued and libcurl will bail out with an
|
||||||
error code. Note that if you use CURLOPT_QUOTE to send commands before a
|
error code (CURLE_FTP_QUOTE_ERROR). Note that if you use CURLOPT_QUOTE to
|
||||||
transfer, no transfer will actually take place then.
|
send commands before a transfer, no transfer will actually take place when a
|
||||||
|
quote command has failed.
|
||||||
|
|
||||||
|
If you set the CURLOPT_HEADER to true, you will tell libcurl to get
|
||||||
|
information about the target file and output "headers" about it. The headers
|
||||||
|
will be in "HTTP-style", looking like they do in HTTP.
|
||||||
|
|
||||||
|
The option to enable headers or to run custom FTP commands may be useful to
|
||||||
|
combine with CURLOPT_NOBODY. If this option is set, no actual file content
|
||||||
|
transfer will be performed.
|
||||||
|
|
||||||
[ custom FTP commands without transfer, FTP "header-only", HTTP 1.0 ]
|
|
||||||
|
|
||||||
Cookies Without Chocolate Chips
|
Cookies Without Chocolate Chips
|
||||||
|
|
||||||
[ set cookies, read cookies from file, cookie-jar ]
|
In the HTTP sense, a cookie is a name with an associated value. A server
|
||||||
|
sends the name and value to the client, and expects it to get sent back on
|
||||||
|
every subsequent request to the server that matches the particular conditions
|
||||||
|
set. The conditions include that the domain name and path match and that the
|
||||||
|
cookie hasn't become too old.
|
||||||
|
|
||||||
|
In real-world cases, servers send new cookies to replace existing one to
|
||||||
|
update them. Server use cookies to "track" users and to keep "sessions".
|
||||||
|
|
||||||
|
Cookies are sent from server to clients with the header Set-Cookie: and
|
||||||
|
they're sent from clients to servers with the Cookie: header.
|
||||||
|
|
||||||
|
To just send whatever cookie you want to a server, you can use CURLOPT_COOKIE
|
||||||
|
to set a cookie string like this:
|
||||||
|
|
||||||
|
curl_easy_setopt(easyhandle, CURLOPT_COOKIE, "name1=var1; name2=var2;");
|
||||||
|
|
||||||
|
In many cases, that is not enough. You might want to dynamicly save whatever
|
||||||
|
cookies the remote server passes to you, and make sure those cookies are then
|
||||||
|
use accordingly on later requests.
|
||||||
|
|
||||||
|
One way to do this, is to save all headers you receive in a plain file and
|
||||||
|
when you make a request, you tell libcurl to read the previous headers to
|
||||||
|
figure out which cookies to use. Set header file to read cookies from with
|
||||||
|
CURLOPT_COOKIEFILE.
|
||||||
|
|
||||||
|
The CURLOPT_COOKIEFILE option also automaticly enables the cookie parser in
|
||||||
|
libcurl. Until the cookie parser is enabled, libcurl will not parse or
|
||||||
|
understand incoming cookies and they will just be ignored. However, when the
|
||||||
|
parser is enabled the cookies will be understood and the cookies will be kept
|
||||||
|
in memory and used properly in subsequent requests when the same handle is
|
||||||
|
used. Many times this is enough, and you may not have to save the cookies to
|
||||||
|
disk at all. Note that the file you specify to CURLOPT_COOKIEFILE doesn't
|
||||||
|
have to exist to enable the parser, so a common way to just enable the parser
|
||||||
|
and not read able might be to use a file name you know doesn't exist.
|
||||||
|
|
||||||
|
If you rather use existing cookies that you've previously received with your
|
||||||
|
Netscape or Mozilla browsers, you can make libcurl use that cookie file as
|
||||||
|
input. The CURLOPT_COOKIEFILE is used for that too, as libcurl will
|
||||||
|
automaticly find out what kind of file it is and act accordingly.
|
||||||
|
|
||||||
|
The perhaps most advanced cookie operation libcurl offers, is saving the
|
||||||
|
entire internal cookie state back into a Netscape/Mozilla formatted cookie
|
||||||
|
file. We call that the cookie-jar. When you set a file name with
|
||||||
|
CURLOPT_COOKIEJAR, that file name will be created and all received cookies
|
||||||
|
will be stored in it when curl_easy_cleanup() is called. This enabled cookies
|
||||||
|
to get passed on properly between multiple handles without any information
|
||||||
|
getting lost.
|
||||||
|
|
||||||
|
|
||||||
Headers Equal Fun
|
Headers Equal Fun
|
||||||
|
68
docs/libcurl/Makefile.am
Normal file
68
docs/libcurl/Makefile.am
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||||
|
|
||||||
|
man_MANS = \
|
||||||
|
curl_easy_cleanup.3 \
|
||||||
|
curl_easy_getinfo.3 \
|
||||||
|
curl_easy_init.3 \
|
||||||
|
curl_easy_perform.3 \
|
||||||
|
curl_easy_setopt.3 \
|
||||||
|
curl_easy_duphandle.3 \
|
||||||
|
curl_formparse.3 \
|
||||||
|
curl_formadd.3 \
|
||||||
|
curl_formfree.3 \
|
||||||
|
curl_getdate.3 \
|
||||||
|
curl_getenv.3 \
|
||||||
|
curl_slist_append.3 \
|
||||||
|
curl_slist_free_all.3 \
|
||||||
|
curl_version.3 \
|
||||||
|
curl_escape.3 \
|
||||||
|
curl_unescape.3 \
|
||||||
|
curl_strequal.3 \
|
||||||
|
curl_strnequal.3 \
|
||||||
|
curl_mprintf.3 \
|
||||||
|
curl_global_init.3 \
|
||||||
|
curl_global_cleanup.3 \
|
||||||
|
libcurl.3
|
||||||
|
|
||||||
|
HTMLPAGES = \
|
||||||
|
curl_easy_cleanup.html \
|
||||||
|
curl_easy_getinfo.html \
|
||||||
|
curl_easy_init.html \
|
||||||
|
curl_easy_perform.html \
|
||||||
|
curl_easy_setopt.html \
|
||||||
|
curl_easy_duphandle.html \
|
||||||
|
curl_formadd.html \
|
||||||
|
curl_formparse.html \
|
||||||
|
curl_formfree.html \
|
||||||
|
curl_getdate.html \
|
||||||
|
curl_getenv.html \
|
||||||
|
curl_slist_append.html \
|
||||||
|
curl_slist_free_all.html \
|
||||||
|
curl_version.html \
|
||||||
|
curl_escape.html \
|
||||||
|
curl_unescape.html \
|
||||||
|
curl_strequal.html \
|
||||||
|
curl_strnequal.html \
|
||||||
|
curl_mprintf.html \
|
||||||
|
curl_global_init.html \
|
||||||
|
curl_global_cleanup.html \
|
||||||
|
libcurl.html \
|
||||||
|
index.html
|
||||||
|
|
||||||
|
EXTRA_DIST = $(man_MANS) $(HTMLPAGES)
|
||||||
|
|
||||||
|
MAN2HTML= gnroff -man $< | man2html >$@
|
||||||
|
|
||||||
|
SUFFIXES = .1 .3 .html
|
||||||
|
|
||||||
|
html: $(HTMLPAGES)
|
||||||
|
|
||||||
|
.3.html:
|
||||||
|
$(MAN2HTML)
|
||||||
|
|
||||||
|
.1.html:
|
||||||
|
$(MAN2HTML)
|
25
docs/libcurl/curl_easy_cleanup.3
Normal file
25
docs/libcurl/curl_easy_cleanup.3
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.\" You can view this file with:
|
||||||
|
.\" nroff -man [file]
|
||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_easy_cleanup 3 "4 March 2002" "libcurl 7.7" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_easy_cleanup - End a libcurl easy session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/curl.h>
|
||||||
|
.sp
|
||||||
|
.BI "void curl_easy_cleanup(CURL *" handle ");"
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function must be the last function to call for an easy session. It is the
|
||||||
|
opposite of the \fIcurl_easy_init\fP function and must be called with the same
|
||||||
|
\fIhandle\fP as input that the curl_easy_init call returned.
|
||||||
|
|
||||||
|
This will effectively close all connections this handle has used and possibly
|
||||||
|
has kept open until now. Don't call this function if you intend to transfer
|
||||||
|
more files.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
None
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_easy_init "(3), "
|
||||||
|
|
25
docs/libcurl/curl_easy_init.3
Normal file
25
docs/libcurl/curl_easy_init.3
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.\" You can view this file with:
|
||||||
|
.\" nroff -man [file]
|
||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_easy_init 3 "4 March 2002" "libcurl 7.8.1" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_easy_init - Start a libcurl easy session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/curl.h>
|
||||||
|
.sp
|
||||||
|
.BI "CURL *curl_easy_init( );"
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function must be the first function to call, and it returns a CURL easy
|
||||||
|
handle that you must use as input to other easy-functions. curl_easy_init
|
||||||
|
intializes curl and this call MUST have a corresponding call to
|
||||||
|
\fIcurl_easy_cleanup\fP when the operation is complete.
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
If this function returns NULL, something went wrong and you cannot use the
|
||||||
|
other curl functions.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_easy_cleanup "(3), " curl_global_init "(3)
|
||||||
|
.SH BUGS
|
||||||
|
Surely there are some, you tell me!
|
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.TH curl_escape 3 "22 March 2001" "libcurl 7.7" "libcurl Manual"
|
.TH curl_escape 3 "6 March 2002" "libcurl 7.9" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_escape - URL encodes the given string
|
curl_escape - URL encodes the given string
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -13,10 +13,8 @@ curl_escape - URL encodes the given string
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This function will convert the given input string to an URL encoded string and
|
This function will convert the given input string to an URL encoded string and
|
||||||
return that as a new allocated string. All input characters that are not a-z,
|
return that as a new allocated string. All input characters that are not a-z,
|
||||||
A-Z or 0-9 will be converted to their "URL escaped" version. If a sequence of
|
A-Z or 0-9 will be converted to their "URL escaped" version (%NN where NN is a
|
||||||
%NN (where NN is a two-digit hexadecimal number) is found in the string to
|
two-digit hexadecimal number).
|
||||||
encode, that 3-letter combination will be copied to the output unmodifed,
|
|
||||||
assuming that it is an already encoded piece of data.
|
|
||||||
|
|
||||||
If the 'length' argument is set to 0, curl_escape() will use strlen() on the
|
If the 'length' argument is set to 0, curl_escape() will use strlen() on the
|
||||||
input 'url' string to find out the size.
|
input 'url' string to find out the size.
|
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.TH curl_formadd 3 "29 October 2001" "libcurl 7.9.1" "libcurl Manual"
|
.TH curl_formadd 3 "1 Match 2002" "libcurl 7.9.1" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_formadd - add a section to a multipart/formdata HTTP POST
|
curl_formadd - add a section to a multipart/formdata HTTP POST
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -87,8 +87,8 @@ Returns non-zero if an error occurs.
|
|||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
HttpPost* post = NULL;
|
struct HttpPost* post = NULL;
|
||||||
HttpPost* last = NULL;
|
struct HttpPost* last = NULL;
|
||||||
char namebuffer[] = "name buffer";
|
char namebuffer[] = "name buffer";
|
||||||
long namelength = strlen(namebuffer);
|
long namelength = strlen(namebuffer);
|
||||||
char buffer[] = "test buffer";
|
char buffer[] = "test buffer";
|
20
docs/libcurl/curl_multi_add_handle.3
Normal file
20
docs/libcurl/curl_multi_add_handle.3
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_add_handle 3 "4 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_add_handle - add an easy handle to a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_handle);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Adds a standard easy handle to the multi stack. This will make this multi
|
||||||
|
handle control the specified easy handle.
|
||||||
|
|
||||||
|
When an easy handle has been added to a multi stack, you can not and you must
|
||||||
|
not use curl_easy_perform() on that handle!
|
||||||
|
.SH RETURN VALUE
|
||||||
|
CURLMcode type, general libcurl multi interface error code.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_multi_init "(3)"
|
18
docs/libcurl/curl_multi_cleanup.3
Normal file
18
docs/libcurl/curl_multi_cleanup.3
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_cleanup 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_cleanup - close down a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/curl.h>
|
||||||
|
.sp
|
||||||
|
.BI "CURLMcode curl_multi_cleanup( CURLM *multi_handle );"
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Cleans up and removes a whole multi stack. It does not free or touch any
|
||||||
|
individual easy handles in any way - they still need to be closed
|
||||||
|
individually, using the usual curl_easy_cleanup() way.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
CURLMcode type, general libcurl multi interface error code.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_init "(3)," curl_easy_cleanup "(3)," curl_easy_init "(3)"
|
23
docs/libcurl/curl_multi_fdset.3
Normal file
23
docs/libcurl/curl_multi_fdset.3
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_fdset 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_fdset - add an easy handle to a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||||
|
fd_set *read_fd_set,
|
||||||
|
fd_set *write_fd_set,
|
||||||
|
fd_set *exc_fd_set,
|
||||||
|
int *max_fd);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function extracts file descriptor information from a given multi_handle.
|
||||||
|
libcurl returns its fd_set sets. The application can use these to select() or
|
||||||
|
poll() on. The curl_multi_perform() function should be called as soon as one
|
||||||
|
of them are ready to be read from or written to.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
CURLMcode type, general libcurl multi interface error code.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_multi_init "(3)"
|
35
docs/libcurl/curl_multi_info_read.3
Normal file
35
docs/libcurl/curl_multi_info_read.3
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_info_read 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_info_read - read multi stack informationals
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
CURLMsg *curl_multi_info_read( CURLM *multi_handle,
|
||||||
|
int *msgs_in_queue);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Ask the multi handle if there's any messages/informationals from the
|
||||||
|
individual transfers. Messages include informationals such as an error code
|
||||||
|
from the transfer or just the fact that a transfer is completed. More details
|
||||||
|
on these should be written down as well.
|
||||||
|
|
||||||
|
Repeated calls to this function will return a new struct each time, until a
|
||||||
|
special "end of msgs" struct is returned as a signal that there is no more to
|
||||||
|
get at this point. The integer pointed to with \fImsgs_in_queue\fP will
|
||||||
|
contain the number of remaining messages after this function was called.
|
||||||
|
|
||||||
|
The data the returned pointer points to will not survive calling
|
||||||
|
curl_multi_cleanup().
|
||||||
|
|
||||||
|
The 'CURLMsg' struct is very simple and only contain very basic informations.
|
||||||
|
If more involved information is wanted, the particular "easy handle" in
|
||||||
|
present in that struct and can thus be used in subsequent regular
|
||||||
|
curl_easy_getinfo() calls (or similar).
|
||||||
|
.SH "RETURN VALUE"
|
||||||
|
A pointer to a filled-in struct, or NULL if it failed or ran out of
|
||||||
|
structs. It also writes the number of messages left in the queue (after this
|
||||||
|
read) in the integer the second argument points to.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_multi_init "(3)," curl_multi_perform "(3)"
|
22
docs/libcurl/curl_multi_init.3
Normal file
22
docs/libcurl/curl_multi_init.3
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_init 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_init - Start a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B #include <curl/curl.h>
|
||||||
|
.sp
|
||||||
|
.BI "CURLM *curl_multi_init( );"
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function returns a CURLM handle to be used as input to all the other
|
||||||
|
multi-functions, sometimes refered to as a multi handle on some places in the
|
||||||
|
documentation. This init call MUST have a corresponding call to
|
||||||
|
\fIcurl_multi_cleanup\fP when the operation is complete.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
If this function returns NULL, something went wrong and you cannot use the
|
||||||
|
other curl functions.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_global_init "(3)," curl_easy_init "(3)"
|
||||||
|
.SH BUGS
|
||||||
|
Surely there are some, you tell me!
|
30
docs/libcurl/curl_multi_perform.3
Normal file
30
docs/libcurl/curl_multi_perform.3
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_perform 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_perform - add an easy handle to a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
When the app thinks there's data available for the multi_handle, it should
|
||||||
|
call this function to read/write whatever there is to read or write right
|
||||||
|
now. curl_multi_perform() returns as soon as the reads/writes are done. This
|
||||||
|
function does not require that there actually is any data available for
|
||||||
|
reading or that data can be written, it can be called just in case. It will
|
||||||
|
write the number of handles that still transfer data in the second argument's
|
||||||
|
integer-pointer.
|
||||||
|
.SH "RETURN VALUE"
|
||||||
|
CURLMcode type, general libcurl multi interface error code.
|
||||||
|
|
||||||
|
NOTE that this only returns errors etc regarding the whole multi stack. There
|
||||||
|
might still have occurred problems on invidual transfers even when this
|
||||||
|
function returns OK.
|
||||||
|
.SH "TYPICAL USAGE"
|
||||||
|
Most application will use \fIcurl_multi_fdset\fP to get the multi_handle's
|
||||||
|
file descriptors, then it'll wait for action on them using select() and as
|
||||||
|
soon as one or more of them are ready, \fIcurl_multi_perform\fP gets called.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_multi_init "(3)"
|
20
docs/libcurl/curl_multi_remove_handle.3
Normal file
20
docs/libcurl/curl_multi_remove_handle.3
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.\" $Id$
|
||||||
|
.\"
|
||||||
|
.TH curl_multi_remove_handle 3 "6 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||||
|
.SH NAME
|
||||||
|
curl_multi_remove_handle - add an easy handle to a multi session
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *easy_handle);
|
||||||
|
.ad
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Removes a given easy_handle from the multi_handle. This will make the
|
||||||
|
specified easy handle be removed from this multi handle's control.
|
||||||
|
|
||||||
|
When the easy handle has been removed from a multi stack, it is again
|
||||||
|
perfectly legal to invoke \fIcurl_easy_perform()\fP on this easy handle.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
CURLMcode type, general libcurl multi interface error code.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR curl_multi_cleanup "(3)," curl_multi_init "(3)"
|
@@ -75,10 +75,10 @@ struct HttpPost {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef int (*curl_progress_callback)(void *clientp,
|
typedef int (*curl_progress_callback)(void *clientp,
|
||||||
size_t dltotal,
|
double dltotal,
|
||||||
size_t dlnow,
|
double dlnow,
|
||||||
size_t ultotal,
|
double ultotal,
|
||||||
size_t ulnow);
|
double ulnow);
|
||||||
|
|
||||||
typedef size_t (*curl_write_callback)(char *buffer,
|
typedef size_t (*curl_write_callback)(char *buffer,
|
||||||
size_t size,
|
size_t size,
|
||||||
@@ -494,6 +494,9 @@ typedef enum {
|
|||||||
/* DNS cache timeout */
|
/* DNS cache timeout */
|
||||||
CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
|
CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
|
||||||
|
|
||||||
|
/* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
|
||||||
|
CINIT(PREQUOTE, OBJECTPOINT, 93),
|
||||||
|
|
||||||
CURLOPT_LASTENTRY /* the last unusued */
|
CURLOPT_LASTENTRY /* the last unusued */
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
@@ -613,8 +616,8 @@ CURLcode curl_global_init(long flags);
|
|||||||
void curl_global_cleanup(void);
|
void curl_global_cleanup(void);
|
||||||
|
|
||||||
/* This is the version number */
|
/* This is the version number */
|
||||||
#define LIBCURL_VERSION "7.9.4"
|
#define LIBCURL_VERSION "7.9.5"
|
||||||
#define LIBCURL_VERSION_NUM 0x070904
|
#define LIBCURL_VERSION_NUM 0x070905
|
||||||
|
|
||||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||||
struct curl_slist {
|
struct curl_slist {
|
||||||
|
@@ -2,17 +2,20 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
|
|
||||||
EXTRA_DIST = getdate.y \
|
EXTRA_DIST = getdate.y \
|
||||||
Makefile.b32 Makefile.b32.resp Makefile.m32 Makefile.vc6 \
|
Makefile.b32 Makefile.b32.resp Makefile.m32 Makefile.vc6 \
|
||||||
libcurl.def dllinit.c curllib.dsp curllib.dsw \
|
libcurl.def dllinit.c curllib.dsp curllib.dsw \
|
||||||
config-vms.h config-win32.h config-riscos.h config-mac.h
|
config-vms.h config-win32.h config-riscos.h config-mac.h \
|
||||||
|
config.h.in
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcurl.la
|
lib_LTLIBRARIES = libcurl.la
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include
|
# we use srcdir/include for the static global include files
|
||||||
|
# we use builddir/lib for the generated lib/config.h file to get found
|
||||||
|
# we use srcdir/lib for the lib-private header files
|
||||||
|
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/lib -I$(top_srcdir)/lib
|
||||||
|
|
||||||
libcurl_la_LDFLAGS = -no-undefined -version-info 2:2:0
|
libcurl_la_LDFLAGS = -no-undefined -version-info 2:2:0
|
||||||
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||||
|
@@ -364,8 +364,13 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* get the most strict timeout of the ones converted to milliseconds */
|
/* get the most strict timeout of the ones converted to milliseconds */
|
||||||
if(data->set.timeout &&
|
if(data->set.timeout && data->set.connecttimeout) {
|
||||||
(data->set.timeout < data->set.connecttimeout))
|
if (data->set.timeout < data->set.connecttimeout)
|
||||||
|
timeout_ms = data->set.timeout*1000;
|
||||||
|
else
|
||||||
|
timeout_ms = data->set.connecttimeout*1000;
|
||||||
|
}
|
||||||
|
else if(data->set.timeout)
|
||||||
timeout_ms = data->set.timeout*1000;
|
timeout_ms = data->set.timeout*1000;
|
||||||
else
|
else
|
||||||
timeout_ms = data->set.connecttimeout*1000;
|
timeout_ms = data->set.connecttimeout*1000;
|
||||||
|
50
lib/cookie.c
50
lib/cookie.c
@@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* In order to be useful for every potential user, curl and libcurl are
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
@@ -127,22 +127,37 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
|
|
||||||
if(httpheader) {
|
if(httpheader) {
|
||||||
/* This line was read off a HTTP-header */
|
/* This line was read off a HTTP-header */
|
||||||
|
char *sep;
|
||||||
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
|
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
|
||||||
ptr = lineptr;
|
ptr = lineptr;
|
||||||
do {
|
do {
|
||||||
/* we have a <what>=<this> pair or a 'secure' word here */
|
/* we have a <what>=<this> pair or a 'secure' word here */
|
||||||
if(strchr(ptr, '=')) {
|
sep = strchr(ptr, '=');
|
||||||
|
if(sep && (!semiptr || (semiptr>sep)) ) {
|
||||||
|
/*
|
||||||
|
* There is a = sign and if there was a semicolon too, which make sure
|
||||||
|
* that the semicolon comes _after_ the equal sign.
|
||||||
|
*/
|
||||||
|
|
||||||
name[0]=what[0]=0; /* init the buffers */
|
name[0]=what[0]=0; /* init the buffers */
|
||||||
if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^=]=%"
|
if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;=]=%"
|
||||||
MAX_COOKIE_LINE_TXT "[^;\r\n]",
|
MAX_COOKIE_LINE_TXT "[^;\r\n]",
|
||||||
name, what)) {
|
name, what)) {
|
||||||
/* this is a legal <what>=<this> pair */
|
/* this is a <name>=<what> pair */
|
||||||
|
|
||||||
|
/* Strip off trailing whitespace from the 'what' */
|
||||||
|
int len=strlen(what);
|
||||||
|
while(len && isspace((int)what[len-1])) {
|
||||||
|
what[len-1]=0;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
if(strequal("path", name)) {
|
if(strequal("path", name)) {
|
||||||
co->path=strdup(what);
|
co->path=strdup(what);
|
||||||
}
|
}
|
||||||
else if(strequal("domain", name)) {
|
else if(strequal("domain", name)) {
|
||||||
co->domain=strdup(what);
|
co->domain=strdup(what);
|
||||||
|
co->field1= (what[0]=='.')?2:1;
|
||||||
}
|
}
|
||||||
else if(strequal("version", name)) {
|
else if(strequal("version", name)) {
|
||||||
co->version=strdup(what);
|
co->version=strdup(what);
|
||||||
@@ -159,7 +174,7 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
*/
|
*/
|
||||||
co->maxage = strdup(what);
|
co->maxage = strdup(what);
|
||||||
co->expires =
|
co->expires =
|
||||||
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]);
|
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) + now;
|
||||||
}
|
}
|
||||||
else if(strequal("expires", name)) {
|
else if(strequal("expires", name)) {
|
||||||
co->expirestr=strdup(what);
|
co->expirestr=strdup(what);
|
||||||
@@ -187,8 +202,11 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!semiptr)
|
if(!semiptr || !*semiptr) {
|
||||||
continue; /* we already know there are no more cookies */
|
/* we already know there are no more cookies */
|
||||||
|
semiptr = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ptr=semiptr+1;
|
ptr=semiptr+1;
|
||||||
while(ptr && *ptr && isspace((int)*ptr))
|
while(ptr && *ptr && isspace((int)*ptr))
|
||||||
@@ -198,9 +216,23 @@ Curl_cookie_add(struct CookieInfo *c,
|
|||||||
if(!semiptr && *ptr)
|
if(!semiptr && *ptr)
|
||||||
/* There are no more semicolons, but there's a final name=value pair
|
/* There are no more semicolons, but there's a final name=value pair
|
||||||
coming up */
|
coming up */
|
||||||
semiptr=ptr;
|
semiptr=strchr(ptr, '\0');
|
||||||
} while(semiptr);
|
} while(semiptr);
|
||||||
|
|
||||||
|
if(NULL == co->name) {
|
||||||
|
/* we didn't get a cookie name, this is an illegal line, bail out */
|
||||||
|
if(co->domain)
|
||||||
|
free(co->domain);
|
||||||
|
if(co->path)
|
||||||
|
free(co->path);
|
||||||
|
if(co->name)
|
||||||
|
free(co->name);
|
||||||
|
if(co->value)
|
||||||
|
free(co->value);
|
||||||
|
free(co);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(NULL == co->domain)
|
if(NULL == co->domain)
|
||||||
/* no domain given in the header line, set the default now */
|
/* no domain given in the header line, set the default now */
|
||||||
co->domain=domain?strdup(domain):NULL;
|
co->domain=domain?strdup(domain):NULL;
|
||||||
|
12
lib/ftp.c
12
lib/ftp.c
@@ -1618,6 +1618,12 @@ CURLcode ftp_perform(struct connectdata *conn)
|
|||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* Send any PREQUOTE strings after transfer type is set? (Wesley Laxton)*/
|
||||||
|
if(data->set.prequote) {
|
||||||
|
if ((result = ftp_sendquote(conn, data->set.prequote)) != CURLE_OK)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if(conn->resume_from) {
|
if(conn->resume_from) {
|
||||||
/* we're about to continue the uploading of a file */
|
/* we're about to continue the uploading of a file */
|
||||||
/* 1. get already existing file's size. We use the SIZE
|
/* 1. get already existing file's size. We use the SIZE
|
||||||
@@ -1803,6 +1809,12 @@ CURLcode ftp_perform(struct connectdata *conn)
|
|||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* Send any PREQUOTE strings after transfer type is set? (Wesley Laxton)*/
|
||||||
|
if(data->set.prequote) {
|
||||||
|
if ((result = ftp_sendquote(conn, data->set.prequote)) != CURLE_OK)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* Attempt to get the size, it'll be useful in some cases: for resumed
|
/* Attempt to get the size, it'll be useful in some cases: for resumed
|
||||||
downloads and when talking to servers that don't give away the size
|
downloads and when talking to servers that don't give away the size
|
||||||
in the RETR response line. */
|
in the RETR response line. */
|
||||||
|
@@ -47,6 +47,11 @@
|
|||||||
|
|
||||||
/* DONT include memdebug.h here! */
|
/* DONT include memdebug.h here! */
|
||||||
|
|
||||||
|
struct memdebug {
|
||||||
|
int size;
|
||||||
|
char mem[1];
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that these debug functions are very simple and they are meant to
|
* Note that these debug functions are very simple and they are meant to
|
||||||
* remain so. For advanced analysis, record a log file and write perl scripts
|
* remain so. For advanced analysis, record a log file and write perl scripts
|
||||||
@@ -67,16 +72,25 @@ void curl_memdebug(const char *logname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *curl_domalloc(size_t size, int line, const char *source)
|
void *curl_domalloc(size_t wantedsize, int line, const char *source)
|
||||||
{
|
{
|
||||||
void *mem=(malloc)(size);
|
struct memdebug *mem;
|
||||||
if(mem)
|
size_t size;
|
||||||
|
|
||||||
|
/* alloc at least 64 bytes */
|
||||||
|
size = sizeof(struct memdebug)+wantedsize;
|
||||||
|
|
||||||
|
mem=(struct memdebug *)(malloc)(size);
|
||||||
|
if(mem) {
|
||||||
/* fill memory with junk */
|
/* fill memory with junk */
|
||||||
memset(mem, 0xA5, size);
|
memset(mem->mem, 0xA5, wantedsize);
|
||||||
if(logfile)
|
mem->size = wantedsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(logfile && source)
|
||||||
fprintf(logfile, "MEM %s:%d malloc(%d) = %p\n",
|
fprintf(logfile, "MEM %s:%d malloc(%d) = %p\n",
|
||||||
source, line, size, mem);
|
source, line, wantedsize, mem->mem);
|
||||||
return mem;
|
return mem->mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *curl_dostrdup(const char *str, int line, const char *source)
|
char *curl_dostrdup(const char *str, int line, const char *source)
|
||||||
@@ -90,32 +104,56 @@ char *curl_dostrdup(const char *str, int line, const char *source)
|
|||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
mem=(strdup)(str);
|
|
||||||
len=strlen(str)+1;
|
len=strlen(str)+1;
|
||||||
|
|
||||||
|
mem=curl_domalloc(len, 0, NULL); /* NULL prevents logging */
|
||||||
|
memcpy(mem, str, len);
|
||||||
|
|
||||||
if(logfile)
|
if(logfile)
|
||||||
fprintf(logfile, "MEM %s:%d strdup(%p) (%d) = %p\n",
|
fprintf(logfile, "MEM %s:%d strdup(%p) (%d) = %p\n",
|
||||||
source, line, str, len, mem);
|
source, line, str, len, mem);
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *curl_dorealloc(void *ptr, size_t size, int line, const char *source)
|
void *curl_dorealloc(void *ptr, size_t wantedsize,
|
||||||
|
int line, const char *source)
|
||||||
{
|
{
|
||||||
void *mem=(realloc)(ptr, size);
|
struct memdebug *mem;
|
||||||
|
|
||||||
|
size_t size = sizeof(struct memdebug)+wantedsize;
|
||||||
|
|
||||||
|
mem = (struct memdebug *)((char *)ptr - offsetof(struct memdebug, mem));
|
||||||
|
|
||||||
|
mem=(struct memdebug *)(realloc)(mem, size);
|
||||||
if(logfile)
|
if(logfile)
|
||||||
fprintf(logfile, "MEM %s:%d realloc(%p, %d) = %p\n",
|
fprintf(logfile, "MEM %s:%d realloc(%p, %d) = %p\n",
|
||||||
source, line, ptr, size, mem);
|
source, line, ptr, wantedsize, mem?mem->mem:NULL);
|
||||||
return mem;
|
|
||||||
|
if(mem) {
|
||||||
|
mem->size = wantedsize;
|
||||||
|
return mem->mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void curl_dofree(void *ptr, int line, const char *source)
|
void curl_dofree(void *ptr, int line, const char *source)
|
||||||
{
|
{
|
||||||
|
struct memdebug *mem;
|
||||||
|
|
||||||
if(NULL == ptr) {
|
if(NULL == ptr) {
|
||||||
fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n",
|
fprintf(stderr, "ILLEGAL free() on NULL at %s:%d\n",
|
||||||
source, line);
|
source, line);
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
mem = (struct memdebug *)((char *)ptr - offsetof(struct memdebug, mem));
|
||||||
|
|
||||||
(free)(ptr);
|
/* destroy */
|
||||||
|
memset(mem->mem, 0x13, mem->size);
|
||||||
|
|
||||||
|
/* free for real */
|
||||||
|
(free)(mem);
|
||||||
|
|
||||||
if(logfile)
|
if(logfile)
|
||||||
fprintf(logfile, "MEM %s:%d free(%p)\n", source, line, ptr);
|
fprintf(logfile, "MEM %s:%d free(%p)\n", source, line, ptr);
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_WINSOCK_H
|
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -603,6 +603,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
data->info.header_size += k->hbuflen;
|
data->info.header_size += k->hbuflen;
|
||||||
|
conn->headerbytecount += k->hbuflen;
|
||||||
|
|
||||||
/* reset hbufp pointer && hbuflen */
|
/* reset hbufp pointer && hbuflen */
|
||||||
k->hbufp = data->state.headerbuff;
|
k->hbufp = data->state.headerbuff;
|
||||||
|
10
lib/url.c
10
lib/url.c
@@ -735,6 +735,12 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
*/
|
*/
|
||||||
data->set.postquote = va_arg(param, struct curl_slist *);
|
data->set.postquote = va_arg(param, struct curl_slist *);
|
||||||
break;
|
break;
|
||||||
|
case CURLOPT_PREQUOTE:
|
||||||
|
/*
|
||||||
|
* List of RAW FTP commands to use prior to RETR (Wesley Laxton)
|
||||||
|
*/
|
||||||
|
data->set.prequote = va_arg(param, struct curl_slist *);
|
||||||
|
break;
|
||||||
case CURLOPT_QUOTE:
|
case CURLOPT_QUOTE:
|
||||||
/*
|
/*
|
||||||
* List of RAW FTP commands to use before a transfer
|
* List of RAW FTP commands to use before a transfer
|
||||||
@@ -1983,8 +1989,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
conn = conn_temp; /* use this connection from now on */
|
conn = conn_temp; /* use this connection from now on */
|
||||||
|
|
||||||
/* we need these pointers if we speak over a proxy */
|
/* we need these pointers if we speak over a proxy */
|
||||||
conn->hostname = old_conn->gname;
|
conn->hostname = conn->gname;
|
||||||
conn->name = old_conn->name;
|
conn->name = &conn->gname[old_conn->name - old_conn->gname];
|
||||||
|
|
||||||
free(conn->path); /* free the previously allocated path pointer */
|
free(conn->path); /* free the previously allocated path pointer */
|
||||||
|
|
||||||
|
@@ -604,8 +604,9 @@ struct UserDefined {
|
|||||||
char *crypto_engine; /* name of the crypto engine to use */
|
char *crypto_engine; /* name of the crypto engine to use */
|
||||||
char *cookiejar; /* dump all cookies to this file */
|
char *cookiejar; /* dump all cookies to this file */
|
||||||
bool crlf; /* convert crlf on ftp upload(?) */
|
bool crlf; /* convert crlf on ftp upload(?) */
|
||||||
struct curl_slist *quote; /* before the transfer */
|
struct curl_slist *quote; /* after connection is established */
|
||||||
struct curl_slist *postquote; /* after the transfer */
|
struct curl_slist *postquote; /* after the transfer */
|
||||||
|
struct curl_slist *prequote; /* before the transfer, after type (Wesley Laxton)*/
|
||||||
struct curl_slist *telnet_options; /* linked list of telnet options */
|
struct curl_slist *telnet_options; /* linked list of telnet options */
|
||||||
curl_TimeCond timecondition; /* kind of time/date comparison */
|
curl_TimeCond timecondition; /* kind of time/date comparison */
|
||||||
time_t timevalue; /* what time to compare with */
|
time_t timevalue; /* what time to compare with */
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
#
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include
|
|
||||||
|
|
||||||
noinst_PROGRAMS = app single double
|
|
||||||
|
|
||||||
app_SOURCES = app.c
|
|
||||||
app_LDADD = ../lib/libcurl.la
|
|
||||||
app_DEPENDENCIES = ../lib/libcurl.la
|
|
||||||
|
|
||||||
single_SOURCES = single.c
|
|
||||||
single_LDADD = ../lib/libcurl.la
|
|
||||||
single_DEPENDENCIES = ../lib/libcurl.la
|
|
||||||
|
|
||||||
double_SOURCES = double.c
|
|
||||||
double_LDADD = ../lib/libcurl.la
|
|
||||||
double_DEPENDENCIES = ../lib/libcurl.la
|
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
|
3
packages/EPM/Makefile.am
Normal file
3
packages/EPM/Makefile.am
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
EXTRA_DIST = README curl.list.in
|
12
packages/EPM/README
Normal file
12
packages/EPM/README
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
EPM is a free UNIX software/file packaging program that generates distribution
|
||||||
|
archives from a list of files. EPM Can:
|
||||||
|
|
||||||
|
* Generate portable script-based distribution packages complete with
|
||||||
|
installation and removal scripts.
|
||||||
|
* Generate vendor distributions in AIX, BSD, Compaq Tru64, Debian, HP-UX,
|
||||||
|
IRIX, Red Hat, and Solaris formats.
|
||||||
|
* Provide a complete, cross-platform software distribution solution for your
|
||||||
|
applications.
|
||||||
|
|
||||||
|
http://www.easysw.com/epm/
|
||||||
|
|
58
packages/EPM/curl.list.in
Normal file
58
packages/EPM/curl.list.in
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Directories...
|
||||||
|
$prefix=@prefix@
|
||||||
|
$exec_prefix=@exec_prefix@
|
||||||
|
$bindir=@bindir@
|
||||||
|
$confdir=@sysconfdir@
|
||||||
|
$docdir=@prefix@/doc
|
||||||
|
$mandir=@mandir@
|
||||||
|
$libdir=@libdir@
|
||||||
|
$srcdir=@top_srcdir@
|
||||||
|
$includedir=@includedir@
|
||||||
|
|
||||||
|
# Product information
|
||||||
|
%product curl
|
||||||
|
%copyright 1998-2002 by Daniel Stenberg
|
||||||
|
%vendor Daniel Stenberg, <daniel@haxx.se>
|
||||||
|
%license ${srcdir}/MITX.txt
|
||||||
|
%readme ${srcdir}/README
|
||||||
|
%description Curl is a command line tool for transfering data specified
|
||||||
|
%description with URL syntax
|
||||||
|
%version @VERSION@
|
||||||
|
%packager Giuseppe "Cowo" Corbelli <cowo@lugbs.linux.it>
|
||||||
|
|
||||||
|
f 0644 cowo pppusers ${mandir}/man1/curl.1 ./docs/curl.1
|
||||||
|
f 0644 cowo pppusers ${mandir}/man1/curl-config.1 ./docs/curl-config.1
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_cleanup.3 ./docs/curl_easy_cleanup.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_getinfo.3 ./docs/curl_easy_getinfo.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_init.3 ./docs/curl_easy_init.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_perform.3 ./docs/curl_easy_perform.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_setopt.3 ./docs/curl_easy_setopt.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_easy_duphandle.3 ./docs/curl_easy_duphandle.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_formparse.3 ./docs/curl_formparse.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_formadd.3 ./docs/curl_formadd.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_formfree.3 ./docs/curl_formfree.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_getdate.3 ./docs/curl_getdate.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_getenv.3 ./docs/curl_getenv.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_slist_append.3 ./docs/curl_slist_append.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_slist_free_all.3 ./docs/curl_slist_free_all.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_version.3 ./docs/curl_version.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_escape.3 ./docs/curl_escape.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_unescape.3 ./docs/curl_unescape.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_strequal.3 ./docs/curl_strequal.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_strnequal.3 ./docs/curl_strnequal.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_mprintf.3 ./docs/curl_mprintf.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_global_init.3 ./docs/curl_global_init.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/curl_global_cleanup.3 ./docs/curl_global_cleanup.3
|
||||||
|
f 0644 cowo pppusers ${mandir}/man3/libcurl.3 ./docs/libcurl.3
|
||||||
|
f 0755 cowo pppusers ${libdir}/libcurl.so.2.0.2 ./lib/.libs/libcurl.so.2.0.2
|
||||||
|
f 0755 cowo pppusers ${libdir}/libcurl.la ./lib/libcurl.la
|
||||||
|
f 0755 cowo pppusers ${libdir}/libcurl.la ./lib/.libs/libcurl.la
|
||||||
|
f 0644 cowo pppusers ${libdir}/libcurl.a ./lib/.libs/libcurl.a
|
||||||
|
f 0755 cowo pppusers ${bindir}/curl ./src/curl
|
||||||
|
f 0755 cowo pppusers ${bindir}/curl ./src/.libs/curl
|
||||||
|
f 0644 cowo pppusers ${includedir}/curl/curl.h ./include/curl/curl.h
|
||||||
|
f 0644 cowo pppusers ${includedir}/curl/easy.h ./include/curl/easy.h
|
||||||
|
f 0644 cowo pppusers ${includedir}/curl/mprintf.h ./include/curl/mprintf.h
|
||||||
|
f 0644 cowo pppusers ${includedir}/curl/stdcheaders.h ./include/curl/stdcheaders.h
|
||||||
|
f 0644 cowo pppusers ${includedir}/curl/types.h ./include/curl/types.h
|
||||||
|
f 0755 cowo pppusers ${bindir}/curl-config ./curl-config
|
@@ -1,3 +1,3 @@
|
|||||||
SUBDIRS = Win32 Linux Solaris
|
SUBDIRS = Win32 Linux Solaris EPM
|
||||||
|
|
||||||
EXTRA_DIST = README
|
EXTRA_DIST = README
|
||||||
|
@@ -2,26 +2,29 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
|
|
||||||
# Some flags needed when trying to cause warnings ;-)
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
# CFLAGS = -g -DMALLOCDEBUG # -Wall -pedantic
|
|
||||||
#CPPFLAGS = -DGLOBURL -DCURL_SEPARATORS
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/include
|
# we use srcdir/include for the static global include files
|
||||||
|
# we use builddir/src for the generated src/config.h file to get found
|
||||||
|
# we use srcdir/lib for the client-private header files
|
||||||
|
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/src -I$(top_srcdir)/src
|
||||||
|
|
||||||
bin_PROGRAMS = curl #memtest
|
bin_PROGRAMS = curl #memtest
|
||||||
|
|
||||||
noinst_HEADERS = setup.h \
|
#memtest_SOURCES = memtest.c
|
||||||
|
#memtest_LDADD = $(top_srcdir)/lib/libcurl.la
|
||||||
|
|
||||||
|
curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c setup.h \
|
||||||
config-win32.h \
|
config-win32.h \
|
||||||
config-mac.h \
|
config-mac.h \
|
||||||
config-vms.h \
|
config-vms.h \
|
||||||
urlglob.h \
|
urlglob.h \
|
||||||
version.h \
|
version.h \
|
||||||
writeout.h
|
writeout.h \
|
||||||
|
config-win32.h \
|
||||||
|
config-mac.h \
|
||||||
|
config-vms.h
|
||||||
|
|
||||||
#memtest_SOURCES = memtest.c
|
|
||||||
#memtest_LDADD = $(top_srcdir)/lib/libcurl.la
|
|
||||||
|
|
||||||
curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c
|
|
||||||
curl_LDADD = ../lib/libcurl.la
|
curl_LDADD = ../lib/libcurl.la
|
||||||
curl_DEPENDENCIES = ../lib/libcurl.la
|
curl_DEPENDENCIES = ../lib/libcurl.la
|
||||||
BUILT_SOURCES = hugehelp.c
|
BUILT_SOURCES = hugehelp.c
|
||||||
@@ -35,8 +38,6 @@ EXTRA_DIST = mkhelp.pl curlmsg.msg \
|
|||||||
macos/src/curl_GUSIConfig.cpp \
|
macos/src/curl_GUSIConfig.cpp \
|
||||||
macos/src/macos_main.cpp
|
macos/src/macos_main.cpp
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
|
||||||
|
|
||||||
MANPAGE=$(top_srcdir)/docs/curl.1
|
MANPAGE=$(top_srcdir)/docs/curl.1
|
||||||
README=$(top_srcdir)/docs/MANUAL
|
README=$(top_srcdir)/docs/MANUAL
|
||||||
MKHELP=$(top_srcdir)/src/mkhelp.pl
|
MKHELP=$(top_srcdir)/src/mkhelp.pl
|
||||||
|
@@ -48,4 +48,9 @@ BADPARAM <Internal Error, Bad parameter to function>
|
|||||||
BADORDER <Internal Error, Bad function calling order>
|
BADORDER <Internal Error, Bad function calling order>
|
||||||
BADPWD <Bad password entered>
|
BADPWD <Bad password entered>
|
||||||
MNYREDIR <Too many redirects>
|
MNYREDIR <Too many redirects>
|
||||||
|
UNKTELNET <Unknown TELNET option specified>
|
||||||
|
UNKMSG <Unknown message (50)>
|
||||||
|
BADSSLCERT <Remote peer's SSL certificate wasn't OK>
|
||||||
|
SRVNOERR <The Server didn't reply anything, which here is considered an error>
|
||||||
|
MAXMSG <This is the LAST KNOWN MESSAGE, appearantly more have been added>
|
||||||
.END
|
.END
|
||||||
|
39
src/main.c
39
src/main.c
@@ -191,6 +191,11 @@ globalvalue int CURL_BADPARAM;
|
|||||||
globalvalue int CURL_BADORDER;
|
globalvalue int CURL_BADORDER;
|
||||||
globalvalue int CURL_BADPWD;
|
globalvalue int CURL_BADPWD;
|
||||||
globalvalue int CURL_MNYREDIR;
|
globalvalue int CURL_MNYREDIR;
|
||||||
|
globalvalue int CURL_UNKTELNET;
|
||||||
|
globalvalue int CURL_UNKMSG;
|
||||||
|
globalvalue int CURL_BADSSLCERT;
|
||||||
|
globalvalue int CURL_SRVNOERR;
|
||||||
|
globalvalue int CURL_MAXMSG;
|
||||||
long vms_cond[] = {
|
long vms_cond[] = {
|
||||||
VMS_STS(1,FAC_SYSTEM,MSG_NORMAL,SEV_SUCCESS),
|
VMS_STS(1,FAC_SYSTEM,MSG_NORMAL,SEV_SUCCESS),
|
||||||
CURL_UNSUPPROTO, /* these are from curlmsg.msg file..... */
|
CURL_UNSUPPROTO, /* these are from curlmsg.msg file..... */
|
||||||
@@ -238,7 +243,12 @@ long vms_cond[] = {
|
|||||||
CURL_BADPARAM,
|
CURL_BADPARAM,
|
||||||
CURL_BADORDER,
|
CURL_BADORDER,
|
||||||
CURL_BADPWD,
|
CURL_BADPWD,
|
||||||
CURL_MNYREDIR
|
CURL_MNYREDIR,
|
||||||
|
CURL_UNKTELNET,
|
||||||
|
CURL_UNKMSG,
|
||||||
|
CURL_BADSSLCERT,
|
||||||
|
CURL_SRVNOERR,
|
||||||
|
CURL_MAXMSG
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -448,6 +458,7 @@ struct Configurable {
|
|||||||
|
|
||||||
struct curl_slist *quote;
|
struct curl_slist *quote;
|
||||||
struct curl_slist *postquote;
|
struct curl_slist *postquote;
|
||||||
|
struct curl_slist *prequote;
|
||||||
|
|
||||||
long ssl_version;
|
long ssl_version;
|
||||||
curl_TimeCond timecond;
|
curl_TimeCond timecond;
|
||||||
@@ -1176,8 +1187,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
config->postfields=postdata;
|
config->postfields=postdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if(SetHTTPrequest(HTTPREQ_SIMPLEPOST, &config->httpreq))
|
if(SetHTTPrequest(HTTPREQ_SIMPLEPOST, &config->httpreq))
|
||||||
return PARAM_BAD_USE;*/
|
return PARAM_BAD_USE;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
/* dump-header to given file name */
|
/* dump-header to given file name */
|
||||||
@@ -1376,12 +1387,18 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
break;
|
break;
|
||||||
case 'Q':
|
case 'Q':
|
||||||
/* QUOTE command to send to FTP server */
|
/* QUOTE command to send to FTP server */
|
||||||
if(nextarg[0] == '-') {
|
switch(nextarg[0]) {
|
||||||
|
case '-':
|
||||||
/* prefixed with a dash makes it a POST TRANSFER one */
|
/* prefixed with a dash makes it a POST TRANSFER one */
|
||||||
nextarg++;
|
nextarg++;
|
||||||
config->postquote = curl_slist_append(config->postquote, nextarg);
|
config->postquote = curl_slist_append(config->postquote, nextarg);
|
||||||
}
|
break;
|
||||||
else {
|
case '+':
|
||||||
|
/* prefixed with a plus makes it a just-before-transfer one */
|
||||||
|
nextarg++;
|
||||||
|
config->prequote = curl_slist_append(config->prequote, nextarg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
config->quote = curl_slist_append(config->quote, nextarg);
|
config->quote = curl_slist_append(config->quote, nextarg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1890,13 +1907,18 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
errorbuffer[0]=0; /* prevent junk from being output */
|
|
||||||
|
|
||||||
#ifdef MALLOCDEBUG
|
#ifdef MALLOCDEBUG
|
||||||
/* this sends all memory debug messages to a logfile named memdump */
|
/* this sends all memory debug messages to a logfile named memdump */
|
||||||
|
char *env;
|
||||||
|
env = curl_getenv("CURL_MEMDEBUG");
|
||||||
|
if(env) {
|
||||||
|
free(env);
|
||||||
curl_memdebug("memdump");
|
curl_memdebug("memdump");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
errorbuffer[0]=0; /* prevent junk from being output */
|
||||||
|
|
||||||
main_init(); /* inits */
|
main_init(); /* inits */
|
||||||
|
|
||||||
config->showerror=TRUE;
|
config->showerror=TRUE;
|
||||||
@@ -2477,6 +2499,7 @@ int main(int argc, char *argv[])
|
|||||||
free_config_fields(&config);
|
free_config_fields(&config);
|
||||||
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
|
if (res > 52) res = 53; /* MAXMSG, porting helper */
|
||||||
return (vms_cond[res]|vms_show);
|
return (vms_cond[res]|vms_show);
|
||||||
#else
|
#else
|
||||||
return res;
|
return res;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* In order to be useful for every potential user, curl and libcurl are
|
* In order to be useful for every potential user, curl and libcurl are
|
||||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||||
@@ -222,16 +222,20 @@ GlobCode glob_word(URLGlob *glob, char *pattern, int pos, int *amount)
|
|||||||
*amount = 1; /* default is one single string */
|
*amount = 1; /* default is one single string */
|
||||||
|
|
||||||
while (*pattern != '\0' && *pattern != '{' && *pattern != '[') {
|
while (*pattern != '\0' && *pattern != '{' && *pattern != '[') {
|
||||||
if (*pattern == '}' || *pattern == ']') {
|
if (*pattern == '}' || *pattern == ']')
|
||||||
return GLOB_ERROR;
|
return GLOB_ERROR;
|
||||||
}
|
|
||||||
if (*pattern == '\\') { /* escape character, skip '\' */
|
/* only allow \ to escape known "special letters" */
|
||||||
|
if (*pattern == '\\' &&
|
||||||
|
(*(pattern+1) == '{' || *(pattern+1) == '[' ||
|
||||||
|
*(pattern+1) == '}' || *(pattern+1) == ']') ) {
|
||||||
|
|
||||||
|
/* escape character, skip '\' */
|
||||||
++pattern;
|
++pattern;
|
||||||
++pos;
|
++pos;
|
||||||
if (*pattern == '\0') { /* but no escaping of '\0'! */
|
if (*pattern == '\0') /* but no escaping of '\0'! */
|
||||||
return GLOB_ERROR;
|
return GLOB_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*buf++ = *pattern++; /* copy character to literal */
|
*buf++ = *pattern++; /* copy character to literal */
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
#define CURL_NAME "curl"
|
#define CURL_NAME "curl"
|
||||||
#define CURL_VERSION "7.9.5-pre1"
|
#define CURL_VERSION "7.9.5"
|
||||||
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
||||||
|
@@ -46,6 +46,7 @@ typedef enum {
|
|||||||
VAR_HEADER_SIZE,
|
VAR_HEADER_SIZE,
|
||||||
VAR_REQUEST_SIZE,
|
VAR_REQUEST_SIZE,
|
||||||
VAR_EFFECTIVE_URL,
|
VAR_EFFECTIVE_URL,
|
||||||
|
VAR_CONTENT_TYPE,
|
||||||
VAR_NUM_OF_VARS /* must be the last */
|
VAR_NUM_OF_VARS /* must be the last */
|
||||||
} replaceid;
|
} replaceid;
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ static struct variable replacements[]={
|
|||||||
{"size_upload", VAR_SIZE_UPLOAD},
|
{"size_upload", VAR_SIZE_UPLOAD},
|
||||||
{"speed_download", VAR_SPEED_DOWNLOAD},
|
{"speed_download", VAR_SPEED_DOWNLOAD},
|
||||||
{"speed_upload", VAR_SPEED_UPLOAD},
|
{"speed_upload", VAR_SPEED_UPLOAD},
|
||||||
|
{"content_type", VAR_CONTENT_TYPE},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -165,6 +167,11 @@ void ourWriteOut(CURL *curl, char *writeinfo)
|
|||||||
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
|
||||||
fprintf(stream, "%.3f", doubleinfo);
|
fprintf(stream, "%.3f", doubleinfo);
|
||||||
break;
|
break;
|
||||||
|
case VAR_CONTENT_TYPE:
|
||||||
|
if(CURLE_OK ==
|
||||||
|
curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &stringp))
|
||||||
|
fputs(stringp, stream);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,10 @@ One regex per line that is removed from the protocol dumps before the
|
|||||||
comparison is made. This is very useful to remove dependencies on dynamicly
|
comparison is made. This is very useful to remove dependencies on dynamicly
|
||||||
changing protocol data such as port numbers or user-agent strings.
|
changing protocol data such as port numbers or user-agent strings.
|
||||||
</strip>
|
</strip>
|
||||||
<protocol>
|
<protocol [nonewline=yes]>
|
||||||
the protocol dump curl should transmit
|
the protocol dump curl should transmit, if 'nonewline' is set, we will cut
|
||||||
|
off the trailing newline of this given data before comparing with the one
|
||||||
|
actually sent by the client
|
||||||
</protocol>
|
</protocol>
|
||||||
<stdout>
|
<stdout>
|
||||||
This verfies that this data was passed to stdout.
|
This verfies that this data was passed to stdout.
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
EXTRA_DIST = ftpserver.pl httpserver.pl httpsserver.pl runtests.pl \
|
EXTRA_DIST = ftpserver.pl httpserver.pl httpsserver.pl runtests.pl \
|
||||||
ftpsserver.pl stunnel.pm getpart.pm FILEFORMAT README \
|
ftpsserver.pl stunnel.pm getpart.pm FILEFORMAT README \
|
||||||
stunnel.pem
|
stunnel.pem memanalyze.pl
|
||||||
|
|
||||||
SUBDIRS = data
|
SUBDIRS = data server
|
||||||
|
|
||||||
PERLFLAGS = -I$(srcdir)
|
PERLFLAGS = -I$(srcdir)
|
||||||
|
|
||||||
@@ -12,11 +12,11 @@ install:
|
|||||||
curl:
|
curl:
|
||||||
@(cd ..; make)
|
@(cd ..; make)
|
||||||
|
|
||||||
test:
|
test: server/sws
|
||||||
@cd data && exec $(MAKE) test
|
@cd data && exec $(MAKE) test
|
||||||
srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl
|
srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl
|
||||||
|
|
||||||
quiet-test:
|
quiet-test: server/sws
|
||||||
@cd data && exec $(MAKE) test
|
@cd data && exec $(MAKE) test
|
||||||
srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl -s -a
|
srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl -s -a
|
||||||
|
|
||||||
@@ -24,3 +24,5 @@ clean:
|
|||||||
rm -rf log
|
rm -rf log
|
||||||
find . -name "*~" | xargs rm -f
|
find . -name "*~" | xargs rm -f
|
||||||
|
|
||||||
|
server/sws:
|
||||||
|
cd server; make sws
|
||||||
|
@@ -12,6 +12,8 @@ test101 test110 test12 test15 test202 test3 test4 test6 \
|
|||||||
test102 test111 test120 test16 test21 test30 test400 test7 \
|
test102 test111 test120 test16 test21 test30 test400 test7 \
|
||||||
test103 test112 test121 test17 test22 test300 test401 test8 \
|
test103 test112 test121 test17 test22 test300 test401 test8 \
|
||||||
test104 test113 test122 test18 test23 test301 test402 test9 \
|
test104 test113 test122 test18 test23 test301 test402 test9 \
|
||||||
test105 test114 test123 test19 test24 test302 test43 \
|
test105 test114 test123 test19 test24 test302 test43 test31 \
|
||||||
test106 test115 test124 test190 test25 test303 test44 test38 \
|
test106 test115 test124 test190 test25 test303 test44 test38 \
|
||||||
test107 test116 test125 test2 test26 test33 test45 test126
|
test107 test116 test125 test2 test26 test33 test45 test126 \
|
||||||
|
test304
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
use curl with multiple request methods
|
use curl with multiple request methods
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
-I -X FOOO localhost
|
-I -d FOOO localhost
|
||||||
</command>
|
</command>
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ HTTP POST with user and password
|
|||||||
<strip>
|
<strip>
|
||||||
^User-Agent:.*
|
^User-Agent:.*
|
||||||
</strip>
|
</strip>
|
||||||
<protocol>
|
<protocol nonewline=yes>
|
||||||
POST /3 HTTP/1.1
|
POST /3 HTTP/1.1
|
||||||
Authorization: Basic ZmFrZTotdXNlcg==
|
Authorization: Basic ZmFrZTotdXNlcg==
|
||||||
Host: 127.0.0.1:8999
|
Host: 127.0.0.1:8999
|
||||||
|
58
tests/data/test304
Normal file
58
tests/data/test304
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
|
||||||
|
blablabla
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<name>
|
||||||
|
HTTPS multipart formpost
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
https://%HOSTIP:%HTTPSPORT/we/want/304 -F name=daniel -F tool=curl -F file=@log/test304.txt
|
||||||
|
</command>
|
||||||
|
# We create this file before the command is invoked!
|
||||||
|
<file name="log/test304.txt">
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
</file>
|
||||||
|
</test>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^(User-Agent:|Content-Type: multipart/form-data;|--curl).*
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
POST /we/want/304 HTTP/1.1
|
||||||
|
User-Agent: curl/7.9.5-pre4 (sparc-sun-solaris2.7) libcurl 7.9.5-pre4 (OpenSSL 0.9.6c) (krb4 enabled)
|
||||||
|
Host: 127.0.0.1:8433
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
|
||||||
|
Content-Length: 1354
|
||||||
|
Expect: 100-continue
|
||||||
|
Content-Type: multipart/form-data; boundary=curlfPpkLyYwSYaH6Fkg0WkEldoJyAQ
|
||||||
|
|
||||||
|
--curlfPpkLyYwSYaH6Fkg0WkEldoJyAQ
|
||||||
|
Content-Disposition: form-data; name="name"
|
||||||
|
|
||||||
|
daniel
|
||||||
|
--curlfPpkLyYwSYaH6Fkg0WkEldoJyAQ
|
||||||
|
Content-Disposition: form-data; name="tool"
|
||||||
|
|
||||||
|
curl
|
||||||
|
--curlfPpkLyYwSYaH6Fkg0WkEldoJyAQ
|
||||||
|
Content-Disposition: form-data; name="file"; filename="log/test304.txt"
|
||||||
|
Content-Type: text/plain
|
||||||
|
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
|
||||||
|
--curlfPpkLyYwSYaH6Fkg0WkEldoJyAQ--
|
||||||
|
</protocol>
|
||||||
|
</verify>
|
56
tests/data/test31
Normal file
56
tests/data/test31
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Type: text/html
|
||||||
|
Funny-head: yesyes
|
||||||
|
Set-Cookie: foobar=name; domain=127.0.0.1; path=/ ; secure
|
||||||
|
Set-Cookie:mismatch=this ; domain=127.0.0.1; path=/silly/
|
||||||
|
Set-Cookie: partmatch=present; domain=127.0.0.1 ; path=/;
|
||||||
|
Set-Cookie: eat=this; domain=moo.foo.moo;
|
||||||
|
Set-Cookie: eat=this-too; domain=.foo.moo;
|
||||||
|
Set-Cookie: nodomainnovalue
|
||||||
|
Set-Cookie: nodomain=value; expires=Tue Feb 1 11:56:27 MET 2014
|
||||||
|
Set-Cookie: nodomainnovalue; domain=reallysilly
|
||||||
|
|
||||||
|
boo
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<name>
|
||||||
|
HTTP with weirdly formatted cookies and cookiejar storage
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HOSTPORT/we/want/31 -b none -c log/jar31.txt
|
||||||
|
</command>
|
||||||
|
</test>
|
||||||
|
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:.*
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /we/want/31 HTTP/1.1
|
||||||
|
Host: 127.0.0.1:8999
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
<file name="log/jar31.txt">
|
||||||
|
# Netscape HTTP Cookie File
|
||||||
|
# http://www.netscape.com/newsref/std/cookie_spec.html
|
||||||
|
# This file was generated by libcurl! Edit at your own risk.
|
||||||
|
|
||||||
|
127.0.0.1 FALSE / TRUE 0 foobar name
|
||||||
|
127.0.0.1 FALSE /silly/ FALSE 0 ismatch this
|
||||||
|
127.0.0.1 FALSE / FALSE 0 partmatch present
|
||||||
|
moo.foo.moo FALSE / FALSE 0 eat this
|
||||||
|
.foo.moo TRUE / FALSE 0 eat this-too
|
||||||
|
127.0.0.1 FALSE / FALSE 1391252187 nodomain value
|
||||||
|
</file>
|
||||||
|
</verify>
|
@@ -5,7 +5,7 @@ HTTP/1.1 200 OK
|
|||||||
Server: Microsoft-IIS/4.0
|
Server: Microsoft-IIS/4.0
|
||||||
Date: Tue, 25 Sep 2001 19:37:44 GMT
|
Date: Tue, 25 Sep 2001 19:37:44 GMT
|
||||||
Content-Type: text/html
|
Content-Type: text/html
|
||||||
Set-Cookie: ckyPersistent=permanent; expires=Tue, 01-Jan-2002 05:00:00 GMT; path=/
|
Set-Cookie: ckyPersistent=permanent; expires=Tue, 01-Jan-2010 05:00:00 GMT; path=/
|
||||||
Set-Cookie: ckySession=temporary; path=/
|
Set-Cookie: ckySession=temporary; path=/
|
||||||
Set-Cookie: ASPSESSIONIDQGGQQSJJ=GKNBDIFAAOFDPDAIEAKDIBKE; path=/
|
Set-Cookie: ASPSESSIONIDQGGQQSJJ=GKNBDIFAAOFDPDAIEAKDIBKE; path=/
|
||||||
Cache-control: private
|
Cache-control: private
|
||||||
@@ -55,7 +55,7 @@ Cookie: mooo=indeed
|
|||||||
www.fake.come FALSE / FALSE 1022144953 cookiecliente si
|
www.fake.come FALSE / FALSE 1022144953 cookiecliente si
|
||||||
www.loser.com FALSE / FALSE 1139150993 UID 99
|
www.loser.com FALSE / FALSE 1139150993 UID 99
|
||||||
127.0.0.1 FALSE / FALSE 1139150993 mooo indeed
|
127.0.0.1 FALSE / FALSE 1139150993 mooo indeed
|
||||||
127.0.0.1 FALSE / FALSE 1009861200 ckyPersistent permanent
|
127.0.0.1 FALSE / FALSE 1262322000 ckyPersistent permanent
|
||||||
127.0.0.1 FALSE / FALSE 0 ckySession temporary
|
127.0.0.1 FALSE / FALSE 0 ckySession temporary
|
||||||
127.0.0.1 FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE
|
127.0.0.1 FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ GKNBDIFAAOFDPDAIEAKDIBKE
|
||||||
</file>
|
</file>
|
||||||
|
@@ -10,6 +10,9 @@ do {
|
|||||||
if($ARGV[0] eq "-v") {
|
if($ARGV[0] eq "-v") {
|
||||||
$verbose=1;
|
$verbose=1;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] eq "-t") {
|
||||||
|
$trace=1;
|
||||||
|
}
|
||||||
} while (shift @ARGV);
|
} while (shift @ARGV);
|
||||||
|
|
||||||
my $maxmem;
|
my $maxmem;
|
||||||
@@ -43,11 +46,11 @@ while(<STDIN>) {
|
|||||||
print "FREE ERROR: Previously freed at: ".$getmem{$addr}."\n";
|
print "FREE ERROR: Previously freed at: ".$getmem{$addr}."\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(0 && $verbose) {
|
|
||||||
print "malloc at ".$getmem{$addr}." is freed again at $source:$linenum\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$totalmem -= $sizeataddr{$addr};
|
$totalmem -= $sizeataddr{$addr};
|
||||||
|
if($trace) {
|
||||||
|
print "FREE: malloc at ".$getmem{$addr}." is freed again at $source:$linenum\n";
|
||||||
|
printf("FREE: %d bytes freed, left allocated: $totalmem bytes\n", $sizeataddr{$addr});
|
||||||
|
}
|
||||||
|
|
||||||
newtotal($totalmem);
|
newtotal($totalmem);
|
||||||
$frees++;
|
$frees++;
|
||||||
@@ -69,8 +72,9 @@ while(<STDIN>) {
|
|||||||
$sizeataddr{$addr}=$size;
|
$sizeataddr{$addr}=$size;
|
||||||
$totalmem += $size;
|
$totalmem += $size;
|
||||||
|
|
||||||
if(0 && $verbose) {
|
if($trace) {
|
||||||
print "malloc($size) at $source:$linenum\n";
|
print "MALLOC: malloc($size) at $source:$linenum",
|
||||||
|
" makes totally $totalmem bytes\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
newtotal($totalmem);
|
newtotal($totalmem);
|
||||||
@@ -84,11 +88,18 @@ while(<STDIN>) {
|
|||||||
$newaddr = $3;
|
$newaddr = $3;
|
||||||
|
|
||||||
$totalmem -= $sizeataddr{$oldaddr};
|
$totalmem -= $sizeataddr{$oldaddr};
|
||||||
|
if($trace) {
|
||||||
|
printf("REALLOC: %d less bytes and ", $sizeataddr{$oldaddr});
|
||||||
|
}
|
||||||
$sizeataddr{$oldaddr}=0;
|
$sizeataddr{$oldaddr}=0;
|
||||||
|
|
||||||
$totalmem += $newsize;
|
$totalmem += $newsize;
|
||||||
$sizeataddr{$newaddr}=$newsize;
|
$sizeataddr{$newaddr}=$newsize;
|
||||||
|
|
||||||
|
if($trace) {
|
||||||
|
printf("%d more bytes ($source:$linenum)\n", $newsize);
|
||||||
|
}
|
||||||
|
|
||||||
newtotal($totalmem);
|
newtotal($totalmem);
|
||||||
$reallocs++;
|
$reallocs++;
|
||||||
|
|
||||||
@@ -106,6 +117,11 @@ while(<STDIN>) {
|
|||||||
|
|
||||||
$totalmem += $size;
|
$totalmem += $size;
|
||||||
|
|
||||||
|
if($trace) {
|
||||||
|
printf("STRDUP: $size bytes at %s, makes totally: %d bytes\n",
|
||||||
|
$getmem{$addr}, $totalmem);
|
||||||
|
}
|
||||||
|
|
||||||
newtotal($totalmem);
|
newtotal($totalmem);
|
||||||
$strdups++;
|
$strdups++;
|
||||||
}
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/env perl
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Main curl test script, in perl to run on more platforms
|
# Main curl test script, in perl to run on more platforms
|
||||||
@@ -22,7 +22,7 @@ my $FTPSPORT=8821; # this is the FTPS server port
|
|||||||
my $CURL="../src/curl"; # what curl executable to run on the tests
|
my $CURL="../src/curl"; # what curl executable to run on the tests
|
||||||
my $LOGDIR="log";
|
my $LOGDIR="log";
|
||||||
my $TESTDIR="data";
|
my $TESTDIR="data";
|
||||||
my $SERVERIN="$LOGDIR/http-request.dump"; # what curl sent the server
|
my $SERVERIN="$LOGDIR/server.input"; # what curl sent the server
|
||||||
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
|
my $CURLLOG="$LOGDIR/curl.log"; # all command lines run
|
||||||
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
|
my $FTPDCMD="$LOGDIR/ftpserver.cmd"; # copy ftp server instructions here
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ my $memory_debug=0;
|
|||||||
my $memdump="memdump";
|
my $memdump="memdump";
|
||||||
|
|
||||||
# the path to the script that analyzes the memory debug output file:
|
# the path to the script that analyzes the memory debug output file:
|
||||||
my $memanalyze="../memanalyze.pl";
|
my $memanalyze="./memanalyze.pl";
|
||||||
|
|
||||||
my $checkstunnel = &checkstunnel;
|
my $checkstunnel = &checkstunnel;
|
||||||
|
|
||||||
@@ -74,6 +74,9 @@ my $pwd; # current working directory
|
|||||||
|
|
||||||
chomp($pwd = `pwd`);
|
chomp($pwd = `pwd`);
|
||||||
|
|
||||||
|
# enable memory debugging if curl is compiled with it
|
||||||
|
$ENV{'CURL_MEMDEBUG'} = 1;
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Return the pid of the server as found in the given pid file
|
# Return the pid of the server as found in the given pid file
|
||||||
#
|
#
|
||||||
@@ -140,16 +143,27 @@ sub runhttpserver {
|
|||||||
my $RUNNING;
|
my $RUNNING;
|
||||||
my $pid;
|
my $pid;
|
||||||
|
|
||||||
|
$pid = checkserver ($HTTPPIDFILE);
|
||||||
|
|
||||||
# verify if our/any server is running on this port
|
# verify if our/any server is running on this port
|
||||||
my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver`;
|
my $data=`$CURL --silent -i $HOSTIP:$HOSTPORT/verifiedserver`;
|
||||||
|
|
||||||
if ( $data =~ /WE ROOLZ(: |)(\d*)/ ) {
|
if ( $data =~ /WE ROOLZ(: |)(\d*)/ ) {
|
||||||
|
if($2) {
|
||||||
$pid = 0+$2;
|
$pid = 0+$2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$pid) {
|
||||||
|
print "Test server already running with unknown pid! Use it...\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
print "Test server already running with pid $pid, killing it...\n";
|
print "Test server already running with pid $pid, killing it...\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($data ne "") {
|
elsif($data ne "") {
|
||||||
|
print "GOT: $data\n";
|
||||||
print "An alien HTTP server is running on port $HOSTPORT\n",
|
print "An alien HTTP server is running on port $HOSTPORT\n",
|
||||||
"Edit runtests.pl to use another port and rerun the test script\n";
|
"Edit runtests.pl to use another port and rerun the test script\n";
|
||||||
exit;
|
exit;
|
||||||
@@ -160,7 +174,7 @@ sub runhttpserver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pid) {
|
if($pid > 0) {
|
||||||
my $res = kill (9, $pid); # die!
|
my $res = kill (9, $pid); # die!
|
||||||
if(!$res) {
|
if(!$res) {
|
||||||
print "Failed to kill our HTTP test server, do it manually and",
|
print "Failed to kill our HTTP test server, do it manually and",
|
||||||
@@ -602,6 +616,15 @@ sub singletest {
|
|||||||
|
|
||||||
my @protstrip=@protocol;
|
my @protstrip=@protocol;
|
||||||
|
|
||||||
|
# check if there's any attributes on the verify/protocol section
|
||||||
|
my %hash = getpartattr("verify", "protocol");
|
||||||
|
|
||||||
|
if($hash{'nonewline'}) {
|
||||||
|
# Yes, we must cut off the final newline from the final line
|
||||||
|
# of the protocol data
|
||||||
|
chomp($protstrip[$#protstrip]);
|
||||||
|
}
|
||||||
|
|
||||||
for(@strip) {
|
for(@strip) {
|
||||||
# strip all patterns from both arrays
|
# strip all patterns from both arrays
|
||||||
@out = striparray( $_, \@out);
|
@out = striparray( $_, \@out);
|
||||||
@@ -835,36 +858,6 @@ if($testthis[0] ne "") {
|
|||||||
$TESTCASES=join(" ", @testthis);
|
$TESTCASES=join(" ", @testthis);
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#
|
|
||||||
# don't let anyone think this works right now
|
|
||||||
|
|
||||||
print <<EOM
|
|
||||||
***************************************************************************
|
|
||||||
|
|
||||||
THIS DOES NOT WORK
|
|
||||||
|
|
||||||
***************************************************************************
|
|
||||||
|
|
||||||
Things in curl-land have changed, but the test suite has not been fixed
|
|
||||||
accordingly and thus, the test suite is currently more or less useless.
|
|
||||||
|
|
||||||
*PLEASE* help us fixing this. We have to make our new test server written
|
|
||||||
in C work and get used instead of the perl version previously used.
|
|
||||||
|
|
||||||
The working version of the test server is found in the tests/server
|
|
||||||
directory in the CVS tree.
|
|
||||||
|
|
||||||
If you run this in the tests/ directory and run the server in there, you
|
|
||||||
can actually get test-responses if you do like this:
|
|
||||||
|
|
||||||
\$ ./server/sws 8080 &
|
|
||||||
\$ curl localhost:8080/3
|
|
||||||
|
|
||||||
EOM
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Output curl version and host info being tested
|
# Output curl version and host info being tested
|
||||||
#
|
#
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
CC = gcc
|
|
||||||
CFLAGS = -g -Wall
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
TARGET = sws
|
|
||||||
OBJS= sws.o getpart.o
|
|
||||||
|
|
||||||
all: $(TARGET)
|
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
|
||||||
$(CC) $(LDFLAGS) -o $@ $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f $(OBJS) *~ $(TARGET) core logfile
|
|
||||||
|
|
12
tests/server/Makefile.am
Normal file
12
tests/server/Makefile.am
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# sws is the Silly Web Server
|
||||||
|
#
|
||||||
|
# Original http server code contributed by Georg Horn. Heavily modified since.
|
||||||
|
#
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
noinst_PROGRAMS = sws
|
||||||
|
|
||||||
|
sws_SOURCES= sws.c getpart.c
|
||||||
|
|
||||||
|
extra_DIST = config.h.in
|
2
tests/server/config.h.in
Normal file
2
tests/server/config.h.in
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
#undef HAVE_SIGNAL
|
@@ -7,6 +7,13 @@
|
|||||||
#define EAT_SPACE(ptr) while( ptr && *ptr && isspace(*ptr) ) ptr++
|
#define EAT_SPACE(ptr) while( ptr && *ptr && isspace(*ptr) ) ptr++
|
||||||
#define EAT_WORD(ptr) while( ptr && *ptr && !isspace(*ptr) && ('>' != *ptr)) ptr++
|
#define EAT_WORD(ptr) while( ptr && *ptr && !isspace(*ptr) && ('>' != *ptr)) ptr++
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define show(x) printf x
|
||||||
|
#else
|
||||||
|
#define show(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static
|
||||||
char *appendstring(char *string, /* original string */
|
char *appendstring(char *string, /* original string */
|
||||||
char *buffer, /* to append */
|
char *buffer, /* to append */
|
||||||
int *stringlen, int *stralloc)
|
int *stringlen, int *stralloc)
|
||||||
@@ -40,7 +47,6 @@ char *spitout(FILE *stream, char *main, char *sub, int *size)
|
|||||||
char *string;
|
char *string;
|
||||||
int stringlen=0;
|
int stringlen=0;
|
||||||
int stralloc=256;
|
int stralloc=256;
|
||||||
int len;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STATE_OUTSIDE,
|
STATE_OUTSIDE,
|
||||||
@@ -60,9 +66,9 @@ char *spitout(FILE *stream, char *main, char *sub, int *size)
|
|||||||
|
|
||||||
if('<' != *ptr) {
|
if('<' != *ptr) {
|
||||||
if(display) {
|
if(display) {
|
||||||
printf("=> %s", buffer);
|
show(("=> %s", buffer));
|
||||||
string = appendstring(string, buffer, &stringlen, &stralloc);
|
string = appendstring(string, buffer, &stringlen, &stralloc);
|
||||||
printf("* %s\n", buffer);
|
show(("* %s\n", buffer));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -113,17 +119,17 @@ char *spitout(FILE *stream, char *main, char *sub, int *size)
|
|||||||
}
|
}
|
||||||
if(display) {
|
if(display) {
|
||||||
string = appendstring(string, buffer, &stringlen, &stralloc);
|
string = appendstring(string, buffer, &stringlen, &stralloc);
|
||||||
printf("* %s\n", buffer);
|
show(("* %s\n", buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if((STATE_INSUB == state) &&
|
if((STATE_INSUB == state) &&
|
||||||
!strcmp(cmain, main) &&
|
!strcmp(cmain, main) &&
|
||||||
!strcmp(csub, sub)) {
|
!strcmp(csub, sub)) {
|
||||||
printf("* (%d bytes) %s\n", stringlen, buffer);
|
show(("* (%d bytes) %s\n", stringlen, buffer));
|
||||||
display = 1; /* start displaying */
|
display = 1; /* start displaying */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("%d (%s/%s): %s\n", state, cmain, csub, buffer);
|
show(("%d (%s/%s): %s\n", state, cmain, csub, buffer));
|
||||||
display = 0; /* no display */
|
display = 0; /* no display */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,19 +5,20 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <getopt.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <assert.h>
|
|
||||||
|
char *spitout(FILE *stream, char *main, char *sub, int *size);
|
||||||
|
|
||||||
#define DEFAULT_PORT 8999
|
#define DEFAULT_PORT 8999
|
||||||
|
|
||||||
#ifndef DEFAULT_LOGFILE
|
#ifndef DEFAULT_LOGFILE
|
||||||
#define DEFAULT_LOGFILE "/dev/null"
|
#define DEFAULT_LOGFILE "log/sws.log"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DOCBUFSIZE 4
|
#define DOCBUFSIZE 4
|
||||||
@@ -25,11 +26,11 @@
|
|||||||
|
|
||||||
#define VERSION "cURL test suite HTTP server/0.1"
|
#define VERSION "cURL test suite HTTP server/0.1"
|
||||||
|
|
||||||
#define REQUEST_DUMP "http-request.dump"
|
#define REQUEST_DUMP "log/server.input"
|
||||||
|
|
||||||
#define TEST_DATA_PATH "data/test%d"
|
#define TEST_DATA_PATH "data/test%d"
|
||||||
|
|
||||||
static char *docfriends = "WE ROOLZ\r\n";
|
static char *docfriends = "HTTP/1.1 200 Mighty fine indeed\r\n\r\nWE ROOLZ\r\n";
|
||||||
static char *doc404 = "HTTP/1.1 404 Not Found\n"
|
static char *doc404 = "HTTP/1.1 404 Not Found\n"
|
||||||
"Server: " VERSION "\n"
|
"Server: " VERSION "\n"
|
||||||
"Connection: close\n"
|
"Connection: close\n"
|
||||||
@@ -56,7 +57,9 @@ static void logmsg(const char *msg)
|
|||||||
strcpy(loctime, asctime(curr_time));
|
strcpy(loctime, asctime(curr_time));
|
||||||
loctime[strlen(loctime) - 1] = '\0';
|
loctime[strlen(loctime) - 1] = '\0';
|
||||||
fprintf(logfp, "%s: pid %d: %s\n", loctime, getpid(), msg);
|
fprintf(logfp, "%s: pid %d: %s\n", loctime, getpid(), msg);
|
||||||
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "%s: pid %d: %s\n", loctime, getpid(), msg);
|
fprintf(stderr, "%s: pid %d: %s\n", loctime, getpid(), msg);
|
||||||
|
#endif
|
||||||
fflush(logfp);
|
fflush(logfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +81,7 @@ static void sigterm_handler(int sig)
|
|||||||
int ProcessRequest(char *request)
|
int ProcessRequest(char *request)
|
||||||
{
|
{
|
||||||
char *line=request;
|
char *line=request;
|
||||||
long contentlength=-1;
|
unsigned long contentlength=0;
|
||||||
|
|
||||||
#define END_OF_HEADERS "\r\n\r\n"
|
#define END_OF_HEADERS "\r\n\r\n"
|
||||||
|
|
||||||
@@ -109,7 +112,7 @@ int ProcessRequest(char *request)
|
|||||||
line++;
|
line++;
|
||||||
} while(line);
|
} while(line);
|
||||||
|
|
||||||
if(contentlength > -1 ) {
|
if(contentlength > 0 ) {
|
||||||
if(contentlength <= strlen(end+strlen(END_OF_HEADERS)))
|
if(contentlength <= strlen(end+strlen(END_OF_HEADERS)))
|
||||||
return 1; /* done */
|
return 1; /* done */
|
||||||
else
|
else
|
||||||
@@ -123,7 +126,7 @@ void storerequest(char *reqbuf)
|
|||||||
{
|
{
|
||||||
FILE *dump;
|
FILE *dump;
|
||||||
|
|
||||||
dump = fopen(REQUEST_DUMP, "wb"); /* b is for windows-preparing */
|
dump = fopen(REQUEST_DUMP, "ab"); /* b is for windows-preparing */
|
||||||
if(dump) {
|
if(dump) {
|
||||||
fwrite(reqbuf, 1, strlen(reqbuf), dump);
|
fwrite(reqbuf, 1, strlen(reqbuf), dump);
|
||||||
|
|
||||||
@@ -133,15 +136,23 @@ void storerequest(char *reqbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define REQBUFSIZ 4096
|
#define REQBUFSIZ 50000
|
||||||
#define MAXDOCNAMELEN 1024
|
#define REQBUFSIZ_TXT "49999"
|
||||||
|
|
||||||
|
/* very-big-path support */
|
||||||
|
#define MAXDOCNAMELEN 40000
|
||||||
|
#define MAXDOCNAMELEN_TXT "39999"
|
||||||
|
|
||||||
#define REQUEST_KEYWORD_SIZE 256
|
#define REQUEST_KEYWORD_SIZE 256
|
||||||
static int get_request(int sock)
|
static int get_request(int sock, int *part)
|
||||||
{
|
{
|
||||||
char reqbuf[REQBUFSIZ], doc[MAXDOCNAMELEN];
|
static char reqbuf[REQBUFSIZ], doc[MAXDOCNAMELEN];
|
||||||
char request[REQUEST_KEYWORD_SIZE];
|
static char request[REQUEST_KEYWORD_SIZE];
|
||||||
unsigned int offset = 0;
|
unsigned int offset = 0;
|
||||||
int prot_major, prot_minor;
|
int prot_major, prot_minor;
|
||||||
|
char logbuf[256];
|
||||||
|
|
||||||
|
*part = 0; /* part zero equals none */
|
||||||
|
|
||||||
while (offset < REQBUFSIZ) {
|
while (offset < REQBUFSIZ) {
|
||||||
int got = recv(sock, reqbuf + offset, REQBUFSIZ - offset, 0);
|
int got = recv(sock, reqbuf + offset, REQBUFSIZ - offset, 0);
|
||||||
@@ -172,7 +183,7 @@ static int get_request(int sock)
|
|||||||
/* dump the request to an external file */
|
/* dump the request to an external file */
|
||||||
storerequest(reqbuf);
|
storerequest(reqbuf);
|
||||||
|
|
||||||
if (sscanf(reqbuf, "%s %s HTTP/%d.%d",
|
if (sscanf(reqbuf, "%" REQBUFSIZ_TXT"s %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
|
||||||
request,
|
request,
|
||||||
doc,
|
doc,
|
||||||
&prot_major,
|
&prot_major,
|
||||||
@@ -185,13 +196,31 @@ static int get_request(int sock)
|
|||||||
|
|
||||||
/* get the number after it */
|
/* get the number after it */
|
||||||
if(ptr) {
|
if(ptr) {
|
||||||
if(!strcmp("/verifiedserver", ptr)) {
|
|
||||||
|
if((strlen(doc) + strlen(request)) < 200)
|
||||||
|
sprintf(logbuf, "Got request: %s %s HTTP/%d.%d",
|
||||||
|
request, doc, prot_major, prot_minor);
|
||||||
|
else
|
||||||
|
sprintf(logbuf, "Got a *HUGE* request HTTP/%d.%d",
|
||||||
|
prot_major, prot_minor);
|
||||||
|
logmsg(logbuf);
|
||||||
|
|
||||||
|
if(!strncmp("/verifiedserver", ptr, 15)) {
|
||||||
logmsg("Are-we-friendly question received");
|
logmsg("Are-we-friendly question received");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
test_no = strtol(ptr+1, &ptr, 10);
|
|
||||||
|
|
||||||
logmsg("Found test number in PATH");
|
ptr++; /* skip the slash */
|
||||||
|
|
||||||
|
test_no = strtol(ptr, &ptr, 10);
|
||||||
|
|
||||||
|
if(test_no > 10000) {
|
||||||
|
*part = test_no % 10000;
|
||||||
|
test_no /= 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(logbuf, "Found test number %d in path", test_no);
|
||||||
|
logmsg(logbuf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@@ -207,15 +236,18 @@ static int get_request(int sock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int send_doc(int sock, int doc)
|
static int send_doc(int sock, int doc, int part_no)
|
||||||
{
|
{
|
||||||
int written;
|
int written;
|
||||||
int count;
|
int count;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
|
char *cmd=NULL;
|
||||||
|
int cmdsize;
|
||||||
|
|
||||||
char filename[256];
|
char filename[256];
|
||||||
|
char partbuf[80]="data";
|
||||||
|
|
||||||
if(doc < 0) {
|
if(doc < 0) {
|
||||||
if(-2 == doc)
|
if(-2 == doc)
|
||||||
@@ -225,8 +257,15 @@ static int send_doc(int sock, int doc)
|
|||||||
buffer = doc404;
|
buffer = doc404;
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
stream=NULL;
|
stream=NULL;
|
||||||
|
|
||||||
|
count = strlen(buffer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(0 != part_no) {
|
||||||
|
sprintf(partbuf, "data%d", part_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sprintf(filename, TEST_DATA_PATH, doc);
|
sprintf(filename, TEST_DATA_PATH, doc);
|
||||||
|
|
||||||
stream=fopen(filename, "rb");
|
stream=fopen(filename, "rb");
|
||||||
@@ -234,14 +273,27 @@ static int send_doc(int sock, int doc)
|
|||||||
logmsg("Couldn't open test file");
|
logmsg("Couldn't open test file");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
ptr = buffer = spitout(stream, "reply", partbuf, &count);
|
||||||
|
fclose(stream);
|
||||||
|
}
|
||||||
|
|
||||||
ptr = buffer = spitout(stream, "reply", "data", &count);
|
/* re-open the same file again */
|
||||||
|
stream=fopen(filename, "rb");
|
||||||
|
if(!stream) {
|
||||||
|
logmsg("Couldn't open test file");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* get the custom server control "commands" */
|
||||||
|
cmd = spitout(stream, "reply", "postcmd", &cmdsize);
|
||||||
|
fclose(stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
written = send(sock, buffer, count, 0);
|
written = send(sock, buffer, count, 0);
|
||||||
if (written < 0) {
|
if (written < 0) {
|
||||||
fclose(stream);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
count -= written;
|
count -= written;
|
||||||
@@ -250,8 +302,28 @@ static int send_doc(int sock, int doc)
|
|||||||
|
|
||||||
if(ptr)
|
if(ptr)
|
||||||
free(ptr);
|
free(ptr);
|
||||||
if(stream)
|
|
||||||
fclose(stream);
|
if(cmdsize > 0 ) {
|
||||||
|
char command[32];
|
||||||
|
int num;
|
||||||
|
char *ptr=cmd;
|
||||||
|
do {
|
||||||
|
if(2 == sscanf(ptr, "%31s %d", command, &num)) {
|
||||||
|
if(!strcmp("wait", command))
|
||||||
|
sleep(num); /* wait this many seconds */
|
||||||
|
else {
|
||||||
|
logmsg("Unknown command in reply command section");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ptr = strchr(ptr, '\n');
|
||||||
|
if(ptr)
|
||||||
|
ptr++;
|
||||||
|
else
|
||||||
|
ptr = NULL;
|
||||||
|
} while(ptr && *ptr);
|
||||||
|
}
|
||||||
|
if(cmd)
|
||||||
|
free(cmd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -262,12 +334,12 @@ int main(int argc, char *argv[])
|
|||||||
int sock, msgsock, flag;
|
int sock, msgsock, flag;
|
||||||
unsigned short port = DEFAULT_PORT;
|
unsigned short port = DEFAULT_PORT;
|
||||||
char *logfile = DEFAULT_LOGFILE;
|
char *logfile = DEFAULT_LOGFILE;
|
||||||
|
int part_no;
|
||||||
|
FILE *pidfile;
|
||||||
|
|
||||||
if(argc>1)
|
if(argc>1)
|
||||||
port = atoi(argv[1]);
|
port = atoi(argv[1]);
|
||||||
|
|
||||||
logfile = "logfile";
|
|
||||||
|
|
||||||
/* FIX: write our pid to a file name */
|
/* FIX: write our pid to a file name */
|
||||||
|
|
||||||
logfp = fopen(logfile, "a");
|
logfp = fopen(logfile, "a");
|
||||||
@@ -276,6 +348,8 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGNAL
|
||||||
|
/* FIX: make a more portable signal handler */
|
||||||
signal(SIGPIPE, sigpipe_handler);
|
signal(SIGPIPE, sigpipe_handler);
|
||||||
signal(SIGINT, sigterm_handler);
|
signal(SIGINT, sigterm_handler);
|
||||||
signal(SIGTERM, sigterm_handler);
|
signal(SIGTERM, sigterm_handler);
|
||||||
@@ -283,6 +357,7 @@ int main(int argc, char *argv[])
|
|||||||
siginterrupt(SIGPIPE, 1);
|
siginterrupt(SIGPIPE, 1);
|
||||||
siginterrupt(SIGINT, 1);
|
siginterrupt(SIGINT, 1);
|
||||||
siginterrupt(SIGTERM, 1);
|
siginterrupt(SIGTERM, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
@@ -309,10 +384,18 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pidfile = fopen(".http.pid", "w");
|
||||||
|
if(pidfile) {
|
||||||
|
fprintf(pidfile, "%d\n", (int)getpid());
|
||||||
|
fclose(pidfile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Couldn't write pid file\n");
|
||||||
|
|
||||||
/* start accepting connections */
|
/* start accepting connections */
|
||||||
listen(sock, 5);
|
listen(sock, 5);
|
||||||
|
|
||||||
printf("*** %s listening on port %u ***\n", VERSION, port);
|
fprintf(stderr, "*** %s listening on port %u ***\n", VERSION, port);
|
||||||
|
|
||||||
while (!sigterm) {
|
while (!sigterm) {
|
||||||
int doc;
|
int doc;
|
||||||
@@ -329,8 +412,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
logmsg("New client connected");
|
logmsg("New client connected");
|
||||||
|
|
||||||
doc = get_request(msgsock);
|
doc = get_request(msgsock, &part_no);
|
||||||
send_doc(msgsock, doc);
|
send_doc(msgsock, doc, part_no);
|
||||||
|
|
||||||
close(msgsock);
|
close(msgsock);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user