Skip to content
Tcl Source Code History Of Ticket 0063cbcada
Login

History Of Ticket 0063cbcada

Artifacts Associated With Ticket 0063cbcada

  1. Ticket change [587a9b40ee] (rid 187083) by oehhar on 2020-09-27 17:39:19:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      This is just a proposal to enhance the http package, not important.
      
      If the -headers argument is not a dict, communication happens with stange data.
      There is no error shown.
      
      My example:
      <verbatim>
      set hHTTP [http::geturl http://localhost:30030/postfile/test.csv\
      	-headers {{Authorization "Basic [binary encode base64 user:pw]"}}\
      	-querychannel $hFile\
      	-command [namespace code TransmitEnd]\
      	-type "text/csv;charset=utf-8"\
      	-timeout [expr 180000]
      </verbatim>
      
      The issue are the double "{{" in the -headers argument. That looks and is stupid. But it happend to me in deep code nesting so not so obvious...
      
      The sent headers are:
      <verbatim>
      host       -> 'localhost:30030'
      user-agent -> 'Mozilla/5.0 (Windows; U; Windows NT 10.0) http/2.10.0 Tcl/8.6.10'
      connection -> 'close'
      </verbatim>
      My test server errors out due to missing content-length.
      
      This issue is, that the line 1415:
      <verbatim>
      	dict for {key value} $state(-headers) {
      </verbatim>
      fails and  is catched by a large general catch.
      
      The http log is:
      
      <verbatim>
      ^A1 URL http://localhost:30030/postfile/el1068.csv - token ::http::1 
      {Using sock0652E0D0 for localhost:30030 - token ::http::1} {}
      L():2020-09-27 19:34:32 5 > (::uitk::uitkStateSet State Transmit)
      ^B1 begin sending request - token ::http::1
      {WARNING - if testing, pay special attention to this case (GI) which is seldom executed - token ::http::1}
      {Closing socket sock0652E0D0 (no connection info)}
      </verbatim>
      
      Thank you,
      Harald
      
    5. foundin initialized to: "2.10.0a1"
    6. is_private initialized to: "0"
    7. login: "oehhar"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "oehhar"
    14. subsystem initialized to: "29. http Package"
    15. title initialized to:
      http: wrong parameter "-headers A" not detected and sent anyway
      
    16. type initialized to: "RFE"
  2. Ticket change [7b7aae7df3] (rid 187164) by oehhar on 2020-09-28 16:05:55:

    1. icomment:
      Implementation proposed with checkin [b069de75ef] within branch [bug-0063cbcada-http-headers-param-check].
      
      I may merge in a week if there are no objections.
      
      Thank you,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  3. Ticket change [b0ae4776bd] (rid 187189) by oehhar on 2020-09-29 08:31:24:

    1. icomment:
      Sorry, solution was based on branch [trunk], and not on [core-8-6-branch].
      Here is the commit now in the right branch: [d3dafb6bd0].
      The branch is still  [bug-0063cbcada-http-headers-param-check].
      
      Thank you,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  4. Ticket change [e21a6be390] (rid 187198) by jan.nijtmans on 2020-09-29 15:59:50:

    1. icomment:
      Nice solution. Thanks!
      
      The added testcase "http-3.2" after "http-3.34" is a duplicate. I assume this one just can be removed. That's my only remark. Further on +1!
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [5bdb26b34f] (rid 187205) by oehhar on 2020-09-29 16:26:58:

    1. assignee changed to: "oehhar"
    2. closedate changed to: "2459122.18539767"
    3. closer changed to: "oehhar"
    4. icomment:
      Thanks to the positive feed-back!
      
      Anything is merged now:
      
         *   core-8-6-branch: [8cc32f2b74]
         *   core-8-branch: [5c8a8fdddb]
         *   trunk: [6d8e3c6658]
      
      Thank you,
      Harald
      
    5. login: "oehhar"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Accepted"
    8. status changed to: "Closed"
    9. username: "oehhar"
  6. Ticket change [db4c76c840] (rid 187207) by sebres on 2020-09-29 18:34:49:

    1. closedate changed to: "2459122.27417895"
    2. closer changed to: "sebres"
    3. icomment:
      Although this check is nice for negative case, it is a bit questionable how it is implemented currently, at least in positive (good) case if the headers value is initially a dict.
      
      Because then this dict object would shimmer twice:
      
          - once by <code>[string is $type($flag) -strict $value]</code> (or even by <code>[llength $value]</code>) to a list;<br>
          - and hereafter by <code>dict for {key value} $state(-headers)</code> back to the dict.
      
      For requests with large headers as dictionary it could be unwanted.
      
      Since 8.7 it is enough to define type of headers as "dict" (without special check with llength).
      For 8.6 (missing <code>[string is dict ...]</code>) it could be implemented differently (e. g. without check of type, with some dict command, like <code>[dict size]</code>).
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
  7. Ticket change [2d641db1af] (rid 187208) by oehhar on 2020-09-30 06:56:51:

    1. closedate changed to: "2459122.7894824"
    2. closer changed to: "oehhar"
    3. icomment:
      Sebres,
      
      thank you, this is bad news.
      
      I have hoped, that:
      
         *   the "string is list" routines do not shimmer to string, if the value is already a dict, as a dict is always a valid list. This implies, that there is a valid dict representation.
         *   the llength routine does not shimmer for dicts, as a dict is always a valid list of length (dict size) * 2. This implies, that there is no string representation and only a dict representation.
      
      So, I see a high optimization potential in those two routines.
      
      On the other hand, do you have a good proposal to check for a valid dict without a catch? I don't like "[catch {dict size $headers}]" to test the format as this pollutes the ::errorX variables.
      
      An alternate approach would be to add a check each time, "-headers" is used.
      But this will happen within a later stage, so no direct feedback to the command call possible (at least not with the -command option).
      
      Thank you,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"
  8. Ticket change [21758f9fdd] (rid 187209) by jan.nijtmans on 2020-09-30 07:58:37:

    1. closedate changed to: "2459122.8323761"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      I think that "string is list" and "llength" should be smart enough to give the right answers for dicts without shimmering. I'll check if they do, but if they don't that's what should be corrected!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  9. Ticket change [73059f9561] (rid 187210) by oehhar on 2020-09-30 08:05:50:

    1. closedate changed to: "2459122.83738894"
    2. closer changed to: "oehhar"
    3. icomment:
      Thank you, Jan and Sebres! Great that you all care so well.
      
      Thanks,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"
  10. Ticket change [bde4748224] (rid 187211) by jan.nijtmans on 2020-09-30 08:21:29:

    1. closedate changed to: "2459122.84826053"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Looks like sebres is right: currently both "llength" and "string is list" shimmer to list. Actually, "string is list" is implemented by determining the "llength", so those two are actually share the same implementation.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  11. Ticket change [3c217ad55b] (rid 187212) by sebres on 2020-09-30 09:30:46:

    1. closedate changed to: "2459122.89636634"
    2. closer changed to: "sebres"
    3. icomment:
      well, <code>[string is list]</code> can indeed be simply extended to consider dict is a list too, but it is not so simple in case of <code>[llength $dict]<code>, because one has to consider whether dictionary is canonical, doesn't own string representation etc, because one could not always calculate it from dict size.
      
      The worse case is here something like that:
      <code><pre>
      % set d {a 1 b 2 c 3 a still_one_a}
      a 1 b 2 c 3 a still_one_a
      % dict size $d
      3
      % llength $d
      8
      </pre></code>
      so an assumtion that it would always work may be wrong.
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
  12. Ticket change [cb0c868d28] (rid 187213) by oehhar on 2020-09-30 09:37:35:

    1. closedate changed to: "2459122.90110223"
    2. closer changed to: "oehhar"
    3. icomment:
      Serbres,
      thank you for the comment, totally right. But there is a case where it would work.
      
      So a "string is dict" would be great to have (without schimmering if already a dict).
      
      Thank you,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"
  13. Ticket change [56e37bb081] (rid 187214) by sebres on 2020-09-30 11:57:38:

    1. closedate changed to: "2459122.99836726"
    2. closer changed to: "sebres"
    3. icomment:
      As already said, <code>[string is dict]</code> is available in 8.7 (since [https://core.tcl-lang.org/tips/doc/trunk/tip/501.md|TIP#501])...
      
      Cherry-pick would be simply, but you've to convince TCT to allow that for 8.6.
      
      It is still a puzzle to me why even such a simplest things must be implemented in dev-version only (also if one consider that 8.7th branch is so old and still not released, let alone how long it'll take to get an upgrade in some distributions).
      
      BTW, I changed format of ticket to wiki several times, but every time you change a ticket (add a comment), its format going changed to plain text... <br>how you do that? old fossil version?
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
  14. Ticket change [c586d096f9] (rid 187215) by oehhar on 2020-09-30 12:09:24:

    1. closedate changed to: "2459123.00652933"
    2. closer changed to: "oehhar"
    3. icomment:
      Dear Sergey,
      
      thank you for the message.
      
      So, at least for core-8-branch and trunk, we could use "string is dict".
      
      And about the "wiki" type. I use the web-interface.
      Each time, I open the ticket it says format: text.
      I change it manually to "wiki".
      WHen you press "Preview", it changes back.
      
      So, thank you for changing it again after this post, if you know how...
      
      Thanks,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"
  15. Ticket change [dd7b09cf7e] (rid 187219) by oehhar on 2020-09-30 12:24:34:

    1. closedate changed to: "2459123.01706738"
    2. icomment:
      Thank you.
      
      So, "string is dict" is used now in:
      
         *   core-8-branch: [097400e5ad]
         *   trunk [78a983fe3d]
      
      For 8.6, we just may remove the patch if the shimmering is a real problem.
      Nevertheless, I think, it is an improbvement.
      
      Thank you,
      Harald
      
    3. login: "oehhar"
    4. mimetype: "text/x-fossil-wiki"
    5. username: "oehhar"
  16. Ticket change [8d9b790199] (rid 187233) by jan.nijtmans on 2020-09-30 14:59:44:

    1. closedate changed to: "2459123.12482074"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Sorry, I couldn't resist tweaking it a little more, with a way that works with 8.6 as well and gives the same error-message. The "catch" is only expensive when there is an error in the -headers dict, not for any other option, so this is IMHO the best I can think of. No ::errorX variables are polluted, except for the (real) error-message we are handling here.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
  17. Ticket change [55ec1c0997] (rid 187242) by oehhar on 2020-09-30 16:39:24:

    1. closedate changed to: "2459123.19403365"
    2. closer changed to: "oehhar"
    3. icomment:
      Informed by PM by Jan:
      
      core-8-branch does not use "string is dict", as the package is installed under "tcl8.6" in the lib folder and thus may be shared between tcl8.6 and tcl8.7.
      
      Thanks for the great work,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"