![](/media/cache/profiles/6d042df5f90546ecee8736241d28dbe1.jpg.50x50_q85.jpg)
HTTP Client test for AbitUSBModem. see: http://developer.mbed.org/users/phsfan/notebook/abitusbmodem/
Dependencies: AbitUSBModem USBHost mbed
TinyHTTP.h
- Committer:
- phsfan
- Date:
- 2015-02-19
- Revision:
- 0:35cf1b2fc6e2
File content as of revision 0:35cf1b2fc6e2:
/* * mbed Tiny HTTP Client for Ethernet Interface Library * Copyright (c) 2012 Hiroshi Suga * Released under the MIT License: http://mbed.org/license/mit */ /** @file * @brief Tiny HTTP Client */ #ifndef TinyHTTP_h #define TinyHTTP_h #include "mbed.h" #define HTTP_PORT 80 #define HTTP_TIMEOUT 3000 // ms #define METHOD_GET 0 #define METHOD_POST 1 typedef void (*onHttpReceiveFunc)(char *buf, int len); /** send http request * @param method METHOD_GET or METHOD_POST * @param host http server * @param uri URI * @param head http header (CR+LF) (or NULL) * @param body POST body (or NULL) * @return http code, -1:failue */ int httpRequest (int method, char *host, int port, char *uri, char *head, char *body, onHttpReceiveFunc func); void createauth (char *user, char *pwd, char *buf, int len); int base64enc(const char *input, unsigned int length, char *output, int len); int urlencode(char *str, char *buf, int len); #endif