Fossil

Check-in [6dab6149b1]
Login

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

Overview
Comment:From the vinfo webpage, provide a hyperlink to download a ZIP archive the version.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6dab6149b13f9fdb214a279d2b3c47619f3eb7b6
User & Date: drh 2007-08-01 13:32:11.000
Context
2007-08-01
13:50
Client must ignore SIGPIPE when writting to the HTTP socket. ... (check-in: 0238e54ff3 user: drh tags: trunk)
13:32
From the vinfo webpage, provide a hyperlink to download a ZIP archive the version. ... (check-in: 6dab6149b1 user: drh tags: trunk)
13:08
Avoid an unnecessary HTTP round-trip on syncs. ... (check-in: ae40356c57 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cgi.c.
98
99
100
101
102
103
104









105
106
107
108
109
110
111

/*
** Set the reply content type
*/
void cgi_set_content_type(const char *zType){
  zContentType = mprintf("%s", zType);
}










/*
** Set the reply status code
*/
void cgi_set_status(int iStat, const char *zStat){
  zReplyStatus = mprintf("%s", zStat);
  iReplyStatus = iStat;







>
>
>
>
>
>
>
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

/*
** Set the reply content type
*/
void cgi_set_content_type(const char *zType){
  zContentType = mprintf("%s", zType);
}

/*
** Set the reply content to the specified BLOB.
*/
void cgi_set_content(Blob *pNewContent){
  blob_reset(&cgiContent);
  cgiContent = *pNewContent;
  blob_zero(pNewContent);
}

/*
** Set the reply status code
*/
void cgi_set_status(int iStat, const char *zStat){
  zReplyStatus = mprintf("%s", zStat);
  iReplyStatus = iStat;
Changes to src/info.c.
213
214
215
216
217
218
219

220
221
222
223
224
225

226
227
228
229
230
231
232
     "SELECT uuid, datetime(mtime, 'localtime'), user, comment"
     "  FROM blob, event"
     " WHERE blob.rid=%d"
     "   AND event.objid=%d",
     rid, rid
  );
  if( db_step(&q)==SQLITE_ROW ){

    @ <h2>Version %s(db_column_text(&q,0))</h2>
    @ <ul>
    @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
    @ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
    @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
    @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>

    @ </ul>
  }
  db_finalize(&q);
  @ <p><h2>Descendents:</h2>
  n = showDescendents(rid, 2);
  if( n==0 ){
    @ <ul>None.  This is a leaf node.</ul>







>
|





>







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
     "SELECT uuid, datetime(mtime, 'localtime'), user, comment"
     "  FROM blob, event"
     " WHERE blob.rid=%d"
     "   AND event.objid=%d",
     rid, rid
  );
  if( db_step(&q)==SQLITE_ROW ){
    const char *zUuid = db_column_text(&q, 0);
    @ <h2>Version %s(zUuid)</h2>
    @ <ul>
    @ <li><b>Date:</b> %s(db_column_text(&q, 1))</li>
    @ <li><b>User:</b> %s(db_column_text(&q, 2))</li>
    @ <li><b>Comment:</b> %s(db_column_text(&q, 3))</li>
    @ <li><a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a></li>
    @ <li><a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a></li>
    @ </ul>
  }
  db_finalize(&q);
  @ <p><h2>Descendents:</h2>
  n = showDescendents(rid, 2);
  if( n==0 ){
    @ <ul>None.  This is a leaf node.</ul>
Changes to src/xfer.c.
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
              "SELECT cid FROM plink WHERE pid=%d", rid
            );
            if( db_changes()>0 ){
              go = 1;
            }
          }
          if( pullFlag && !go && 
              db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<=0", rid) ){
            go = 1;
          }
        }else if( pullFlag ){
          go = 1;
          content_put(0, blob_str(&aToken[1]));
        }
      }else







|







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
              "SELECT cid FROM plink WHERE pid=%d", rid
            );
            if( db_changes()>0 ){
              go = 1;
            }
          }
          if( pullFlag && !go && 
              db_exists("SELECT 1 FROM blob WHERE rid=%d AND size<0", rid) ){
            go = 1;
          }
        }else if( pullFlag ){
          go = 1;
          content_put(0, blob_str(&aToken[1]));
        }
      }else
Changes to src/zip.c.
312
313
314
315
316
317
318

































    usage("UUID ZIPFILE");
  }
  db_must_be_within_tree();
  rid = name_to_rid(g.argv[2]);
  zip_of_baseline(rid, &zip);
  blob_write_to_file(&zip, g.argv[3]);
}








































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
    usage("UUID ZIPFILE");
  }
  db_must_be_within_tree();
  rid = name_to_rid(g.argv[2]);
  zip_of_baseline(rid, &zip);
  blob_write_to_file(&zip, g.argv[3]);
}

/*
** WEBPAGE: zip
**
** Generate a ZIP archive for the baseline specified by g.zExtra
** and return that ZIP archive as the HTTP reply content.
*/
void baseline_zip_page(void){
  int rid;
  char *zName;
  int i;
  Blob zip;

  login_check_credentials();
  if( !g.okRead || !g.okHistory ){ login_needed(); return; }
  zName = mprintf("%s", g.zExtra);
  i = strlen(zName);
  for(i=strlen(zName)-1; i>5; i--){
    if( zName[i]=='.' ){
      zName[i] = 0;
      break;
    }
  }
  rid = name_to_rid(zName);
  if( rid==0 ){
    @ Not found
    return;
  }
  zip_of_baseline(rid, &zip);
  cgi_set_content(&zip);
  cgi_set_content_type("application/zip");
  cgi_reply();
}