Curl + KISS in RRF
-
I was using that script to connect windows 10 to Octoprint- same one i started with and posted above.
I was not able to get it to connect to duet. One of the posters was using a Mac and the script options are different.
good idea on trying to enable the debugging! i know M111 P2 (?) sets debug in HTTP. I will try that. P1 is network and floods the terminal buffers
Currently, I am either getting that 'continue' error or an authentication error. I do not have any password set but something tells me i should try to connect with no password regardless to start the connection.
-
@sinned6915 maybe your timeout is because Duet doesn't close the connection, dc42 has commented in https://forum.duet3d.com/topic/867/duet-wifi-s3d/42 to use additional:
dc42:
You may wish to add the following line at the end:
curl "http://XXX.XXX.XXX.XXX/rr_disconnect"
This will avoid RRF buffering up messages that S3D isn't going to fetch.Another idea:
Your curl command seems to be ok, the connection reported 100 and 200, which means successful.It transmitted 9 bytes. Are you sure it is not a link which you want to upload (the (8) file), which is only 9 bytes long?And you could try -X POST in the command additionally.Edit: the content-length comment was wrong, the 9 bytes are the response. But the sending is about 2 MB, maybe there is a file limit somewhere. E.g. https://forum.duet3d.com/topic/4355/maximum-g-code-file-size/3 the SD card clustered.
-
@JoergS5 I saw the content lengths and thought it was odd, but assumed that it was HTTP not file system.
I have an overnight print going so I will test it out after it gets done. I remember reading about the cluster size somewhere and it prompted me to seek out the official SD card formatter. I can not remember what I used when i formatted the card. Its worth checking out.
I did try playing with the -X POST but I thought that it complained about being redundant with the -F option. I am not sure why the syntax changes color on this so much, but the first tan line says POST and I assumed that it was using POST. I will have to double check.
What I can not figure out is if its waiting for a server response- 'multpart' form boundary.
-
@sinned6915 my last few ideas:
to test whether your connection (with authentication) works correctly, you could start a print with curl of an existing file.
I saw curl has an alternative to multipart, for post also. You could try this also. But as I understood, curl manages the multipart formatting.
Kiss may produce specific gcode, you could try the curl with a little general gcode file.
I saw a curl option like --data-binary, maybe this helps. -
@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