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:33] 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+
  
-La petición con live http-headers es: +Pulsamos continue y nos fijamos en los POST de http headers:
-<code> +
-http://testvalidacio.catcert.cat/psiswebclient/verifyCert.do+
  
  
  
-POST /psiswebclient/verifyCert.do HTTP/1.1+Si hacemos click lo abre en otra ventana:
  
-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+Para simularloprimero vamos a la primera web y guardamos la cookie
  
-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" \ 
 +     -c cookie1 \ 
 +     -D header1 \ 
 +     -o page1.html \ 
 +     -L "http://localhost:8000/mw-config/index.php" 
 +</code>
  
-Accept-Encodinggzip,deflate+<code> 
 +curl -A "User-AgentMozilla/5.0 (X11; Linux 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-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7+<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>
  
-Keep-Alive: 115 
  
-Connectionkeep-alive+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 →
  
-Refererhttp://testvalidacio.catcert.cat/psiswebclient/verify/certificate/verifycertreq.jsp+<code> 
 +curl -A "User-AgentMozilla/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>
  
-CookieJSESSIONID=FF1FA7290A9763D5666EAA41F28BCC96.app-linux3; __utma=207753728.979729517.1283506803.1283510321.1299841686.4; __utmz=207753728.1299841686.4.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)+POST: 
 +  mysql__SameAccount=1&mysql_wgDBuser=wikiuser&mysql_wgDBpassword=&submit-continue=Continue
  
-Content-Typemultipart/form-databoundary=---------------------------19885389925490671952116794076 +<code> 
- +curl -A "User-AgentMozilla/5.0 (X11Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" \ 
-Content-Length: 2301 +     -b cookie4 \ 
- +     -c cookie5 \ 
------------------------------19885389925490671952116794076 +     -D header5 \ 
- +     -o page5.html \ 
-Content-Disposition: form-data; name="certBase64" +     -d "mysql__SameAccount=1&mysql_wgDBuser=wikiuser&mysql_wgDBpassword=&submit-continue=Continue\ 
- +     -e "http://localhost:8000/mw-config/index.php?page=DBSettings" \ 
- +     -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 
-