changeset 299:78a5b319acd3

From Jani Manoses: fix problem with HTTP and early close.
author gthomas
date Fri, 16 Aug 2002 23:59:46 +0000
parents 357090aab579
children 58c748750ca6
files packages/redboot/current/ChangeLog packages/redboot/current/src/io.c packages/redboot/current/src/net/http_client.c
diffstat 3 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,10 @@
+2002-08-16  Jani Monoses  <jani@iv.ro>
+
+	* src/io.c: Do not add empty lines to command history.
+	* src/net/http_client.c: Read all data when in CLOSE_WAIT
+	otherwise if the server closes quickly enough nothing is 
+	received.
+	
 2002-08-09  Andrew Lunn  <andrew.lunn@ascom.ch>
 	
 	* src/crc.c: Removed. Replaced with the CRC package.
--- a/packages/redboot/current/src/io.c
+++ b/packages/redboot/current/src/io.c
@@ -490,7 +490,7 @@ int
 	    }
             last_ch = c;
 #if CYGNUM_REDBOOT_CMD_LINE_EDITING != 0
-            if (cmd_history) {
+            if (cmd_history && (buf != eol)) {
                 // Save current line - only when enabled
                 if (++_cl_index == _CL_NUM_LINES) _cl_index = 0;
                 if (_cl_index > _cl_max_index) _cl_max_index = _cl_index;
--- a/packages/redboot/current/src/net/http_client.c
+++ b/packages/redboot/current/src/net/http_client.c
@@ -131,16 +131,15 @@ http_stream_read(char *buf,
                     if (s->sock.data_bytes == 0 && s->sock.rxcnt == 0) {
                         __tcp_close(&s->sock);
                         return total;
-                    }
-                }
-                if (s->sock.state == _CLOSED) {
-                    // The connection is gone
-                    s->open = false;
-                    
+                    }  
+                } else if (s->sock.state == _CLOSED) {
+                    	// The connection is gone
+                    	s->open = false;
+                    	return -1;
+                } else {	
+                    *err = HTTP_IO;
                     return -1;
-                }
-                *err = HTTP_IO;
-                return -1;
+		}
             }
             s->actual_len = __tcp_read(&s->sock, s->data, sizeof(s->data));
             if (s->actual_len > 0) {