Commit 323b3949ce72e6fa5163da5a48ee885d04810c2f

Authored by Ferràn Quer i Guerrero
1 parent 62fc5c15

--no commit message

Project/applications/smartcities/httpClient.c 0 → 100644
  1 +#include "httpClient.h"
  2 +
  3 +/*
  4 +------------
  5 +POST request
  6 +------------
  7 +POST /path/script.cgi HTTP/1.0
  8 +From: frog@jmarshall.com
  9 +User-Agent: HTTPTool/1.0
  10 +Content-Type: application/x-www-form-urlencoded
  11 +Content-Length: 32
  12 +
  13 +home=Cosby&favorite+flavor=flies
  14 +-----------
  15 +GET request
  16 +-----------
  17 +"GET $path HTTP/1.1\015\012",
  18 + "Host: $host\015\012",
  19 + "Connection: close\015\012",
  20 + "User-Agent: GetURL11/1.0\015\012\015\012" ;
  21 +------------
  22 +POST REQUEST
  23 +------------
  24 +POST https://www.easypolls.net/polladm
  25 +Host: www.easypolls.net
  26 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0
  27 +Accept: application/json, text/javascript, *\/*; q=0.01
  28 +Accept-Language: ca,en;q=0.8,en-us;q=0.6,es-es;q=0.4,es;q=0.2
  29 +Accept-Encoding: gzip, deflate
  30 +Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  31 +X-Requested-With: XMLHttpRequest
  32 +Referer: https://www.easypolls.net/
  33 +Content-Length: 55
  34 +Cookie: AWSELB=47292F3B1ABE6284EA92626CE03FD9D94424CDF5A4944582983CE557A13B86D33CD0A0B08CB1F9B3F96C4EB2EB02C3C2B05BACD02900197E12E24FFBC154B412B3DBEC7AA9; __utma=223536783.418364988.1395162582.1395162582.1395162582.1; __utmb=223536783.1.10.1395162582; __utmc=223536783; __utmz=223536783.1395162582.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); JSESSIONID=4A2F288CE32F6F940ACA69C5AB4C41C8; __atuvc=1%7C12
  35 +Connection: keep-alive
  36 +Pragma: no-cache
  37 +Cache-Control: no-cache
  38 +
  39 +command=login&email=mail%40host.com&password=lskdfja
  40 +-----------
  41 +GET REQUEST
  42 +-----------
  43 +GET /path/file.html HTTP/1.1
  44 +Host: www.host1.com:80
  45 +
  46 +[Content]
  47 +*/
  48 +
  49 +//const static char httpHeaders[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n";
  50 +const static char httpHeaders[] = "HTTP/1.1 OK\r\nContent-type: text/html\r\n\r\n";
... ...
Project/applications/smartcities/include/httpClient.h 0 → 100644
  1 +/*
  2 + * Custom http client implementation based on httpServer
  3 + *
  4 + */
  5 +#ifndef HTTP_CLIENT_H
  6 +#define HTTP_CLIENT_H
  7 +
  8 +#include "libwismart.h"
  9 +#include "lwip/opt.h"
  10 +#include "lwip/tcp.h"
  11 +#include "lwip/udp.h"
  12 +#include "lwip/sys.h"
  13 +#include "lwip/api.h"
  14 +#include "ch.h"
  15 +
  16 +#define DBG(fmt,...) if(1){printf("[SRV] "fmt"\r\n", ##__VA_ARGS__);}else{({});}
  17 +#define DBG_WARNING(fmt,...) if(1){printf("[SRV_WARNING] "fmt"\r\n", ##__VA_ARGS__);}else{({});}
  18 +
  19 +void httpServer_init(void);
  20 +void httpServer_start(void);
  21 +msg_t httpServer_threadFunc(void *arg);
  22 +void httpServer_serveClient(struct netconn* httpClientConnection);
  23 +void getLocalTime(uint32_t* hours, uint32_t* minutes, uint32_t* seconds);
  24 +
  25 +#endif
0 26 \ No newline at end of file
... ...