Compare commits
6 Commits
curl-7_6-p
...
curl-7_6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac98c73b04 | ||
![]() |
a145654394 | ||
![]() |
e8382ba290 | ||
![]() |
fcb347d124 | ||
![]() |
c331ef02f9 | ||
![]() |
3a3f632bf0 |
12
CHANGES
12
CHANGES
@@ -5,6 +5,18 @@
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
History of Changes
|
||||
|
||||
|
||||
Version 7.6
|
||||
|
||||
Daniel (26 January 2001)
|
||||
- Lots of mails back and forth with Bob Schader finally made me add a small
|
||||
piece of code in the HTTP engine so that HTTP upload resume works. You can
|
||||
now do an operation like 'curl -T file -C <offset> <URL>' and curl will PUT
|
||||
the ending part of the file starting at given offet to the specified URL.
|
||||
|
||||
Version 7.6-pre4
|
||||
|
||||
Daniel (25 January 2001)
|
||||
- I took hold of Rick Jones' question why we don't use recv() and send() for
|
||||
reading/writing to the sockets and I've now modified the sread() and
|
||||
|
@@ -1,3 +1,4 @@
|
||||
Updated for curl 7.6 on January 26, 2001
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -12,13 +13,6 @@ INTERNALS
|
||||
|
||||
Thus, the largest amount of code and complexity is in the library part.
|
||||
|
||||
SYMBOLS
|
||||
=======
|
||||
All symbols used internally must use a 'Curl_' prefix if they're used in more
|
||||
than a single file. Single-file symbols must be made static. Public
|
||||
(exported) symbols must use a 'curl_' prefix. (There are exceptions, but they
|
||||
are destined to be changed to follow this pattern in the future.)
|
||||
|
||||
CVS
|
||||
===
|
||||
All changes to the sources are committed to the CVS repository as soon as
|
||||
@@ -35,10 +29,11 @@ Windows vs Unix
|
||||
There are a few differences in how to program curl the unix way compared to
|
||||
the Windows way. The four perhaps most notable details are:
|
||||
|
||||
1. Different function names for close(), read(), write()
|
||||
1. Different function names for socket operations.
|
||||
|
||||
In curl, this is solved with defines and macros, so that the source looks
|
||||
the same at all places except for the header file that defines them.
|
||||
the same at all places except for the header file that defines them. The
|
||||
macros in use are sclose(), sread() and swrite().
|
||||
|
||||
2. Windows requires a couple of init calls for the socket stuff
|
||||
|
||||
@@ -187,6 +182,15 @@ Library
|
||||
exists in lib/getpass.c. libcurl offers a custom callback that can be used
|
||||
instead of this, but it doesn't change much to us.
|
||||
|
||||
Library Symbols
|
||||
===============
|
||||
|
||||
All symbols used internally in libcurl must use a 'Curl_' prefix if they're
|
||||
used in more than a single file. Single-file symbols must be made
|
||||
static. Public (exported) symbols must use a 'curl_' prefix. (There are
|
||||
exceptions, but they are destined to be changed to follow this pattern in the
|
||||
future.)
|
||||
|
||||
Return Codes and Informationals
|
||||
===============================
|
||||
|
||||
|
@@ -452,7 +452,7 @@ char *curl_getenv(char *variable);
|
||||
char *curl_version(void);
|
||||
|
||||
/* This is the version number */
|
||||
#define LIBCURL_VERSION "7.6-pre4"
|
||||
#define LIBCURL_VERSION "7.6"
|
||||
#define LIBCURL_VERSION_NUM 0x070600
|
||||
|
||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||
|
58
lib/http.c
58
lib/http.c
@@ -471,6 +471,64 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
if(!checkheaders(data, "Accept:"))
|
||||
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
|
||||
|
||||
if((data->bits.http_post ||
|
||||
data->bits.http_formpost ||
|
||||
data->bits.http_put) &&
|
||||
data->resume_from) {
|
||||
/**********************************************************************
|
||||
* Resuming upload in HTTP means that we PUT or POST and that we have
|
||||
* got a resume_from value set. The resume value has already created
|
||||
* a Range: header that will be passed along. We need to "fast forward"
|
||||
* the file the given number of bytes and decrease the assume upload
|
||||
* file size before we continue this venture in the dark lands of HTTP.
|
||||
*********************************************************************/
|
||||
|
||||
if(data->resume_from < 0 ) {
|
||||
/*
|
||||
* This is meant to get the size of the present remote-file by itself.
|
||||
* We don't support this now. Bail out!
|
||||
*/
|
||||
data->resume_from = 0;
|
||||
}
|
||||
|
||||
if(data->resume_from) {
|
||||
/* do we still game? */
|
||||
int passed=0;
|
||||
|
||||
/* Now, let's read off the proper amount of bytes from the
|
||||
input. If we knew it was a proper file we could've just
|
||||
fseek()ed but we only have a stream here */
|
||||
do {
|
||||
int readthisamountnow = (data->resume_from - passed);
|
||||
int actuallyread;
|
||||
|
||||
if(readthisamountnow > BUFSIZE)
|
||||
readthisamountnow = BUFSIZE;
|
||||
|
||||
actuallyread =
|
||||
data->fread(data->buffer, 1, readthisamountnow, data->in);
|
||||
|
||||
passed += actuallyread;
|
||||
if(actuallyread != readthisamountnow) {
|
||||
failf(data, "Could only read %d bytes from the input\n",
|
||||
passed);
|
||||
return CURLE_READ_ERROR;
|
||||
}
|
||||
} while(passed != data->resume_from); /* loop until done */
|
||||
|
||||
/* now, decrease the size of the read */
|
||||
if(data->infilesize>0) {
|
||||
data->infilesize -= data->resume_from;
|
||||
|
||||
if(data->infilesize <= 0) {
|
||||
failf(data, "File already completely uploaded\n");
|
||||
return CURLE_PARTIAL_FILE;
|
||||
}
|
||||
}
|
||||
/* we've passed, proceed as normal */
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
send_buffer *req_buffer;
|
||||
struct curl_slist *headers=data->headers;
|
||||
|
@@ -444,10 +444,14 @@ _Transfer(struct connectdata *c_conn)
|
||||
write a chunk of the body */
|
||||
if(conn->protocol&PROT_HTTP) {
|
||||
/* HTTP-only checks */
|
||||
if (data->resume_from && !content_range ) {
|
||||
if (data->resume_from &&
|
||||
!content_range &&
|
||||
(data->httpreq==HTTPREQ_GET)) {
|
||||
/* we wanted to resume a download, although the server
|
||||
doesn't seem to support this */
|
||||
failf (data, "HTTP server doesn't seem to support byte ranges. Cannot resume.");
|
||||
doesn't seem to support this and we did this with a GET
|
||||
(if it wasn't a GET we did a POST or PUT resume) */
|
||||
failf (data, "HTTP server doesn't seem to support "
|
||||
"byte ranges. Cannot resume.");
|
||||
return CURLE_HTTP_RANGE_ERROR;
|
||||
}
|
||||
else if (data->newurl) {
|
||||
|
@@ -301,6 +301,8 @@ CURLcode curl_open(CURL **curl, char *url)
|
||||
|
||||
data->current_speed = -1; /* init to negative == impossible */
|
||||
|
||||
data->httpreq = HTTPREQ_GET; /* Default HTTP request */
|
||||
|
||||
*curl = data;
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -340,6 +342,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
break;
|
||||
case CURLOPT_POST:
|
||||
data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
|
||||
data->httpreq = HTTPREQ_POST;
|
||||
break;
|
||||
case CURLOPT_FILETIME:
|
||||
data->bits.get_filetime = va_arg(param, long)?TRUE:FALSE;
|
||||
@@ -361,19 +364,17 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
break;
|
||||
case CURLOPT_PUT:
|
||||
data->bits.http_put = va_arg(param, long)?TRUE:FALSE;
|
||||
data->httpreq = HTTPREQ_PUT;
|
||||
break;
|
||||
case CURLOPT_MUTE:
|
||||
data->bits.mute = va_arg(param, long)?TRUE:FALSE;
|
||||
break;
|
||||
|
||||
case CURLOPT_TIMECONDITION:
|
||||
data->timecondition = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_TIMEVALUE:
|
||||
data->timevalue = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_SSLVERSION:
|
||||
data->ssl.version = va_arg(param, long);
|
||||
break;
|
||||
@@ -405,10 +406,12 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
|
||||
break;
|
||||
case CURLOPT_CUSTOMREQUEST:
|
||||
data->customrequest = va_arg(param, char *);
|
||||
data->httpreq = HTTPREQ_CUSTOM;
|
||||
break;
|
||||
case CURLOPT_HTTPPOST:
|
||||
data->httppost = va_arg(param, struct HttpPost *);
|
||||
data->bits.http_formpost = data->httppost?1:0;
|
||||
data->httpreq = HTTPREQ_POST_FORM;
|
||||
break;
|
||||
case CURLOPT_INFILE:
|
||||
data->in = va_arg(param, FILE *);
|
||||
|
@@ -278,9 +278,25 @@ struct FTP {
|
||||
char *file; /* decoded file */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
HTTPREQ_NONE, /* first in list */
|
||||
HTTPREQ_GET,
|
||||
HTTPREQ_POST,
|
||||
HTTPREQ_POST_FORM, /* we make a difference internally */
|
||||
HTTPREQ_PUT,
|
||||
HTTPREQ_CUSTOM,
|
||||
HTTPREQ_LAST /* last in list */
|
||||
} Curl_HttpReq;
|
||||
|
||||
/* This struct is for boolean settings that define how to behave during
|
||||
this session. */
|
||||
struct Configbits {
|
||||
/* these four request types mirror the httpreq field */
|
||||
bool http_formpost;
|
||||
bool http_post;
|
||||
bool http_put;
|
||||
bool http_get;
|
||||
|
||||
bool get_filetime;
|
||||
bool tunnel_thru_httpproxy;
|
||||
bool ftp_append;
|
||||
@@ -290,10 +306,7 @@ struct Configbits {
|
||||
bool hide_progress;
|
||||
bool http_fail_on_error;
|
||||
bool http_follow_location;
|
||||
bool http_formpost;
|
||||
bool http_include_header;
|
||||
bool http_post;
|
||||
bool http_put;
|
||||
bool http_set_referer;
|
||||
bool http_auto_referer; /* set "correct" referer when following location: */
|
||||
bool httpproxy;
|
||||
@@ -308,7 +321,6 @@ struct Configbits {
|
||||
bool verbose;
|
||||
bool this_is_a_follow; /* this is a followed Location: request */
|
||||
bool krb4; /* kerberos4 connection requested */
|
||||
|
||||
bool proxystringalloc; /* the http proxy string is malloc()'ed */
|
||||
bool rangestringalloc; /* the range string is malloc()'ed */
|
||||
bool urlstringalloc; /* the URL string is malloc()'ed */
|
||||
@@ -481,6 +493,8 @@ struct UrlData {
|
||||
TimeCond timecondition; /* kind of comparison */
|
||||
time_t timevalue; /* what time to compare with */
|
||||
|
||||
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
|
||||
|
||||
char *customrequest; /* http/ftp request to use */
|
||||
|
||||
char *headerbuff; /* allocated buffer to store headers in */
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#define CURL_NAME "curl"
|
||||
#define CURL_VERSION "7.6-pre4"
|
||||
#define CURL_VERSION "7.6"
|
||||
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
||||
|
Reference in New Issue
Block a user