Check-in [3cb547be2c]
Not logged in

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

Overview
Comment:Code to randomize messages from client to the server.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3cb547be2c7db73b523813b42fe5cd0d82f429e4
User & Date: drh 2008-07-26 14:02:33.000
Context
2008-07-26
16:51
Add a "User-Agent" header to the HTTP traffic generated by fossil. The user-agent string is "Fossil/$UUID". check-in: 31824fbf91 user: dan tags: trunk
14:02
Code to randomize messages from client to the server. check-in: 3cb547be2c user: drh tags: trunk
2008-07-25
12:30
Disable the "branch" command pending further discussion and clarification of its purpose and intent. check-in: f6d3d89e76 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/xfer.c.
519
520
521
522
523
524
525

526
527
528
529
530
531
532
  xfer.mxSend = db_get_int("max-download", 5000000);

  db_begin_transaction();
  db_multi_exec(
     "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
  );
  while( blob_line(xfer.pIn, &xfer.line) ){

    xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));

    /*   file UUID SIZE \n CONTENT
    **   file UUID DELTASRC SIZE \n CONTENT
    **
    ** Accept a file from the client.
    */







>







519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
  xfer.mxSend = db_get_int("max-download", 5000000);

  db_begin_transaction();
  db_multi_exec(
     "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
  );
  while( blob_line(xfer.pIn, &xfer.line) ){
    if( blob_buffer(&xfer.line)[0]=='#' ) continue;
    xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));

    /*   file UUID SIZE \n CONTENT
    **   file UUID DELTASRC SIZE \n CONTENT
    **
    ** Accept a file from the client.
    */
837
838
839
840
841
842
843

844
845
846
847
848
849
850
    blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
    nCard++;
  }
  printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");

  while( go ){
    int newPhantom = 0;


    /* Send make the most recently received cookie.  Let the server
    ** figure out if this is a cookie that it cares about.
    */
    zCookie = db_get("cookie", 0);
    if( zCookie ){
      blob_appendf(&send, "cookie %s\n", zCookie);







>







838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
    blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
    nCard++;
  }
  printf(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");

  while( go ){
    int newPhantom = 0;
    char *zRandomness;

    /* Send make the most recently received cookie.  Let the server
    ** figure out if this is a cookie that it cares about.
    */
    zCookie = db_get("cookie", 0);
    if( zCookie ){
      blob_appendf(&send, "cookie %s\n", zCookie);
868
869
870
871
872
873
874







875
876
877
878
879
880
881
      while( zName ){
        blob_appendf(&send, "reqconfig %s\n", zName);
        zName = configure_next_name(configMask);
        nCard++;
      }
      configMask = 0;
    }








    /* Exchange messages with the server */
    nFileSend = xfer.nFileSent + xfer.nDeltaSent;
    printf(zValueFormat, "Send:",
            blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent,
            xfer.nFileSent, xfer.nDeltaSent);
    nCard = 0;







>
>
>
>
>
>
>







870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
      while( zName ){
        blob_appendf(&send, "reqconfig %s\n", zName);
        zName = configure_next_name(configMask);
        nCard++;
      }
      configMask = 0;
    }

    /* Append randomness to the end of the message */
#if 0   /* Enable this after all servers have upgraded */
    zRandomness = db_text(0, "SELECT hex(randomblob(20))");
    blob_appendf(&send, "# %s\n", zRandomness);
    free(zRandomness);
#endif

    /* Exchange messages with the server */
    nFileSend = xfer.nFileSent + xfer.nDeltaSent;
    printf(zValueFormat, "Send:",
            blob_size(&send), nCard+xfer.nGimmeSent+xfer.nIGotSent,
            xfer.nFileSent, xfer.nDeltaSent);
    nCard = 0;