New CC3000 HTTPServer example

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tech500
 
Posts: 199
Joined: Wed Dec 04, 2013 3:53 pm

New CC3000 HTTPServer example

Post by tech500 »

Thank you for the new HTTPServer example!

How do I setup to parse two GET requests and have all other GET requests be "Page Not found?"

For example: "GET /index.htm" for the main page and "GET /log.txt" for a down load file link and all others to be invalid

William

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: New CC3000 HTTPServer example

Post by adafruit_support_mike »

For that small a set of options, just comparing the request URL to the strings would be easiest.

If you're using Arduino String objects:

- Use indexOf() to find where the string "GET /" begins
- Add 5 to that value to get the point where the name of the file begins
- Take a 9-character substring at that point and compare it to "index.htm"
- If that doesn't work take a 7-character substring and compare it to "log.txt"

There are more advanced ways to do it, but for such a small list of options this is easier to write and less confusing.

User avatar
tech500
 
Posts: 199
Joined: Wed Dec 04, 2013 3:53 pm

Re: New CC3000 HTTPServer example

Post by tech500 »

I will give indexof() a try.

Can a HTTPSever dispaly an entire Html coded page?

Are there differences between a HTTPServer and a WebServer?

William

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: New CC3000 HTTPServer example

Post by adafruit_support_mike »

Tech500 wrote:Can a HTTPSever dispaly an entire Html coded page?
Yes, but you're limited by the amount of data the Arduino can store or generate.
Tech500 wrote:Are there differences between a HTTPServer and a WebServer?
Kinda like the difference between a gumball machine and Amazon: they both distibute things, but one is a lot simpler.

An Arduino HTTP server will probably have a specific focus and display/process a limited set of data. A full-scale webserver is a network interface to information stored in a whole range of places and formats.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”