curl
Versatile tool to get info from url's.
debugging
A way to make curl log about the certificate interaction is running it like this.
| trace.log | |
|---|---|
- --trace trace.log : Full trace log output will go to the file trace.log
- -k : or --insecure, this option doe not fail on 'insecure' connections
- --cert x.pem : use the client certificate x.pem
osx problem
The --cert parameter does not work on osx. It is also not listed in the man page for some reason since it is there. You can circumvent most problems by adding the client certificate to your keychain and then using the name in the --cert parameter. So something like :
| include client cert | |
|---|---|
While on the subject, don't use darwinssl at all since it crashes as well. To test what you use :
| version | |
|---|---|
Will mention which ssl version it uses, if you have darwinssl listed :
The last bash is what i needed before it used the correct version.
POST files
Here is a simple setup you can use to post files to a http(s) server if you have no access on ssh or ftp. This is what you can use on the serverside, php is enough but I added a html file that can be used for manual uploads as well.
| post | |
|---|---|
Simple html file to use the next php file :
Remotely you can post a file to this server with :
| post a file | |
|---|---|
file size problem
In the setup above I encountered multiple times that the $_FILES array in the php script stayed empty. It seems that any error you make causes this to happen.
For instance this typo : '@data=thefile.gz' instead of 'data=@thefile.gz' causes no error but an empty _FILES. The last time I encountered it was when the transferred file was too big !! The default limit is set in /etc/php5/apache2/php.ini on the server :
I presume both need to be enlarged, since my first attempt was enlarging upload_max_filesize to 20M while my file was 8,5 M. It still did not work until i zipped the file so it went under 8MB