Fossil SCM
Unify use of the user-agent string.
Commit
55c91af5ade4aa64482fae081269d2f52ad2fd7e
Parent
a60d2976ff922a0…
3 files changed
+1
-2
+10
+1
-2
+1
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -110,12 +110,11 @@ | ||
| 110 | 110 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | 111 | fossil_free(zEncoded); |
| 112 | 112 | fossil_free(zCredentials); |
| 113 | 113 | } |
| 114 | 114 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | - blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION | |
| 116 | - " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); | |
| 115 | + blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); | |
| 117 | 116 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 118 | 117 | if( g.fHttpTrace ){ |
| 119 | 118 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 120 | 119 | }else{ |
| 121 | 120 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 122 | 121 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -110,12 +110,11 @@ | |
| 110 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | fossil_free(zEncoded); |
| 112 | fossil_free(zCredentials); |
| 113 | } |
| 114 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION |
| 116 | " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); |
| 117 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 118 | if( g.fHttpTrace ){ |
| 119 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 120 | }else{ |
| 121 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 122 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -110,12 +110,11 @@ | |
| 110 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | fossil_free(zEncoded); |
| 112 | fossil_free(zCredentials); |
| 113 | } |
| 114 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); |
| 116 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 117 | if( g.fHttpTrace ){ |
| 118 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 119 | }else{ |
| 120 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 121 |
+10
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -837,10 +837,20 @@ | ||
| 837 | 837 | const char *get_version(){ |
| 838 | 838 | static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " |
| 839 | 839 | MANIFEST_DATE " UTC"; |
| 840 | 840 | return version; |
| 841 | 841 | } |
| 842 | + | |
| 843 | +/* | |
| 844 | +** This function returns the user-agent string for Fossil, for | |
| 845 | +** use in HTTP(S) requests. | |
| 846 | +*/ | |
| 847 | +const char *get_user_agent(){ | |
| 848 | + static const char version[] = "Fossil/" RELEASE_VERSION " (" MANIFEST_DATE | |
| 849 | + " " MANIFEST_VERSION ")"; | |
| 850 | + return version; | |
| 851 | +} | |
| 842 | 852 | |
| 843 | 853 | /* |
| 844 | 854 | ** COMMAND: version |
| 845 | 855 | ** |
| 846 | 856 | ** Usage: %fossil version ?-verbose|-v? |
| 847 | 857 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -837,10 +837,20 @@ | |
| 837 | const char *get_version(){ |
| 838 | static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " |
| 839 | MANIFEST_DATE " UTC"; |
| 840 | return version; |
| 841 | } |
| 842 | |
| 843 | /* |
| 844 | ** COMMAND: version |
| 845 | ** |
| 846 | ** Usage: %fossil version ?-verbose|-v? |
| 847 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -837,10 +837,20 @@ | |
| 837 | const char *get_version(){ |
| 838 | static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " |
| 839 | MANIFEST_DATE " UTC"; |
| 840 | return version; |
| 841 | } |
| 842 | |
| 843 | /* |
| 844 | ** This function returns the user-agent string for Fossil, for |
| 845 | ** use in HTTP(S) requests. |
| 846 | */ |
| 847 | const char *get_user_agent(){ |
| 848 | static const char version[] = "Fossil/" RELEASE_VERSION " (" MANIFEST_DATE |
| 849 | " " MANIFEST_VERSION ")"; |
| 850 | return version; |
| 851 | } |
| 852 | |
| 853 | /* |
| 854 | ** COMMAND: version |
| 855 | ** |
| 856 | ** Usage: %fossil version ?-verbose|-v? |
| 857 |
+1
-2
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -914,12 +914,11 @@ | ||
| 914 | 914 | blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded); |
| 915 | 915 | fossil_free(zEncoded); |
| 916 | 916 | fossil_free(zCredentials); |
| 917 | 917 | } |
| 918 | 918 | blob_appendf(&hdr, "Host: %s\r\n" |
| 919 | - "User-Agent: Fossil/" RELEASE_VERSION " (" MANIFEST_DATE | |
| 920 | - " " MANIFEST_VERSION ")\r\n", urlData.hostname); | |
| 919 | + "User-Agent: %s\r\n", urlData.hostname, get_user_agent()); | |
| 921 | 920 | if( zType[0]=='P' ){ |
| 922 | 921 | blob_appendf(&hdr, "Content-Type: application/x-www-form-urlencoded\r\n" |
| 923 | 922 | "Content-Length: %d\r\n\r\n", blob_size(&payload)); |
| 924 | 923 | }else{ |
| 925 | 924 | blob_appendf(&hdr, "\r\n"); |
| 926 | 925 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -914,12 +914,11 @@ | |
| 914 | blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded); |
| 915 | fossil_free(zEncoded); |
| 916 | fossil_free(zCredentials); |
| 917 | } |
| 918 | blob_appendf(&hdr, "Host: %s\r\n" |
| 919 | "User-Agent: Fossil/" RELEASE_VERSION " (" MANIFEST_DATE |
| 920 | " " MANIFEST_VERSION ")\r\n", urlData.hostname); |
| 921 | if( zType[0]=='P' ){ |
| 922 | blob_appendf(&hdr, "Content-Type: application/x-www-form-urlencoded\r\n" |
| 923 | "Content-Length: %d\r\n\r\n", blob_size(&payload)); |
| 924 | }else{ |
| 925 | blob_appendf(&hdr, "\r\n"); |
| 926 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -914,12 +914,11 @@ | |
| 914 | blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded); |
| 915 | fossil_free(zEncoded); |
| 916 | fossil_free(zCredentials); |
| 917 | } |
| 918 | blob_appendf(&hdr, "Host: %s\r\n" |
| 919 | "User-Agent: %s\r\n", urlData.hostname, get_user_agent()); |
| 920 | if( zType[0]=='P' ){ |
| 921 | blob_appendf(&hdr, "Content-Type: application/x-www-form-urlencoded\r\n" |
| 922 | "Content-Length: %d\r\n\r\n", blob_size(&payload)); |
| 923 | }else{ |
| 924 | blob_appendf(&hdr, "\r\n"); |
| 925 |