mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-27 04:10:47 +00:00
More trailing whilespace removal
This commit is contained in:
parent
7d961b6c93
commit
b9cf7acb1a
285 changed files with 769 additions and 769 deletions
|
|
@ -60,7 +60,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# DHCP Client Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
CSRCS += dhcpc.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# DHCP Daemn Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
CSRCS += dhcpd.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ static inline int dhcpd_openresponder(void)
|
|||
static void dhcpd_initpacket(uint8_t mtype)
|
||||
{
|
||||
uint32_t nulladdr = 0;
|
||||
|
||||
|
||||
/* Set up the generic parts of the DHCP server message */
|
||||
|
||||
memset(&g_state.ds_outpacket, 0, sizeof(struct dhcpmsg_s));
|
||||
|
|
@ -889,7 +889,7 @@ static int dhcpd_sendpacket(int bbroadcast)
|
|||
* (1) If he caller know that it needs to multicast the response, it will set bbroadcast.
|
||||
* (2) Otherwise, if the client already has and address (ciaddr), then use that for uni-cast
|
||||
* (3) Broadcast if the client says it can't handle uni-cast (BOOTP_BROADCAST set)
|
||||
* (4) Otherwise, the client claims it can handle the uni-casst response and we
|
||||
* (4) Otherwise, the client claims it can handle the uni-casst response and we
|
||||
* will uni-cast to the offered address (yiaddr).
|
||||
*
|
||||
* NOTE: We really should also check the giaddr field. If no zero, the server should
|
||||
|
|
@ -936,7 +936,7 @@ static int dhcpd_sendpacket(int bbroadcast)
|
|||
len = (g_state.ds_optend - (uint8_t*)&g_state.ds_outpacket) + 1;
|
||||
nvdbg("sendto %08lx:%04x len=%d\n",
|
||||
(long)ntohl(addr.sin_addr.s_addr), ntohs(addr.sin_port), len);
|
||||
|
||||
|
||||
ret = sendto(sockfd, &g_state.ds_outpacket, len, 0,
|
||||
(struct sockaddr *)&addr, sizeof(struct sockaddr_in));
|
||||
close(sockfd);
|
||||
|
|
@ -1138,7 +1138,7 @@ static inline int dhcpd_request(void)
|
|||
if (g_state.ds_optserverip)
|
||||
{
|
||||
/* ACK if the serverip is correct and the requested IP address is the one
|
||||
* already offered to the client.
|
||||
* already offered to the client.
|
||||
*/
|
||||
|
||||
if (g_state.ds_optserverip == ntohl(g_state.ds_serverip) &&
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ include $(APPDIR)/Make.defs
|
|||
# Telnet daemon
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
CSRCS += discover.c
|
||||
|
|
@ -69,7 +69,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ include $(APPDIR)/Make.defs
|
|||
# DHCP Daemn Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
# FTP connection management
|
||||
CSRCS = ftpc_connect.c ftpc_disconnect.c
|
||||
CSRCS = ftpc_connect.c ftpc_disconnect.c
|
||||
|
||||
# FTP commands
|
||||
CSRCS += ftpc_cdup.c ftpc_chdir.c ftpc_chmod.c ftpc_filesize.c ftpc_filetime.c
|
||||
|
|
@ -82,7 +82,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
* Make the parent of the current directory be the new current directory.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
int ftpc_cdup(SESSION handle)
|
||||
{
|
||||
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)handle;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
|||
int ret;
|
||||
|
||||
/* Verify that we are still connecte to the server */
|
||||
|
||||
|
||||
if (!ftpc_sockconnected(&session->cmd))
|
||||
{
|
||||
ndbg("Cmd channel si not connected\n");
|
||||
|
|
@ -169,7 +169,7 @@ int ftpc_cmd(struct ftpc_session_s *session, const char *cmd, ...)
|
|||
}
|
||||
|
||||
/* Get the response to the command */
|
||||
|
||||
|
||||
ret = fptc_getreply(session);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,20 +101,20 @@ static int ftpc_recvinit(struct ftpc_session_s *session, FAR const char *path,
|
|||
/* Handle the resume offset (caller is responsible for fseeking in the
|
||||
* file)
|
||||
*/
|
||||
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
/* Send the REST command. This command sets the offset where the
|
||||
* transfer should start. This must come after PORT or PASV commands.
|
||||
*/
|
||||
|
||||
|
||||
ret = ftpc_cmd(session, "REST %ld", offset);
|
||||
if (ret < 0)
|
||||
{
|
||||
ndbg("REST command failed: %d\n", errno);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
session->size = offset;
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ static int ftpc_recvbinary(FAR struct ftpc_session_s *session,
|
|||
}
|
||||
|
||||
/* Increment the size of the file written */
|
||||
|
||||
|
||||
session->size += nwritten;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
|
|||
else if (ch == ISO_cr)
|
||||
{
|
||||
/* What follows the carriage return? */
|
||||
|
||||
|
||||
ch = ftpc_sockgetc(&session->cmd);
|
||||
if (ch == '\0')
|
||||
{
|
||||
|
|
@ -184,7 +184,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
|
|||
if (ndx < CONFIG_FTP_MAXREPLY)
|
||||
{
|
||||
/* Yes.. put the character in the reply buffer */
|
||||
|
||||
|
||||
session->reply[ndx++] = (char)ch;
|
||||
}
|
||||
else
|
||||
|
|
@ -212,7 +212,7 @@ int fptc_getreply(struct ftpc_session_s *session)
|
|||
int ret;
|
||||
|
||||
/* Set up a timeout */
|
||||
|
||||
|
||||
if (session->replytimeo)
|
||||
{
|
||||
ret = wd_start(session->wdog, session->replytimeo, ftpc_timeout, 1, session);
|
||||
|
|
@ -244,7 +244,7 @@ int fptc_getreply(struct ftpc_session_s *session)
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
nvdbg("Reply: %s\n", session->reply);
|
||||
nvdbg("Reply: %s\n", session->reply);
|
||||
|
||||
if (session->reply[3] == '-')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ extern "C" {
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
/* Low-level string management */
|
||||
|
||||
|
||||
EXTERN void ftpc_stripcrlf(FAR char *str);
|
||||
EXTERN void ftpc_stripslash(FAR char *str);
|
||||
EXTERN FAR char *ftpc_dequote(FAR const char *hostname);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
* No operation command. Using NOOP allows us to make sure that commands
|
||||
* are passed over the control connection without changing the status of
|
||||
* any data transaction or server status. This is useful for (1)
|
||||
* maintaining connections during long IDLE times and (2) It can also be
|
||||
* maintaining connections during long IDLE times and (2) It can also be
|
||||
* used as a harmless way of detecting timeouts.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ static int ftpc_sendfile(struct ftpc_session_s *session, const char *path,
|
|||
*
|
||||
* - "450 Requested file action not taken", "452 - Requested action not
|
||||
* taken" or "553 Requested action not taken" without first responding
|
||||
* with a mark.
|
||||
* with a mark.
|
||||
*/
|
||||
|
||||
/* In active mode, we need to accept a connection on the data socket
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ int ftpc_rename(SESSION handle, FAR const char *oldname, FAR const char *newname
|
|||
|
||||
newcopy = strdup(newname);
|
||||
ftpc_stripslash(newcopy);
|
||||
|
||||
|
||||
/* A RNTO request asks the server to finish renaming a file. RNTO must
|
||||
* come immediately after RNFR; otherwise the server may reject RNTO with:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
|||
return NULL;
|
||||
}
|
||||
start++;
|
||||
|
||||
|
||||
end = strchr(start, '\"');
|
||||
if (!end)
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
|||
*
|
||||
* len = end - start + 1 = 11 (+ NUL terminator)
|
||||
*/
|
||||
|
||||
|
||||
len = end - start + 1;
|
||||
pwd = (char *)malloc(len + 1);
|
||||
if (!pwd)
|
||||
|
|
@ -128,7 +128,7 @@ FAR char *ftpc_rpwd(SESSION handle)
|
|||
ndbg("Failed to allocate string\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Copy the string into the allocated memory */
|
||||
|
||||
memcpy(pwd, start, len);
|
||||
|
|
|
|||
|
|
@ -210,14 +210,14 @@ void ftpc_sockcopy(FAR struct ftpc_socket_s *dest,
|
|||
*
|
||||
* Description:
|
||||
* Accept a connection on the data socket. This function is onlly used
|
||||
* in active mode.
|
||||
* in active mode.
|
||||
*
|
||||
* In active mode FTP the client connects from a random port (N>1023) to the
|
||||
* FTP server's command port, port 21. Then, the client starts listening to
|
||||
* port N+1 and sends the FTP command PORT N+1 to the FTP server. The server
|
||||
* will then connect back to the client's specified data port from its local
|
||||
* data port, which is port 20. In passive mode FTP the client initiates
|
||||
* both connections to the server, solving the problem of firewalls filtering
|
||||
* both connections to the server, solving the problem of firewalls filtering
|
||||
* the incoming data port connection to the client from the server. When
|
||||
* opening an FTP connection, the client opens two random ports locally
|
||||
* (N>1023 and N+1). The first port contacts the server on port 21, but
|
||||
|
|
@ -225,7 +225,7 @@ void ftpc_sockcopy(FAR struct ftpc_socket_s *dest,
|
|||
* back to its data port, the client will issue the PASV command. The result
|
||||
* of this is that the server then opens a random unprivileged port (P >
|
||||
* 1023) and sends the PORT P command back to the client. The client then
|
||||
* initiates the connection from port N+1 to port P on the server to transfer
|
||||
* initiates the connection from port N+1 to port P on the server to transfer
|
||||
* data.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
* port N+1 and sends the FTP command PORT N+1 to the FTP server. The server
|
||||
* will then connect back to the client's specified data port from its local
|
||||
* data port, which is port 20. In passive mode FTP the client initiates
|
||||
* both connections to the server, solving the problem of firewalls filtering
|
||||
* both connections to the server, solving the problem of firewalls filtering
|
||||
* the incoming data port connection to the client from the server. When
|
||||
* opening an FTP connection, the client opens two random ports locally
|
||||
* (N>1023 and N+1). The first port contacts the server on port 21, but
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
* back to its data port, the client will issue the PASV command. The result
|
||||
* of this is that the server then opens a random unprivileged port (P >
|
||||
* 1023) and sends the PORT P command back to the client. The client then
|
||||
* initiates the connection from port N+1 to port P on the server to transfer
|
||||
* initiates the connection from port N+1 to port P on the server to transfer
|
||||
* data.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
|
@ -137,7 +137,7 @@ static int ftp_pasvmode(struct ftpc_session_s *session,
|
|||
/* The response is then 6 integer values: four representing the
|
||||
* IP address and two representing the port number.
|
||||
*/
|
||||
|
||||
|
||||
nscan = sscanf(ptr, "%d,%d,%d,%d,%d,%d",
|
||||
&tmpap[0], &tmpap[1], &tmpap[2],
|
||||
&tmpap[3], &tmpap[4], &tmpap[5]);
|
||||
|
|
@ -149,7 +149,7 @@ static int ftp_pasvmode(struct ftpc_session_s *session,
|
|||
|
||||
/* Then copy the sscanf'ed values as bytes */
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
addrport[i] = (uint8_t)(tmpap[i] & 0xff);
|
||||
|
|
@ -185,7 +185,7 @@ static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
|||
if (relpath[0] == '~')
|
||||
{
|
||||
/* Is the relative path only '~' */
|
||||
|
||||
|
||||
if (relpath[1] == '\0')
|
||||
{
|
||||
return strdup(homedir);
|
||||
|
|
@ -209,7 +209,7 @@ static FAR char *ftpc_abspath(FAR struct ftpc_session_s *session,
|
|||
/* No tilde expansion. Check for a path relative to the current
|
||||
* directory.
|
||||
*/
|
||||
|
||||
|
||||
else if (strncmp(relpath, "./", 2) == 0)
|
||||
{
|
||||
ret = asprintf(&ptr, "%s%s", curdir, relpath+1);
|
||||
|
|
@ -278,7 +278,7 @@ int ftpc_xfrinit(FAR struct ftpc_session_s *session)
|
|||
if (FTPC_IS_PASSIVE(session))
|
||||
{
|
||||
/* Yes.. going passive. */
|
||||
|
||||
|
||||
ret = ftp_pasvmode(session, addrport);
|
||||
if (ret != OK)
|
||||
{
|
||||
|
|
@ -370,7 +370,7 @@ int ftpc_xfrmode(struct ftpc_session_s *session, uint8_t xfrmode)
|
|||
*
|
||||
* The server accepts the TYPE request with code 200.
|
||||
*/
|
||||
|
||||
|
||||
ret = ftpc_cmd(session, "TYPE %c", xfrmode == FTPC_XFRMODE_ASCII ? 'A' : 'I');
|
||||
session->xfrmode = xfrmode;
|
||||
}
|
||||
|
|
@ -405,7 +405,7 @@ int ftpc_xfrabort(FAR struct ftpc_session_s *session, FAR FILE *stream)
|
|||
if (ret > 0)
|
||||
{
|
||||
/* Read data from command channel */
|
||||
|
||||
|
||||
nvdbg("Flush cmd channel data\n");
|
||||
while (stream && fread(session->buffer, 1, CONFIG_FTP_BUFSIZE, stream) > 0);
|
||||
return OK;
|
||||
|
|
@ -428,7 +428,7 @@ int ftpc_xfrabort(FAR struct ftpc_session_s *session, FAR FILE *stream)
|
|||
while (stream && fread(session->buffer, 1, CONFIG_FTP_BUFSIZE, stream) > 0);
|
||||
|
||||
/* Get the ABORt reply */
|
||||
|
||||
|
||||
fptc_getreply(session);
|
||||
|
||||
/* Expected replys are: "226 Closing data connection" or
|
||||
|
|
@ -448,7 +448,7 @@ int ftpc_xfrabort(FAR struct ftpc_session_s *session, FAR FILE *stream)
|
|||
/* Expected replys are: or "225 Data connection open; no transfer in progress"
|
||||
* "226 Closing data connection"
|
||||
*/
|
||||
|
||||
|
||||
if (session->code != 226 && session->code != 225)
|
||||
{
|
||||
nvdbg("Expected 225 or 226 reply\n");
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ FAR char *ftpc_dequote(FAR const char *str)
|
|||
if (allocstr)
|
||||
{
|
||||
/* Search the string */
|
||||
|
||||
|
||||
ptr = allocstr;
|
||||
while (*str)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# Telnet daemon
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS += ftpd.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ static const struct ftpd_cmd_s g_ftpdcmdtab[] =
|
|||
{"XMKD", ftpd_command_mkd , FTPD_CMDFLAG_LOGIN}, /* XMKD <SP> <pathname> <CRLF> */
|
||||
{"DELE", ftpd_command_dele, FTPD_CMDFLAG_LOGIN}, /* DELE <SP> <pathname> <CRLF> */
|
||||
{"PASV", ftpd_command_pasv, FTPD_CMDFLAG_LOGIN}, /* PASV <CRLF> */
|
||||
{"EPSV", ftpd_command_epsv, FTPD_CMDFLAG_LOGIN}, /* EPSV <SP> <net-prt> <CRLF> OR EPSV <SP> ALL <CRLF> */
|
||||
{"EPSV", ftpd_command_epsv, FTPD_CMDFLAG_LOGIN}, /* EPSV <SP> <net-prt> <CRLF> OR EPSV <SP> ALL <CRLF> */
|
||||
{"LPSV", ftpd_command_epsv, FTPD_CMDFLAG_LOGIN}, /* LPSV ??? */
|
||||
{"LIST", ftpd_command_list, FTPD_CMDFLAG_LOGIN}, /* LIST [<SP> <pathname>] <CRLF> */
|
||||
{"NLST", ftpd_command_nlst, FTPD_CMDFLAG_LOGIN}, /* NLST [<SP> <pathname>] <CRLF> */
|
||||
|
|
@ -242,7 +242,7 @@ static const struct ftpd_cmd_s g_ftpdcmdtab[] =
|
|||
{"STAT", ftpd_command_stat, FTPD_CMDFLAG_LOGIN}, /* STAT [<SP> <pathname>] <CRLF> */
|
||||
{"ALLO", ftpd_command_stat, FTPD_CMDFLAG_LOGIN}, /* ALLO <SP> <decimal-integer> [<SP> R <SP> <decimal-integer>] <CRLF> */
|
||||
#endif
|
||||
{NULL, (ftpd_cmdhandler_t)0, 0}
|
||||
{NULL, (ftpd_cmdhandler_t)0, 0}
|
||||
};
|
||||
|
||||
static const char g_cdup[] = "..";
|
||||
|
|
@ -350,7 +350,7 @@ static void ftpd_account_free(FAR struct ftpd_account_s *account)
|
|||
{
|
||||
free(prev->home);
|
||||
}
|
||||
|
||||
|
||||
if (prev->password)
|
||||
{
|
||||
free(prev->password);
|
||||
|
|
@ -385,7 +385,7 @@ static int ftpd_account_setpassword(FAR struct ftpd_account_s *account,
|
|||
}
|
||||
|
||||
/* Free any existing password string */
|
||||
|
||||
|
||||
if (account->password)
|
||||
{
|
||||
free(account->password);
|
||||
|
|
@ -425,7 +425,7 @@ static int ftpd_account_add(FAR struct ftpd_server_s *server,
|
|||
}
|
||||
|
||||
/* Handle the case where the list is empty */
|
||||
|
||||
|
||||
if (!server->head)
|
||||
{
|
||||
server->head = head;
|
||||
|
|
@ -486,7 +486,7 @@ ftpd_account_search_user(FAR struct ftpd_session_s *session,
|
|||
{
|
||||
FAR struct ftpd_account_s *newaccount = NULL;
|
||||
FAR struct ftpd_account_s *account;
|
||||
uint8_t accountflags;
|
||||
uint8_t accountflags;
|
||||
|
||||
account = session->head;
|
||||
while (account)
|
||||
|
|
@ -647,7 +647,7 @@ static FAR char *ftpd_strtok(bool skipspace, FAR const char *delimiters,
|
|||
FAR const char *dptr;
|
||||
FAR char *sptr;
|
||||
FAR char *ret;
|
||||
|
||||
|
||||
sptr = *str;
|
||||
|
||||
/* Skip any leading spaces */
|
||||
|
|
@ -681,7 +681,7 @@ static FAR char *ftpd_strtok(bool skipspace, FAR const char *delimiters,
|
|||
|
||||
sptr++;
|
||||
}
|
||||
|
||||
|
||||
/* Save the place where we will resuming searching */
|
||||
|
||||
*str = sptr;
|
||||
|
|
@ -940,7 +940,7 @@ static ssize_t ftpd_recv(int sd, FAR void *data, size_t size, int timeout)
|
|||
static ssize_t ftpd_send(int sd, FAR const void *data, size_t size, int timeout)
|
||||
{
|
||||
ssize_t ret;
|
||||
|
||||
|
||||
/* Handle any requested timetout */
|
||||
|
||||
if (timeout >= 0)
|
||||
|
|
@ -1052,7 +1052,7 @@ static int ftpd_dataopen(FAR struct ftpd_session_s *session)
|
|||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/* PASV session */
|
||||
|
||||
session->data.addrlen = sizeof(session->data.addr);
|
||||
|
|
@ -1109,7 +1109,7 @@ static FAR struct ftpd_server_s *ftpd_openserver(int port)
|
|||
sa_family_t family;
|
||||
socklen_t addrlen;
|
||||
FAR const void *addr;
|
||||
#if defined(SOMAXCONN)
|
||||
#if defined(SOMAXCONN)
|
||||
int backlog = SOMAXCONN;
|
||||
#else
|
||||
int backlog = 5;
|
||||
|
|
@ -1142,14 +1142,14 @@ static FAR struct ftpd_server_s *ftpd_openserver(int port)
|
|||
}
|
||||
|
||||
family = AF_INET6;
|
||||
addrlen = (socklen_t)sizeof(server->addr.in6);
|
||||
addrlen = (socklen_t)sizeof(server->addr.in6);
|
||||
addr = (FAR void *)(&server->addr.in6);
|
||||
|
||||
server->addr.in6.sin6_family = family;
|
||||
server->addr.in6.sin6_flowinfo = 0;
|
||||
server->addr.in6.sin6_addr = in6addr_any;
|
||||
server->addr.in6.sin6_port = htons(port);
|
||||
#else
|
||||
#else
|
||||
server->sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (server->sd < 0)
|
||||
{
|
||||
|
|
@ -1158,13 +1158,13 @@ static FAR struct ftpd_server_s *ftpd_openserver(int port)
|
|||
}
|
||||
|
||||
family = AF_INET;
|
||||
addrlen = (socklen_t)sizeof(server->addr.in4);
|
||||
addrlen = (socklen_t)sizeof(server->addr.in4);
|
||||
addr = (FAR void *)(&server->addr.in4);
|
||||
|
||||
server->addr.in4.sin_family = family;
|
||||
server->addr.in4.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
server->addr.in4.sin_port = htons(port);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_HAVE_REUSEADDR
|
||||
{
|
||||
|
|
@ -1214,14 +1214,14 @@ static int ftpd_pathignore(FAR struct ftpd_pathnode_s *currpath)
|
|||
{
|
||||
currpath->ignore = true;
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (strcmp(currpath->name, "..") == 0)
|
||||
{
|
||||
currpath->ignore = true;
|
||||
|
||||
|
||||
node = currpath->blink;
|
||||
while (node)
|
||||
{
|
||||
|
|
@ -1251,7 +1251,7 @@ static int ftpd_pathignore(FAR struct ftpd_pathnode_s *currpath)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name:
|
||||
* Name:
|
||||
****************************************************************************/
|
||||
|
||||
static void ftpd_nodefree(FAR struct ftpd_pathnode_s *node)
|
||||
|
|
@ -1286,7 +1286,7 @@ static FAR struct ftpd_pathnode_s *ftpd_path2node(FAR const char *path)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
while (path[0] != '\0')
|
||||
{
|
||||
name = ftpd_strtok_alloc(false, "/\\", &path);
|
||||
|
|
@ -1326,7 +1326,7 @@ static FAR struct ftpd_pathnode_s *ftpd_path2node(FAR const char *path)
|
|||
|
||||
(void)ftpd_pathignore(newnode);
|
||||
}
|
||||
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
|
|
@ -1371,7 +1371,7 @@ static FAR char *ftpd_node2path(FAR struct ftpd_pathnode_s *node,
|
|||
|
||||
node2 = node2->flink;
|
||||
}
|
||||
|
||||
|
||||
namelen = !node1->name ? 0 : strlen(node1->name);
|
||||
if (!node2)
|
||||
{
|
||||
|
|
@ -1391,7 +1391,7 @@ static FAR char *ftpd_node2path(FAR struct ftpd_pathnode_s *node,
|
|||
|
||||
node1 = node1->flink;
|
||||
}
|
||||
|
||||
|
||||
path = (FAR char *)malloc(allocsize);
|
||||
if (!path)
|
||||
{
|
||||
|
|
@ -1421,7 +1421,7 @@ static FAR char *ftpd_node2path(FAR struct ftpd_pathnode_s *node,
|
|||
|
||||
node2 = node2->flink;
|
||||
}
|
||||
|
||||
|
||||
namelen = !node1->name ? 0 : strlen(node1->name);
|
||||
|
||||
if (!node2)
|
||||
|
|
@ -1461,7 +1461,7 @@ ftpd_nodeappend(FAR struct ftpd_pathnode_s *head,
|
|||
if (node && node->name && strlen(node->name) <= 0)
|
||||
{
|
||||
ftpd_nodefree(head);
|
||||
head = NULL;
|
||||
head = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1475,7 +1475,7 @@ ftpd_nodeappend(FAR struct ftpd_pathnode_s *head,
|
|||
head = node;
|
||||
node = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (node)
|
||||
{
|
||||
temp = head;
|
||||
|
|
@ -1487,7 +1487,7 @@ ftpd_nodeappend(FAR struct ftpd_pathnode_s *head,
|
|||
node->blink = temp;
|
||||
temp->flink = node;
|
||||
}
|
||||
|
||||
|
||||
/* clear ignore */
|
||||
|
||||
temp = head;
|
||||
|
|
@ -1532,7 +1532,7 @@ static int ftpd_getpath(FAR struct ftpd_session_s *session,
|
|||
{
|
||||
*workpath = NULL;
|
||||
}
|
||||
|
||||
|
||||
worknode = ftpd_path2node(!session->work ? "" : session->work);
|
||||
if (!worknode)
|
||||
{
|
||||
|
|
@ -1664,8 +1664,8 @@ static off_t ftpd_offsatoi(FAR const char *filename, off_t offset)
|
|||
return -errval;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
temp = 0;
|
||||
ret = 0;
|
||||
temp = 0;
|
||||
|
||||
if (offset == (off_t)(-1))
|
||||
{
|
||||
|
|
@ -1805,7 +1805,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
|||
g_respfmt1, 550, ' ', "Can not open file !");
|
||||
goto errout_with_data;
|
||||
}
|
||||
|
||||
|
||||
/* Restart position */
|
||||
|
||||
if (session->restartpos > 0)
|
||||
|
|
@ -2005,7 +2005,7 @@ static int ftpd_stream(FAR struct ftpd_session_s *session, int cmdtype)
|
|||
|
||||
pos += (off_t)wrbytes;
|
||||
}
|
||||
|
||||
|
||||
errout_with_session:;
|
||||
close(session->fd);
|
||||
session->fd = -1;
|
||||
|
|
@ -2254,7 +2254,7 @@ static int ftpd_listbuffer(FAR struct ftpd_session_s *session, FAR char *path,
|
|||
offset += snprintf(&buffer[offset], buflen - offset, " %02u:%02u",
|
||||
tm.tm_hour, tm.tm_min);
|
||||
}
|
||||
|
||||
|
||||
/* basename */
|
||||
|
||||
offset += snprintf(&buffer[offset], buflen - offset, " %s", name);
|
||||
|
|
@ -2318,7 +2318,7 @@ static int fptd_listscan(FAR struct ftpd_session_s *session, FAR char *path,
|
|||
if (!S_ISDIR(st.st_mode))
|
||||
{
|
||||
ret = ftpd_listbuffer(session, path, &st, session->data.buffer,
|
||||
session->data.buflen, opton);
|
||||
session->data.buflen, opton);
|
||||
if (ret == 0)
|
||||
{
|
||||
ret = ftpd_response(session->data.sd, session->txtimeout,
|
||||
|
|
@ -2351,7 +2351,7 @@ static int fptd_listscan(FAR struct ftpd_session_s *session, FAR char *path,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
asprintf(&temp, "%s/%s", path, entry->d_name);
|
||||
if (!temp)
|
||||
{
|
||||
|
|
@ -2366,7 +2366,7 @@ static int fptd_listscan(FAR struct ftpd_session_s *session, FAR char *path,
|
|||
}
|
||||
|
||||
ret = ftpd_listbuffer(session, temp, &st, session->data.buffer,
|
||||
session->data.buflen, opton);
|
||||
session->data.buflen, opton);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = ftpd_response(session->data.sd, session->txtimeout,
|
||||
|
|
@ -2414,7 +2414,7 @@ static int ftpd_command_user(FAR struct ftpd_session_s *session)
|
|||
{
|
||||
int ret;
|
||||
|
||||
/* Clear session status */
|
||||
/* Clear session status */
|
||||
|
||||
session->flags = 0;
|
||||
session->restartpos = 0;
|
||||
|
|
@ -2586,7 +2586,7 @@ static int ftpd_command_type(FAR struct ftpd_session_s *session)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
session->type = FTPD_SESSIONTYPE_NONE;
|
||||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 500, ' ', "TYPE not understood !");
|
||||
|
|
@ -2708,7 +2708,7 @@ static int ftpd_command_port(FAR struct ftpd_session_s *session)
|
|||
|
||||
utemp = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | (value[3]);
|
||||
session->data.addr.in4.sin_addr.s_addr = htonl((long)utemp);
|
||||
|
||||
|
||||
utemp = (value[4] << 8) | (value[5]);
|
||||
session->data.addr.in4.sin_port = htons((short)utemp);
|
||||
|
||||
|
|
@ -2724,11 +2724,11 @@ static int ftpd_command_port(FAR struct ftpd_session_s *session)
|
|||
memset(&session->data.addr, 0, sizeof(session->data.addr));
|
||||
|
||||
session->data.addr.in4.sin_family = AF_INET;
|
||||
|
||||
|
||||
utemp = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | (value[3]);
|
||||
session->data.addr.in4.sin_addr.s_addr = htonl(utemp);
|
||||
}
|
||||
|
||||
|
||||
utemp = (value[4] << 8) | (value[5]);
|
||||
session->data.addr.in4.sin_port = htons(utemp);
|
||||
}
|
||||
|
|
@ -2737,7 +2737,7 @@ static int ftpd_command_port(FAR struct ftpd_session_s *session)
|
|||
memset(&session->data.addr, 0, sizeof(session->data.addr));
|
||||
|
||||
session->data.addr.in4.sin_family = AF_INET;
|
||||
|
||||
|
||||
utemp = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | (value[3]);
|
||||
session->data.addr.in4.sin_addr.s_addr = htonl(utemp);
|
||||
}
|
||||
|
|
@ -2798,13 +2798,13 @@ static int ftpd_command_eprt(FAR struct ftpd_session_s *session)
|
|||
"EPRT command not implemented !");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
count = 3;
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
field[index] = NULL;
|
||||
}
|
||||
|
||||
|
||||
str = (FAR const char *)&session->param[left];
|
||||
for (index = 0; index < count && *str != '\0'; index++)
|
||||
{
|
||||
|
|
@ -2844,7 +2844,7 @@ static int ftpd_command_eprt(FAR struct ftpd_session_s *session)
|
|||
if (family == 1)
|
||||
{
|
||||
family = AF_INET;
|
||||
|
||||
|
||||
session->data.addr.in4.sin_family = family;
|
||||
(void)inet_pton(family, field[1], &session->data.addr.in4.sin_addr);
|
||||
session->data.addr.in4.sin_port = htons((short)atoi(field[2]));
|
||||
|
|
@ -2855,7 +2855,7 @@ static int ftpd_command_eprt(FAR struct ftpd_session_s *session)
|
|||
if (family == 2)
|
||||
{
|
||||
family = AF_INET6;
|
||||
|
||||
|
||||
session->data.addr.in6.sin6_family = family;
|
||||
(void)inet_pton(family, field[1], &session->data.addr.in6.sin6_addr);
|
||||
session->data.addr.in6.sin6_port = htons((short)atoi(field[2]));
|
||||
|
|
@ -2866,7 +2866,7 @@ static int ftpd_command_eprt(FAR struct ftpd_session_s *session)
|
|||
ndbg("Unrecognized family: %d\n", family);
|
||||
family = AF_UNSPEC;
|
||||
}
|
||||
|
||||
|
||||
for (index = 0;index < count;index++)
|
||||
{
|
||||
if (field[index])
|
||||
|
|
@ -2975,7 +2975,7 @@ static int ftpd_command_rmd(FAR struct ftpd_session_s *session)
|
|||
g_respfmt1, 550, ' ',
|
||||
"Can not remove directory !");
|
||||
}
|
||||
|
||||
|
||||
free(abspath);
|
||||
free(workpath);
|
||||
|
||||
|
|
@ -3008,7 +3008,7 @@ static int ftpd_command_mkd(FAR struct ftpd_session_s *session)
|
|||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 550, ' ', "Can not make directory !");
|
||||
}
|
||||
|
||||
|
||||
free(abspath);
|
||||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 250, ' ', "MKD command successful");
|
||||
|
|
@ -3060,7 +3060,7 @@ static int ftpd_command_dele(FAR struct ftpd_session_s *session)
|
|||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 550, ' ', "Can not delete file !");
|
||||
}
|
||||
|
||||
|
||||
free(abspath);
|
||||
free(workpath);
|
||||
|
||||
|
|
@ -3154,7 +3154,7 @@ static int ftpd_command_pasv(FAR struct ftpd_session_s *session)
|
|||
g_respfmt1, 425, ' ', "PASV getsockname fail !");
|
||||
}
|
||||
|
||||
ret = listen(session->data.sd, 1);
|
||||
ret = listen(session->data.sd, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
(void)ftpd_dataclose(session);
|
||||
|
|
@ -3213,10 +3213,10 @@ static int ftpd_command_epsv(FAR struct ftpd_session_s *session)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||
#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||
int ipv6only = 0;
|
||||
(void)setsockopt(session->data.sd, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, sizeof(ipv6only));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
session->data.sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
|
@ -3251,7 +3251,7 @@ static int ftpd_command_epsv(FAR struct ftpd_session_s *session)
|
|||
}
|
||||
#else
|
||||
session->data.addr.in4.sin_port = htons(0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ret = bind(session->data.sd, (FAR const struct sockaddr *)&session->data.addr,
|
||||
session->data.addrlen);
|
||||
|
|
@ -3420,7 +3420,7 @@ static int ftpd_command_size(FAR struct ftpd_session_s *session)
|
|||
g_respfmt1, 550, ' ', "Unknown size !");
|
||||
}
|
||||
path = abspath;
|
||||
|
||||
|
||||
ret = 0;
|
||||
switch (session->type)
|
||||
{
|
||||
|
|
@ -3442,14 +3442,14 @@ static int ftpd_command_size(FAR struct ftpd_session_s *session)
|
|||
": not a regular file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
ret = ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
"%03u%c%llu\r\n", 213, ' ', (unsigned long long)st.st_size);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case FTPD_SESSIONTYPE_A:
|
||||
case FTPD_SESSIONTYPE_A:
|
||||
{
|
||||
status = stat(path, &st);
|
||||
if (status < 0)
|
||||
|
|
@ -3530,7 +3530,7 @@ static int ftpd_command_stru(FAR struct ftpd_session_s *session)
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name:
|
||||
* Name:
|
||||
****************************************************************************/
|
||||
|
||||
static int ftpd_command_rnfr(FAR struct ftpd_session_s *session)
|
||||
|
|
@ -3562,7 +3562,7 @@ static int ftpd_command_rnfr(FAR struct ftpd_session_s *session)
|
|||
g_respfmt2, 550, ' ', session->param,
|
||||
": No such file or directory.");
|
||||
}
|
||||
|
||||
|
||||
session->renamefrom = abspath;
|
||||
session->flags |= FTPD_SESSIONFLAG_RENAMEFROM;
|
||||
|
||||
|
|
@ -3578,7 +3578,7 @@ static int ftpd_command_rnto(FAR struct ftpd_session_s *session)
|
|||
{
|
||||
FAR char *abspath;
|
||||
int ret;
|
||||
|
||||
|
||||
if (!session->renamefrom)
|
||||
{
|
||||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
|
|
@ -3591,7 +3591,7 @@ static int ftpd_command_rnto(FAR struct ftpd_session_s *session)
|
|||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
g_respfmt1, 550, ' ', "RNTO error !");
|
||||
}
|
||||
|
||||
|
||||
ret = rename(session->renamefrom, abspath);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
@ -3641,7 +3641,7 @@ static int ftpd_command_rest(FAR struct ftpd_session_s *session)
|
|||
{
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
session->restartpos = (off_t)atoll(session->param);
|
||||
#else
|
||||
#else
|
||||
session->restartpos = (off_t)atoi(session->param);
|
||||
#endif
|
||||
session->flags |= FTPD_SESSIONFLAG_RESTARTPOS;
|
||||
|
|
@ -3686,10 +3686,10 @@ static int ftpd_command_mdtm(FAR struct ftpd_session_s *session)
|
|||
g_respfmt2, 550, ' ', session->param,
|
||||
": not a plain file.");
|
||||
}
|
||||
|
||||
|
||||
free(abspath);
|
||||
|
||||
memcpy(&tm, gmtime(&st.st_mtime), sizeof(tm));
|
||||
|
||||
memcpy(&tm, gmtime(&st.st_mtime), sizeof(tm));
|
||||
return ftpd_response(session->cmd.sd, session->txtimeout,
|
||||
"%03u%c%04u%02u%02u%02u%02u%02u\r\n", 213, ' ',
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
|
|
@ -3826,7 +3826,7 @@ static int ftpd_command(FAR struct ftpd_session_s *session)
|
|||
int index = 0;
|
||||
|
||||
/* Search the command table for a matching command */
|
||||
|
||||
|
||||
for (index = 0; g_ftpdcmdtab[index].command; index++)
|
||||
{
|
||||
/* Does the command string match this entry? */
|
||||
|
|
@ -3834,7 +3834,7 @@ static int ftpd_command(FAR struct ftpd_session_s *session)
|
|||
if (strcmp(session->command, g_ftpdcmdtab[index].command) == 0)
|
||||
{
|
||||
/* Yes.. is a login required to execute this command? */
|
||||
|
||||
|
||||
if ((g_ftpdcmdtab[index].flags & FTPD_CMDFLAG_LOGIN) != 0)
|
||||
{
|
||||
/* Yes... Check if the user is logged in */
|
||||
|
|
@ -4049,7 +4049,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
|||
recvbytes = ftpd_recv(session->cmd.sd, session->cmd.buffer,
|
||||
session->cmd.buflen - 1, session->rxtimeout);
|
||||
|
||||
/* recbytes < 0 is a receive failure (posibily a timeout);
|
||||
/* recbytes < 0 is a receive failure (posibily a timeout);
|
||||
* recbytes == 0 indicates that we have lost the connection.
|
||||
*/
|
||||
|
||||
|
|
@ -4063,7 +4063,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
|||
/* Make sure that the recevied string is NUL terminated */
|
||||
|
||||
session->cmd.buffer[recvbytes] = '\0';
|
||||
|
||||
|
||||
/* TELNET protocol (RFC854)
|
||||
* IAC 255(FFH) interpret as command:
|
||||
* IP 244(F4H) interrupt process--permanently
|
||||
|
|
@ -4093,7 +4093,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
|||
}
|
||||
|
||||
/* Make command message */
|
||||
|
||||
|
||||
session->command = &session->cmd.buffer[offset];
|
||||
while (session->cmd.buffer[offset] != '\0')
|
||||
{
|
||||
|
|
@ -4103,7 +4103,7 @@ static FAR void *ftpd_worker(FAR void *arg)
|
|||
session->cmd.buffer[offset] = '\0';
|
||||
break;
|
||||
}
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
/* Parse command and param tokens */
|
||||
|
|
@ -4214,7 +4214,7 @@ int ftpd_adduser(FTPD_SESSION handle, uint8_t accountflags,
|
|||
ndbg("ftpd_account_setpassword failed: %d\n", ret);
|
||||
goto errout_with_account;
|
||||
}
|
||||
|
||||
|
||||
ret = ftpd_account_sethome(newaccount, home);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
@ -4234,7 +4234,7 @@ int ftpd_adduser(FTPD_SESSION handle, uint8_t accountflags,
|
|||
|
||||
errout_with_account:
|
||||
ftpd_account_free(newaccount);
|
||||
|
||||
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -4287,8 +4287,8 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
|||
session->head = server->head;
|
||||
session->curr = NULL;
|
||||
session->flags = 0;
|
||||
session->txtimeout = -1;
|
||||
session->rxtimeout = -1;
|
||||
session->txtimeout = -1;
|
||||
session->rxtimeout = -1;
|
||||
session->cmd.sd = (int)(-1);
|
||||
session->cmd.addrlen = (socklen_t)sizeof(session->cmd.addr);
|
||||
session->cmd.buflen = (size_t)CONFIG_FTPD_CMDBUFFERSIZE;
|
||||
|
|
@ -4318,7 +4318,7 @@ int ftpd_session(FTPD_SESSION handle, int timeout)
|
|||
}
|
||||
|
||||
/* Allocate a data buffer */
|
||||
|
||||
|
||||
session->data.buffer = (FAR char *)malloc(session->data.buflen);
|
||||
if (!session->data.buffer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ philosophy as JSON itself. Simple, dumb, out of the way.
|
|||
|
||||
Some JSON:
|
||||
{
|
||||
"name": "Jack (\"Bee\") Nimble",
|
||||
"name": "Jack (\"Bee\") Nimble",
|
||||
"format": {
|
||||
"type": "rect",
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"interlace": false,
|
||||
"type": "rect",
|
||||
"width": 1920,
|
||||
"height": 1080,
|
||||
"interlace": false,
|
||||
"frame rate": 24
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ Finished? Delete the root (this takes care of everything else).
|
|||
That's AUTO mode. If you're going to use Auto mode, you really ought to check pointers
|
||||
before you dereference them. If you want to see how you'd build this struct in code?
|
||||
cJSON *root,*fmt;
|
||||
root=cJSON_CreateObject();
|
||||
root=cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(root, "name", cJSON_CreateString("Jack (\"Bee\") Nimble"));
|
||||
cJSON_AddItemToObject(root, "format", fmt=cJSON_CreateObject());
|
||||
cJSON_AddStringToObject(fmt,"type", "rect");
|
||||
|
|
@ -198,7 +198,7 @@ void parse_object(cJSON *item)
|
|||
int i; for (i=0;i<cJSON_GetArraySize(item);i++)
|
||||
{
|
||||
cJSON *subitem=cJSON_GetArrayItem(item,i);
|
||||
// handle subitem.
|
||||
// handle subitem.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ void parse_object(cJSON *item)
|
|||
{
|
||||
// handle subitem
|
||||
if (subitem->child) parse_object(subitem->child);
|
||||
|
||||
|
||||
subitem=subitem->next;
|
||||
}
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ cJSON *Create_array_of_anything(cJSON **items,int num)
|
|||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
and simply: Create_array_of_anything(objects,24);
|
||||
|
||||
cJSON doesn't make any assumptions about what order you create things in.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
static const char *ep;
|
||||
|
||||
static const unsigned char firstByteMark[7] =
|
||||
|
|
@ -75,7 +75,7 @@ static char *print_object(cJSON *item, int depth, int fmt);
|
|||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
static char *cJSON_strdup(const char *str)
|
||||
{
|
||||
size_t len;
|
||||
|
|
@ -168,7 +168,7 @@ static const char *parse_number(cJSON *item, const char *num)
|
|||
do
|
||||
{
|
||||
n = (n * 10.0) + (*num++ - '0'), scale--;
|
||||
}
|
||||
}
|
||||
while (*num >= '0' && *num <= '9');
|
||||
}
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ static const char *parse_array(cJSON *item, const char *value)
|
|||
|
||||
/* Skip any spacing, get the value. */
|
||||
|
||||
value = skip(parse_value(child, skip(value)));
|
||||
value = skip(parse_value(child, skip(value)));
|
||||
if (!value)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -845,7 +845,7 @@ static const char *parse_object(cJSON *item, const char *value)
|
|||
|
||||
/* Skip any spacing, get the value. */
|
||||
|
||||
value = skip(parse_value(child, skip(value + 1)));
|
||||
value = skip(parse_value(child, skip(value + 1)));
|
||||
if (!value)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -1089,7 +1089,7 @@ static cJSON *create_reference(cJSON *item)
|
|||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
const char *cJSON_GetErrorPtr(void)
|
||||
{
|
||||
return ep;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ config NETUTILS_NTPCLIENT_SERVERIP
|
|||
|
||||
config NETUTILS_NTPCLIENT_PORTNO
|
||||
int "NTP server port number"
|
||||
default 123
|
||||
default 123
|
||||
|
||||
config NETUTILS_NTPCLIENT_STACKSIZE
|
||||
int "NTP client daemon stack stack size"
|
||||
|
|
@ -26,11 +26,11 @@ config NETUTILS_NTPCLIENT_STACKSIZE
|
|||
|
||||
config NETUTILS_NTPCLIENT_SERVERPRIO
|
||||
int "NTP client daemon priority"
|
||||
default 100
|
||||
default 100
|
||||
|
||||
config NETUTILS_NTPCLIENT_POLLDELAYSEC
|
||||
int "NTP client poll interval (seconds)"
|
||||
default 60
|
||||
default 60
|
||||
|
||||
config NETUTILS_NTPCLIENT_SIGWAKEUP
|
||||
int "NTP client wakeup signal number"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# NTP client daemon Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
CSRCS += ntpclient.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# SMTP Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS += smtp.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# Telnet daemon
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS += telnetd_daemon.c telnetd_driver.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ struct telnetd_s
|
|||
* connection is accepted. */
|
||||
};
|
||||
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
* started. It contains global information visable to all telnet daemons.
|
||||
*/
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ struct telnetd_common_s
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
* started. It contains global information visable to all telnet daemons.
|
||||
*/
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ extern struct telnetd_common_s g_telnetdcommon;
|
|||
* Return:
|
||||
* An allocated string represent the full path to the created driver. The
|
||||
* receiver of the string must de-allocate this memory when it is no longer
|
||||
* needed. NULL is returned on a failure.
|
||||
* needed. NULL is returned on a failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
/* This structure is used to passed information to telnet daemon when it
|
||||
* started.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ static void telnetd_sendopt(FAR struct telnetd_dev_s *priv, uint8_t option,
|
|||
uint8_t value);
|
||||
|
||||
/* Character driver methods */
|
||||
|
||||
|
||||
static int telnetd_open(FAR struct file *filep);
|
||||
static int telnetd_close(FAR struct file *filep);
|
||||
static ssize_t telnetd_read(FAR struct file *, FAR char *, size_t);
|
||||
|
|
@ -181,7 +181,7 @@ static inline void telnetd_dumpbuffer(FAR const char *msg,
|
|||
/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_NET have to be
|
||||
* defined or the following does nothing.
|
||||
*/
|
||||
|
||||
|
||||
nvdbgdumpbuffer(msg, (FAR const uint8_t*)buffer, nbytes);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -741,7 +741,7 @@ static int telnetd_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
* Return:
|
||||
* An allocated string represent the full path to the created driver. The
|
||||
* receiver of the string must de-allocate this memory when it is no longer
|
||||
* needed. NULL is returned on a failure.
|
||||
* needed. NULL is returned on a failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# TFTP Client Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
|
|
@ -68,7 +68,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ choice
|
|||
is an error.
|
||||
|
||||
Typical values, if they're defined, are "users" for THTTPD_TILDE_MAP1
|
||||
and "public_html" for THTTPD_TILDE_MAP2.
|
||||
and "public_html" for THTTPD_TILDE_MAP2.
|
||||
|
||||
config THTTPD_USE_TILDE_MAP1
|
||||
bool "Tilde mapping 1"
|
||||
|
|
@ -244,7 +244,7 @@ config THTTPD_USE_TILDE_MAP2
|
|||
the name of a subdirectory off of the user's actual home dir,
|
||||
something like "public_html".
|
||||
|
||||
The typical value THTTPD_TILDE_MAP2 is "public_html".
|
||||
The typical value THTTPD_TILDE_MAP2 is "public_html".
|
||||
|
||||
config THTTPD_TILDE_MAP_NONE
|
||||
bool "No tilde mapping"
|
||||
|
|
@ -286,7 +286,7 @@ config THTTPD_TILDE_MAP2
|
|||
the name of a subdirectory off of the user's actual home dir,
|
||||
something like "public_html".
|
||||
|
||||
The typical value THTTPD_TILDE_MAP2 is "public_html".
|
||||
The typical value THTTPD_TILDE_MAP2 is "public_html".
|
||||
|
||||
config THTTPD_GENERATE_INDICES
|
||||
bool "Generate name indices"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# THTTPD Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS += thttpd.c libhttpd.c thttpd_cgi.c thttpd_alloc.c thttpd_strings.c timers.c fdwatch.c tdate_parse.c
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static int get_filename(char *vfilename, char *filename,
|
|||
|
||||
/* Used for the various commands that accept a file name. These commands
|
||||
* accept two tags: virtual Gives a virtual path to a document on the
|
||||
* server. file Gives a pathname relative to the current directory. ../
|
||||
* server. file Gives a pathname relative to the current directory. ../
|
||||
* cannot be used in this pathname, nor can absolute paths be used.
|
||||
*/
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ static int get_filename(char *vfilename, char *filename,
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (fl - vl + strlen(val) >= fnsize)
|
||||
{
|
||||
return -1;
|
||||
|
|
@ -403,7 +403,7 @@ static void do_config(FILE *instream, char *vfilename, char *filename,
|
|||
* strftime library call. g_sizefmt Determines the formatting to be used
|
||||
* when displaying the size of a file. Valid choices are bytes, for a
|
||||
* formatted byte count (formatted as 1,234,567), or abbrev for an
|
||||
* abbreviated version displaying the number of kilobytes or megabytes the
|
||||
* abbreviated version displaying the number of kilobytes or megabytes the
|
||||
* file occupies.
|
||||
*/
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ static void do_include(FILE *instream, char *vfilename, char *filename,
|
|||
(void)fclose(instream2);
|
||||
}
|
||||
|
||||
static void do_echo(FILE *instream, char *vfilename, char *filename,
|
||||
static void do_echo(FILE *instream, char *vfilename, char *filename,
|
||||
char *directive, char *tag, char *val)
|
||||
{
|
||||
char *cp;
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@
|
|||
* about tildes. Enabling both options is an error.
|
||||
*
|
||||
* Typical values, if they're defined, are "users" for CONFIG_THTTPD_TILDE_MAP1 and "public_html"
|
||||
* for CONFIG_THTTPD_TILDE_MAP2.
|
||||
* for CONFIG_THTTPD_TILDE_MAP2.
|
||||
*/
|
||||
|
||||
# if defined(CONFIG_THTTPD_TILDE_MAP1) && defined(CONFIG_THTTPD_TILDE_MAP2)
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
static void fdwatch_dump(const char *msg, FAR struct fdwatch_s *fw)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
fwvdbg("%s\n", msg);
|
||||
fwvdbg("nwatched: %d nfds: %d\n", fw->nwatched, fw->nfds);
|
||||
for (i = 0; i < fw->nwatched; i++)
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ static void send_authenticate(httpd_conn *hc, char *realm)
|
|||
(void)snprintf(header, maxheader, "%s%s\"\r\n", headstr, realm);
|
||||
httpd_send_err(hc, 401, err401title, header, err401form, hc->encodedurl);
|
||||
|
||||
/* If the request was a POST then there might still be data to be read, so
|
||||
/* If the request was a POST then there might still be data to be read, so
|
||||
* we need to do a lingering close.
|
||||
*/
|
||||
|
||||
|
|
@ -1046,8 +1046,8 @@ static int vhost_map(httpd_conn *hc)
|
|||
{
|
||||
/* Skip dots in the hostname. If we don't, then we get vhost
|
||||
* directories in higher level of filestructure if dot gets involved
|
||||
* into path construction. It's `while' used here instead of `if' for
|
||||
* it's possible to have a hostname formed with two dots at the end of
|
||||
* into path construction. It's `while' used here instead of `if' for
|
||||
* it's possible to have a hostname formed with two dots at the end of
|
||||
* it.
|
||||
*/
|
||||
|
||||
|
|
@ -1146,9 +1146,9 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
|
|||
if ((path[0] == '/' && strncmp(path, httpd_root, strlen(httpd_root)) != 0) || path[0] != '/')
|
||||
{
|
||||
/* Start out with httpd_root in checked. Allow space in the reallocation
|
||||
* include NULL terminator and possibly a '/'
|
||||
* include NULL terminator and possibly a '/'
|
||||
*/
|
||||
|
||||
|
||||
checkedlen = strlen(httpd_root);
|
||||
httpd_realloc_str(&checked, &maxchecked, checkedlen+2);
|
||||
strcpy(checked, httpd_root);
|
||||
|
|
@ -1175,7 +1175,7 @@ static char *expand_filename(char *path, char **restP, bool tildemapped)
|
|||
httpd_realloc_str(&checked, &maxchecked, 1);
|
||||
checked[0] = '\0';
|
||||
checkedlen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the whole filename (minus the leading '.') into rest. */
|
||||
|
||||
|
|
@ -1725,7 +1725,7 @@ static void ls_child(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Now the world permissions. Owner and group permissions are
|
||||
/* Now the world permissions. Owner and group permissions are
|
||||
* not of interest to web clients.
|
||||
*/
|
||||
|
||||
|
|
@ -2531,7 +2531,7 @@ int httpd_got_request(httpd_conn *hc)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case CHST_LF:
|
||||
switch (c)
|
||||
{
|
||||
|
|
@ -2994,7 +2994,7 @@ int httpd_parse_request(httpd_conn *hc)
|
|||
}
|
||||
}
|
||||
|
||||
/* Ok, the request has been parsed. Now we resolve stuff that may require
|
||||
/* Ok, the request has been parsed. Now we resolve stuff that may require
|
||||
* the entire request.
|
||||
*/
|
||||
|
||||
|
|
@ -3169,7 +3169,7 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
|||
}
|
||||
|
||||
/* Is it world-readable or world-executable? We check explicitly instead
|
||||
* of just trying to open it, so that no one ever gets surprised by a file
|
||||
* of just trying to open it, so that no one ever gets surprised by a file
|
||||
* that's not set world-readable and yet somehow is readable by the HTTP
|
||||
* server and therefore the *whole* world.
|
||||
*/
|
||||
|
|
@ -3374,7 +3374,7 @@ int httpd_start_request(httpd_conn *hc, struct timeval *nowP)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* It's not CGI. If it's executable or there's pathinfo, someone's trying
|
||||
/* It's not CGI. If it's executable or there's pathinfo, someone's trying
|
||||
* to either serve or run a non-CGI file as CGI. Either case is
|
||||
* prohibited.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ static int handle_newconnect(struct timeval *tv, int listen_fd)
|
|||
struct connect_s *conn;
|
||||
ClientData client_data;
|
||||
|
||||
/* This loops until the accept() fails, trying to start new connections as
|
||||
/* This loops until the accept() fails, trying to start new connections as
|
||||
* fast as possible so we don't overrun the listen queue.
|
||||
*/
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ static int handle_newconnect(struct timeval *tv, int listen_fd)
|
|||
/* Get the next free connection from the free list */
|
||||
|
||||
conn = free_connections;
|
||||
|
||||
|
||||
/* Are there any free connections? */
|
||||
|
||||
if (!conn)
|
||||
|
|
@ -234,7 +234,7 @@ static int handle_newconnect(struct timeval *tv, int listen_fd)
|
|||
}
|
||||
|
||||
nvdbg("New connection fd %d\n", conn->hc->conn_fd);
|
||||
|
||||
|
||||
/* Remove the connection entry from the free list */
|
||||
|
||||
conn->conn_state = CNST_READING;
|
||||
|
|
@ -246,7 +246,7 @@ static int handle_newconnect(struct timeval *tv, int listen_fd)
|
|||
conn->wakeup_timer = NULL;
|
||||
conn->linger_timer = NULL;
|
||||
conn->offset = 0;
|
||||
|
||||
|
||||
/* Set the connection file descriptor to no-delay mode */
|
||||
|
||||
httpd_set_ndelay(conn->hc->conn_fd);
|
||||
|
|
@ -294,7 +294,7 @@ static void handle_read(struct connect_s *conn, struct timeval *tv)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ndbg("read(fd=%d) failed: %d\n", hc->conn_fd, errno);
|
||||
BADREQUEST("read");
|
||||
goto errout_with_400;
|
||||
|
|
@ -448,7 +448,7 @@ static void handle_send(struct connect_s *conn, struct timeval *tv)
|
|||
/* httpd_write does not return until all bytes have been sent
|
||||
* (or an error occurs).
|
||||
*/
|
||||
|
||||
|
||||
nwritten = httpd_write(hc->conn_fd, hc->buffer, hc->buflen);
|
||||
if (nwritten < 0)
|
||||
{
|
||||
|
|
@ -488,8 +488,8 @@ static void handle_linger(struct connect_s *conn, struct timeval *tv)
|
|||
httpd_conn *hc = conn->hc;
|
||||
int ret;
|
||||
|
||||
/* In lingering-close mode we just read and ignore bytes. An error or EOF
|
||||
* ends things, otherwise we go until a timeout
|
||||
/* In lingering-close mode we just read and ignore bytes. An error or EOF
|
||||
* ends things, otherwise we go until a timeout
|
||||
*/
|
||||
|
||||
ret = read(conn->hc->conn_fd, hc->buffer, CONFIG_THTTPD_IOBUFFERSIZE);
|
||||
|
|
@ -533,7 +533,7 @@ static void clear_connection(struct connect_s *conn, struct timeval *tv)
|
|||
* this unless it's necessary, because it ties up a connection slot and
|
||||
* file descriptor which means our maximum connection-handling rateis
|
||||
* lower. So, elsewhere we set a flag when we detect the few
|
||||
* circumstances that make a lingering close necessary. If the flag isn't
|
||||
* circumstances that make a lingering close necessary. If the flag isn't
|
||||
* set we do the real close now.
|
||||
*/
|
||||
|
||||
|
|
@ -790,7 +790,7 @@ int thttpd_main(int argc, char **argv)
|
|||
{
|
||||
if (!handle_newconnect(&tv, hs->listen_fd))
|
||||
{
|
||||
/* Go around the loop and do another fdwatch, rather than
|
||||
/* Go around the loop and do another fdwatch, rather than
|
||||
* dropping through and processing existing connections. New
|
||||
* connections always get priority.
|
||||
*/
|
||||
|
|
@ -820,7 +820,7 @@ int thttpd_main(int argc, char **argv)
|
|||
*/
|
||||
|
||||
if (conn->conn_state != CNST_SENDING)
|
||||
{
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Figure out the status. Look for a Status: or Location: header; else if
|
||||
/* Figure out the status. Look for a Status: or Location: header; else if
|
||||
* there's an HTTP header line, get it from there; else default to 200.
|
||||
*/
|
||||
|
||||
|
|
@ -811,7 +811,7 @@ static int cgi_child(int argc, char **argv)
|
|||
|
||||
cc->rdfd = pipefd[0];
|
||||
close(pipefd[1]);
|
||||
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
nlldbg("STDOUT dup2: %d\n", errno);
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ void tmr_run(struct timeval *now)
|
|||
{
|
||||
next = tmr->next;
|
||||
|
||||
/* Since the lists are sorted, as soon as we find a timer * that isn'tmr
|
||||
/* Since the lists are sorted, as soon as we find a timer * that isn'tmr
|
||||
* ready yet, we can go on to the next list
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ int uip_parsehttpurl(const char *url, uint16_t *port,
|
|||
{
|
||||
uint16_t accum = 0;
|
||||
src++; /* Skip over the colon */
|
||||
|
||||
|
||||
while (*src >= '0' && *src <= '9')
|
||||
{
|
||||
accum = 10*accum + *src - '0';
|
||||
|
|
@ -141,7 +141,7 @@ int uip_parsehttpurl(const char *url, uint16_t *port,
|
|||
bytesleft--;
|
||||
|
||||
/* The copy the rest of the file name to the user buffer */
|
||||
|
||||
|
||||
strncpy(dest, src, namelen);
|
||||
filename[namelen-1] = '\0';
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ void uip_server(uint16_t portno, pthread_startroutine_t handler, int stacksize)
|
|||
for (;;)
|
||||
{
|
||||
/* Accept the next connectin */
|
||||
|
||||
|
||||
addrlen = sizeof(struct sockaddr_in);
|
||||
acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen);
|
||||
if (acceptsd < 0)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# Web client library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS = webclient.c
|
||||
|
|
@ -66,7 +66,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ config NETUTILS_HTTPD_SINGLECONNECT
|
|||
default y if DISABLE_PTHREAD
|
||||
---help---
|
||||
By default, the uIP web server will create a new, independent thread
|
||||
for each connection. This can, however, use a lot of stack space
|
||||
for each connection. This can, however, use a lot of stack space
|
||||
if there are many connections and that can be a problem is RAM is
|
||||
limited. If this option is selected, then a single thread will
|
||||
service all HTTP requests and, in this case, only a single connection
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ include $(APPDIR)/Make.defs
|
|||
# Web server library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS = httpd.c httpd_cgi.c
|
||||
|
|
@ -73,7 +73,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct httpd_cgi_call *cgi_calls = NULL;
|
|||
|
||||
void httpd_cgi_register(struct httpd_cgi_call *cgi_call)
|
||||
{
|
||||
if (cgi_calls == NULL)
|
||||
if (cgi_calls == NULL)
|
||||
{
|
||||
cgi_calls = cgi_call;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,13 +89,13 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
if (S_ISDIR(st.st_mode))
|
||||
if (S_ISDIR(st.st_mode))
|
||||
{
|
||||
errno = EISDIR;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (!S_ISREG(st.st_mode))
|
||||
if (!S_ISREG(st.st_mode))
|
||||
{
|
||||
errno = ENOENT;
|
||||
return ERROR;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
include $(APPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET_TCP),y)
|
||||
CSRCS += xmlparser.c response.c
|
||||
|
|
@ -67,7 +67,7 @@ ROOTDEPPATH = --dep-path .
|
|||
|
||||
# Common build
|
||||
|
||||
VPATH =
|
||||
VPATH =
|
||||
|
||||
all: .built
|
||||
.PHONY: context depend clean distclean
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* apps/netutils/xmlrpc/response.c
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2012 Max Holtzberg. All rights reserved.
|
||||
* Author: Max Holtzberg <mh@uvc.de>
|
||||
*
|
||||
|
|
@ -9,34 +9,34 @@
|
|||
* an-embeddable-lightweight-xml-rpc-server/184405364
|
||||
*
|
||||
* Copyright (c) 2002 Cogito LLC. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, is hereby granted without fee provided
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, is hereby granted without fee provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
* 3. Neither the name of Cogito LLC nor the names of its
|
||||
* contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior
|
||||
* 3. Neither the name of Cogito LLC nor the names of its
|
||||
* contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COGITO LLC AND CONTRIBUTERS 'AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARAY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COGITO LLC AND CONTRIBUTERS 'AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARAY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
* apps/netutils/xmlrpc/xmlparser.c
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2012 Max Holtzberg. All rights reserved.
|
||||
* Author: Max Holtzberg <mh@uvc.de>
|
||||
*
|
||||
|
|
@ -9,34 +9,34 @@
|
|||
* an-embeddable-lightweight-xml-rpc-server/184405364
|
||||
*
|
||||
* Copyright (c) 2002 Cogito LLC. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, is hereby granted without fee provided
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, is hereby granted without fee provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
* 3. Neither the name of Cogito LLC nor the names of its
|
||||
* contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior
|
||||
* 3. Neither the name of Cogito LLC nor the names of its
|
||||
* contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COGITO LLC AND CONTRIBUTERS 'AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARAY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY COGITO LLC AND CONTRIBUTERS 'AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARAY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue