Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some things should be printed immediately #8

Open
lazyatom opened this issue Mar 30, 2012 · 3 comments
Open

Some things should be printed immediately #8

lazyatom opened this issue Mar 30, 2012 · 3 comments

Comments

@lazyatom
Copy link
Contributor

If you were using a printer to send a message, you might want it to appear without intervention by the recipient.

I think we might be able to do this elegantly using HTTP headers (e.g. X-Print: now).

@lazyatom
Copy link
Contributor Author

lazyatom commented Apr 9, 2012

We might be able to re-use the header processing from here: https://github.com/ovidiucp/TinyWebServer/blob/master/TinyWebServer.cpp#L99

(Or at least use the technique of storing the headers in some intermediate structure, rather than having to parse them as they arrive in the stream).

@lazyatom
Copy link
Contributor Author

We might also be able to use a different status code, which could be easier to parse than a proper HTTP header...

@lazyatom
Copy link
Contributor Author

lazyatom commented Mar 8, 2013

I've been thinking a bit more about this. I'm relatively sure that there's no way to fit in decent header processing into the space we have left on the Ardunio, principally because the headers could arrive in any order from the server.

However, the server could supply a single, custom header that included a more easily parseable set of values. For example:

HTTP/1.1 200 OK
Date: Fri, 08 Mar 2013 21:13:04 GMT
Status: 200 OK
Content-Type: vnd.gofreerange.printer.A2-raw
Content-length: 32045
X-Printer-PrintImmediately: true
X-Printer-Encoded-Status: 200|32045|1

The server returns the interesting headers as normal, but also provides a single, encoded header which has a value that can be more easily broken down: 200 is the status code, 32045 is the content length and 1 is a flag indicating whether or not to print immediately.

Using a single header makes the Arduino software much simpler.

lazyatom added a commit that referenced this issue Mar 8, 2013
This relates to #8, and explores using a single encoded header to
simplify parsing of more complex parameters from the server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant