This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Redboot: Add HTTP_FORBIDDEN error code


Hi,

The error messages from the HTTP client in redboot are not very
informative (Bad HTTP request). Add a HTTP_FORBIDDEN with a
corresponding error code for the common 403 Forbidden error code.

Index: packages/redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.255
diff -u -r1.255 ChangeLog
--- packages/redboot/current/ChangeLog	4 Jun 2007 20:30:59 -0000	1.255
+++ packages/redboot/current/ChangeLog	8 Aug 2007 07:36:33 -0000
@@ -1,3 +1,9 @@
+2007-08-08  Peter Korsgaard  <peter.korsgaard@barco.com>
+
+	* include/net/http.h:
+	* src/net/http_client.c: Add HTTP_FORBIDDEN error code for 403
+	Forbidden response.
+
 2007-06-03  Andrew Lunn <andrew.lunn@ascom.ch>
 
 	* src/net/net_io.c: (do_ip_addr): Option to set domain name.
Index: packages/redboot/current/include/net/http.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/net/http.h,v
retrieving revision 1.3
diff -u -r1.3 http.h
--- packages/redboot/current/include/net/http.h	3 Apr 2003 15:21:10 -0000	1.3
+++ packages/redboot/current/include/net/http.h	8 Aug 2007 07:36:33 -0000
@@ -61,12 +61,13 @@
 extern void  http_stream_close(int *err);
 extern char *http_error(int err);
 
-#define HTTP_NOERR    0   // No error
-#define HTTP_BADHDR   1   // Invalid HTTP header (response)
-#define HTTP_OPEN     2   // Problems opening connection
-#define HTTP_IO       3   // Misc I/O problems
-#define HTTP_BADREQ   4   // Bad request
-#define HTTP_NOFILE   5   // No such file
+#define HTTP_NOERR     0   // No error
+#define HTTP_BADHDR    1   // Invalid HTTP header (response)
+#define HTTP_OPEN      2   // Problems opening connection
+#define HTTP_IO        3   // Misc I/O problems
+#define HTTP_BADREQ    4   // Bad request
+#define HTTP_NOFILE    5   // No such file
+#define HTTP_FORBIDDEN 6   // Forbidden
 
 extern getc_io_funcs_t http_io;
 #endif // _HTTP_H_
Index: packages/redboot/current/src/net/http_client.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/net/http_client.c,v
retrieving revision 1.9
diff -u -r1.9 http_client.c
--- packages/redboot/current/src/net/http_client.c	13 Aug 2004 12:26:01 -0000	1.9
+++ packages/redboot/current/src/net/http_client.c	8 Aug 2007 07:36:33 -0000
@@ -178,6 +178,9 @@
                             case 400:
                                 *err = HTTP_BADREQ;
                                 break;
+                            case 403:
+                                *err = HTTP_FORBIDDEN;
+                                break;
                             case 404:
                                 *err = HTTP_NOFILE;
                                 break;
@@ -243,6 +246,8 @@
         return "Can't connect to host";
     case HTTP_IO:
         return "I/O error";
+    case HTTP_FORBIDDEN:
+        return "Forbidden (check permissions)";
     }
     return errmsg;
 }

-- 
Bye, Peter Korsgaard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]