]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Sockets/WebServer/Hello.c
AppPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / AppPkg / Applications / Sockets / WebServer / Hello.c
CommitLineData
9f7f5161 1/**
2 @file
4684b66f 3 Hello World response page
4
bcb96695
MK
5 Copyright (c) 2011-2012, Intel Corporation. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9f7f5161 7
4684b66f 8**/
9
10#include <WebServer.h>
11
12
13/**
14 Respond with the Hello World page
15
16 @param [in] SocketFD The socket's file descriptor to add to the list.
17 @param [in] pPort The WSDT_PORT structure address
18 @param [out] pbDone Address to receive the request completion status
19
20 @retval EFI_SUCCESS The request was successfully processed
21
22**/
23EFI_STATUS
24HelloPage (
25 IN int SocketFD,
26 IN WSDT_PORT * pPort,
27 OUT BOOLEAN * pbDone
28 )
29{
30 EFI_STATUS Status;
31
32 DBG_ENTER ( );
33
34 //
35 // Send the Hello World page
36 //
37 for ( ; ; ) {
38 //
39 // Send the page header
40 //
41 Status = HttpPageHeader ( SocketFD, pPort, L"Hello World" );
42 if ( EFI_ERROR ( Status )) {
43 break;
44 }
45
46 //
47 // Send the page body
48 //
49 Status = HttpSendAnsiString ( SocketFD,
50 pPort,
51 "<h1>Hello World</h1>\r\n"
52 "<p>\r\n"
53 " This response was generated by the UEFI web server application.\r\n"
54 "</p>\r\n" );
55 if ( EFI_ERROR ( Status )) {
56 break;
57 }
58
59 //
60 // Send the page trailer
61 //
62 Status = HttpPageTrailer ( SocketFD, pPort, pbDone );
63 break;
64 }
65
66 //
67 // Return the operation status
68 //
69 DBG_EXIT_STATUS ( Status );
70 return Status;
71}