<i>http::geturl : Missing Content-Length header for POST requests</i> status still Open with 3 other changes
by
.
D 2022-05-10T22:05:17.416
J icomment Hi\sAndreas,\r\n\r\nYou\sappear\sto\sbe\susing\s"-method\sPOST"\sto\swork\saround\sthe\sissue\sthat\shttp::geturl\streats\s"-query\s{}"\sas\sa\sGET\snot\sa\sPOST\s(see\salso\sbug\s[15e4bd83c28d0a]).\r\n\r\nThe\sman\spage\shttp(n)\sstates:\r\n\r\n<verbatim>\r\n\s\s\s\s-method\stype\r\n\s\s\s\s\s\s\s\sForce\sthe\sHTTP\srequest\smethod\sto\stype.\s::http::geturl\swill\sauto-select\sGET,\sPOST\sor\sHEAD\sbased\son\sother\soptions,\sbut\sthis\soption\senables\schoices\slike\sPUT\sand\sDELETE\sfor\swebdav\ssupport.\r\n</verbatim>\r\n\r\nThe\soption\s-method\sallows\sthe\scaller\sto\soverride\sthe\smethod\sthat\swould\sotherwise\sbe\sselected\sby\shttp::geturl.\s\sThis\soption\sgives\sthe\sscript\sthe\spower\sto\ssend\snonsense\srequests.\s\sFor\sexample,\sthe\soptions\s"-query\sfoo\s-method\sGET"\swill\ssend\sa\sGET\swith\sa\srequest\sbody,\salthough\sRFC\s7231\sstates:\r\n\r\n<verbatim>\r\n\s\s\sA\spayload\swithin\sa\sGET\srequest\smessage\shas\sno\sdefined\ssemantics;\r\n\s\s\ssending\sa\spayload\sbody\son\sa\sGET\srequest\smight\scause\ssome\sexisting\r\n\s\s\simplementations\sto\sreject\sthe\srequest.\r\n</verbatim>\r\n\r\nWhen\susing\soption\s-method,\sit\sis\sthe\sresponsibility\sof\sthe\scaller\sto\schoose\sarguments\ssuch\sthat\sthe\srequest\sis\snot\snonsense.\s\sIn\sgeneral\sit\sis\snot\spossible\sfor\shttp::geturl\sto\sguess\swhat\sthe\scaller\sintends.\s\sIf\sthere\swere\sno\sother\sway\sto\ssend\sa\sPOST\swithout\sa\srequest\sbody,\sI\swould\sattempt\sto\sadapt\shttp::geturl.\sHowever,\sthere\sis\sa\ssolution\sand\sso\sI\spropose\sto\samend\sthe\sman\spage\sto\sclarify\sthe\suse\sof\soption\s-method\sand\smention\sthis\sspecific\scase:\r\n\r\n<verbatim>\r\nIt\sis\sthe\scaller's\sresponsibility\sto\sensure\sthat\sthe\sheaders\sand\srequest\sbody\s(if\sany)\sconform\sto\sthe\srequirements\sof\sthe\smethod.\s\sFor\sexample\sif\susing\s-method\sPOST\sto\ssend\sa\sPOST\swith\san\sempty\srequest\sbody,\sthe\scaller\smust\salso\ssupply\sthe\soption\s"-headers\s{Content-Length\s0}".\r\n</verbatim>\r\n\r\nBest\swishes,\r\n\r\nKeith\sNash.
J login kjnash
J mimetype text/x-fossil-wiki
K 6afa947d1a92aacecdc4e681741d006b63da4e94
U kjnash
Z 61e75ffc413ba7e47fc9c81331dcc254