Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix configure option handling #10

Merged
merged 4 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions generic/tclcurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
return TCL_ERROR;
}
break;
case 32:
if (SetoptCurlOffT(interp,curlHandle,CURLOPT_POSTFIELDSIZE_LARGE,
tableIndex,objv)) {
return TCL_ERROR;
}
break;
case 33:
if (SetoptChar(interp,curlHandle,
CURLOPT_FTPPORT,tableIndex,objv)) {
Expand Down Expand Up @@ -2237,8 +2243,7 @@ SetoptLong(Tcl_Interp *interp,CURL *curlHandle,CURLoption opt,
*
* curlSetoptCurlOffT --
*
* Set the curl options that require a curl_off_t, even if we really
* use a long to do it. (Cutting and pasting at its worst)
* Set the curl options that require a curl_off_t
*
* Parameter:
* interp: The interpreter we are working with.
Expand All @@ -2254,17 +2259,17 @@ SetoptLong(Tcl_Interp *interp,CURL *curlHandle,CURLoption opt,
int
SetoptCurlOffT(Tcl_Interp *interp,CURL *curlHandle,CURLoption opt,
int tableIndex,Tcl_Obj *tclObj) {
long longNumber;
Tcl_WideInt wideNumber;
char *parPtr;

if (Tcl_GetLongFromObj(interp,tclObj,&longNumber)) {
if (Tcl_GetWideIntFromObj(interp,tclObj,&wideNumber)) {
parPtr=curlstrdup(Tcl_GetString(tclObj));
curlErrorSetOpt(interp,configTable,tableIndex,parPtr);
Tcl_Free(parPtr);
return 1;
}

if (curl_easy_setopt(curlHandle,opt,(curl_off_t)longNumber)) {
if (curl_easy_setopt(curlHandle,opt,(curl_off_t)wideNumber)) {
parPtr=curlstrdup(Tcl_GetString(tclObj));
curlErrorSetOpt(interp,configTable,tableIndex,parPtr);
Tcl_Free(parPtr);
Expand Down
16 changes: 8 additions & 8 deletions generic/tclcurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ CONST static char *optionTable[] = {
"CURLOPT_FOLLOWLOCATION","CURLOPT_TRANSFERTEXT", "CURLOPT_PUT",
"CURLOPT_MUTE", "CURLOPT_USERPWD", "CURLOPT_PROXYUSERPWD",
"CURLOPT_RANGE", "CURLOPT_ERRORBUFFER", "CURLOPT_HTTPGET",
"CURLOPT_POST", "CURLOPT_POSTFIELDS", "CURLOPT_POSTFIELDSIZE",
"CURLOPT_POST", "CURLOPT_POSTFIELDS", "CURLOPT_POSTFIELDSIZE_LARGE",
"CURLOPT_FTPPORT", "CURLOPT_COOKIE", "CURLOPT_COOKIEFILE",
"CURLOPT_HTTPHEADER", "CURLOPT_HTTPPOST", "CURLOPT_SSLCERT",
"CURLOPT_SSLCERTPASSWD", "CURLOPT_SSLVERSION", "CURLOPT_CRLF",
Expand Down Expand Up @@ -191,13 +191,13 @@ CONST static char *optionTable[] = {
"CURLOPT_POSTREDIR", "CURLOPT_USERNAME", "CURLOPT_PASSWORD",
"CURLOPT_PROXYUSERNAME", "CURLOPT_PROXYPASSWORD", "CURLOPT_TFTP_BLKSIZE",
"CURLOPT_SOCKS5_GSSAPI_SERVICE", "CURLOPT_SOCKS5_GSSAPI_NEC",
"CURLOPT_PROTOCOLS", "CURLOPT_REDIR_PROTOCOLS","CURLOPT_FTP_SSL_CC",
"CURLOPT_PROTOCOLS", "CURLOPT_REDIR_PROTOCOLS","CURLOPT_FTP_SSL_CCC",
"CURLOPT_SSH_KNOWNHOSTS", "CURLOPT_SSH_KEYFUNCTION","CURLOPT_MAIL_FROM",
"CURLOPT_MAIL_RCPT", "CURLOPT_FTP_USE_PRET", "CURLOPT_WILDCARDMATCH",
"CURLOPT_CHUNK_BGN_PROC", "CURLOPT_CHUNK_BGN_VAR", "CURLOPT_CHUNK_END_PROC",
"CURLOPT_FNMATCH_PROC", "CURLOPT_RESOLVE", "CURLOPT_TLSAUTH_USERNAME",
"CURLOPT_TLSAUTH_PASSWORD","CURLOPT_GSSAPI_DELEGATION", "CURLOPT_NOPROXY",
"CURLOPT_TELNETOPTIONS",
"CURLOPT_TLSAUTH_PASSWORD", "CURLOPT_TLSAUTH_TYPE", "CURLOPT_TRANSFER_ENCODING",
"CURLOPT_GSSAPI_DELEGATION", "CURLOPT_NOPROXY", "CURLOPT_TELNETOPTIONS",
(char *)NULL
};

Expand All @@ -212,7 +212,7 @@ CONST static char *configTable[] = {
"-followlocation", "-transfertext", "-put",
"-mute", "-userpwd", "-proxyuserpwd",
"-range", "-errorbuffer", "-httpget",
"-post", "-postfields", "-postfieldssize",
"-post", "-postfields", "-postfieldsize",
"-ftpport", "-cookie", "-cookiefile",
"-httpheader", "-httppost", "-sslcert",
"-sslcertpasswd", "-sslversion", "-crlf",
Expand Down Expand Up @@ -256,13 +256,13 @@ CONST static char *configTable[] = {
"-certinfo", "-postredir", "-username",
"-password", "-proxyuser", "-proxypassword",
"-tftpblksize", "-socks5gssapiservice","-socks5gssapinec",
"-protocols", "-redirprotocols", "-ftpsslcc",
"-protocols", "-redirprotocols", "-ftpsslccc",
"-sshknownhosts", "-sshkeyproc", "-mailfrom",
"-mailrcpt", "-ftpusepret", "-wildcardmatch",
"-chunkbgnproc", "-chunkbgnvar", "-chunkendproc",
"-fnmatchproc", "-resolve", "-tlsauthusername",
"-tlsauthpassword", "-gssapidelegation", "-noproxy",
"-telnetoptions",
"-tlsauthpassword", "-tlsauthtype", "-transferencoding",
"-gssapidelegation", "-noproxy", "-telnetoptions",
(char *) NULL
};

Expand Down