Fossil

Check-in [19c60b7f]
Login

Check-in [19c60b7f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Sync and Clone HTTP requests omit the extra /xfer path element from the end. This should work fine with all versions of Fossil server published since 2010, but might require that the /xfer path element be added manually to the URL for server instances that predate check-in [94bb313444b0165e].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 19c60b7fc9e2400e56a6f938bbad0e34ca746ca2eabdecac10945539f1f5e8c6
User & Date: drh 2019-04-06 19:03:25
About

Suppose the Fossil server is being run as a CGI script named "index.html" or perhaps "index.cgi". Let the domain be "example.org". If a user visits the main website at https://example.org, the web server will automatically redirect to https://example.org/index.cgi which will then run Fossil and all is well. But, prior to this change, if you tried to clone using

 fossil clone https://example.org ex.fossil

Then the HTTP request for the clone would go to https://example.org/xfer. The web server would not normally know to redirect that request to https://example.org/index.cgi/xfer unless someone made special provisions in the web server setup, which is unlikely. Thus, the clone would fail.

After this change, the clone and sync HTTP requests go to the URL as stated on the command line, with no additions. Thus the web server can supply an appropriate 302 redirect. The prior check-in from 2010 knows to automatically append the /xfer path element to any inbound request that has a mimetype of application/x-fossil. And so all will be well, as long as the server has been updated at least once in the previous 9 years. But this means that using a recent Fossil client against a really old Fossil server will break unless the URL for the sync is changed to explicitly include the /xfer path element at the end.

Hopefully this will never come up, but I thought it important do document the issue here, in case it does.

Context
2019-04-08
15:36
Try to suppress an SQLite scan warning on servers for repositories with a large number of shunned or private artifacts. ... (check-in: 85dd55db user: drh tags: trunk)
2019-04-06
19:03
Sync and Clone HTTP requests omit the extra /xfer path element from the end. This should work fine with all versions of Fossil server published since 2010, but might require that the /xfer path element be added manually to the URL for server instances that predate check-in [94bb313444b0165e]. ... (check-in: 19c60b7f user: drh tags: trunk)
2019-04-03
18:33
Update the built-in SQLite to the latest 3.28.0 alpha version. ... (check-in: 41974e08 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http.c.

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  blob_zero(pHdr);
  i = strlen(g.url.path);
  if( i>0 && g.url.path[i-1]=='/' ){
    zSep = "";
  }else{
    zSep = "/";
  }
  blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.url.path, zSep);
  if( g.url.proxyAuth ){
    blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth);
  }
  if( g.zHttpAuth && g.zHttpAuth[0] ){
    const char *zCredentials = g.zHttpAuth;
    char *zEncoded = encode64(zCredentials, -1);
    blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);







|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  blob_zero(pHdr);
  i = strlen(g.url.path);
  if( i>0 && g.url.path[i-1]=='/' ){
    zSep = "";
  }else{
    zSep = "/";
  }
  blob_appendf(pHdr, "POST %s%s HTTP/1.0\r\n", g.url.path, zSep);
  if( g.url.proxyAuth ){
    blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth);
  }
  if( g.zHttpAuth && g.zHttpAuth[0] ){
    const char *zCredentials = g.zHttpAuth;
    char *zEncoded = encode64(zCredentials, -1);
    blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);