mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
new binary stdout approach for win32 systems
This commit is contained in:
parent
2dbadc6405
commit
5da5cfa33e
11
CHANGES
11
CHANGES
@ -6,6 +6,17 @@
|
|||||||
|
|
||||||
History of Changes
|
History of Changes
|
||||||
|
|
||||||
|
Daniel (14 June 2000)
|
||||||
|
- Applied Luong Dinh Dung's comments about a few win32 compile problems.
|
||||||
|
|
||||||
|
- Applied Björn Stenberg's suggested fix that turns the win32 stdout to
|
||||||
|
binary. It won't do it if the -B / --use-ascii option is used. That option
|
||||||
|
is now an extended version of the previous -B /--ftp--ascii. The flag was
|
||||||
|
already in use be the ldap as well so the new name fits pretty good. The
|
||||||
|
libcyrl CURLOPT_TRANSFERTEXT was also introduced as an alias to the now
|
||||||
|
obsolete CURLOPT_FTPASCII. Can't verify this fix myself as I have no win32
|
||||||
|
compiler around.
|
||||||
|
|
||||||
Daniel (13 June 2000)
|
Daniel (13 June 2000)
|
||||||
- Luong Dinh Dung <dung at sch.bme.hu> found a problem in curl_easy_cleanup()
|
- Luong Dinh Dung <dung at sch.bme.hu> found a problem in curl_easy_cleanup()
|
||||||
since it free()ed the main curl struct *twice*. This is now corrected.
|
since it free()ed the main curl struct *twice*. This is now corrected.
|
||||||
|
@ -137,11 +137,13 @@ server sends as part of a HTTP header. NOTE that this means that the library
|
|||||||
will resend the same request on the new location and follow new Location:
|
will resend the same request on the new location and follow new Location:
|
||||||
headers all the way until no more such headers are returned.
|
headers all the way until no more such headers are returned.
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_FTPASCII
|
.B CURLOPT_TRANSFERTEXT
|
||||||
A non-zero parameter tells the library to use ASCII mode for ftp transfers,
|
A non-zero parameter tells the library to use ASCII mode for ftp transfers,
|
||||||
instead of the default binary transfer. This will only be useable when
|
instead of the default binary transfer. For LDAP transfers it gets the data in
|
||||||
transfering text data between system with different views on certain
|
plain text instead of HTML and for win32 systems it does not set the stdout to
|
||||||
characters, such as newlines or similar.
|
binary mode. This option can be useable when transfering text data between
|
||||||
|
system with different views on certain characters, such as newlines or
|
||||||
|
similar.
|
||||||
.TP
|
.TP
|
||||||
.B CURLOPT_PUT
|
.B CURLOPT_PUT
|
||||||
A non-zero parameter tells the library to use HTTP PUT a file. The file to put
|
A non-zero parameter tells the library to use HTTP PUT a file. The file to put
|
||||||
|
@ -345,7 +345,12 @@ typedef enum {
|
|||||||
T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||||
T(NETRC, LONG, 51), /* read user+password from .netrc */
|
T(NETRC, LONG, 51), /* read user+password from .netrc */
|
||||||
T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
|
T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
|
||||||
|
|
||||||
|
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
|
||||||
|
instead. It goes for more protocols than just ftp... */
|
||||||
T(FTPASCII, LONG, 53), /* use TYPE A for transfer */
|
T(FTPASCII, LONG, 53), /* use TYPE A for transfer */
|
||||||
|
|
||||||
|
T(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
|
||||||
T(PUT, LONG, 54), /* PUT the input file */
|
T(PUT, LONG, 54), /* PUT the input file */
|
||||||
T(MUTE, LONG, 55), /* force NOPROGRESS */
|
T(MUTE, LONG, 55), /* force NOPROGRESS */
|
||||||
|
|
||||||
|
23
src/main.c
23
src/main.c
@ -89,12 +89,11 @@
|
|||||||
#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */
|
#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */
|
||||||
#define CONF_NETRC (1<<22) /* read user+password from .netrc */
|
#define CONF_NETRC (1<<22) /* read user+password from .netrc */
|
||||||
#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */
|
#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */
|
||||||
#define CONF_FTPASCII (1<<24) /* use TYPE A for transfer */
|
#define CONF_GETTEXT (1<<24) /* use ASCII/text for transfer */
|
||||||
#define CONF_HTTPPOST (1<<25) /* multipart/form-data HTTP POST */
|
#define CONF_HTTPPOST (1<<25) /* multipart/form-data HTTP POST */
|
||||||
#define CONF_PUT (1<<27) /* PUT the input file */
|
#define CONF_PUT (1<<27) /* PUT the input file */
|
||||||
#define CONF_MUTE (1<<28) /* force NOPROGRESS */
|
#define CONF_MUTE (1<<28) /* force NOPROGRESS */
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
#ifndef HAVE_STRDUP
|
||||||
/* Ultrix doesn't have strdup(), so make a quick clone: */
|
/* Ultrix doesn't have strdup(), so make a quick clone: */
|
||||||
char *strdup(char *str)
|
char *strdup(char *str)
|
||||||
@ -202,7 +201,7 @@ static void help(void)
|
|||||||
" -a/--append Append to target file when uploading (F)\n"
|
" -a/--append Append to target file when uploading (F)\n"
|
||||||
" -A/--user-agent <string> User-Agent to send to server (H)\n"
|
" -A/--user-agent <string> User-Agent to send to server (H)\n"
|
||||||
" -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
|
" -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
|
||||||
" -B/--ftp-ascii Use ASCII transfer (F)\n"
|
" -B/--use-ascii Use ASCII/text transfer\n"
|
||||||
" -c/--continue Resume a previous transfer where we left it\n"
|
" -c/--continue Resume a previous transfer where we left it\n"
|
||||||
" -C/--continue-at <offset> Specify absolute resume offset\n"
|
" -C/--continue-at <offset> Specify absolute resume offset\n"
|
||||||
" -d/--data POST data (H)\n"
|
" -d/--data POST data (H)\n"
|
||||||
@ -384,7 +383,8 @@ static int getparameter(char *flag, /* f or -long-flag */
|
|||||||
{"a", "append", FALSE},
|
{"a", "append", FALSE},
|
||||||
{"A", "user-agent", TRUE},
|
{"A", "user-agent", TRUE},
|
||||||
{"b", "cookie", TRUE},
|
{"b", "cookie", TRUE},
|
||||||
{"B", "ftp-ascii", FALSE},
|
{"B", "ftp-ascii", FALSE}, /* this long format is OBSOLETEE now! */
|
||||||
|
{"B", "use-ascii", FALSE},
|
||||||
{"c", "continue", FALSE},
|
{"c", "continue", FALSE},
|
||||||
{"C", "continue-at", TRUE},
|
{"C", "continue-at", TRUE},
|
||||||
{"d", "data", TRUE},
|
{"d", "data", TRUE},
|
||||||
@ -572,8 +572,8 @@ static int getparameter(char *flag, /* f or -long-flag */
|
|||||||
GetStr(&config->cookiefile, nextarg);
|
GetStr(&config->cookiefile, nextarg);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
/* use type ASCII when transfering ftp files */
|
/* use ASCII/text when transfering */
|
||||||
config->conf ^= CONF_FTPASCII;
|
config->conf ^= CONF_GETTEXT;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
/* This makes us continue an ftp transfer */
|
/* This makes us continue an ftp transfer */
|
||||||
@ -1194,6 +1194,15 @@ int main(int argc, char *argv[])
|
|||||||
if(!config.errors)
|
if(!config.errors)
|
||||||
config.errors = stderr;
|
config.errors = stderr;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
if(!config.outfile && !(config.flags & CONF_GETTEXT)) {
|
||||||
|
/* We get the output to stdout and we have not got the ASCII/text flag,
|
||||||
|
then set stdout to be binary */
|
||||||
|
setmode( 1, O_BINARY );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
main_init();
|
main_init();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -1262,7 +1271,7 @@ int main(int argc, char *argv[])
|
|||||||
curl_easy_setopt(curl, CURLOPT_FTPAPPEND, config.conf&CONF_FTPAPPEND);
|
curl_easy_setopt(curl, CURLOPT_FTPAPPEND, config.conf&CONF_FTPAPPEND);
|
||||||
curl_easy_setopt(curl, CURLOPT_NETRC, config.conf&CONF_NETRC);
|
curl_easy_setopt(curl, CURLOPT_NETRC, config.conf&CONF_NETRC);
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, config.conf&CONF_FOLLOWLOCATION);
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, config.conf&CONF_FOLLOWLOCATION);
|
||||||
curl_easy_setopt(curl, CURLOPT_FTPASCII, config.conf&CONF_FTPASCII);
|
curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, config.conf&CONF_GETTEXT);
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_PUT, config.conf&CONF_PUT);
|
curl_easy_setopt(curl, CURLOPT_PUT, config.conf&CONF_PUT);
|
||||||
curl_easy_setopt(curl, CURLOPT_MUTE, config.conf&CONF_MUTE);
|
curl_easy_setopt(curl, CURLOPT_MUTE, config.conf&CONF_MUTE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user