Curl + KISS in RRF
-
@sinned6915 I just discovered an intersting tool HTTPie: https://github.com/jakubroztocil/httpie#file-upload-forms which allows to run http commands interactively. This may help finding the problem.
-
@sinned6915 I checked the documentation https://github.com/chrishamm/DuetWebControl, the chapter rr_upload says, a response {"err":0} means, that the transfer was successful.
So I suspect the target path makes problems.
-
So I am making some headway I think-
You are right, the transfer is getting initiated, but the payload is empty.
Here is the partial output ofM111 S1 P2 - https://pastebin.com/UE2ytPLr
all it shows is that the connections are initiated and accepted .
The gcode file list shows the file is there but with 0 length.
-
@sinned6915 I would try using a more current curl version, current is 7.65.1. There were lots of bug fixes since 7.55.1 (list: https://curl.haxx.se/changes.html)
-
Sure about the quoting?
-F "file=@"F:\3D_Printer\Kiss_1.6.3\EV2\Preload\KS_Wizard(8).gcode""
Looks like you either need to escape or change the inner qoutes, or more likely remove the outer ones? -
i updated curl to latest version. no luck
i played with the quotes, it does not seem to matter.
I am using DWC 1.22.6 and curl 7.65.1
can i request that someone who uses curl to do this it add the flag for verbose messages and post the output?
are you using username and passwd to connect to the DWC or it public?
-
@sinned6915 I just saw another possibility: https://reprap.org/forum/read.php?416,819219
-
i finally got this figured out. Windows is a little bit different-
In KISS the script call from the Printer ->Post-Process command is
<KSPATH>\EV2RRF.BAT "<FILE>"
the EV2RRF.BAT script contains-
ECHO ON curl -# -v --data-binary "@%1" -X POST http://192.168.0.25/rr_upload?name=gcodes/%~nx1 curl "http://192.168.0.25/rr_disconnect" PAUSE
the %~nx1 is to parse the filename
CAUTION: something does not like dashes / minus signs in the filenames. I have not been able to determine if its KISS or CURL, but its easier to just avoid them all together.
thanks to all who helped me figure this out.
EDIT: The resulting command window will open and show you the progress of the transfer. It will then prompt you to hit any key to close the command window -
F:\3D_Printer\Kiss_1.6.3>ECHO ON F:\3D_Printer\Kiss_1.6.3>curl -# -v --data-binary "@"F:\3D_Printer\Models\Microscope_Stand\files\arm_base.gcode"" -X POST http://192.168.0.25/rr_upload?name=gcodes/arm_base.gcode Note: Unnecessary use of -X or --request, POST is already inferred. * Trying 192.168.0.25:80... * TCP_NODELAY set * Connected to 192.168.0.25 (192.168.0.25) port 80 (#0) > POST /rr_upload?name=gcodes/arm_base.gcode HTTP/1.1 > Host: 192.168.0.25 > User-Agent: curl/7.65.1 > Accept: */* > Content-Length: 6109076 > Content-Type: application/x-www-form-urlencoded > Expect: 100-continue > * Done waiting for 100-continue * We are completely uploaded and fine * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Cache-Control: no-cache, no-store, must-revalidate < Pragma: no-cache < Expires: 0 < Access-Control-Allow-Origin: * < Content-Type: application/json < Content-Length: 9 < Connection: close < {"err":0}* Closing connection 0 F:\3D_Printer\Kiss_1.6.3>curl "http://192.168.0.25/rr_disconnect" {"err":0} F:\3D_Printer\Kiss_1.6.3>PAUSE Press any key to continue . . .
-
@sinned6915 nice that you found the reason finally! Could you please post the command line which works for you, in case someone needs the command also. Would be a good documentation project.
-
to send it via command prompt in Windows -
curl -v -F "file=KS_Wizard.gcode" "http://192.168.0.29/rr_upload?name=gcodes/KS_Wizard.gcode"
where KS_Wizard.gcode was the filename
-
@sinned6915 Thank you, I see, you used the filename without any paths. Good idea. Thank you for documenting. Using curl and rr_ codes is a nice way to connect different hardware or software.
I expect it was some problem of the differences between Windows, Linux and Apple of the path usage which causes the problems, maybe something not defined portable enough. Linux uses /, Windows uses \ and often must be escaped to doubled backslash or some %... value.
-
it's rough, but it works. if I take out either the -X or POST it goes kerflewie.
the Expect 100-continue seems to be the message while its transfering, and it takes a bit to upload the gcode.
i think part of the original issue is the KISS post-process script is using the double quotes in passing on the filename as the argument.
thanks again for your support