Overview
| Artifact ID: | f6b4cabc8a081b394102aa9760f55f33c41b6b91 |
|---|---|
| Ticket: | 6afa947d1a92aacecdc4e681741d006b63da4e94
http::geturl : Missing Content-Length header for POST requests |
| User & Date: | droll on 2017-06-05 20:09:20 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
HTTP POST requests require a Content-Length header if they don't use chunked encoding. The http::geturl command doesn't provide the Content-Length header if it performs a POST requests with an empty body/query. This is certainly a specific situation, however HTTP post requests with empty body/query are legal requests. However, a missing Content-Length header may create misunderstandings on the server side (e.g. seen with Mongoose 6.4). The following code lines demonstrate that the Content-Length header is missing for POST requests if the body/query is missing or empty. The code redefines the 'puts' command to print the data transferred through the socket on the standard output. package require http #-> 2.8.9 rename puts puts_orig proc puts {args} { ::puts_orig stdout "#Std -> [lindex $args end]" ::puts_orig {*}$args } http::geturl http://192.168.1.21:8083/JS/Run/zway.controller.data.softwareRevisionVersion.value -method POST #Std -> POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1 #Std -> Host: 192.168.1.21:8083 #Std -> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 10.0) http/2.8.9 Tcl/8.6.4 #Std -> Connection: close #Std -> Accept: */* #Std -> Accept-Encoding: gzip,deflate,compress http::geturl http://192.168.1.21:8083/JS/Run/zway.controller.data.softwareRevisionVersion.value -method POST -query "" #Std -> POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1 #Std -> Host: 192.168.1.21:8083 #Std -> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 10.0) http/2.8.9 Tcl/8.6.4 #Std -> Connection: close #Std -> Accept: */* #Std -> Accept-Encoding: gzip,deflate,compress http::geturl http://192.168.1.21:8083/JS/Run/zway.controller.data.softwareRevisionVersion.value -method POST -query "Hello" #Std -> POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1 #Std -> Host: 192.168.1.21:8083 #Std -> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 10.0) http/2.8.9 Tcl/8.6.4 #Std -> Connection: close #Std -> Accept: */* #Std -> Accept-Encoding: gzip,deflate,compress #Std -> Content-Type: application/x-www-form-urlencoded #Std -> Content-Length: 5 #Std -> #Std -> Hello It would be good to fix the http::geturl command in a way that the 'Content-Length' header is also provided for POST requests with empty/missing bodies/queries. - foundin changed to: "http package, 2.8.9"
- is_private changed to: "0"
- login: "droll"
- priority changed to: "5 Medium"
- private_contact changed to: "c7f3b5a0831cb53da82e8d0adc0c229e226e82cc"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "droll"
- subsystem changed to: "29. http Package"
- title changed to:
http::geturl : Missing Content-Length header for POST requests
- type changed to: "Bug"