]> git.sven.stormbind.net Git - sven/tclcurl.git/commitdiff
New upstream version 7.22.0+hg20160822 upstream upstream/7.22.0+hg20160822
authorSven Hoexter <sven@timegate.de>
Sun, 4 Sep 2016 14:47:19 +0000 (16:47 +0200)
committerSven Hoexter <sven@timegate.de>
Sun, 4 Sep 2016 14:47:19 +0000 (16:47 +0200)
.hg_archival.txt
doc/tclcurl.html
doc/tclcurl.n
generic/tclcurl.c
generic/tclcurl.h

index 98a7ef7af0c5765338eb6dc64f5358d8403c962e..f9ee62155d0a5d2171976ef4ae87de88512d98cf 100644 (file)
@@ -1,5 +1,6 @@
 repo: 11ea73a1b3c3793635669d40e602ff7f52f53e3a
-node: b5bc0662447d3c92cc8d30e637e5a25457eac077
+node: 475f63137a7ecb3e8528e279ab66c0e59c16ab43
 branch: default
 latesttag: null
-latesttagdistance: 13
+latesttagdistance: 18
+changessincelatesttag: 19
index 57582414b3bf6cd9b91142c5efdbbabe5576720f..9fe96c867574baf950bf328d93d21c6f31b1ffe7 100755 (executable)
@@ -1244,6 +1244,18 @@ Enforce HTTP 1.0 requests.
 
 <DD>
 Enforce HTTP 1.1 requests.
+<DT><B>2.0</B>
+
+<DD>
+Enforce HTTP version 2 requests.
+<DT><B>2TLS</B>
+
+<DD>
+Enforce version 2 requests for HTTPS, version 1.1 for HTTP.
+<DT><B>2_PRIOR_KNOWLEDGE</B>
+
+<DD>
+Enforce HTTP 2 requests without performing HTTP/1.1 Upgrade first.
 </DL>
 </DL>
 
index 6e7227a04058c35ada9552ed15c0e7b9c0aeed37..59fce53278a88ddf86fc7ae22e30e014c3906a9b 100755 (executable)
@@ -1047,6 +1047,15 @@ Enforce HTTP 1.0 requests.
 .TP
 .B 1.1
 Enforce HTTP 1.1 requests.
+.TP
+.B 2.0
+Enforce HTTP version 2 requests.
+.TP
+.B 2TLS
+Enforce version 2 requests for HTTPS, version 1.1 for HTTP.
+.TP
+.B 2_PRIOR_KNOWLEDGE
+Enforce HTTP 2 requests without performing HTTP/1.1 Upgrade first.
 .RE
 
 .TP
index 21c947cd369afb3b27c16b606d46a48dc192b5af..5e0a85143ab71dc9e4f56b3ffc77ab7533f23027 100755 (executable)
@@ -87,7 +87,7 @@ curlCreateObjCmd (Tcl_Interp *interp,struct curlObjData  *curlData) {
     Tcl_Command         cmdToken;
 
     /* We try with curl1, if it already exists with curl2...*/
-    handleName=(char *)Tcl_Alloc(10);
+    handleName=(char *)Tcl_Alloc(32);
     for (i=1;;i++) {
         sprintf(handleName,"curl%d",i);
         if (!Tcl_GetCommandInfo(interp,handleName,&info)) {
@@ -465,6 +465,12 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
         case 1:
             Tcl_Free(curlData->outFile);
             curlData->outFile=curlstrdup(Tcl_GetString(objv));
+            if (curlData->outFlag) {
+                if (curlData->outHandle!=NULL) {
+                    fclose(curlData->outHandle);
+                    curlData->outHandle=NULL;
+                }
+            }
             if ((strcmp(curlData->outFile,""))&&(strcmp(curlData->outFile,"stdout"))) {
                 curlData->outFlag=1;
             } else {
@@ -477,6 +483,12 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
         case 2:
             Tcl_Free(curlData->inFile);
             curlData->inFile=curlstrdup(Tcl_GetString(objv));
+            if (curlData->inFlag) {
+                if (curlData->inHandle!=NULL) {
+                    fclose(curlData->inHandle);
+                    curlData->inHandle=NULL;
+                }
+            }
             if ((strcmp(curlData->inFile,""))&&(strcmp(curlData->inFile,"stdin"))) {
                 curlData->inFlag=1;
             } else {
@@ -908,6 +920,13 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
         case 44:
             Tcl_Free(curlData->headerFile);
             curlData->headerFile=curlstrdup(Tcl_GetString(objv));
+            if (curlData->headerFlag) {
+                if (curlData->headerHandle!=NULL) {
+                    fclose(curlData->headerHandle);
+                    curlData->headerHandle=NULL;
+                }
+                curl_easy_setopt(curlHandle,CURLOPT_HEADERDATA,NULL);
+            }
             if ((strcmp(curlData->headerFile,""))&&(strcmp(curlData->headerFile,"stdout"))
                     &&(strcmp(curlData->headerFile,"stderr"))) {
                 curlData->headerFlag=1;
@@ -1029,6 +1048,14 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
             }
             break;
         case 61:
+            if (curlData->headerFlag) {
+                if (curlData->headerHandle!=NULL) {
+                    fclose(curlData->headerHandle);
+                    curlData->headerHandle=NULL;
+                }
+                curl_easy_setopt(curlHandle,CURLOPT_HEADERDATA,NULL);
+                curlData->headerFlag=0;
+            }
             if (curl_easy_setopt(curlHandle,CURLOPT_HEADERFUNCTION,
                     curlHeaderReader)) {
                 return TCL_ERROR;
@@ -1043,6 +1070,14 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
         case 62:
             Tcl_Free(curlData->bodyVarName);
             curlData->bodyVarName=curlstrdup(Tcl_GetString(objv));
+            if (curlData->outFlag) {
+                if (curlData->outHandle!=NULL) {
+                    fclose(curlData->outHandle);
+                    curlData->outHandle=NULL;
+                }
+                curl_easy_setopt(curlHandle,CURLOPT_WRITEDATA,NULL);
+            }
+            curlData->outFlag=0;
             if (curl_easy_setopt(curlHandle,CURLOPT_WRITEFUNCTION,
                     curlBodyReader)) {
                 return TCL_ERROR;
@@ -1080,6 +1115,13 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
             break;
         case 65:
             curlData->writeProc=curlstrdup(Tcl_GetString(objv));
+            if (curlData->outFlag) {
+                if (curlData->outHandle!=NULL) {
+                    fclose(curlData->outHandle);
+                    curlData->outHandle=NULL;
+                }
+                curl_easy_setopt(curlHandle,CURLOPT_WRITEDATA,NULL);
+           }
             curlData->outFlag=0;
             if (curl_easy_setopt(curlHandle,CURLOPT_WRITEFUNCTION,
                     curlWriteProcInvoke)) {
@@ -1093,6 +1135,13 @@ curlSetOpts(Tcl_Interp *interp, struct curlObjData *curlData,
             break;
         case 66:
             curlData->readProc=curlstrdup(Tcl_GetString(objv));
+            if (curlData->inFlag) {
+                if (curlData->inHandle!=NULL) {
+                    fclose(curlData->inHandle);
+                    curlData->inHandle=NULL;
+                }
+                curl_easy_setopt(curlHandle,CURLOPT_READDATA,NULL);
+            }
             curlData->inFlag=0;
             if (strcmp(curlData->readProc,"")) {
                 if (curl_easy_setopt(curlHandle,CURLOPT_READFUNCTION,
@@ -2418,12 +2467,14 @@ curlHeaderReader(void *ptr,size_t size,size_t nmemb,FILE *curlDataPtr) {
         headerContent[charLength]=0;
         /* There may be multiple 'Set-Cookie' headers, so we use a list */
         if (Tcl_StringCaseMatch(headerName,"Set-Cookie",1)) {
-            Tcl_SetVar2(curlData->interp,curlData->headerVar,headerName, \
+            Tcl_SetVar2(curlData->interp,curlData->headerVar,headerName,
                     headerContent,TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
         } else {
             Tcl_SetVar2(curlData->interp,curlData->headerVar,headerName,
                     headerContent,0);
         }
+        Tcl_Free(headerContent);
+        Tcl_Free(headerName);
     }
     regExp=Tcl_RegExpCompile(curlData->interp,"(^(HTTP|http)[^\r]+)(\r*)(\n)");
     match=Tcl_RegExpExec(curlData->interp,regExp,header,header);
@@ -2436,6 +2487,7 @@ curlHeaderReader(void *ptr,size_t size,size_t nmemb,FILE *curlDataPtr) {
 
         Tcl_SetVar2(curlData->interp,curlData->headerVar,"http",
                 httpStatus,0);
+       Tcl_Free(httpStatus);
     }
     return size*nmemb;
 }
@@ -4138,7 +4190,7 @@ curlCreateShareObjCmd (Tcl_Interp *interp,struct shcurlObjData  *shcurlData) {
     Tcl_Command         cmdToken;
 
     /* We try with scurl1, if it already exists with scurl2...*/
-    shandleName=(char *)Tcl_Alloc(10);
+    shandleName=(char *)Tcl_Alloc(32);
     for (i=1;;i++) {
         sprintf(shandleName,"scurl%d",i);
         if (!Tcl_GetCommandInfo(interp,shandleName,&info)) {
index acbee1f1dd73a0cfe0c02c515059b1f46e71a9db..b235d58d09ea735034ce974c544b716a50530c5f 100755 (executable)
@@ -294,7 +294,13 @@ CONST static char   *curlFormTable[]={
 };
 
 CONST static char   *httpVersionTable[] = {
-    "none", "1.0", "1.1", (char *)NULL
+    "none",  /* CURL_HTTP_VERSION_NONE */
+    "1.0",  /* CURL_HTTP_VERSION_1_0 */
+    "1.1",  /* CURL_HTTP_VERSION_1_1 */
+    "2.0",  /* CURL_HTTP_VERSION_2_0 */
+    "2TLS",  /* CURL_HTTP_VERSION_2TLS */
+    "2_PRIOR_KNOWLEDGE",  /* CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE */
+    (char *)NULL
 };
 
 CONST static char *netrcTable[] = {