You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/08/18 15:07:59 UTC

[incubator-nuttx-apps] branch master updated (18158ed -> 78e8090)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from 18158ed  system: add libuv port for NuttX
     new 7a1d626  netutils/webclient: Enable to send long HTTP request
     new 10386cf  examples/wget: wget example to work without NSH_NETINIT config
     new 78e8090  examples: wget: Fix nxstyle issues

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/wget/Kconfig          | 10 +++++++++-
 examples/wget/Makefile         |  2 +-
 examples/wget/wget_main.c      | 18 +++++++++++++++---
 netutils/webclient/webclient.c | 14 ++++++++++----
 4 files changed, 35 insertions(+), 9 deletions(-)


[incubator-nuttx-apps] 02/03: examples/wget: wget example to work without NSH_NETINIT config

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 10386cf5b5d8dad97c5a5dc3ffd2e321c47aa299
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Tue Jul 28 15:23:33 2020 +0900

    examples/wget: wget example to work without NSH_NETINIT config
    
    - Network initialization codes are not needed
      with NSH_NETINIT config.
    - Suppport commandline argument to set the URL to get.
    - Change stack size to independent
---
 examples/wget/Kconfig     | 10 +++++++++-
 examples/wget/Makefile    |  2 +-
 examples/wget/wget_main.c | 12 +++++++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/examples/wget/Kconfig b/examples/wget/Kconfig
index 437ec94..97c53aa 100644
--- a/examples/wget/Kconfig
+++ b/examples/wget/Kconfig
@@ -12,14 +12,22 @@ config EXAMPLES_WGET
 
 if EXAMPLES_WGET
 
+config EXAMPLES_WGET_STACKSIZE
+	int "wget stack size"
+	default DEFAULT_TASK_STACKSIZE
+	---help---
+		Stack size of "wget" command. If you use SSL connection,
+		you should increase this value around 8096.
+
 config EXAMPLES_WGET_URL
 	string "File URL"
 	default ""
 	---help---
-	The URL of the file to get
+		The URL of the file to get
 
 config EXAMPLES_WGET_NOMAC
 	bool "Use Canned MAC Address"
+	depends on !NSH_NETINIT
 	default n
 
 config EXAMPLES_WGET_IPADDR
diff --git a/examples/wget/Makefile b/examples/wget/Makefile
index cc3e241..ecc3966 100644
--- a/examples/wget/Makefile
+++ b/examples/wget/Makefile
@@ -41,7 +41,7 @@ MAINSRC = wget_main.c
 
 PROGNAME = wget
 PRIORITY = SCHED_PRIORITY_DEFAULT
-STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
+STACKSIZE = $(CONFIG_EXAMPLES_WGET_STACKSIZE)
 MODULE = $(CONFIG_EXAMPLES_WGET)
 
 include $(APPDIR)/Application.mk
diff --git a/examples/wget/wget_main.c b/examples/wget/wget_main.c
index 32ed435..1f3897b 100644
--- a/examples/wget/wget_main.c
+++ b/examples/wget/wget_main.c
@@ -108,6 +108,7 @@ static void callback(FAR char **buffer, int offset, int datend,
 
 int main(int argc, FAR char *argv[])
 {
+#ifndef CONFIG_NSH_NETINIT
   struct in_addr addr;
 #if defined(CONFIG_EXAMPLES_WGET_NOMAC)
   uint8_t mac[IFHWADDRLEN];
@@ -145,9 +146,18 @@ int main(int argc, FAR char *argv[])
    */
 
   netlib_ifup("eth0");
+#endif /* CONFIG_NSH_NETINIT */
 
   /* Then start the server */
 
-  wget(CONFIG_EXAMPLES_WGET_URL, g_iobuffer, 512, callback, NULL);
+  if (argc > 1)
+    {
+      wget(argv[1], g_iobuffer, 512, callback, NULL);
+    }
+  else
+    {
+      wget(CONFIG_EXAMPLES_WGET_URL, g_iobuffer, 512, callback, NULL);
+    }
+
   return 0;
 }


[incubator-nuttx-apps] 03/03: examples: wget: Fix nxstyle issues

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 78e8090842bbd3123a58629e94d30144954f6ef4
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Fri Aug 7 14:13:56 2020 +0900

    examples: wget: Fix nxstyle issues
---
 examples/wget/wget_main.c      | 6 ++++--
 netutils/webclient/webclient.c | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/examples/wget/wget_main.c b/examples/wget/wget_main.c
index 1f3897b..3b634d9 100644
--- a/examples/wget/wget_main.c
+++ b/examples/wget/wget_main.c
@@ -53,7 +53,8 @@
  * Preprocessor Definitions
  ****************************************************************************/
 
-/* Configuration Checks ******************************************************/
+/* Configuration Checks *****************************************************/
+
 /* BEWARE:
  * There are other configuration settings needed in netutitls/wget/wgetc.s,
  * but there are default values for those so we cannot check them here.
@@ -88,6 +89,7 @@ static char g_iobuffer[512];
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
+
 /****************************************************************************
  * Name: callback
  ****************************************************************************/
@@ -114,7 +116,7 @@ int main(int argc, FAR char *argv[])
   uint8_t mac[IFHWADDRLEN];
 #endif
 
-/* Many embedded network interfaces must have a software assigned MAC */
+  /* Many embedded network interfaces must have a software assigned MAC */
 
 #ifdef CONFIG_EXAMPLES_WGET_NOMAC
   mac[0] = 0x00;
diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index 8773f11..0a70d0e 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -666,9 +666,10 @@ static int wget_base(FAR const char *url, FAR char *buffer, int buflen,
               nerr("ERROR: send failed: %d\n", errno);
               goto errout;
             }
+
           len -= ret;
         }
-      while(len > 0);
+      while (len > 0);
 
       /* Now loop to get the file sent in response to the GET.  This
        * loop continues until either we read the end of file (nbytes == 0)


[incubator-nuttx-apps] 01/03: netutils/webclient: Enable to send long HTTP request

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 7a1d6265045051db4936ccff53e554c73272804d
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Tue Jul 28 15:23:33 2020 +0900

    netutils/webclient: Enable to send long HTTP request
    
    Call send() repeatedly until whole buffer to be sent.
---
 netutils/webclient/webclient.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index 675ce78..8773f11 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -658,12 +658,17 @@ static int wget_base(FAR const char *url, FAR char *buffer, int buflen,
 
       len = dest - buffer;
 
-      ret = send(sockfd, buffer, len, 0);
-      if (ret < 0)
+      do
         {
-          nerr("ERROR: send failed: %d\n", errno);
-          goto errout;
+          ret = send(sockfd, buffer + ((dest - buffer) - len), len, 0);
+          if (ret < 0)
+            {
+              nerr("ERROR: send failed: %d\n", errno);
+              goto errout;
+            }
+          len -= ret;
         }
+      while(len > 0);
 
       /* Now loop to get the file sent in response to the GET.  This
        * loop continues until either we read the end of file (nbytes == 0)