User Tools

Site Tools


informatica:linux:curl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
informatica:linux:curl [2011/03/14 11:36] 83.247.136.12informatica:linux:curl [2020/05/29 16:46] jose
Line 1: Line 1:
-====== Post de un fichero ====== +====== Post con curl ====== 
-En la web de validación de catcert subimos un certificado para validarlo: +Instalamos la extensión "HTTP header live"
-  http://testvalidacio.catcert.cat+
  
-Exportamos nuestro certificado a un fichero certificado.txt. La petición es: +http://localhost:8000/mw-config/index.php
-  curl -F "certFile=@certificado.txt;application/octet-stream" http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do+
  
-Sacamos el nombre de la variable de **Content-Disposition** el tipo de fichero de **Content-Type**:\\ +Pulsamos continue nos fijamos en los POST de http headers:
-  Content-Disposition: form-data; name="certFile"; filename="certificado.txt" +
-  Content-Typeapplication/octet-stream+
  
-Toda la petición con live http-headers es: 
-<code> 
-http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do 
  
  
 +Si hacemos click lo abre en otra ventana:
  
-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+Para simularlo, primero vamos a la primera web y guardamos la cookie
  
-Accepttext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8+<code> 
 +curl -A "User-AgentMozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" \ 
 +     -c cookie1 \ 
 +     -D header1 \ 
 +     -o page1.html \ 
 +     -L "http://localhost:8000/mw-config/index.php" 
 +</code>
  
-Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3+<code> 
 +curl -A "User-Agent: Mozilla/5.0 (X11Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" \ 
 +     -b cookie1 \ 
 +     -c cookie2 \ 
 +     -D header2 \ 
 +     -o page2.html \ 
 +     -X POST \ 
 +     -d "LanguageRequestTime=1590767092&uselang=en&ContLang=en&submit-continue=Continue"
 +     -e "http://localhost:8000/mw-config/index.php" \ 
 +     -L "http://localhost:8000/mw-config/index.php?page=Welcome" 
 +</code>
  
-Accept-Encodinggzip,deflate+<code> 
 +curl -A "User-AgentMozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
 +     -b cookie2 \ 
 +     -c cookie3 \ 
 +     -D header3 \ 
 +     -o page3.html \ 
 +     -X POST \ 
 +     -d "submit-continue=Continue"
 +     -e "http://localhost:8000/mw-config/index.php?page=Welcome"
 +     -L "http://localhost:8000/mw-config/index.php?page=Language" 
 +</code>
  
-Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 
  
-Keep-Alive115+POST 
 +  DBType=mysql&mysql_wgDBserver=app-db&mysql_wgDBname=my_wiki&mysql_wgDBprefix=prueba&mysql__InstallUser=root&mysql__InstallPassword=wiki&sqlite_wgSQLiteDataDir=/var/www/data&sqlite_wgDBname=my_wiki&submit-continue=Continue →
  
-Connectionkeep-alive+<code> 
 +curl -A "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
 +     -b cookie3 \ 
 +     -c cookie4 \ 
 +     -D header4 \ 
 +     -o page4.html \ 
 +     -d "DBType=mysql&mysql_wgDBserver=app-db&mysql_wgDBname=my_wiki&mysql_wgDBprefix=prueba&mysql__InstallUser=root&mysql__InstallPassword=wiki&sqlite_wgSQLiteDataDir=/var/www/data&sqlite_wgDBname=my_wiki&submit-continue=Continue"
 +     -e "http://localhost:8000/mw-config/index.php?page=DBConnect"
 +     -L "http://localhost:8000/mw-config/index.php?page=DBConnect" 
 +</code>
  
-Refererhttp://testvalidacio.catcert.cat/psiswebclient/verify/certificate/verifycertreq.jsp+POST: 
 +  mysql__SameAccount=1&mysql_wgDBuser=wikiuser&mysql_wgDBpassword=&submit-continue=Continue
  
-CookieJSESSIONID=FF1FA7290A9763D5666EAA41F28BCC96.app-linux3__utma=207753728.979729517.1283506803.1283510321.1299841686.4__utmz=207753728.1299841686.4.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) +<code> 
- +curl -A "User-AgentMozilla/5.0 (X11Linux x86_64rv:68.0Gecko/20100101 Firefox/68.0" \ 
-Content-Type: multipart/form-data; boundary=---------------------------19885389925490671952116794076 +     -b cookie4 \ 
- +     -c cookie5 \ 
-Content-Length: 2301 +     -D header5 \ 
- +     -o page5.html \ 
------------------------------19885389925490671952116794076 +     -d "mysql__SameAccount=1&mysql_wgDBuser=wikiuser&mysql_wgDBpassword=&submit-continue=Continue\ 
- +     -e "http://localhost:8000/mw-config/index.php?page=DBSettings" \ 
-Content-Disposition: form-data; name="certBase64" +     -L "http://localhost:8000/mw-config/index.php?page=DBSettings"
- +
- +
- +
- +
- +
------------------------------19885389925490671952116794076 +
- +
-Content-Disposition: form-data; name="certFile"; filename="certificado.txt" +
- +
-Content-Typeapplication/octet-stream +
- +
- +
- +
------BEGIN CERTIFICATE----- +
- +
-MIIFQDCCBKmgAwIBAgIEPL7q0TANBgkqhkiG9w0BAQUFADA2MQswCQYDVQQGEwJF +
- +
-nl5zfYDAJMWIE8hALMzH1DkSHW1UCbL1kVUNZQNhLmzqohsi1jIFTu691hkSJ/6C +
- +
-qYf91A=+
- +
------END CERTIFICATE----- +
- +
- +
- +
------------------------------19885389925490671952116794076-- +
- +
- +
- +
-HTTP/1.1 200 OK +
- +
-DateMon, 14 Mar 2011 10:38:53 GMT +
- +
-Content-Type: text/html;charset=ISO-8859-1 +
- +
-Content-Length: 31767 +
- +
-Connection: Keep-Alive +
- +
-----------------------------------------------------------+
 </code> </code>
- 
-====== Con Proxy ====== 
-curl -x proxy:puerto -U usuario:contrasenya url 
-