Form

HTTP Forms can be used to pass data to the server. Originally, form submissions are encoded in HTML pages and the web browser sees to convert the HTML form submission in a formatted HTTP POST Request with the values submitted by the user.
In the context of an embedded HTTP client, forms will usually not be inside an HTML file but the form fields will directly come from the upper application and the µC/HTTP-client stack will take care of formatting the HTTP request with the form data.  

Two types of forms exist: application type forms and multipart type forms. The application type form is very basic and is used to pass a set of key-value pairs with the URL encoding. The multipart form type is more complex and can also be used to upload files to an HTTP server.

Below is examples of Application and Multipart type forms inside of HTML pages.

Application Form Example inside HTML
<html>
	<body>
 		<form action="form_return_page.htm" method="post">
 			Text Box 1: <input type="text" name="textbox1" /><br>
			Text Box 2: <input type="text" name="textbox1" /><br>
 			<input type="submit" name="submit" value="Submit"></input>
 		</form>
 	</body>
</html>


Multipart Form Example inside HTML
<html>
	<body>
		<form action="form_return_page.htm" method="post" enctype="multipart/form-data">
			Browse file: <input type="file" name="fileUploaded"/><br>
			<input type="submit" name="submit" value="Submit"></input>
		</form>
	</body>
</html>


Below is an example of the conversion of an HTML Mutlipart form in an HTTP POST request.

Figure - Multipart Form Request Example


The HTTP POST method is normally used to submit forms to an HTTP server.

µC/HTTP-server

µC/HTTP-server supports these two types of forms and the file upload with the multipart form type. When the feature is enabled, the HTTP server can saved the data received in the form inside a key-value pairs list accessible in the HTTPs_CONN object by the upper application via hook functions.

See section Form Submission Configuration to enable the Form Submission feature.

See section Form to configure Form feature and retrieve data received in form.

µC/HTTP-client

µC/HTTP-client supports these two types of forms and offers different ways to send a form's requests.

See Section Form Submission Configuration to enable the Form Submission feature.

See section Form Submission for examples on how to send Application and Multipart type form.