Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 587a9b40eece2baba8ccb8833129bfc170e6e86506c5a0a938f02743408cf9e7
Ticket: 0063cbcada41024be2d778dc719a64fe2144e0aa
http: wrong parameter "-headers A" not detected and sent anyway
User & Date: oehhar on 2020-09-27 17:39:19
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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 changed to: "2.10.0a1"
  6. is_private changed to: "0"
  7. login: "oehhar"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "oehhar"
  14. subsystem changed to: "29. http Package"
  15. title changed to:
    http: wrong parameter "-headers A" not detected and sent anyway
    
  16. type changed to: "RFE"