User Tools

Site Tools


informatica:linux:curl:post_de_un_fichero

Post de un fichero

En la web de validación de catcert subimos un certificado para validarlo:

http://testvalidacio.catcert.cat

Exportamos nuestro certificado a un fichero certificado.txt. La petición es:

curl -F "certFile=@certificado.txt;application/octet-stream" http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do

Sacamos el nombre de la variable de Content-Disposition y el tipo de fichero de Content-Type:

Content-Disposition: form-data; name="certFile"; filename="certificado.txt"
Content-Type: application/octet-stream

Toda la petición con live http-headers es:

http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do



POST /psiswebclient/verifyCert.do HTTP/1.1

Host: testvalidacio.catcert.cat

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; es-ES; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Referer: http://testvalidacio.catcert.cat/psiswebclient/verify/certificate/verifycertreq.jsp

Cookie: JSESSIONID=FF1FA7290A9763D5666EAA41F28BCC96.app-linux3; __utma=207753728.979729517.1283506803.1283510321.1299841686.4; __utmz=207753728.1299841686.4.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

Content-Type: multipart/form-data; boundary=---------------------------19885389925490671952116794076

Content-Length: 2301

-----------------------------19885389925490671952116794076

Content-Disposition: form-data; name="certBase64"





-----------------------------19885389925490671952116794076

Content-Disposition: form-data; name="certFile"; filename="certificado.txt"

Content-Type: application/octet-stream



-----BEGIN CERTIFICATE-----

MIIFQDCCBKmgAwIBAgIEPL7q0TANBgkqhkiG9w0BAQUFADA2MQswCQYDVQQGEwJF

nl5zfYDAJMWIE8hALMzH1DkSHW1UCbL1kVUNZQNhLmzqohsi1jIFTu691hkSJ/6C

qYf91A==

-----END CERTIFICATE-----



-----------------------------19885389925490671952116794076--



HTTP/1.1 200 OK

Date: Mon, 14 Mar 2011 10:38:53 GMT

Content-Type: text/html;charset=ISO-8859-1

Content-Length: 31767

Connection: Keep-Alive

----------------------------------------------------------

Con Proxy

curl -x proxy:puerto -U usuario:contrasenya url

informatica/linux/curl/post_de_un_fichero.txt · Last modified: 2015/04/13 20:19 by 127.0.0.1