### bufStart Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets a reference to the start of buffer data. ```APIDOC ## bufStart ### Description Get a reference to the start of buffer data. ### Signature `char *bufStart(WebsBuf *bp)` ### Parameters - **bp** (WebsBuf*) - Pointer to the buffer. ### Returns - **char*** - Pointer to start of data. ``` -------------------------------- ### Install Bun Source: https://github.com/embedthis/goahead/blob/main/README.md URL for installing Bun, a prerequisite for running the test suite. ```text https://bun.com/docs/install ``` -------------------------------- ### Install vcpkg and OpenSSL for Visual Studio build Source: https://github.com/embedthis/goahead/blob/main/README.md Install vcpkg and OpenSSL, required before building with Visual Studio. ```bash git clone https://github.com/microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat .\vcpkg integrate install .\vcpkg install openssl ``` -------------------------------- ### Install test dependencies with npm Source: https://github.com/embedthis/goahead/blob/main/README.md Install the test dependencies (TestMe and Ejscript) from the top level of the source tree using npm. ```bash npm install ``` -------------------------------- ### websStartEvent Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Starts a callback event. ```APIDOC ## websStartEvent ### Description Starts a callback event. This schedules an event to run once. The event can be rescheduled in the callback by invoking websRestartEvent. ### Method Function ### Signature ```c int websStartEvent(int delay, WebsEventProc proc, void *data) ``` ### Parameters - **delay** (int) - Required - Delay in milliseconds in which to run the callback. - **proc** (WebsEventProc) - Required - Callback procedure function. Signature is: void (*fn)(void *data, int id). - **data** (void*) - Required - Data reference to pass to the callback. ### Returns A positive integer event ID. ### API Stability Stable. ``` -------------------------------- ### bufAdjustStart Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Adjusts the start (servp) reference. ```APIDOC ## bufAdjustStart ### Description Adjust the start (servp) reference. ### Signature `void bufAdjustStart(WebsBuf *bp, ssize count)` ### Parameters - **bp** (WebsBuf*) - Pointer to the buffer. - **count** (ssize) - Count to adjust by. ``` -------------------------------- ### Install Windows PowerShell Source: https://github.com/embedthis/goahead/blob/main/README.md Install Windows PowerShell if not already installed on your system. ```bash winget install --id Microsoft.PowerShell --source winget ``` -------------------------------- ### sstarts Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Tests if a string starts with a given pattern. ```APIDOC ## sstarts ### Description Test if the string starts with a given pattern. ### Function Signature bool sstarts(cchar *str, cchar *prefix) ### Parameters - **str** (cchar*) - The string to test. - **prefix** (cchar*) - The prefix pattern. ### Returns - **bool** - True if the string starts with the prefix, false otherwise. ``` -------------------------------- ### bufCompact Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Compacts the data in the buffer and moves it to the start of the buffer. ```APIDOC ## bufCompact ### Description Compact the data in the buffer and move to the start of the buffer. ### Signature `void bufCompact(WebsBuf *bp)` ### Parameters - **bp** (WebsBuf*) - Pointer to the buffer. ``` -------------------------------- ### websStartEvent Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Starts a callback event with a specified delay. ```APIDOC ## websStartEvent ### Description Start a callback event. ### Signature `int websStartEvent(int delay, WebsEventProc proc, void *data)` ### Parameters - **delay** (int) - Required - Delay before the event fires. - **proc** (WebsEventProc) - Required - Callback function to invoke. - **data** (void*) - Required - User data passed to the callback. ### Returns - **int** - Event ID or error code. ``` -------------------------------- ### bufAdjustStart Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Function to adjust the start reference of a buffer. ```APIDOC ## void bufAdjustStart (WebsBuf *bp, ssize count) ### Description Adjust the start (servp) reference. ### Parameters - **bp** (WebsBuf *) - Required - Buffer reference. - **count** (ssize) - Required - Number of bytes to adjust. ### API Stability Stable. ``` -------------------------------- ### websOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Initializes the GoAhead web server subsystem and prepares it to handle HTTP requests. ```APIDOC ## int websOpen(cchar *documents, cchar *routes) ### Description Open the web server. This initializes the GoAhead web server subsystem and prepares it to handle HTTP requests. This function must be called before any other GoAhead APIs. It initializes internal data structures, sets up the document root directory, and optionally loads routing configuration. ### Parameters - **documents** (cchar*) - Optional - Web documents directory path. If NULL, uses build-time default. - **routes** (cchar*) - Optional - Filename for a route configuration file. If NULL, no routes are loaded. ### Returns Zero if successful, otherwise -1 on error. ``` -------------------------------- ### Run tests with make Source: https://github.com/embedthis/goahead/blob/main/README.md Run the test suite using the make command. ```bash make test ``` -------------------------------- ### bufStart Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Returns a pointer to the beginning of the buffer's data. ```APIDOC ## bufStart ### Description Get a reference to the start of buffer data. ### Parameters - **bp** (WebsBuf*) - Required - Buffer reference. ### Returns A string pointer. ### API Stability Stable. ``` -------------------------------- ### websGetUsers Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the users hash. ```APIDOC ## websGetUsers ### Description Gets the users hash. ### Method Function ### Signature `WebsHash websGetUsers(void)` ### Parameters None. ### Returns The users hash object. ### API Stability Stable. ``` -------------------------------- ### Open GoAhead Visual Studio solution Source: https://github.com/embedthis/goahead/blob/main/README.md Open the Visual Studio solution file at projects/vs2022/goahead.sln, then select Build -> Solution. ```text projects/vs2022/goahead.sln ``` -------------------------------- ### websGetSessionVar Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get a session variable. ```APIDOC ## websGetSessionVar ### Description Get a session variable. This does not create a session. If the request has no session, the default value is returned. Use websSetSessionVar or websCreateSession to establish a session. ### Signature `cchar *websGetSessionVar(Webs *wp, cchar *name, cchar *defaultValue)` ### Parameters - **wp** (Webs*) - Required - Webs request object. - **name** (cchar*) - Required - Session variable name. - **defaultValue** (cchar*) - Required - Default value to return if the variable does not exist. ### Returns Session variable value or default value if it does not exist. ### API Stability Stable. ``` -------------------------------- ### bufCreate Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Creates and initializes a buffer. ```APIDOC ## bufCreate ### Description Create and initialize a buffer. ### Signature `int bufCreate(WebsBuf *bp, int increment, int maxsize)` ### Parameters - **bp** (WebsBuf*) - Pointer to the buffer. - **increment** (int) - Increment size. - **maxsize** (int) - Maximum size. ### Returns - **int** - Status code. ``` -------------------------------- ### websGetSessionID Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the session ID. ```APIDOC ## websGetSessionID ### Description Get the session ID. ### Signature `char *websGetSessionID(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns The session ID if session state storage is defined for this request. Caller must free. ### API Stability Stable. ``` -------------------------------- ### Generate and open API docs Source: https://github.com/embedthis/goahead/blob/main/src/osdep/README.md Generate HTML API documentation from the annotated header and open it in a browser. ```bash make doc open doc/api/osdep.html ``` -------------------------------- ### websGetRoles Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the roles hash. ```APIDOC ## websGetRoles ### Description Get the roles hash. ### Signature `WebsHash websGetRoles(void)` ### Parameters None. ### Returns The roles hash object. ### API Stability Stable. ``` -------------------------------- ### websGetRandomBytes Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get some random data. ```APIDOC ## websGetRandomBytes ### Description Get some random data. ### Signature `int websGetRandomBytes(char *buf, ssize length, bool block)` ### Parameters - **buf** (char*) - Required - Reference to a buffer to hold the random data. - **length** (ssize) - Required - Size of the buffer. - **block** (bool) - Required - Set to true if it is acceptable to block while accumulating entropy sufficient to provide good random data. Setting to false will cause this API to not block and may return random data of a lower quality. ### Returns No return value documented. ### API Stability Stable. ``` -------------------------------- ### websGetPath Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request path. ```APIDOC ## websGetPath ### Description Get the request path. The URI path component excludes the http protocol, hostname, port, reference and query components. It always beings with "/". ### Signature `cchar *websGetPath(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns Request path string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### buildWinCmdLine Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Builds a Windows lpCommandLine string from a NULL-terminated argv array. ```APIDOC ## buildWinCmdLine ### Description Build a Windows lpCommandLine string from a NULL-terminated argv array. ### Signature `ssize buildWinCmdLine(char **argp, char *out)` ### Parameters - **argp** (char**) - Array of arguments. - **out** (char*) - Output buffer. ### Returns - **ssize** - Number of bytes written. ``` -------------------------------- ### websGetPassword Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request password. ```APIDOC ## websGetPassword ### Description Get the request password. The request password may be encoded depending on the authentication scheme. See wp->encoded to test if it is encoded. ### Signature `cchar *websGetPassword(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns Password string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### websOptionsOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens the options handler. ```APIDOC ## int websOptionsOpen(void) ### Description Open the options handler. ### Returns Zero if successful, otherwise -1. ``` -------------------------------- ### logOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Initializes the logging module. ```APIDOC ## logOpen ### Description Opens the log logging module. ### Signature `int logOpen(void)` ### Parameters None. ### Returns Zero if successful. ### API Stability Stable. ``` -------------------------------- ### websGetMethod Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request method. ```APIDOC ## websGetMethod ### Description Get the request method. ### Signature `cchar *websGetMethod(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns HTTP method string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### wopenAlloc Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Initializes the walloc module. ```APIDOC ## wopenAlloc ### Description Initializes the walloc module. Should be called the very first thing after the application starts and wcloseAlloc should be called the last thing before exiting. If not called, it will be called on the first allocation with default values. If buf is NULL, memory is allocated using malloc. flags may be set to WEBS_USE_MALLOC if using malloc is okay. ### Parameters - **buf** (void*) - Optional - User supplied block of memory to use for allocations. - **bufsize** (int) - Required - Size of buf. - **flags** (int) - Required - Allocation flags. Set to WEBS_USE_MALLOC to permit the use of malloc() to grow memory. ### Returns Zero if successful, otherwise -1. ### API Stability Stable. ``` -------------------------------- ### websGetHost Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request host. ```APIDOC ## websGetHost ### Description Gets the request host. The request host is set to the Host HTTP header value if it is present. Otherwise it is set to the request URI hostname. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns cchar* - Host string. Caller should not free. ### API Stability Stable ``` -------------------------------- ### Generate password and write to file Source: https://github.com/embedthis/goahead/blob/main/doc/man/gopass.txt Used to create a password and write it to the specified authentication configuration file. The example generates a password for user joshua with roles administrator and buyer for realm example.com. ```shell gopass --file auth.conf --password pass1 example.com joshua administrator buyer ``` -------------------------------- ### websGetFilename Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request filename. ```APIDOC ## websGetFilename ### Description Gets the request filename. The URI is mapped to a filename by decoding and prepending with the request directory. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns cchar* - Filename string. Caller should not free. ### API Stability Stable ``` -------------------------------- ### websFsOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens the file system module. ```APIDOC ## websFsOpen ### Description Open the file system module. ### Signature `int websFsOpen(void)` ### Parameters None. ### Returns Integer status code. ``` -------------------------------- ### websGetDebug Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the debug flag. ```APIDOC ## websGetDebug ### Description Gets the debug flag. If GoAhead is invoked with debugger, the debug flag will be set to true. ### Returns int - True if GoAhead is running in debug mode. ### API Stability Stable ``` -------------------------------- ### websFsOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens the file system module. ```APIDOC ## websFsOpen ### Description Opens the file system module. ### Returns int - Zero if successful, otherwise -1. ### API Stability Stable ``` -------------------------------- ### websGetDateString Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets a date as a string. ```APIDOC ## websGetDateString ### Description Gets a date as a string. If sbuf is supplied, it is used to calculate the date. Otherwise, the current time is used. ### Parameters - **sbuf** (WebsFileInfo*) - Required - File info object. ### Returns char* - An allocated date string. Caller should free. ### API Stability Stable ``` -------------------------------- ### socketGetList Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the list of sockets. ```APIDOC ## socketGetList ### Description Get the list of sockets. ### Signature `WebsSocket **socketGetList(void)` ### Parameters None. ### Returns - **WebsSocket\*** - A pointer to an array of socket pointers. ``` -------------------------------- ### websFileOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens and initializes the file handler. ```APIDOC ## websFileOpen ### Description Open and initialize the file handler. ### Signature `void websFileOpen(void)` ### API Stability Stable. ``` -------------------------------- ### buildWinCmdLine Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Constructs a Windows command-line string from an argument vector, used internally for process spawning. ```APIDOC ## buildWinCmdLine ### Description Build a Windows lpCommandLine string from a NULL-terminated argv array. Walks argp, calls appendWinArg per element, separates elements with a single space, and null-terminates out. NULL argp or NULL out returns 0 with no write. Caller is responsible for pre-allocating out to the worst-case size, computed as the sum of 2 * slen(argp[i]) + 3 per element plus one separator per gap plus one null terminator. Exposed for unit testing the cmdLine builder on non-Windows hosts. ### Parameters - **argp** (char**) - Required - NULL-terminated argv array. NULL argp[i] is treated as an empty argv element. - **out** (char*) - Required - Caller-allocated buffer of sufficient worst-case size. ### Returns Total bytes written excluding the null terminator. ### API Stability Internal. ``` -------------------------------- ### Run GoAhead server from test directory Source: https://github.com/embedthis/goahead/blob/main/README.md Change to the test directory and start the GoAhead server with verbose output, serving the web directory on 127.0.0.1:8080. ```bash cd test ../build/bin/goahead -v web 127.0.0.1:8080 ``` -------------------------------- ### websStatFile Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets file status for a file. ```APIDOC ## websStatFile ### Description Gets file status for a file. ### Method Function ### Signature ```c int websStatFile(cchar *path, WebsFileInfo *sbuf) ``` ### Parameters - **path** (cchar*) - Required - Filename path. - **sbuf** (WebsFileInfo*) - Required - File information structure to modify with file status. ### Returns Zero if successful, otherwise -1. ### API Stability Stable. ``` -------------------------------- ### websReadPassword Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get a password from the terminal console. ```APIDOC ## char * websReadPassword(cchar *prompt) ### Description Get a password from the terminal console. ### Parameters - **prompt** (cchar*) - Required - Text prompt to display before reading the password. ### Returns The entered password. Caller must free. ``` -------------------------------- ### socketOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Initializes the socket module. ```APIDOC ## socketOpen ### Description Open the socket module. ### Signature int socketOpen(void) ### Returns Zero if successful, otherwise -1. ### API Stability Stable. ``` -------------------------------- ### websGetServerAddress Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the server IP address. ```APIDOC ## websGetServerAddress ### Description Get the server IP address. ### Signature `cchar *websGetServerAddress(void)` ### Parameters None. ### Returns Server IP address string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### websGetServer Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the server host name. ```APIDOC ## websGetServer ### Description Get the server host name. ### Signature `cchar *websGetServer(void)` ### Parameters None. ### Returns Host name string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### Convert web files to C structures with webcomp Source: https://github.com/embedthis/goahead/blob/main/doc/man/webcomp.txt Commands to create a file list, convert files to C structures, and compile the generated C file. ```shell find web -type f -print >fileList ``` ```shell webcomp --files filelist >romFiles.c ``` ```shell cc -o romFiles.o romFiles.c ``` -------------------------------- ### websGetQuery Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request query component. ```APIDOC ## websGetQuery ### Description Get the request query component. ### Signature `cchar *websGetQuery(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns Request query string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### Build GoAhead with make on Linux/macOS Source: https://github.com/embedthis/goahead/blob/main/README.md Build GoAhead on Linux or macOS using make. Use `make SHOW=1` to see commands as they are invoked, and `make help` to list available make variables. ```bash make ``` ```bash make SHOW=1 ``` ```bash make help ``` -------------------------------- ### websGetProtocol Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request HTTP protocol. ```APIDOC ## websGetProtocol ### Description Get the request HTTP protocol. This will be set to either "http" or "https". ### Signature `cchar *websGetProtocol(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns Protocol string. Caller should not free. ### API Stability Stable. ``` -------------------------------- ### bufCreate Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Function to create and initialize a buffer. ```APIDOC ## int bufCreate (WebsBuf *bp, int increment, int maxsize) ### Description Create and initialize a buffer. Initializes a WebsBuf structure for dynamic buffer operations. The buffer will automatically grow as needed up to the specified maximum size. Growth occurs in increments that double each time to minimize frequent reallocations. WebsBuf provides efficient ring buffer functionality ideal for HTTP request/response buffering, dynamic string building, I/O buffering and queuing, and memory-efficient data streaming. ### Parameters - **bp** (WebsBuf *) - Required - Pointer to an allocated WebsBuf structure to initialize. - **increment** (int) - Required - Initial increment size for buffer growth (bytes). Must be > 0. - **maxsize** (int) - Required - Maximum size the buffer can grow to (bytes). Use -1 for unlimited growth. ### Returns Zero if successful, -1 on error (invalid parameters or memory allocation failure). ### API Stability Stable. ``` -------------------------------- ### websGetPort Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Get the request TCP/IP port. ```APIDOC ## websGetPort ### Description Get the request TCP/IP port. ### Signature `int websGetPort(Webs *wp)` ### Parameters - **wp** (Webs*) - Required - Webs request object. ### Returns TCP/IP Port integer. ### API Stability Stable. ``` -------------------------------- ### websGetIfaddr Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request interface address. ```APIDOC ## websGetIfaddr ### Description Gets the request interface address. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns cchar* - Network interface string. Caller should not free. ### API Stability Stable ``` -------------------------------- ### websGetExt Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request URI extension. ```APIDOC ## websGetExt ### Description Gets the request URI extension. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns cchar* - The URI filename extension component. Caller should not free. ### API Stability Stable ``` -------------------------------- ### socketListen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens a listening socket. ```APIDOC ## socketListen ### Description Open a listening socket. ### Signature `int socketListen(cchar *host, int port, SocketAccept accept, int flags)` ### Parameters - **host** (cchar*) - Required - The host name or IP address. - **port** (int) - Required - The port number. - **accept** (SocketAccept) - Required - The accept callback function. - **flags** (int) - Required - Flags controlling socket behavior. ### Returns - **int** - The socket ID, or -1 on error. ``` -------------------------------- ### websGetEof Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request EOF status. ```APIDOC ## websGetEof ### Description Gets the request EOF status. The request EOF status is set to true when all the request body (POST|PUT) data has been received. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns int - True if all the request body data has been received. ### API Stability Stable ``` -------------------------------- ### websFileOpen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Opens and initializes the file handler for the GoAhead web server. ```APIDOC ## websFileOpen ### Description Open and initialize the file handler. ### Signature `void websFileOpen(void)` ### Parameters None. ### Returns None. ``` -------------------------------- ### wopenAlloc Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Initializes the walloc memory allocation module. ```APIDOC ## wopenAlloc ### Description Initialize the walloc module. ### Signature `int wopenAlloc(void *buf, int bufsize, int flags)` ### Parameters - **buf** (void*) - Required - Memory buffer. - **bufsize** (int) - Required - Size of the buffer. - **flags** (int) - Required - Allocation flags. ### Returns - **int** - Status code (0 on success). ``` -------------------------------- ### websGetCookie Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the request cookie if supplied. ```APIDOC ## websGetCookie ### Description Gets the request cookie if supplied. ### Parameters - **wp** (Webs*) - Required - The request object. ### Returns cchar* - Cookie string if defined, otherwise null. Caller must not free. ### API Stability Stable ``` -------------------------------- ### websGetBackground Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets the background execution flag. ```APIDOC ## websGetBackground ### Description Gets the background execution flag. If GoAhead is invoked with background, it will run as a daemon in the background. ### Returns int - True if GoAhead is running in the background. ### API Stability Stable ``` -------------------------------- ### websListen Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Creates a listening socket on the specified network endpoint to accept incoming HTTP connections. ```APIDOC ## websListen ### Description Creates a listening socket on the specified network endpoint to accept incoming HTTP connections. The server will bind to the specified IP address and port and begin accepting connections from clients. Multiple endpoints can be created by calling this function multiple times with different addresses. ### Method Function ### Signature `int websListen(cchar *endpoint)` ### Parameters - **endpoint** (cchar*) - Required - Network endpoint specification in the format "IP:PORT". Supported formats: "127.0.0.1:8080" - IPv4 address with port, ":8080" - All IPv4 interfaces on port 8080, "*:8080" - All interfaces on port 8080, "[::1]:8080" - IPv6 loopback with port, "[::]:8080" - All IPv6 interfaces on port 8080, "192.168.1.100:80" - Specific IPv4 interface. ### Returns Positive integer holding a Socket ID handle if successful, otherwise -1 on error. The socket ID can be used with other socket APIs for management. ### API Stability Stable. ``` -------------------------------- ### Options and trace route (commented) Source: https://github.com/embedthis/goahead/blob/main/src/route.txt Commented-out route that would handle OPTIONS and TRACE methods. ```plaintext route uri=/ methods=OPTIONS|TRACE handler=options ``` -------------------------------- ### websReadPassword Source: https://github.com/embedthis/goahead/blob/main/doc/api/goahead.html Gets a password from the terminal console. ```APIDOC ## websReadPassword ### Description Gets a password from the terminal console. ### Signature ```c char *websReadPassword(cchar *prompt) ``` ### Parameters - **prompt** (cchar*) - Prompt to display. ### Returns - **char*** - Pointer to the entered password string. ```