Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface HTTPClient SDFileSystem mbed-rtos mbed wolfSSL
Fork of SimpleDropbox by
dropbox.cpp
- Committer:
- wolfSSL
- Date:
- 2014-12-08
- Revision:
- 0:b20eee676480
- Child:
- 3:0bf592148055
File content as of revision 0:b20eee676480:
/* dropbox.c
*
* Copyright (C) 2006-2014 wolfSSL Inc.
*
* This file is part of CyaSSL.
*
* CyaSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* CyaSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "mbed.h"
#include "EthernetInterface.h"
#include "HTTPClient.h"
extern HTTPClient http;
HTTPResult dropbox_get(const char *url, char *buff, int size)
{
HTTPResult ret ;
#define LOCATION_SIZE 128
static char location[LOCATION_SIZE] ;
static const char HeaderLines[] =
"User-Agent: curl/7.33.0\r\n"
"Accept: */*\r\n" ;
http.setHeader(HeaderLines) ;
http.setLocationBuf(location, LOCATION_SIZE) ;
ret = http.get(url, buff, size) ;
if (ret != HTTP_REDIRECT) {
printf("++ Err = %d - HTTP ret = %d ++\n",
ret, http.getHTTPResponseCode());
return ret ;
}
ret = http.get(location, buff, size) ;
if (ret != HTTP_OK) {
printf("++ Err = %d - HTTP ret = %d ++\n",
ret, http.getHTTPResponseCode());
return ret ;
}
return HTTP_OK ;
}
