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

on and sendHeader Method Clarifications #99

Open
Xylopyrographer opened this issue Jan 1, 2023 · 0 comments
Open

on and sendHeader Method Clarifications #99

Xylopyrographer opened this issue Jan 1, 2023 · 0 comments

Comments

@Xylopyrographer
Copy link

Excellent resource. Thank-you very much for taking the time to put his together. A significant amount of work.

I'm looking to better understand what is going on with a few of the ESP8266WebServer library methods.

Referring to the WebUpdate example:

Regarding sendHeader(const String& name, const String& value, bool first = false) method.

  1. Does it actually send anything to the client or is it just preparing parts of the header for the next time a send() method is called? (Meaning the method name is more akin to setHeader()?)

  2. sendHeader() seems to operate on a key:value model where name is the key and value is what is set against that key? Meaning name is the literal text to be included in the response header and value is the literal text that follows name? (Assuming as well the method inserts : between the pair?)

  3. Can multiple calls to sendHeader() be made to build up the desired header?

  4. Is the name parameter limited to certain text strings? If so, where are those enumerated?

  5. What is the effect on the header of using the first parameter? Does it change the order of elements assembled by previous sendHeader() calls?

  6. What is used to create the rest of the header after call(s) to sendHeader()? As in, after call(s) to sendHeader(), what is is the final text of the header?

Regarding on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn)

As used in line 34, it has 4 parameters.

  1. For the method parameter, most examples use HTTP_POST or HTTP_GET. What do these expand to and where are they enumerated?

  2. Trying to understand the 4th parameter, ufn. It seems to be the function called to handle file uploads. But under what conditions, or what triggers it to be called instead of the 3rd parameter, fn?

  3. Why prefer that method over using onFileUpload(THandlerFunction fn)?

Thanks for reading this far. Any insight would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant