Fossil SCM
Rename the HTTP header variable used by httpCmd back to hdr for consistency with other code.
Commit
e44932b12c8d145dde09a414827fac847a2d3dd6
Parent
0fe1771a766c19a…
1 file changed
+11
-11
+11
-11
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -845,11 +845,11 @@ | ||
| 845 | 845 | int argc, |
| 846 | 846 | const char **argv, |
| 847 | 847 | int *argl |
| 848 | 848 | ){ |
| 849 | 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | - Blob header, payload; | |
| 850 | + Blob hdr, payload; | |
| 851 | 851 | ReCompiled *pRe = 0; |
| 852 | 852 | UrlData urlData; |
| 853 | 853 | |
| 854 | 854 | if( argc>1 && fossil_strnicmp(argv[1], "-asynchronous\0", 14) ){ |
| 855 | 855 | Th_ErrorMessage(interp, |
| @@ -889,34 +889,34 @@ | ||
| 889 | 889 | re_free(pRe); |
| 890 | 890 | if( transport_open(&urlData) ){ |
| 891 | 891 | Th_ErrorMessage(interp, transport_errmsg(&urlData), 0, 0); |
| 892 | 892 | return TH_ERROR; |
| 893 | 893 | } |
| 894 | - blob_zero(&header); | |
| 894 | + blob_zero(&hdr); | |
| 895 | 895 | if( strlen(urlData.path)>0 && zParams!=argv[1] ){ |
| 896 | 896 | zSep = ""; |
| 897 | 897 | }else{ |
| 898 | 898 | zSep = "/"; |
| 899 | 899 | } |
| 900 | - blob_appendf(&header, "%s %s%s%s HTTP/1.0\r\n", | |
| 900 | + blob_appendf(&hdr, "%s %s%s%s HTTP/1.0\r\n", | |
| 901 | 901 | zType, zSep, urlData.path, zParams ? zParams : ""); |
| 902 | 902 | if( urlData.proxyAuth ){ |
| 903 | - blob_appendf(&header, "Proxy-Authorization: %s\r\n", urlData.proxyAuth); | |
| 903 | + blob_appendf(&hdr, "Proxy-Authorization: %s\r\n", urlData.proxyAuth); | |
| 904 | 904 | } |
| 905 | 905 | if( urlData.passwd && urlData.user && urlData.passwd[0]=='#' ){ |
| 906 | 906 | char *zCredentials = mprintf("%s:%s", urlData.user, &urlData.passwd[1]); |
| 907 | 907 | char *zEncoded = encode64(zCredentials, -1); |
| 908 | - blob_appendf(&header, "Authorization: Basic %s\r\n", zEncoded); | |
| 908 | + blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded); | |
| 909 | 909 | fossil_free(zEncoded); |
| 910 | 910 | fossil_free(zCredentials); |
| 911 | 911 | } |
| 912 | - blob_appendf(&header, "Host: %s\r\n", urlData.hostname); | |
| 913 | - blob_appendf(&header, "User-Agent: Fossil/" RELEASE_VERSION | |
| 914 | - " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); | |
| 915 | - blob_appendf(&header, "Content-Type: text/plain\r\n"); | |
| 916 | - blob_appendf(&header, "Content-Length: %d\r\n\r\n", blob_size(&payload)); | |
| 917 | - transport_send(&urlData, &header); | |
| 912 | + blob_appendf(&hdr, "Host: %s\r\n", urlData.hostname); | |
| 913 | + blob_appendf(&hdr, "User-Agent: Fossil/" RELEASE_VERSION | |
| 914 | + " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); | |
| 915 | + blob_appendf(&hdr, "Content-Type: text/plain\r\n"); | |
| 916 | + blob_appendf(&hdr, "Content-Length: %d\r\n\r\n", blob_size(&payload)); | |
| 917 | + transport_send(&urlData, &hdr); | |
| 918 | 918 | transport_send(&urlData, &payload); |
| 919 | 919 | transport_close(&urlData); |
| 920 | 920 | Th_SetResult(interp, 0, 0); /* NOTE: Asynchronous, no results yet. */ |
| 921 | 921 | return TH_OK; |
| 922 | 922 | } |
| 923 | 923 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -845,11 +845,11 @@ | |
| 845 | int argc, |
| 846 | const char **argv, |
| 847 | int *argl |
| 848 | ){ |
| 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | Blob header, payload; |
| 851 | ReCompiled *pRe = 0; |
| 852 | UrlData urlData; |
| 853 | |
| 854 | if( argc>1 && fossil_strnicmp(argv[1], "-asynchronous\0", 14) ){ |
| 855 | Th_ErrorMessage(interp, |
| @@ -889,34 +889,34 @@ | |
| 889 | re_free(pRe); |
| 890 | if( transport_open(&urlData) ){ |
| 891 | Th_ErrorMessage(interp, transport_errmsg(&urlData), 0, 0); |
| 892 | return TH_ERROR; |
| 893 | } |
| 894 | blob_zero(&header); |
| 895 | if( strlen(urlData.path)>0 && zParams!=argv[1] ){ |
| 896 | zSep = ""; |
| 897 | }else{ |
| 898 | zSep = "/"; |
| 899 | } |
| 900 | blob_appendf(&header, "%s %s%s%s HTTP/1.0\r\n", |
| 901 | zType, zSep, urlData.path, zParams ? zParams : ""); |
| 902 | if( urlData.proxyAuth ){ |
| 903 | blob_appendf(&header, "Proxy-Authorization: %s\r\n", urlData.proxyAuth); |
| 904 | } |
| 905 | if( urlData.passwd && urlData.user && urlData.passwd[0]=='#' ){ |
| 906 | char *zCredentials = mprintf("%s:%s", urlData.user, &urlData.passwd[1]); |
| 907 | char *zEncoded = encode64(zCredentials, -1); |
| 908 | blob_appendf(&header, "Authorization: Basic %s\r\n", zEncoded); |
| 909 | fossil_free(zEncoded); |
| 910 | fossil_free(zCredentials); |
| 911 | } |
| 912 | blob_appendf(&header, "Host: %s\r\n", urlData.hostname); |
| 913 | blob_appendf(&header, "User-Agent: Fossil/" RELEASE_VERSION |
| 914 | " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); |
| 915 | blob_appendf(&header, "Content-Type: text/plain\r\n"); |
| 916 | blob_appendf(&header, "Content-Length: %d\r\n\r\n", blob_size(&payload)); |
| 917 | transport_send(&urlData, &header); |
| 918 | transport_send(&urlData, &payload); |
| 919 | transport_close(&urlData); |
| 920 | Th_SetResult(interp, 0, 0); /* NOTE: Asynchronous, no results yet. */ |
| 921 | return TH_OK; |
| 922 | } |
| 923 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -845,11 +845,11 @@ | |
| 845 | int argc, |
| 846 | const char **argv, |
| 847 | int *argl |
| 848 | ){ |
| 849 | const char *zSep, *zType, *zRegexp, *zParams; |
| 850 | Blob hdr, payload; |
| 851 | ReCompiled *pRe = 0; |
| 852 | UrlData urlData; |
| 853 | |
| 854 | if( argc>1 && fossil_strnicmp(argv[1], "-asynchronous\0", 14) ){ |
| 855 | Th_ErrorMessage(interp, |
| @@ -889,34 +889,34 @@ | |
| 889 | re_free(pRe); |
| 890 | if( transport_open(&urlData) ){ |
| 891 | Th_ErrorMessage(interp, transport_errmsg(&urlData), 0, 0); |
| 892 | return TH_ERROR; |
| 893 | } |
| 894 | blob_zero(&hdr); |
| 895 | if( strlen(urlData.path)>0 && zParams!=argv[1] ){ |
| 896 | zSep = ""; |
| 897 | }else{ |
| 898 | zSep = "/"; |
| 899 | } |
| 900 | blob_appendf(&hdr, "%s %s%s%s HTTP/1.0\r\n", |
| 901 | zType, zSep, urlData.path, zParams ? zParams : ""); |
| 902 | if( urlData.proxyAuth ){ |
| 903 | blob_appendf(&hdr, "Proxy-Authorization: %s\r\n", urlData.proxyAuth); |
| 904 | } |
| 905 | if( urlData.passwd && urlData.user && urlData.passwd[0]=='#' ){ |
| 906 | char *zCredentials = mprintf("%s:%s", urlData.user, &urlData.passwd[1]); |
| 907 | char *zEncoded = encode64(zCredentials, -1); |
| 908 | blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded); |
| 909 | fossil_free(zEncoded); |
| 910 | fossil_free(zCredentials); |
| 911 | } |
| 912 | blob_appendf(&hdr, "Host: %s\r\n", urlData.hostname); |
| 913 | blob_appendf(&hdr, "User-Agent: Fossil/" RELEASE_VERSION |
| 914 | " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); |
| 915 | blob_appendf(&hdr, "Content-Type: text/plain\r\n"); |
| 916 | blob_appendf(&hdr, "Content-Length: %d\r\n\r\n", blob_size(&payload)); |
| 917 | transport_send(&urlData, &hdr); |
| 918 | transport_send(&urlData, &payload); |
| 919 | transport_close(&urlData); |
| 920 | Th_SetResult(interp, 0, 0); /* NOTE: Asynchronous, no results yet. */ |
| 921 | return TH_OK; |
| 922 | } |
| 923 |