diff --git a/README.md b/README.md index b6b8321368c32e31e33fe75183ea656d9796b8ea..75b59b92f61af9d48ad533a59730cf0223fa1138 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,45 @@ curl -X POST -H "X-Resource-Type: file" -H "Authorization: Bearer valid-token-1" curl -X DELETE -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" http://localhost:8080/ftps/mon-ftp/dossier1_nouveau_nom ``` +#### 3) Exemple download et upload fichiers et dossiers + +On montre que l'on peut télécharger une image sur le serveur2 et l'envoyer sur le serveur1 : + +- download image : +```shell +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp2/image0.png -o image0.png +``` + +- upload image : +```shell +curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" --upload-file image0.png http://localhost:8080/ftps/mon-ftp/image0.png +``` + +Ensuite on montre que l'on peut envoyer un dossier en commençant par en faire un zip, et que l'on peut télécharger le `dossier0` qui est sur le serveur2 : + +- upload dossier : +```shell +zip -r dossier1.zip dossier1 + +curl -X POST -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" -H "Content-Type: application/octet-stream" --data-binary @dossier1.zip http://localhost:8080/ftps/mon-ftp/upload-dir/dossier1 +``` + +- download dossier : +```shell +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp2/dossier0 -o dossier0.zip + +unzip dossier1.zip +``` + +#### 4) Exemple chercher des fichiers stockés dans plusieurs serveurs FTP + +Maintenant que l'on a `image0.png` sur les deux serveur on peut utiliser la commande suivante pour obtenir les URLs des fichiers qui sont sur deux serveurs FTP : + +- rechercher une ressource : +```shell +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" http://localhost:8080/ftps/search/image0.png +``` + ## Instructions de build et d'exécution SANS la vidéo ### Build l'archive @@ -158,41 +197,43 @@ curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" **Note comprise entre 11 et 12 si—en plus—le proxy FlopBox, permet de télécharger (download) et téléverser (upload) un petit fichier texte:** -- download fichier : + +- upload fichier : ```shell -curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/fichier1 -o fichier1 +curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" --upload-file fichier2 http://localhost:8080/ftps/mon-ftp/fichier2 ``` -- download dossier (ne fonctionne pas bien pour le moment je crois) : +- upload dossier : ```shell -curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/dossier1 -o dossier1.zip +zip -r dossier1.zip dossier1 -unzip dossier1.zip +curl -X POST -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" -H "Content-Type: application/octet-stream" --data-binary @dossier1.zip http://localhost:8080/ftps/mon-ftp/upload-dir/dossier1 ``` -- upload fichier : +- download fichier : ```shell -curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" --upload-file fichier2 http://localhost:8080/ftps/mon-ftp/fichier2 +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/fichier1 -o fichier1 ``` -- upload dossier : - +- download dossier : ```shell -zip -r dossier2.zip dossier2 +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/dossier1 -o dossier1.zip -curl -X POST -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" -H "Content-Type: application/octet-stream" --data-binary @dossier2.zip http://localhost:8080/ftps/mon-ftp/upload-dir/dossier2 +unzip dossier1.zip ``` **Note comprise entre 12 et 13 si—en plus—le proxy FlopBox, permet de télécharger (download) et téléverser (upload) un gros fichier binaire (image, vidéo, etc.):** -- download fichier : +(comme dans l'étape d'avant on peut envoyer et télécharger des images) + +- upload image : ```shell -curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/image.png -o image.png +curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" --upload-file image.png http://localhost:8080/ftps/mon-ftp/image.png ``` -- upload fichier : +- download image : ```shell -curl -X PUT -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: user" -H "X-FTP-Pass: password" --upload-file image2.jpg http://localhost:8080/ftps/mon-ftp/image2.jpg +curl -X GET -H "Authorization: Bearer valid-token-1" -H "X-FTP-User: anonymous" -H "X-FTP-Pass: anonymous" http://localhost:8080/ftps/mon-ftp/image0.png -o image0.png ``` **Note comprise entre 13 et 14 si—en plus—le proxy FlopBox permet de gérer plusieurs serveurs FTP différents (ajout, suppression, modification des serveurs):** diff --git a/dossier_serveur_ftp2/dossier0/fichier01 b/dossier_serveur_ftp2/dossier0/fichier01 new file mode 100644 index 0000000000000000000000000000000000000000..9021e9a019f1ad492ab273c8785aad80c16d3b01 --- /dev/null +++ b/dossier_serveur_ftp2/dossier0/fichier01 @@ -0,0 +1 @@ +FICHIER01 diff --git a/dossier_serveur_ftp2/image0.jpg b/dossier_serveur_ftp2/image0.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6ea0d8bee03746c1ae94cfa7e064183a21407a11 Binary files /dev/null and b/dossier_serveur_ftp2/image0.jpg differ