Fossil SCM

Add documentation for the --transport-command options on the various sync commands. Improvements to the documentation of the sync protocol.

drh 2021-12-22 20:40 trunk
Commit 505d9d48eb5966c0bc04779e043eaf245f56e2554a28e3e6b29770932bd07107
--- src/clone.c
+++ src/clone.c
@@ -132,10 +132,11 @@
132132
** --once Don't remember the URI.
133133
** --private Also clone private branches
134134
** --save-http-password Remember the HTTP password without asking
135135
** --ssh-command|-c SSH Use SSH as the "ssh" command
136136
** --ssl-identity FILENAME Use the SSL identity if requested by the server
137
+** --transport-command CMD Use CMD to move messages to the server and back
137138
** -u|--unversioned Also sync unversioned content
138139
** -v|--verbose Show more statistics in output
139140
** --workdir DIR Also open a checkout in DIR
140141
**
141142
** See also: [[init]], [[open]]
142143
--- src/clone.c
+++ src/clone.c
@@ -132,10 +132,11 @@
132 ** --once Don't remember the URI.
133 ** --private Also clone private branches
134 ** --save-http-password Remember the HTTP password without asking
135 ** --ssh-command|-c SSH Use SSH as the "ssh" command
136 ** --ssl-identity FILENAME Use the SSL identity if requested by the server
 
137 ** -u|--unversioned Also sync unversioned content
138 ** -v|--verbose Show more statistics in output
139 ** --workdir DIR Also open a checkout in DIR
140 **
141 ** See also: [[init]], [[open]]
142
--- src/clone.c
+++ src/clone.c
@@ -132,10 +132,11 @@
132 ** --once Don't remember the URI.
133 ** --private Also clone private branches
134 ** --save-http-password Remember the HTTP password without asking
135 ** --ssh-command|-c SSH Use SSH as the "ssh" command
136 ** --ssl-identity FILENAME Use the SSL identity if requested by the server
137 ** --transport-command CMD Use CMD to move messages to the server and back
138 ** -u|--unversioned Also sync unversioned content
139 ** -v|--verbose Show more statistics in output
140 ** --workdir DIR Also open a checkout in DIR
141 **
142 ** See also: [[init]], [[open]]
143
+1 -1
--- src/http.c
+++ src/http.c
@@ -232,11 +232,11 @@
232232
zFullUrl = url_full(&g.url);
233233
zCmd = mprintf("%s %$ %$ %$", g.zHttpCmd, zFullUrl,zUplink,zDownlink);
234234
fossil_free(zFullUrl);
235235
blob_write_to_file(pSend, zUplink);
236236
if( g.fHttpTrace ){
237
- fossil_print("RUN: %s\n", zCmd);
237
+ fossil_print("RUN %s\n", zCmd);
238238
}
239239
rc = fossil_system(zCmd);
240240
if( rc ){
241241
fossil_warning("Transport command failed: %s\n", zCmd);
242242
}
243243
--- src/http.c
+++ src/http.c
@@ -232,11 +232,11 @@
232 zFullUrl = url_full(&g.url);
233 zCmd = mprintf("%s %$ %$ %$", g.zHttpCmd, zFullUrl,zUplink,zDownlink);
234 fossil_free(zFullUrl);
235 blob_write_to_file(pSend, zUplink);
236 if( g.fHttpTrace ){
237 fossil_print("RUN: %s\n", zCmd);
238 }
239 rc = fossil_system(zCmd);
240 if( rc ){
241 fossil_warning("Transport command failed: %s\n", zCmd);
242 }
243
--- src/http.c
+++ src/http.c
@@ -232,11 +232,11 @@
232 zFullUrl = url_full(&g.url);
233 zCmd = mprintf("%s %$ %$ %$", g.zHttpCmd, zFullUrl,zUplink,zDownlink);
234 fossil_free(zFullUrl);
235 blob_write_to_file(pSend, zUplink);
236 if( g.fHttpTrace ){
237 fossil_print("RUN %s\n", zCmd);
238 }
239 rc = fossil_system(zCmd);
240 if( rc ){
241 fossil_warning("Transport command failed: %s\n", zCmd);
242 }
243
--- src/http_transport.c
+++ src/http_transport.c
@@ -141,12 +141,12 @@
141141
if( pUrlData->path && pUrlData->path[0] ){
142142
blob_append_escaped_arg(&zCmd, pUrlData->path, 1);
143143
}else{
144144
fossil_fatal("ssh:// URI does not specify a path to the repository");
145145
}
146
- if( g.fSshTrace ){
147
- fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */
146
+ if( g.fSshTrace || g.fHttpTrace ){
147
+ fossil_print("RUN %s\n", blob_str(&zCmd)); /* Show the whole SSH command */
148148
}
149149
popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
150150
if( sshPid==0 ){
151151
socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
152152
}
@@ -177,19 +177,15 @@
177177
#else
178178
socket_set_errmsg("HTTPS: Fossil has been compiled without SSL support");
179179
rc = 1;
180180
#endif
181181
}else if( pUrlData->isFile ){
182
- sqlite3_uint64 iRandId;
183182
if( !db_looks_like_a_repository(pUrlData->name) ){
184183
fossil_fatal("not a fossil repository: \"%s\"", pUrlData->name);
185184
}
186
- sqlite3_randomness(sizeof(iRandId), &iRandId);
187
- transport.zOutFile = mprintf("%s-%llu-out.http",
188
- g.zRepositoryName, iRandId);
189
- transport.zInFile = mprintf("%s-%llu-in.http",
190
- g.zRepositoryName, iRandId);
185
+ transport.zOutFile = fossil_temp_filename();
186
+ transport.zInFile = fossil_temp_filename();
191187
transport.pFile = fossil_fopen(transport.zOutFile, "wb");
192188
if( transport.pFile==0 ){
193189
fossil_fatal("cannot output temporary file: %s", transport.zOutFile);
194190
}
195191
transport.isOpen = 1;
@@ -226,12 +222,12 @@
226222
fclose(transport.pFile);
227223
transport.pFile = 0;
228224
}
229225
file_delete(transport.zInFile);
230226
file_delete(transport.zOutFile);
231
- free(transport.zInFile);
232
- free(transport.zOutFile);
227
+ sqlite3_free(transport.zInFile);
228
+ sqlite3_free(transport.zOutFile);
233229
}else{
234230
socket_close();
235231
}
236232
transport.isOpen = 0;
237233
}
@@ -280,10 +276,11 @@
280276
fclose(transport.pFile);
281277
zCmd = mprintf("%$ http --in %$ --out %$ --ipaddr 127.0.0.1"
282278
" %$ --localauth",
283279
g.nameOfExe, transport.zOutFile, transport.zInFile, pUrlData->name
284280
);
281
+ if( g.fHttpTrace ) fossil_print("RUN %s\n", zCmd);
285282
fossil_system(zCmd);
286283
free(zCmd);
287284
transport.pFile = fossil_fopen(transport.zInFile, "rb");
288285
}
289286
}
290287
--- src/http_transport.c
+++ src/http_transport.c
@@ -141,12 +141,12 @@
141 if( pUrlData->path && pUrlData->path[0] ){
142 blob_append_escaped_arg(&zCmd, pUrlData->path, 1);
143 }else{
144 fossil_fatal("ssh:// URI does not specify a path to the repository");
145 }
146 if( g.fSshTrace ){
147 fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */
148 }
149 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
150 if( sshPid==0 ){
151 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
152 }
@@ -177,19 +177,15 @@
177 #else
178 socket_set_errmsg("HTTPS: Fossil has been compiled without SSL support");
179 rc = 1;
180 #endif
181 }else if( pUrlData->isFile ){
182 sqlite3_uint64 iRandId;
183 if( !db_looks_like_a_repository(pUrlData->name) ){
184 fossil_fatal("not a fossil repository: \"%s\"", pUrlData->name);
185 }
186 sqlite3_randomness(sizeof(iRandId), &iRandId);
187 transport.zOutFile = mprintf("%s-%llu-out.http",
188 g.zRepositoryName, iRandId);
189 transport.zInFile = mprintf("%s-%llu-in.http",
190 g.zRepositoryName, iRandId);
191 transport.pFile = fossil_fopen(transport.zOutFile, "wb");
192 if( transport.pFile==0 ){
193 fossil_fatal("cannot output temporary file: %s", transport.zOutFile);
194 }
195 transport.isOpen = 1;
@@ -226,12 +222,12 @@
226 fclose(transport.pFile);
227 transport.pFile = 0;
228 }
229 file_delete(transport.zInFile);
230 file_delete(transport.zOutFile);
231 free(transport.zInFile);
232 free(transport.zOutFile);
233 }else{
234 socket_close();
235 }
236 transport.isOpen = 0;
237 }
@@ -280,10 +276,11 @@
280 fclose(transport.pFile);
281 zCmd = mprintf("%$ http --in %$ --out %$ --ipaddr 127.0.0.1"
282 " %$ --localauth",
283 g.nameOfExe, transport.zOutFile, transport.zInFile, pUrlData->name
284 );
 
285 fossil_system(zCmd);
286 free(zCmd);
287 transport.pFile = fossil_fopen(transport.zInFile, "rb");
288 }
289 }
290
--- src/http_transport.c
+++ src/http_transport.c
@@ -141,12 +141,12 @@
141 if( pUrlData->path && pUrlData->path[0] ){
142 blob_append_escaped_arg(&zCmd, pUrlData->path, 1);
143 }else{
144 fossil_fatal("ssh:// URI does not specify a path to the repository");
145 }
146 if( g.fSshTrace || g.fHttpTrace ){
147 fossil_print("RUN %s\n", blob_str(&zCmd)); /* Show the whole SSH command */
148 }
149 popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0);
150 if( sshPid==0 ){
151 socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd);
152 }
@@ -177,19 +177,15 @@
177 #else
178 socket_set_errmsg("HTTPS: Fossil has been compiled without SSL support");
179 rc = 1;
180 #endif
181 }else if( pUrlData->isFile ){
 
182 if( !db_looks_like_a_repository(pUrlData->name) ){
183 fossil_fatal("not a fossil repository: \"%s\"", pUrlData->name);
184 }
185 transport.zOutFile = fossil_temp_filename();
186 transport.zInFile = fossil_temp_filename();
 
 
 
187 transport.pFile = fossil_fopen(transport.zOutFile, "wb");
188 if( transport.pFile==0 ){
189 fossil_fatal("cannot output temporary file: %s", transport.zOutFile);
190 }
191 transport.isOpen = 1;
@@ -226,12 +222,12 @@
222 fclose(transport.pFile);
223 transport.pFile = 0;
224 }
225 file_delete(transport.zInFile);
226 file_delete(transport.zOutFile);
227 sqlite3_free(transport.zInFile);
228 sqlite3_free(transport.zOutFile);
229 }else{
230 socket_close();
231 }
232 transport.isOpen = 0;
233 }
@@ -280,10 +276,11 @@
276 fclose(transport.pFile);
277 zCmd = mprintf("%$ http --in %$ --out %$ --ipaddr 127.0.0.1"
278 " %$ --localauth",
279 g.nameOfExe, transport.zOutFile, transport.zInFile, pUrlData->name
280 );
281 if( g.fHttpTrace ) fossil_print("RUN %s\n", zCmd);
282 fossil_system(zCmd);
283 free(zCmd);
284 transport.pFile = fossil_fopen(transport.zInFile, "rb");
285 }
286 }
287
+12 -1
--- src/sync.c
+++ src/sync.c
@@ -238,11 +238,11 @@
238238
&& find_option("share-links",0,0)!=0
239239
){
240240
*pSyncFlags |= SYNC_SHARE_LINKS;
241241
}
242242
243
- /* Undocumented option: --transport-command COMMAND
243
+ /* Option: --transport-command COMMAND
244244
**
245245
** Causes COMMAND to be run with three arguments in order to talk
246246
** to the server.
247247
**
248248
** COMMAND URL PAYLOAD REPLY
@@ -249,10 +249,15 @@
249249
**
250250
** URL is the server name. PAYLOAD is the name of a temporary file
251251
** that will contain the xfer-protocol payload to send to the server.
252252
** REPLY is a temporary filename in which COMMAND should write the
253253
** content of the reply from the server.
254
+ **
255
+ ** CMD is reponsible for HTTP redirects. The following Fossil command
256
+ ** can be used for CMD to achieve a working sync:
257
+ **
258
+ ** fossil test-httpmsg --xfer
254259
*/
255260
g.zHttpCmd = find_option("transport-command",0,1);
256261
257262
url_proxy_options();
258263
clone_ssh_find_options();
@@ -317,10 +322,12 @@
317322
** --proxy PROXY Use the specified HTTP proxy
318323
** -R|--repository REPO Local repository to pull into
319324
** --share-links Share links to mirror repos
320325
** --ssl-identity FILE Local SSL credentials, if requested by remote
321326
** --ssh-command SSH Use SSH as the "ssh" command
327
+** --transport-command CMD Use external command CMD to move messages
328
+** between client and server
322329
** -v|--verbose Additional (debugging) output
323330
** --verily Exchange extra information with the remote
324331
** to ensure no content is overlooked
325332
**
326333
** See also: [[clone]], [[config]], [[push]], [[remote]], [[sync]]
@@ -368,10 +375,12 @@
368375
** --proxy PROXY Use the specified HTTP proxy
369376
** --private Push private branches too
370377
** -R|--repository REPO Local repository to push from
371378
** --ssl-identity FILE Local SSL credentials, if requested by remote
372379
** --ssh-command SSH Use SSH as the "ssh" command
380
+** --transport-command CMD Use external command CMD to communicate with
381
+** the server
373382
** -v|--verbose Additional (debugging) output
374383
** --verily Exchange extra information with the remote
375384
** to ensure no content is overlooked
376385
**
377386
** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]]
@@ -416,10 +425,12 @@
416425
** --private Sync private branches too
417426
** -R|--repository REPO Local repository to sync with
418427
** --share-links Share links to mirror repos
419428
** --ssl-identity FILE Local SSL credentials, if requested by remote
420429
** --ssh-command SSH Use SSH as the "ssh" command
430
+** --transport-command CMD Use external command CMD to move message
431
+** between the client and the server
421432
** -u|--unversioned Also sync unversioned content
422433
** -v|--verbose Additional (debugging) output
423434
** --verily Exchange extra information with the remote
424435
** to ensure no content is overlooked
425436
**
426437
--- src/sync.c
+++ src/sync.c
@@ -238,11 +238,11 @@
238 && find_option("share-links",0,0)!=0
239 ){
240 *pSyncFlags |= SYNC_SHARE_LINKS;
241 }
242
243 /* Undocumented option: --transport-command COMMAND
244 **
245 ** Causes COMMAND to be run with three arguments in order to talk
246 ** to the server.
247 **
248 ** COMMAND URL PAYLOAD REPLY
@@ -249,10 +249,15 @@
249 **
250 ** URL is the server name. PAYLOAD is the name of a temporary file
251 ** that will contain the xfer-protocol payload to send to the server.
252 ** REPLY is a temporary filename in which COMMAND should write the
253 ** content of the reply from the server.
 
 
 
 
 
254 */
255 g.zHttpCmd = find_option("transport-command",0,1);
256
257 url_proxy_options();
258 clone_ssh_find_options();
@@ -317,10 +322,12 @@
317 ** --proxy PROXY Use the specified HTTP proxy
318 ** -R|--repository REPO Local repository to pull into
319 ** --share-links Share links to mirror repos
320 ** --ssl-identity FILE Local SSL credentials, if requested by remote
321 ** --ssh-command SSH Use SSH as the "ssh" command
 
 
322 ** -v|--verbose Additional (debugging) output
323 ** --verily Exchange extra information with the remote
324 ** to ensure no content is overlooked
325 **
326 ** See also: [[clone]], [[config]], [[push]], [[remote]], [[sync]]
@@ -368,10 +375,12 @@
368 ** --proxy PROXY Use the specified HTTP proxy
369 ** --private Push private branches too
370 ** -R|--repository REPO Local repository to push from
371 ** --ssl-identity FILE Local SSL credentials, if requested by remote
372 ** --ssh-command SSH Use SSH as the "ssh" command
 
 
373 ** -v|--verbose Additional (debugging) output
374 ** --verily Exchange extra information with the remote
375 ** to ensure no content is overlooked
376 **
377 ** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]]
@@ -416,10 +425,12 @@
416 ** --private Sync private branches too
417 ** -R|--repository REPO Local repository to sync with
418 ** --share-links Share links to mirror repos
419 ** --ssl-identity FILE Local SSL credentials, if requested by remote
420 ** --ssh-command SSH Use SSH as the "ssh" command
 
 
421 ** -u|--unversioned Also sync unversioned content
422 ** -v|--verbose Additional (debugging) output
423 ** --verily Exchange extra information with the remote
424 ** to ensure no content is overlooked
425 **
426
--- src/sync.c
+++ src/sync.c
@@ -238,11 +238,11 @@
238 && find_option("share-links",0,0)!=0
239 ){
240 *pSyncFlags |= SYNC_SHARE_LINKS;
241 }
242
243 /* Option: --transport-command COMMAND
244 **
245 ** Causes COMMAND to be run with three arguments in order to talk
246 ** to the server.
247 **
248 ** COMMAND URL PAYLOAD REPLY
@@ -249,10 +249,15 @@
249 **
250 ** URL is the server name. PAYLOAD is the name of a temporary file
251 ** that will contain the xfer-protocol payload to send to the server.
252 ** REPLY is a temporary filename in which COMMAND should write the
253 ** content of the reply from the server.
254 **
255 ** CMD is reponsible for HTTP redirects. The following Fossil command
256 ** can be used for CMD to achieve a working sync:
257 **
258 ** fossil test-httpmsg --xfer
259 */
260 g.zHttpCmd = find_option("transport-command",0,1);
261
262 url_proxy_options();
263 clone_ssh_find_options();
@@ -317,10 +322,12 @@
322 ** --proxy PROXY Use the specified HTTP proxy
323 ** -R|--repository REPO Local repository to pull into
324 ** --share-links Share links to mirror repos
325 ** --ssl-identity FILE Local SSL credentials, if requested by remote
326 ** --ssh-command SSH Use SSH as the "ssh" command
327 ** --transport-command CMD Use external command CMD to move messages
328 ** between client and server
329 ** -v|--verbose Additional (debugging) output
330 ** --verily Exchange extra information with the remote
331 ** to ensure no content is overlooked
332 **
333 ** See also: [[clone]], [[config]], [[push]], [[remote]], [[sync]]
@@ -368,10 +375,12 @@
375 ** --proxy PROXY Use the specified HTTP proxy
376 ** --private Push private branches too
377 ** -R|--repository REPO Local repository to push from
378 ** --ssl-identity FILE Local SSL credentials, if requested by remote
379 ** --ssh-command SSH Use SSH as the "ssh" command
380 ** --transport-command CMD Use external command CMD to communicate with
381 ** the server
382 ** -v|--verbose Additional (debugging) output
383 ** --verily Exchange extra information with the remote
384 ** to ensure no content is overlooked
385 **
386 ** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]]
@@ -416,10 +425,12 @@
425 ** --private Sync private branches too
426 ** -R|--repository REPO Local repository to sync with
427 ** --share-links Share links to mirror repos
428 ** --ssl-identity FILE Local SSL credentials, if requested by remote
429 ** --ssh-command SSH Use SSH as the "ssh" command
430 ** --transport-command CMD Use external command CMD to move message
431 ** between the client and the server
432 ** -u|--unversioned Also sync unversioned content
433 ** -v|--verbose Additional (debugging) output
434 ** --verily Exchange extra information with the remote
435 ** to ensure no content is overlooked
436 **
437
+60 -1
--- www/sync.wiki
+++ www/sync.wiki
@@ -77,19 +77,42 @@
7777
processor housed in a datacenter, nor does the client need to be a desktop
7878
or handheld device. For the purposes of this article "client" simply means
7979
the repository that initiates the conversation and "server" is the repository
8080
that responds. Nothing more.</p>
8181
82
-<h4>2.0.1 Encrypted Transport</h4>
82
+<h4>2.0.1 HTTPS Transport</h4>
8383
8484
<p>In the current implementation of Fossil, the server only
8585
understands HTTP requests. The client can send either
8686
clear-text HTTP requests or encrypted HTTPS requests. But when
8787
HTTPS requests are sent, they first must be decrypted by a web server
8888
or proxy before being passed to the Fossil server. This limitation
8989
may be relaxed in a future release.</p>
9090
91
+<h4>2.0.2 SSH Transport</h4>
92
+
93
+<p>When doing a sync using an "ssh:..." URL, the same HTTP transport protocol
94
+is used. Fossil simply uses [https://en.wikipedia.org/wiki/Secure_Shell|ssh]
95
+to start an instance of the [/help?cmd=test-http|fossil test-http] command
96
+running on the remote machine. It then sends HTTP requests and gets back HTTP
97
+replies over the SSH connection, rather than sending and receiving over an
98
+internet socket. To see the specific "ssh" command that the Fossil client
99
+runs in order to set up a connection, add either of the the "--httptrace" or
100
+"--sshtrace" options to the "fossil sync" command line.
101
+
102
+<h4>2.0.3 FILE Transport</h4>
103
+
104
+<p>When doing a sync using a "file:..." URL, the same HTTP protocol is
105
+still used. But instead of sending each HTTP request over a socket or
106
+via SSH, the HTTP request is written into a temporary file. The client
107
+then invokes the [/help?cmd=http|fossil http] command in a subprocess
108
+to process the request and and generate a reply. The client then reads
109
+the HTTP reply out of a temporary file on disk, and deletes the two
110
+temporary files. To see the specific "fossil http" command that is run
111
+in order to implement the "file:" transport, add the "--httptrace"
112
+option to the "fossil sync" command.
113
+
91114
<h3>2.1 Server Identification</h3>
92115
93116
<p>The server is identified by a URL argument that accompanies the
94117
push, pull, or sync command on the client. (As a convenience to
95118
users, the URL can be omitted on the client command and the same URL
@@ -1005,5 +1028,41 @@
10051028
<li>Repositories keep track of all artifacts that are not named in any
10061029
cluster and send igot messages for those artifacts.
10071030
<li>Repositories keep track of all the phantoms they hold and send
10081031
gimme messages for those artifacts.
10091032
</ol>
1033
+
1034
+<h2>7.0 Troubleshooting And Debugging Hints</h2>
1035
+
1036
+<p>
1037
+If you run the [/help?cmd=sync|fossil sync] command
1038
+(or [/help?cmd=pull|pull] or [/help?cmd=push|push] or
1039
+[/help?cmd=clone|clone]) with the --httptrace option, Fossil
1040
+will keep a copy of each HTTP request and reply in files
1041
+named:
1042
+<ul>
1043
+<li> <tt>http-request-</tt><i>N</i><tt>.txt</tt>
1044
+<li> <tt>http-reply-</tt><i>N</i><tt>.txt</tt>
1045
+</ul>
1046
+
1047
+<p>In the above, <i>N</i> is a integer that increments with each
1048
+round-trip. If you are having trouble on the server side,
1049
+you can run the "[/help?cmd=test-http|fossil test-http]" command in a
1050
+debugger using one the "http-request-N.txt" files as input and
1051
+single step through the processing performed by the server.
1052
+
1053
+<p>The "--transport-command CMD" option on [/help?cmd=sync|fossil sync]
1054
+(and similar) causes the external program "CMD" to be used to move
1055
+the sync message to the server and retrieve the sync reply. The
1056
+CMD is given three arguments:
1057
+<ol>
1058
+<li> The URL of the server
1059
+<li> The name of a temporary file that contains the output-bound sync
1060
+ protocol text, with the HTTP headers
1061
+<li> The name of a temporary file into which the CMD should write the
1062
+ reply sync protocol text, again without any HTTP headers
1063
+</ol>
1064
+
1065
+<p>In a complex debugging situation, you can run the command
1066
+"fossil sync --transport-command ./debugging_script" where
1067
+"debugging_script" is some script of your own that invokes
1068
+the anomolous behavior your are trying to debug.
10101069
--- www/sync.wiki
+++ www/sync.wiki
@@ -77,19 +77,42 @@
77 processor housed in a datacenter, nor does the client need to be a desktop
78 or handheld device. For the purposes of this article "client" simply means
79 the repository that initiates the conversation and "server" is the repository
80 that responds. Nothing more.</p>
81
82 <h4>2.0.1 Encrypted Transport</h4>
83
84 <p>In the current implementation of Fossil, the server only
85 understands HTTP requests. The client can send either
86 clear-text HTTP requests or encrypted HTTPS requests. But when
87 HTTPS requests are sent, they first must be decrypted by a web server
88 or proxy before being passed to the Fossil server. This limitation
89 may be relaxed in a future release.</p>
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91 <h3>2.1 Server Identification</h3>
92
93 <p>The server is identified by a URL argument that accompanies the
94 push, pull, or sync command on the client. (As a convenience to
95 users, the URL can be omitted on the client command and the same URL
@@ -1005,5 +1028,41 @@
1005 <li>Repositories keep track of all artifacts that are not named in any
1006 cluster and send igot messages for those artifacts.
1007 <li>Repositories keep track of all the phantoms they hold and send
1008 gimme messages for those artifacts.
1009 </ol>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1010
--- www/sync.wiki
+++ www/sync.wiki
@@ -77,19 +77,42 @@
77 processor housed in a datacenter, nor does the client need to be a desktop
78 or handheld device. For the purposes of this article "client" simply means
79 the repository that initiates the conversation and "server" is the repository
80 that responds. Nothing more.</p>
81
82 <h4>2.0.1 HTTPS Transport</h4>
83
84 <p>In the current implementation of Fossil, the server only
85 understands HTTP requests. The client can send either
86 clear-text HTTP requests or encrypted HTTPS requests. But when
87 HTTPS requests are sent, they first must be decrypted by a web server
88 or proxy before being passed to the Fossil server. This limitation
89 may be relaxed in a future release.</p>
90
91 <h4>2.0.2 SSH Transport</h4>
92
93 <p>When doing a sync using an "ssh:..." URL, the same HTTP transport protocol
94 is used. Fossil simply uses [https://en.wikipedia.org/wiki/Secure_Shell|ssh]
95 to start an instance of the [/help?cmd=test-http|fossil test-http] command
96 running on the remote machine. It then sends HTTP requests and gets back HTTP
97 replies over the SSH connection, rather than sending and receiving over an
98 internet socket. To see the specific "ssh" command that the Fossil client
99 runs in order to set up a connection, add either of the the "--httptrace" or
100 "--sshtrace" options to the "fossil sync" command line.
101
102 <h4>2.0.3 FILE Transport</h4>
103
104 <p>When doing a sync using a "file:..." URL, the same HTTP protocol is
105 still used. But instead of sending each HTTP request over a socket or
106 via SSH, the HTTP request is written into a temporary file. The client
107 then invokes the [/help?cmd=http|fossil http] command in a subprocess
108 to process the request and and generate a reply. The client then reads
109 the HTTP reply out of a temporary file on disk, and deletes the two
110 temporary files. To see the specific "fossil http" command that is run
111 in order to implement the "file:" transport, add the "--httptrace"
112 option to the "fossil sync" command.
113
114 <h3>2.1 Server Identification</h3>
115
116 <p>The server is identified by a URL argument that accompanies the
117 push, pull, or sync command on the client. (As a convenience to
118 users, the URL can be omitted on the client command and the same URL
@@ -1005,5 +1028,41 @@
1028 <li>Repositories keep track of all artifacts that are not named in any
1029 cluster and send igot messages for those artifacts.
1030 <li>Repositories keep track of all the phantoms they hold and send
1031 gimme messages for those artifacts.
1032 </ol>
1033
1034 <h2>7.0 Troubleshooting And Debugging Hints</h2>
1035
1036 <p>
1037 If you run the [/help?cmd=sync|fossil sync] command
1038 (or [/help?cmd=pull|pull] or [/help?cmd=push|push] or
1039 [/help?cmd=clone|clone]) with the --httptrace option, Fossil
1040 will keep a copy of each HTTP request and reply in files
1041 named:
1042 <ul>
1043 <li> <tt>http-request-</tt><i>N</i><tt>.txt</tt>
1044 <li> <tt>http-reply-</tt><i>N</i><tt>.txt</tt>
1045 </ul>
1046
1047 <p>In the above, <i>N</i> is a integer that increments with each
1048 round-trip. If you are having trouble on the server side,
1049 you can run the "[/help?cmd=test-http|fossil test-http]" command in a
1050 debugger using one the "http-request-N.txt" files as input and
1051 single step through the processing performed by the server.
1052
1053 <p>The "--transport-command CMD" option on [/help?cmd=sync|fossil sync]
1054 (and similar) causes the external program "CMD" to be used to move
1055 the sync message to the server and retrieve the sync reply. The
1056 CMD is given three arguments:
1057 <ol>
1058 <li> The URL of the server
1059 <li> The name of a temporary file that contains the output-bound sync
1060 protocol text, with the HTTP headers
1061 <li> The name of a temporary file into which the CMD should write the
1062 reply sync protocol text, again without any HTTP headers
1063 </ol>
1064
1065 <p>In a complex debugging situation, you can run the command
1066 "fossil sync --transport-command ./debugging_script" where
1067 "debugging_script" is some script of your own that invokes
1068 the anomolous behavior your are trying to debug.
1069

Keyboard Shortcuts

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