Fossil

Check-in [a60d2976]
Login

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

Overview
Comment:Fix Content-Type/Content-Length for GET/POST requests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-change-hook
Files: files | file ages | folders
SHA1:a60d2976ff922a08acf505d389f014a80d11e50f
User & Date: jan.nijtmans 2013-12-13 15:19:32
Context
2013-12-13
21:46
Unify use of the user-agent string. check-in: 55c91af5 user: mistachkin tags: tkt-change-hook
15:19
Fix Content-Type/Content-Length for GET/POST requests. check-in: a60d2976 user: jan.nijtmans tags: tkt-change-hook
14:19
Merge trunk and fix typo (missing backslash) check-in: 84710701 user: jan.nijtmans tags: tkt-change-hook
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/th_main.c.

911
912
913
914
915
916
917
918
919
920

921
922



923
924
925
926
927
928
929
    if( urlData.passwd && urlData.user && urlData.passwd[0]=='#' ){
      char *zCredentials = mprintf("%s:%s", urlData.user, &urlData.passwd[1]);
      char *zEncoded = encode64(zCredentials, -1);
      blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded);
      fossil_free(zEncoded);
      fossil_free(zCredentials);
    }
    blob_appendf(&hdr, "Host: %s\r\n", urlData.hostname);
    blob_appendf(&hdr, "User-Agent: Fossil/" RELEASE_VERSION
                       " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n");

    blob_appendf(&hdr, "Content-Type: text/plain\r\n");
    blob_appendf(&hdr, "Content-Length: %d\r\n\r\n", blob_size(&payload));



    if( transport_open(&urlData) ){
      Th_ErrorMessage(interp, transport_errmsg(&urlData), 0, 0);
      blob_reset(&hdr);
      blob_reset(&payload);
      return TH_ERROR;
    }
    transport_send(&urlData, &hdr);







|
|
|
>
|
|
>
>
>







911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
    if( urlData.passwd && urlData.user && urlData.passwd[0]=='#' ){
      char *zCredentials = mprintf("%s:%s", urlData.user, &urlData.passwd[1]);
      char *zEncoded = encode64(zCredentials, -1);
      blob_appendf(&hdr, "Authorization: Basic %s\r\n", zEncoded);
      fossil_free(zEncoded);
      fossil_free(zCredentials);
    }
    blob_appendf(&hdr, "Host: %s\r\n"
        "User-Agent: Fossil/" RELEASE_VERSION " (" MANIFEST_DATE
        " " MANIFEST_VERSION ")\r\n", urlData.hostname);
    if( zType[0]=='P' ){
      blob_appendf(&hdr, "Content-Type: application/x-www-form-urlencoded\r\n"
          "Content-Length: %d\r\n\r\n", blob_size(&payload));
    }else{
      blob_appendf(&hdr, "\r\n");
    }
    if( transport_open(&urlData) ){
      Th_ErrorMessage(interp, transport_errmsg(&urlData), 0, 0);
      blob_reset(&hdr);
      blob_reset(&payload);
      return TH_ERROR;
    }
    transport_send(&urlData, &hdr);