Giter Club home page Giter Club logo

uhttp's Introduction

uHTTP

Donate

uHTTP is a tiny library for Arduino that provide a very manner way to access to HTTP request data

This library is written by Filippo Sallemi [email protected]

Installation

To install the libraries, you need to place them into your "libraries" folder. You can find it within your Arduino IDE distribution within the "hardware" folder.

  # cd <path/to/your/arduino/distribution>/libraries
  # git clone https://github.com/nomadnt/uHTTP.git

Or you download the zipped version of the library from https://github.com/nomadnt/uHTTP/archive/master.zip, create a directory <path/to/your/arduino/distribution>/libraries/uHTTP and put the contents of the zip-file there.

Additional information can be found on the Arduino website: http://www.arduino.cc/en/Hacking/Libraries

Be sure to restart the IDE if it was running.

Documentation

For any further information please visit our wiki.

uhttp's People

Contributors

cidzoo avatar ivankravets avatar tonyputi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

uhttp's Issues

Arduino reset after receiving http request

LS,
I am experimenting with your uHTTP code using windows/arduino nano (V3)/ENC28J60 ethernet.

As start I just took your example.
It starts OK, but during display of the results the arduino just resets, browser displays "Connection was reset".
To make sure it is not the result of the displaying I removed all print(ln) lines from the example but then still the issue remains and no reply is send to the browser.

When using the "webserver example" from standard arduino ide it works OK (http request received in arduino, result sent back and displayed in browser. This show board and network connectivity is OK.

Did you see this behaviour before ? Is there a way to debug this ?

Herman

even example doesn't compile on arduino 1.6.6

Hi.

Hi try to use uHTTP but even when I load the example, it doesn't compile and get a lot of error, those are:

[code]

Build options changed, rebuilding all
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp: In member function 'EthernetClient uHTTP::available()':
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp:84:52: error: 'strncmp_P' was not declared in this scope
if(strncmp_P(buffer, PSTR("OP"), 2) == 0) method = uHTTP_METHOD_OPTIONS;
^
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp:149:56: error: 'strncmp_P' was not declared in this scope
if(strncmp_P(buffer, PSTR("Auth"), 4) == 0) header = AUTHORIZATION;
^
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp: In member function 'const char* uHTTP::parse(const char
, char
, const FlashStringHelper)':
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp:350:56: error: 'strtok_rP' was not declared in this scope
sub = strtok_rP(act, (const PROGMEM char *) sep, &ptr);
^
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp: In member function 'const char
uHTTP::parse(const FlashStringHelper, char, const __FlashStringHelper*)':
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp:368:105: error: 'strncmp_P' was not declared in this scope
for(act = buffer; strncmp_P(sub, (const PROGMEM char *) needle, strlen_P((const PROGMEM char *) needle)); act = NULL){
^
C:\Users\o_for\Documents\Arduino\libraries\uHTTP-master\uHTTP.cpp:369:56: error: 'strtok_rP' was not declared in this scope
sub = strtok_rP(act, (const PROGMEM char *) sep, &ptr);
^
Multiple libraries were found for "Ethernet.h"
Used: C:\Users\o_for\Documents\Arduino\libraries\Ethernet
Not used: C:\arduino-nightly\libraries\Ethernet
Error compiling.

[/code]

uHTTP::body() don't return full data

Hi.

I run uHTTP on my arduino, everything work execpt if I want to get data from body.
on a put request , the client send json data, if a print client all the data is present a have a size of approximatly 1500 char.

but even if I push the uHTTP_buffer_size to 2000 or 3000, the body() return only a faction of the data.

this is client request:
UT /channels HTTP/1.1
Host: 192.168.0.110
Connection: keep-alive
Content-Length: 1511
Accept: application/json, text/plain, /
Origin: http://192.168.0.110
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: http://192.168.0.110/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,fr;q=0.6
{"channels":"[{"name":"name0","canal":"0","status":true,"temperature":21.42,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YJ"},{"name":"name1","canal":"1","status":false,"temperature":-50,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YK"},{"name":"name2","canal":"2","status":false,"temperature":0,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YL"},{"name":"name3","canal":"3","status":false,"temperature":0,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YM"},{"name":"name4","canal":"4","status":false,"temperature":21.27,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YN"},{"name":"name5","canal":"5","status":false,"temperature":20.88,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YO"},{"name":"name6","canal":"6","status":false,"temperature":21.01,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YP"},{"name":"name7","canal":"7","status":false,"temperature":21.04,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YQ"},{"name":"name8","canal":"8","status":false,"temperature":-50,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YR"},{"name":"name9","canal":"9","status":false,"temperature":-50,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YS"}]"}-50,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YR"},{"name":"name9","canal":"9","status":false,"temperature":-50,"setPoint":5,"permission":false,"percentOut":0,"$$hashKey":"0YS"}]"}

Why base on EthernetClient and not Client?

Just stumbled upon you library. And looked briefly through the code and saw that it uses EthernetServer and EthernetClient. Why not use the more generic Server and Client? If done like that it could be used with WifiServer and WifiClient as well.

Query string

Write method to parse query string and get variable passed from xhr request

Bug

I get this error:

no matching function for call to 'uHTTP::uHTTP(EthernetClient&)'

for this point of code...

void loop(){
if(EthernetClient client = server.available()){
uHTTP *request = new uHTTP(client);

Timeout

Add timeout to avoid DoS attack.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.