Fossil SCM

Move the SSH shared account code back to the branch to keep the development of this new feature separate.

andybradford 2013-09-07 21:50 UTC ssh-test-http
Commit 56169d0775ca4bb46179df0b834881ec4fffeb12
+3 -3
--- src/cgi.c
+++ src/cgi.c
@@ -460,15 +460,15 @@
460460
*/
461461
void cgi_replace_parameter(const char *zName, const char *zValue){
462462
int i;
463463
for(i=0; i<nUsedQP; i++){
464464
if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
465
- aParamQP[i].zValue = mprintf("%s",zValue);
465
+ aParamQP[i].zValue = zValue;
466466
return;
467467
}
468468
}
469
- cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0);
469
+ cgi_set_parameter_nocopy(zName, zValue, 0);
470470
}
471471
472472
/*
473473
** Add a query parameter. The zName portion is fixed but a copy
474474
** must be made of zValue.
@@ -1391,11 +1391,11 @@
13911391
for(i=0; zToken[i] && zToken[i]!='?'; i++){}
13921392
if( zToken[i] ) zToken[i++] = 0;
13931393
if( nCycles==0 ){
13941394
cgi_setenv("PATH_INFO", zToken);
13951395
}else{
1396
- cgi_replace_parameter("PATH_INFO", zToken);
1396
+ cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken));
13971397
}
13981398
13991399
/* Get all the optional fields that follow the first line.
14001400
*/
14011401
while( fgets(zLine,sizeof(zLine),g.httpIn) ){
14021402
--- src/cgi.c
+++ src/cgi.c
@@ -460,15 +460,15 @@
460 */
461 void cgi_replace_parameter(const char *zName, const char *zValue){
462 int i;
463 for(i=0; i<nUsedQP; i++){
464 if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
465 aParamQP[i].zValue = mprintf("%s",zValue);
466 return;
467 }
468 }
469 cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0);
470 }
471
472 /*
473 ** Add a query parameter. The zName portion is fixed but a copy
474 ** must be made of zValue.
@@ -1391,11 +1391,11 @@
1391 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1392 if( zToken[i] ) zToken[i++] = 0;
1393 if( nCycles==0 ){
1394 cgi_setenv("PATH_INFO", zToken);
1395 }else{
1396 cgi_replace_parameter("PATH_INFO", zToken);
1397 }
1398
1399 /* Get all the optional fields that follow the first line.
1400 */
1401 while( fgets(zLine,sizeof(zLine),g.httpIn) ){
1402
--- src/cgi.c
+++ src/cgi.c
@@ -460,15 +460,15 @@
460 */
461 void cgi_replace_parameter(const char *zName, const char *zValue){
462 int i;
463 for(i=0; i<nUsedQP; i++){
464 if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){
465 aParamQP[i].zValue = zValue;
466 return;
467 }
468 }
469 cgi_set_parameter_nocopy(zName, zValue, 0);
470 }
471
472 /*
473 ** Add a query parameter. The zName portion is fixed but a copy
474 ** must be made of zValue.
@@ -1391,11 +1391,11 @@
1391 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1392 if( zToken[i] ) zToken[i++] = 0;
1393 if( nCycles==0 ){
1394 cgi_setenv("PATH_INFO", zToken);
1395 }else{
1396 cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken));
1397 }
1398
1399 /* Get all the optional fields that follow the first line.
1400 */
1401 while( fgets(zLine,sizeof(zLine),g.httpIn) ){
1402
+2 -12
--- src/clone.c
+++ src/clone.c
@@ -90,29 +90,27 @@
9090
** URL must be in one of the following form: ([...] mean optional)
9191
** HTTP/HTTPS protocol:
9292
** http[s]://[userid[:password]@]host[:port][/path]
9393
**
9494
** SSH protocol:
95
-** ssh://[userid[:password]@]host[:port]/path/to/repo.fossil
95
+** ssh://[userid[:password]@]host[:port]/path/to/repo.fossil\\
96
+** [?fossil=path/to/fossil.exe]
9697
**
9798
** Filesystem:
9899
** [file://]path/to/repo.fossil
99100
**
100101
** Note: For ssh and filesystem, path must have an extra leading
101102
** '/' to use an absolute path.
102103
**
103
-** Note: the userid for SSH is the SSH account, not the Fossil account.
104
-**
105104
** By default, your current login name is used to create the default
106105
** admin user. This can be overridden using the -A|--admin-user
107106
** parameter.
108107
**
109108
** Options:
110109
** --admin-user|-A USERNAME Make USERNAME the administrator
111110
** --private Also clone private branches
112111
** --ssl-identity=filename Use the SSL identity if requested by the server
113
-** --ssh-fossil|-f /fossil Use this path as remote fossil command
114112
** --ssh-command|-c 'command' Use this SSH command
115113
** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
116114
**
117115
** See also: init
118116
*/
@@ -199,18 +197,13 @@
199197
200198
/*
201199
** Look for SSH clone command line options and setup in globals.
202200
*/
203201
void clone_ssh_find_options(void){
204
- const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
205202
const char *zSshCmd; /* SSH command string */
206203
const char *zFossilUser; /* Fossil user if login specified for SSH */
207204
208
- zSshFossilCmd = find_option("ssh-fossil","f",1);
209
- if( zSshFossilCmd && zSshFossilCmd[0] ){
210
- g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
211
- }
212205
zSshCmd = find_option("ssh-command","c",1);
213206
if( zSshCmd && zSshCmd[0] ){
214207
g.zSshCmd = mprintf("%s", zSshCmd);
215208
}
216209
zFossilUser = find_option("ssh-fossil-user","l",1);
@@ -222,15 +215,12 @@
222215
/*
223216
** Set SSH options discovered in global variables (set from command line
224217
** options).
225218
*/
226219
void clone_ssh_db_set_options(void){
227
- if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
228
- db_set("ssh-fossil", g.zSshFossilCmd, 0);
229
- }
230220
if( g.zSshCmd && g.zSshCmd[0] ){
231221
db_set("ssh-command", g.zSshCmd, 0);
232222
}
233223
if( g.zFossilUser && g.zFossilUser[0] ){
234224
db_set("ssh-fossil-user", g.zFossilUser, 0);
235225
}
236226
}
237227
--- src/clone.c
+++ src/clone.c
@@ -90,29 +90,27 @@
90 ** URL must be in one of the following form: ([...] mean optional)
91 ** HTTP/HTTPS protocol:
92 ** http[s]://[userid[:password]@]host[:port][/path]
93 **
94 ** SSH protocol:
95 ** ssh://[userid[:password]@]host[:port]/path/to/repo.fossil
 
96 **
97 ** Filesystem:
98 ** [file://]path/to/repo.fossil
99 **
100 ** Note: For ssh and filesystem, path must have an extra leading
101 ** '/' to use an absolute path.
102 **
103 ** Note: the userid for SSH is the SSH account, not the Fossil account.
104 **
105 ** By default, your current login name is used to create the default
106 ** admin user. This can be overridden using the -A|--admin-user
107 ** parameter.
108 **
109 ** Options:
110 ** --admin-user|-A USERNAME Make USERNAME the administrator
111 ** --private Also clone private branches
112 ** --ssl-identity=filename Use the SSL identity if requested by the server
113 ** --ssh-fossil|-f /fossil Use this path as remote fossil command
114 ** --ssh-command|-c 'command' Use this SSH command
115 ** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
116 **
117 ** See also: init
118 */
@@ -199,18 +197,13 @@
199
200 /*
201 ** Look for SSH clone command line options and setup in globals.
202 */
203 void clone_ssh_find_options(void){
204 const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
205 const char *zSshCmd; /* SSH command string */
206 const char *zFossilUser; /* Fossil user if login specified for SSH */
207
208 zSshFossilCmd = find_option("ssh-fossil","f",1);
209 if( zSshFossilCmd && zSshFossilCmd[0] ){
210 g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
211 }
212 zSshCmd = find_option("ssh-command","c",1);
213 if( zSshCmd && zSshCmd[0] ){
214 g.zSshCmd = mprintf("%s", zSshCmd);
215 }
216 zFossilUser = find_option("ssh-fossil-user","l",1);
@@ -222,15 +215,12 @@
222 /*
223 ** Set SSH options discovered in global variables (set from command line
224 ** options).
225 */
226 void clone_ssh_db_set_options(void){
227 if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
228 db_set("ssh-fossil", g.zSshFossilCmd, 0);
229 }
230 if( g.zSshCmd && g.zSshCmd[0] ){
231 db_set("ssh-command", g.zSshCmd, 0);
232 }
233 if( g.zFossilUser && g.zFossilUser[0] ){
234 db_set("ssh-fossil-user", g.zFossilUser, 0);
235 }
236 }
237
--- src/clone.c
+++ src/clone.c
@@ -90,29 +90,27 @@
90 ** URL must be in one of the following form: ([...] mean optional)
91 ** HTTP/HTTPS protocol:
92 ** http[s]://[userid[:password]@]host[:port][/path]
93 **
94 ** SSH protocol:
95 ** ssh://[userid[:password]@]host[:port]/path/to/repo.fossil\\
96 ** [?fossil=path/to/fossil.exe]
97 **
98 ** Filesystem:
99 ** [file://]path/to/repo.fossil
100 **
101 ** Note: For ssh and filesystem, path must have an extra leading
102 ** '/' to use an absolute path.
103 **
 
 
104 ** By default, your current login name is used to create the default
105 ** admin user. This can be overridden using the -A|--admin-user
106 ** parameter.
107 **
108 ** Options:
109 ** --admin-user|-A USERNAME Make USERNAME the administrator
110 ** --private Also clone private branches
111 ** --ssl-identity=filename Use the SSL identity if requested by the server
 
112 ** --ssh-command|-c 'command' Use this SSH command
113 ** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
114 **
115 ** See also: init
116 */
@@ -199,18 +197,13 @@
197
198 /*
199 ** Look for SSH clone command line options and setup in globals.
200 */
201 void clone_ssh_find_options(void){
 
202 const char *zSshCmd; /* SSH command string */
203 const char *zFossilUser; /* Fossil user if login specified for SSH */
204
 
 
 
 
205 zSshCmd = find_option("ssh-command","c",1);
206 if( zSshCmd && zSshCmd[0] ){
207 g.zSshCmd = mprintf("%s", zSshCmd);
208 }
209 zFossilUser = find_option("ssh-fossil-user","l",1);
@@ -222,15 +215,12 @@
215 /*
216 ** Set SSH options discovered in global variables (set from command line
217 ** options).
218 */
219 void clone_ssh_db_set_options(void){
 
 
 
220 if( g.zSshCmd && g.zSshCmd[0] ){
221 db_set("ssh-command", g.zSshCmd, 0);
222 }
223 if( g.zFossilUser && g.zFossilUser[0] ){
224 db_set("ssh-fossil-user", g.zFossilUser, 0);
225 }
226 }
227
-3
--- src/db.c
+++ src/db.c
@@ -2136,11 +2136,10 @@
21362136
{ "proxy", 0, 32, 0, "off" },
21372137
{ "relative-paths",0, 0, 0, "on" },
21382138
{ "repo-cksum", 0, 0, 0, "on" },
21392139
{ "self-register", 0, 0, 0, "off" },
21402140
{ "ssh-command", 0, 40, 0, "" },
2141
- { "ssh-fossil", 0, 40, 0, "" },
21422141
{ "ssl-ca-location",0, 40, 0, "" },
21432142
{ "ssl-identity", 0, 40, 0, "" },
21442143
#ifdef FOSSIL_ENABLE_TCL
21452144
{ "tcl", 0, 0, 0, "off" },
21462145
{ "tcl-setup", 0, 40, 0, "" },
@@ -2308,12 +2307,10 @@
23082307
** users can not be deleted. Default: off.
23092308
**
23102309
** ssh-command Command used to talk to a remote machine with
23112310
** the "ssh://" protocol.
23122311
**
2313
-** ssh-fossil Remote fossil command to run with the "ssh://" protocol.
2314
-**
23152312
** ssl-ca-location The full pathname to a file containing PEM encoded
23162313
** CA root certificates, or a directory of certificates
23172314
** with filenames formed from the certificate hashes as
23182315
** required by OpenSSL.
23192316
** If set, this will override the OS default list of
23202317
--- src/db.c
+++ src/db.c
@@ -2136,11 +2136,10 @@
2136 { "proxy", 0, 32, 0, "off" },
2137 { "relative-paths",0, 0, 0, "on" },
2138 { "repo-cksum", 0, 0, 0, "on" },
2139 { "self-register", 0, 0, 0, "off" },
2140 { "ssh-command", 0, 40, 0, "" },
2141 { "ssh-fossil", 0, 40, 0, "" },
2142 { "ssl-ca-location",0, 40, 0, "" },
2143 { "ssl-identity", 0, 40, 0, "" },
2144 #ifdef FOSSIL_ENABLE_TCL
2145 { "tcl", 0, 0, 0, "off" },
2146 { "tcl-setup", 0, 40, 0, "" },
@@ -2308,12 +2307,10 @@
2308 ** users can not be deleted. Default: off.
2309 **
2310 ** ssh-command Command used to talk to a remote machine with
2311 ** the "ssh://" protocol.
2312 **
2313 ** ssh-fossil Remote fossil command to run with the "ssh://" protocol.
2314 **
2315 ** ssl-ca-location The full pathname to a file containing PEM encoded
2316 ** CA root certificates, or a directory of certificates
2317 ** with filenames formed from the certificate hashes as
2318 ** required by OpenSSL.
2319 ** If set, this will override the OS default list of
2320
--- src/db.c
+++ src/db.c
@@ -2136,11 +2136,10 @@
2136 { "proxy", 0, 32, 0, "off" },
2137 { "relative-paths",0, 0, 0, "on" },
2138 { "repo-cksum", 0, 0, 0, "on" },
2139 { "self-register", 0, 0, 0, "off" },
2140 { "ssh-command", 0, 40, 0, "" },
 
2141 { "ssl-ca-location",0, 40, 0, "" },
2142 { "ssl-identity", 0, 40, 0, "" },
2143 #ifdef FOSSIL_ENABLE_TCL
2144 { "tcl", 0, 0, 0, "off" },
2145 { "tcl-setup", 0, 40, 0, "" },
@@ -2308,12 +2307,10 @@
2307 ** users can not be deleted. Default: off.
2308 **
2309 ** ssh-command Command used to talk to a remote machine with
2310 ** the "ssh://" protocol.
2311 **
 
 
2312 ** ssl-ca-location The full pathname to a file containing PEM encoded
2313 ** CA root certificates, or a directory of certificates
2314 ** with filenames formed from the certificate hashes as
2315 ** required by OpenSSL.
2316 ** If set, this will override the OS default list of
2317
--- src/http_transport.c
+++ src/http_transport.c
@@ -91,19 +91,17 @@
9191
int transport_ssh_open(void){
9292
/* For SSH we need to create and run SSH fossil http
9393
** to talk to the remote machine.
9494
*/
9595
static int fPrintSshCmd = 1; /* Print SSH command only once */
96
- const char *zSshFossilCmd; /* Path to fossil on remote host */
9796
const char *zSsh; /* The base SSH command */
9897
Blob zCmd; /* The SSH command */
9998
char *zHost; /* The host name to contact */
10099
int n; /* Size of prefix string */
101100
102101
socket_ssh_resolve_addr();
103102
zSsh = db_get("ssh-command", zDefaultSshCmd);
104
- zSshFossilCmd = db_get("ssh-fossil", "fossil");
105103
blob_init(&zCmd, zSsh, -1);
106104
if( g.urlPort!=g.urlDfltPort && g.urlPort ){
107105
#ifdef __MINGW32__
108106
blob_appendf(&zCmd, " -P %d", g.urlPort);
109107
#else
@@ -121,11 +119,11 @@
121119
}
122120
n = blob_size(&zCmd);
123121
blob_append(&zCmd, " ", 1);
124122
shell_escape(&zCmd, zHost);
125123
blob_append(&zCmd, " ", 1);
126
- shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
124
+ shell_escape(&zCmd, mprintf("%s", g.urlFossil));
127125
if( url_ssh_use_http() ){
128126
blob_append(&zCmd, " http", 5);
129127
}else{
130128
blob_append(&zCmd, " test-http", 10);
131129
}
132130
--- src/http_transport.c
+++ src/http_transport.c
@@ -91,19 +91,17 @@
91 int transport_ssh_open(void){
92 /* For SSH we need to create and run SSH fossil http
93 ** to talk to the remote machine.
94 */
95 static int fPrintSshCmd = 1; /* Print SSH command only once */
96 const char *zSshFossilCmd; /* Path to fossil on remote host */
97 const char *zSsh; /* The base SSH command */
98 Blob zCmd; /* The SSH command */
99 char *zHost; /* The host name to contact */
100 int n; /* Size of prefix string */
101
102 socket_ssh_resolve_addr();
103 zSsh = db_get("ssh-command", zDefaultSshCmd);
104 zSshFossilCmd = db_get("ssh-fossil", "fossil");
105 blob_init(&zCmd, zSsh, -1);
106 if( g.urlPort!=g.urlDfltPort && g.urlPort ){
107 #ifdef __MINGW32__
108 blob_appendf(&zCmd, " -P %d", g.urlPort);
109 #else
@@ -121,11 +119,11 @@
121 }
122 n = blob_size(&zCmd);
123 blob_append(&zCmd, " ", 1);
124 shell_escape(&zCmd, zHost);
125 blob_append(&zCmd, " ", 1);
126 shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
127 if( url_ssh_use_http() ){
128 blob_append(&zCmd, " http", 5);
129 }else{
130 blob_append(&zCmd, " test-http", 10);
131 }
132
--- src/http_transport.c
+++ src/http_transport.c
@@ -91,19 +91,17 @@
91 int transport_ssh_open(void){
92 /* For SSH we need to create and run SSH fossil http
93 ** to talk to the remote machine.
94 */
95 static int fPrintSshCmd = 1; /* Print SSH command only once */
 
96 const char *zSsh; /* The base SSH command */
97 Blob zCmd; /* The SSH command */
98 char *zHost; /* The host name to contact */
99 int n; /* Size of prefix string */
100
101 socket_ssh_resolve_addr();
102 zSsh = db_get("ssh-command", zDefaultSshCmd);
 
103 blob_init(&zCmd, zSsh, -1);
104 if( g.urlPort!=g.urlDfltPort && g.urlPort ){
105 #ifdef __MINGW32__
106 blob_appendf(&zCmd, " -P %d", g.urlPort);
107 #else
@@ -121,11 +119,11 @@
119 }
120 n = blob_size(&zCmd);
121 blob_append(&zCmd, " ", 1);
122 shell_escape(&zCmd, zHost);
123 blob_append(&zCmd, " ", 1);
124 shell_escape(&zCmd, mprintf("%s", g.urlFossil));
125 if( url_ssh_use_http() ){
126 blob_append(&zCmd, " http", 5);
127 }else{
128 blob_append(&zCmd, " test-http", 10);
129 }
130
+1
--- src/json.c
+++ src/json.c
@@ -1307,10 +1307,11 @@
13071307
CSTR(g, urlPath);
13081308
CSTR(g, urlUser);
13091309
CSTR(g, urlPasswd);
13101310
CSTR(g, urlCanonical);
13111311
CSTR(g, urlProxyAuth);
1312
+ CSTR(g, urlFossil);
13121313
CSTR(g, zLogin);
13131314
CSTR(g, zSSLIdentity);
13141315
CSTR(g, zIpAddr);
13151316
CSTR(g, zNonce);
13161317
CSTR(g, zCsrfToken);
13171318
--- src/json.c
+++ src/json.c
@@ -1307,10 +1307,11 @@
1307 CSTR(g, urlPath);
1308 CSTR(g, urlUser);
1309 CSTR(g, urlPasswd);
1310 CSTR(g, urlCanonical);
1311 CSTR(g, urlProxyAuth);
 
1312 CSTR(g, zLogin);
1313 CSTR(g, zSSLIdentity);
1314 CSTR(g, zIpAddr);
1315 CSTR(g, zNonce);
1316 CSTR(g, zCsrfToken);
1317
--- src/json.c
+++ src/json.c
@@ -1307,10 +1307,11 @@
1307 CSTR(g, urlPath);
1308 CSTR(g, urlUser);
1309 CSTR(g, urlPasswd);
1310 CSTR(g, urlCanonical);
1311 CSTR(g, urlProxyAuth);
1312 CSTR(g, urlFossil);
1313 CSTR(g, zLogin);
1314 CSTR(g, zSSLIdentity);
1315 CSTR(g, zIpAddr);
1316 CSTR(g, zNonce);
1317 CSTR(g, zCsrfToken);
1318
+1 -2
--- src/main.c
+++ src/main.c
@@ -136,11 +136,10 @@
136136
int fQuiet; /* True if -quiet flag is present */
137137
int fHttpTrace; /* Trace outbound HTTP requests */
138138
int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
139139
int fSshTrace; /* Trace the SSH setup traffic */
140140
int fSshClient; /* HTTP client flags for SSH client */
141
- char *zSshFossilCmd; /* Path to remoe fossil command for SSH */
142141
char *zSshCmd; /* SSH command string */
143142
char *zFossilUser; /* Fossil user if different from URL user */
144143
int fNoSync; /* Do not do an autosync ever. --nosync */
145144
char *zPath; /* Name of webpage being served */
146145
char *zExtra; /* Extra path information past the webpage name */
@@ -179,10 +178,11 @@
179178
char *urlPath; /* Pathname for http: */
180179
char *urlUser; /* User id for http: */
181180
char *urlPasswd; /* Password for http: */
182181
char *urlCanonical; /* Canonical representation of the URL */
183182
char *urlProxyAuth; /* Proxy-Authorizer: string */
183
+ char *urlFossil; /* The fossil query parameter on ssh: */
184184
unsigned urlFlags; /* Boolean flags controlling URL processing */
185185
186186
const char *zLogin; /* Login name. "" if not logged in. */
187187
const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
188188
** SSL client identity */
@@ -585,11 +585,10 @@
585585
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
586586
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
587587
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
588588
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
589589
g.fSshClient = 0;
590
- g.zSshFossilCmd = 0;
591590
g.zSshCmd = 0;
592591
g.zFossilUser = 0;
593592
if( g.fSqlTrace ) g.fSqlStats = 1;
594593
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
595594
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
596595
--- src/main.c
+++ src/main.c
@@ -136,11 +136,10 @@
136 int fQuiet; /* True if -quiet flag is present */
137 int fHttpTrace; /* Trace outbound HTTP requests */
138 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
139 int fSshTrace; /* Trace the SSH setup traffic */
140 int fSshClient; /* HTTP client flags for SSH client */
141 char *zSshFossilCmd; /* Path to remoe fossil command for SSH */
142 char *zSshCmd; /* SSH command string */
143 char *zFossilUser; /* Fossil user if different from URL user */
144 int fNoSync; /* Do not do an autosync ever. --nosync */
145 char *zPath; /* Name of webpage being served */
146 char *zExtra; /* Extra path information past the webpage name */
@@ -179,10 +178,11 @@
179 char *urlPath; /* Pathname for http: */
180 char *urlUser; /* User id for http: */
181 char *urlPasswd; /* Password for http: */
182 char *urlCanonical; /* Canonical representation of the URL */
183 char *urlProxyAuth; /* Proxy-Authorizer: string */
 
184 unsigned urlFlags; /* Boolean flags controlling URL processing */
185
186 const char *zLogin; /* Login name. "" if not logged in. */
187 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
188 ** SSL client identity */
@@ -585,11 +585,10 @@
585 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
586 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
587 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
588 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
589 g.fSshClient = 0;
590 g.zSshFossilCmd = 0;
591 g.zSshCmd = 0;
592 g.zFossilUser = 0;
593 if( g.fSqlTrace ) g.fSqlStats = 1;
594 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
595 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
596
--- src/main.c
+++ src/main.c
@@ -136,11 +136,10 @@
136 int fQuiet; /* True if -quiet flag is present */
137 int fHttpTrace; /* Trace outbound HTTP requests */
138 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
139 int fSshTrace; /* Trace the SSH setup traffic */
140 int fSshClient; /* HTTP client flags for SSH client */
 
141 char *zSshCmd; /* SSH command string */
142 char *zFossilUser; /* Fossil user if different from URL user */
143 int fNoSync; /* Do not do an autosync ever. --nosync */
144 char *zPath; /* Name of webpage being served */
145 char *zExtra; /* Extra path information past the webpage name */
@@ -179,10 +178,11 @@
178 char *urlPath; /* Pathname for http: */
179 char *urlUser; /* User id for http: */
180 char *urlPasswd; /* Password for http: */
181 char *urlCanonical; /* Canonical representation of the URL */
182 char *urlProxyAuth; /* Proxy-Authorizer: string */
183 char *urlFossil; /* The fossil query parameter on ssh: */
184 unsigned urlFlags; /* Boolean flags controlling URL processing */
185
186 const char *zLogin; /* Login name. "" if not logged in. */
187 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
188 ** SSL client identity */
@@ -585,11 +585,10 @@
585 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
586 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
587 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
588 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
589 g.fSshClient = 0;
 
590 g.zSshCmd = 0;
591 g.zFossilUser = 0;
592 if( g.fSqlTrace ) g.fSqlStats = 1;
593 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
594 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
595
+30 -5
--- src/url.c
+++ src/url.c
@@ -64,11 +64,11 @@
6464
**
6565
** http://userid:password@host:port/path
6666
**
6767
** SSH url format is:
6868
**
69
-** ssh://userid:password@host:port/path
69
+** ssh://userid:password@host:port/path?fossil=path/to/fossil.exe
7070
**
7171
*/
7272
void url_parse(const char *zUrl, unsigned int urlFlags){
7373
int i, j, c;
7474
char *zFile = 0;
@@ -107,10 +107,11 @@
107107
iStart = 8;
108108
}else if( zUrl[0]=='s' ){
109109
g.urlIsSsh = 1;
110110
g.urlProtocol = "ssh";
111111
g.urlDfltPort = 22;
112
+ g.urlFossil = "fossil";
112113
iStart = 6;
113114
}else{
114115
g.urlIsHttps = 0;
115116
g.urlProtocol = "http";
116117
g.urlDfltPort = 80;
@@ -157,21 +158,44 @@
157158
for(i=0; g.urlPath[i] && g.urlPath[i]!='?'; i++){}
158159
if( g.urlPath[i] ){
159160
g.urlPath[i] = 0;
160161
i++;
161162
}
163
+ zExe = mprintf("");
164
+ while( g.urlPath[i]!=0 ){
165
+ char *zName, *zValue;
166
+ zName = &g.urlPath[i];
167
+ zValue = zName;
168
+ while( g.urlPath[i] && g.urlPath[i]!='=' ){ i++; }
169
+ if( g.urlPath[i]=='=' ){
170
+ g.urlPath[i] = 0;
171
+ i++;
172
+ zValue = &g.urlPath[i];
173
+ while( g.urlPath[i] && g.urlPath[i]!='&' ){ i++; }
174
+ }
175
+ if( g.urlPath[i] ){
176
+ g.urlPath[i] = 0;
177
+ i++;
178
+ }
179
+ if( fossil_strcmp(zName,"fossil")==0 ){
180
+ g.urlFossil = zValue;
181
+ dehttpize(g.urlFossil);
182
+ zExe = mprintf("%cfossil=%T", cQuerySep, g.urlFossil);
183
+ cQuerySep = '&';
184
+ }
185
+ }
162186
163187
dehttpize(g.urlPath);
164188
if( g.urlDfltPort==g.urlPort ){
165189
g.urlCanonical = mprintf(
166
- "%s://%s%T%T",
167
- g.urlProtocol, zLogin, g.urlName, g.urlPath
190
+ "%s://%s%T%T%s",
191
+ g.urlProtocol, zLogin, g.urlName, g.urlPath, zExe
168192
);
169193
}else{
170194
g.urlCanonical = mprintf(
171
- "%s://%s%T:%d%T",
172
- g.urlProtocol, zLogin, g.urlName, g.urlPort, g.urlPath
195
+ "%s://%s%T:%d%T%s",
196
+ g.urlProtocol, zLogin, g.urlName, g.urlPort, g.urlPath, zExe
173197
);
174198
}
175199
if( g.urlIsSsh && g.urlPath[1] ) g.urlPath++;
176200
free(zLogin);
177201
}else if( strncmp(zUrl, "file:", 5)==0 ){
@@ -254,10 +278,11 @@
254278
fossil_print("g.urlHostname = %s\n", g.urlHostname);
255279
fossil_print("g.urlPath = %s\n", g.urlPath);
256280
fossil_print("g.urlUser = %s\n", g.urlUser);
257281
fossil_print("g.urlPasswd = %s\n", g.urlPasswd);
258282
fossil_print("g.urlCanonical = %s\n", g.urlCanonical);
283
+ fossil_print("g.urlFossil = %s\n", g.urlFossil);
259284
fossil_print("g.urlFlags = 0x%02x\n", g.urlFlags);
260285
if( g.urlIsFile || g.urlIsSsh ) break;
261286
if( i==0 ){
262287
fossil_print("********\n");
263288
url_enable_proxy("Using proxy: ");
264289
--- src/url.c
+++ src/url.c
@@ -64,11 +64,11 @@
64 **
65 ** http://userid:password@host:port/path
66 **
67 ** SSH url format is:
68 **
69 ** ssh://userid:password@host:port/path
70 **
71 */
72 void url_parse(const char *zUrl, unsigned int urlFlags){
73 int i, j, c;
74 char *zFile = 0;
@@ -107,10 +107,11 @@
107 iStart = 8;
108 }else if( zUrl[0]=='s' ){
109 g.urlIsSsh = 1;
110 g.urlProtocol = "ssh";
111 g.urlDfltPort = 22;
 
112 iStart = 6;
113 }else{
114 g.urlIsHttps = 0;
115 g.urlProtocol = "http";
116 g.urlDfltPort = 80;
@@ -157,21 +158,44 @@
157 for(i=0; g.urlPath[i] && g.urlPath[i]!='?'; i++){}
158 if( g.urlPath[i] ){
159 g.urlPath[i] = 0;
160 i++;
161 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
163 dehttpize(g.urlPath);
164 if( g.urlDfltPort==g.urlPort ){
165 g.urlCanonical = mprintf(
166 "%s://%s%T%T",
167 g.urlProtocol, zLogin, g.urlName, g.urlPath
168 );
169 }else{
170 g.urlCanonical = mprintf(
171 "%s://%s%T:%d%T",
172 g.urlProtocol, zLogin, g.urlName, g.urlPort, g.urlPath
173 );
174 }
175 if( g.urlIsSsh && g.urlPath[1] ) g.urlPath++;
176 free(zLogin);
177 }else if( strncmp(zUrl, "file:", 5)==0 ){
@@ -254,10 +278,11 @@
254 fossil_print("g.urlHostname = %s\n", g.urlHostname);
255 fossil_print("g.urlPath = %s\n", g.urlPath);
256 fossil_print("g.urlUser = %s\n", g.urlUser);
257 fossil_print("g.urlPasswd = %s\n", g.urlPasswd);
258 fossil_print("g.urlCanonical = %s\n", g.urlCanonical);
 
259 fossil_print("g.urlFlags = 0x%02x\n", g.urlFlags);
260 if( g.urlIsFile || g.urlIsSsh ) break;
261 if( i==0 ){
262 fossil_print("********\n");
263 url_enable_proxy("Using proxy: ");
264
--- src/url.c
+++ src/url.c
@@ -64,11 +64,11 @@
64 **
65 ** http://userid:password@host:port/path
66 **
67 ** SSH url format is:
68 **
69 ** ssh://userid:password@host:port/path?fossil=path/to/fossil.exe
70 **
71 */
72 void url_parse(const char *zUrl, unsigned int urlFlags){
73 int i, j, c;
74 char *zFile = 0;
@@ -107,10 +107,11 @@
107 iStart = 8;
108 }else if( zUrl[0]=='s' ){
109 g.urlIsSsh = 1;
110 g.urlProtocol = "ssh";
111 g.urlDfltPort = 22;
112 g.urlFossil = "fossil";
113 iStart = 6;
114 }else{
115 g.urlIsHttps = 0;
116 g.urlProtocol = "http";
117 g.urlDfltPort = 80;
@@ -157,21 +158,44 @@
158 for(i=0; g.urlPath[i] && g.urlPath[i]!='?'; i++){}
159 if( g.urlPath[i] ){
160 g.urlPath[i] = 0;
161 i++;
162 }
163 zExe = mprintf("");
164 while( g.urlPath[i]!=0 ){
165 char *zName, *zValue;
166 zName = &g.urlPath[i];
167 zValue = zName;
168 while( g.urlPath[i] && g.urlPath[i]!='=' ){ i++; }
169 if( g.urlPath[i]=='=' ){
170 g.urlPath[i] = 0;
171 i++;
172 zValue = &g.urlPath[i];
173 while( g.urlPath[i] && g.urlPath[i]!='&' ){ i++; }
174 }
175 if( g.urlPath[i] ){
176 g.urlPath[i] = 0;
177 i++;
178 }
179 if( fossil_strcmp(zName,"fossil")==0 ){
180 g.urlFossil = zValue;
181 dehttpize(g.urlFossil);
182 zExe = mprintf("%cfossil=%T", cQuerySep, g.urlFossil);
183 cQuerySep = '&';
184 }
185 }
186
187 dehttpize(g.urlPath);
188 if( g.urlDfltPort==g.urlPort ){
189 g.urlCanonical = mprintf(
190 "%s://%s%T%T%s",
191 g.urlProtocol, zLogin, g.urlName, g.urlPath, zExe
192 );
193 }else{
194 g.urlCanonical = mprintf(
195 "%s://%s%T:%d%T%s",
196 g.urlProtocol, zLogin, g.urlName, g.urlPort, g.urlPath, zExe
197 );
198 }
199 if( g.urlIsSsh && g.urlPath[1] ) g.urlPath++;
200 free(zLogin);
201 }else if( strncmp(zUrl, "file:", 5)==0 ){
@@ -254,10 +278,11 @@
278 fossil_print("g.urlHostname = %s\n", g.urlHostname);
279 fossil_print("g.urlPath = %s\n", g.urlPath);
280 fossil_print("g.urlUser = %s\n", g.urlUser);
281 fossil_print("g.urlPasswd = %s\n", g.urlPasswd);
282 fossil_print("g.urlCanonical = %s\n", g.urlCanonical);
283 fossil_print("g.urlFossil = %s\n", g.urlFossil);
284 fossil_print("g.urlFlags = 0x%02x\n", g.urlFlags);
285 if( g.urlIsFile || g.urlIsSsh ) break;
286 if( i==0 ){
287 fossil_print("********\n");
288 url_enable_proxy("Using proxy: ");
289

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button