ssi.c File Reference

SSI (Server Side Includes) More...

#include "core/net.h"
#include "http/http_server.h"
#include "http/http_server_misc.h"
#include "http/mime.h"
#include "http/ssi.h"
#include "str.h"
#include "debug.h"
#include "fs_port.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   HTTP_TRACE_LEVEL
 

Functions

error_t ssiExecuteScript (HttpConnection *connection, const char_t *uri, uint_t level)
 Execute SSI script. More...
 
error_t ssiProcessCommand (HttpConnection *connection, const char_t *tag, size_t length, const char_t *uri, uint_t level)
 Process SSI directive. More...
 
error_t ssiProcessIncludeCommand (HttpConnection *connection, const char_t *tag, size_t length, const char_t *uri, uint_t level)
 Process SSI include directive. More...
 
error_t ssiProcessEchoCommand (HttpConnection *connection, const char_t *tag, size_t length)
 Process SSI echo directive. More...
 
error_t ssiProcessExecCommand (HttpConnection *connection, const char_t *tag, size_t length)
 Process SSI exec directive. More...
 
error_t ssiSearchTag (const char_t *s, size_t sLen, const char_t *tag, size_t tagLen, size_t *pos)
 Search a string for a given tag. More...
 

Detailed Description

SSI (Server Side Includes)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Description

Server Side Includes (SSI) is a simple interpreted server-side scripting language used to generate dynamic content to web pages

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file ssi.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   HTTP_TRACE_LEVEL

Definition at line 37 of file ssi.c.

Function Documentation

◆ ssiExecuteScript()

error_t ssiExecuteScript ( HttpConnection connection,
const char_t uri,
uint_t  level 
)

Execute SSI script.

Parameters
[in]connectionStructure representing an HTTP connection
[in]uriNULL-terminated string containing the file to process
[in]levelCurrent level of recursion
Returns
Error code

Definition at line 67 of file ssi.c.

◆ ssiProcessCommand()

error_t ssiProcessCommand ( HttpConnection connection,
const char_t tag,
size_t  length,
const char_t uri,
uint_t  level 
)

Process SSI directive.

Parameters
[in]connectionStructure representing an HTTP connection
[in]tagPointer to the SSI tag
[in]lengthTotal length of the SSI tag
[in]uriNULL-terminated string containing the file being processed
[in]levelCurrent level of recursion
Returns
Error code

Definition at line 364 of file ssi.c.

◆ ssiProcessEchoCommand()

error_t ssiProcessEchoCommand ( HttpConnection connection,
const char_t tag,
size_t  length 
)

Process SSI echo directive.

This echo directive displays the contents of a specified HTTP environment variable

Parameters
[in]connectionStructure representing an HTTP connection
[in]tagPointer to the SSI tag
[in]lengthTotal length of the SSI tag
Returns
Error code

Definition at line 602 of file ssi.c.

◆ ssiProcessExecCommand()

error_t ssiProcessExecCommand ( HttpConnection connection,
const char_t tag,
size_t  length 
)

Process SSI exec directive.

This exec directive executes a program, script, or shell command on the server. The cmd parameter specifies a server-side command. The cgi parameter specifies the path to a CGI script

Parameters
[in]connectionStructure representing an HTTP connection
[in]tagPointer to the SSI tag
[in]lengthTotal length of the SSI tag
Returns
Error code

Definition at line 776 of file ssi.c.

◆ ssiProcessIncludeCommand()

error_t ssiProcessIncludeCommand ( HttpConnection connection,
const char_t tag,
size_t  length,
const char_t uri,
uint_t  level 
)

Process SSI include directive.

This include directive allows the content of one document to be included in another. The file parameter defines the included file as relative to the document path. The virtual parameter defines the included file as relative to the document root

Parameters
[in]connectionStructure representing an HTTP connection
[in]tagPointer to the SSI tag
[in]lengthTotal length of the SSI tag
[in]uriNULL-terminated string containing the file being processed
[in]levelCurrent level of recursion
Returns
Error code

Definition at line 422 of file ssi.c.

◆ ssiSearchTag()

error_t ssiSearchTag ( const char_t s,
size_t  sLen,
const char_t tag,
size_t  tagLen,
size_t *  pos 
)

Search a string for a given tag.

Parameters
[in]sString to search
[in]sLenLength of the string to search
[in]tagString containing the tag to search for
[in]tagLenLength of the tag
[out]posThe index of the first occurrence of the tag in the string,
Return values
NO_ERRORif the specified tag has been found
ERROR_PARTIAL_MATCHif a partial match occurs
ERROR_NO_MATCHif the tag does not appear in the string

Definition at line 859 of file ssi.c.