Hi All,

Thanks for your comments. I modified the patch and I am testing it.
There is the modified version but I didn't test it, yet.

Dod

Index: gateway/gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.217
diff -u -r1.217 http.c
--- gateway/gwlib/http.c        16 Feb 2004 19:41:26 -0000      1.217
+++ gateway/gwlib/http.c        3 Jun 2004 10:43:49 -0000
@@ -2338,6 +2338,81 @@
     return client;
 }

+/*
+ * The http_send_reply(...) uses this function to determinate the
+ * reason pahrase for a status code.
+ */
+Octstr *http_reason_phrase(int status)
+{
+       Octstr *result=0;
+       switch (status) {
+       case HTTP_OK:
+               result= octstr_imm("OK");                                              
 /* 200 */
+               break;
+       case HTTP_CREATED:
+               result= octstr_imm("Created");                                  /* 201 
*/
+               break;
+       case HTTP_ACCEPTED:
+               result= octstr_imm("Accepted");                                 /* 202 
*/
+               break;
+       case HTTP_NO_CONTENT:
+               result= octstr_imm("No Content");                               /* 204 
*/
+               break;
+       case HTTP_RESET_CONTENT:
+               result= octstr_imm("Reset Content");                    /* 205 */
+               break;
+       case HTTP_MOVED_PERMANENTLY:
+               result= octstr_imm("Moved Permanently");                /* 301 */
+               break;
+       case HTTP_FOUND:
+               result= octstr_imm("Found");                                    /* 302 
*/
+               break;
+       case HTTP_SEE_OTHER:
+               result= octstr_imm("See Other");                                /* 303 
*/
+               break;
+       case HTTP_NOT_MODIFIED:
+               result= octstr_imm("Not Modified");                             /* 304 
*/
+               break;
+       case HTTP_TEMPORARY_REDIRECT:
+               result= octstr_imm("Temporary Redirect");               /* 307 */
+               break;
+       case HTTP_BAD_REQUEST:
+               result= octstr_imm("Bad Request");                              /* 400 
*/
+               break;
+       case HTTP_UNAUTHORIZED:
+               result= octstr_imm("Unauthorized");                             /* 401 
*/
+               break;
+       case HTTP_FORBIDDEN:
+               result= octstr_imm("Forbidden");                                /* 403 
*/
+               break;
+       case HTTP_NOT_FOUND:
+               result= octstr_imm("Not Found");                                /* 404 
*/
+               break;
+       case HTTP_BAD_METHOD:
+               result= octstr_imm("Method Not Allowed");               /* 405 */
+               break;
+       case HTTP_NOT_ACCEPTABLE:
+               result= octstr_imm("Not Acceptable");                   /* 406 */
+               break;
+       case HTTP_REQUEST_ENTITY_TOO_LARGE:
+               result= octstr_imm("Request Entity Too Large"); /* 413 */
+               break;
+       case HTTP_UNSUPPORTED_MEDIA_TYPE:
+               result= octstr_imm("Unsupported Media Type");   /* 415 */
+               break;
+       case HTTP_INTERNAL_SERVER_ERROR:
+               result= octstr_imm("Internal Server Error");    /* 500 */
+               break;
+       case HTTP_NOT_IMPLEMENTED:
+               result= octstr_imm("Not Implemented")   ;               /* 501 */
+               break;
+       case HTTP_BAD_GATEWAY:
+               result= octstr_imm("Bad Gateway");                              /* 502 
*/
+               break;
+       }
+       return result;
+}
+

 void http_send_reply(HTTPClient *client, int status, List *headers,
                     Octstr *body)
@@ -2347,9 +2422,9 @@
     int ret;

     if (client->use_version_1_0)
-       response = octstr_format("HTTP/1.0 %d Foo\r\n", status);
+       response = octstr_format("HTTP/1.0 %d %S\r\n", status,
http_reason_phrase(status));
     else
-       response = octstr_format("HTTP/1.1 %d Foo\r\n", status);
+       response = octstr_format("HTTP/1.1 %d %S\r\n", status,
http_reason_phrase(status));

     /* identify ourselfs */
     octstr_format_append(response, "Server: " GW_NAME "/%s\r\n",
 GW_VERSION);


--
Zoltan Dudas
Software Engineer
SEI Magyarorszag Kft.
WEB: http://www.sei-it.com
E-Mail: [EMAIL PROTECTED]
Phone: +36 52 889 532
Fax: +36 52 889 599


Index: gateway/gwlib/http.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/http.c,v
retrieving revision 1.217
diff -u -r1.217 http.c
--- gateway/gwlib/http.c	16 Feb 2004 19:41:26 -0000	1.217
+++ gateway/gwlib/http.c	3 Jun 2004 10:43:49 -0000
@@ -2338,6 +2338,81 @@
     return client;
 }
 
+/*
+ * The http_send_reply(...) uses this function to determinate the
+ * reason pahrase for a status code.
+ */
+Octstr *http_reason_phrase(int status)
+{
+	Octstr *result=0;
+	switch (status) {
+	case HTTP_OK:
+		result= octstr_imm("OK");						/* 200 */
+		break;
+	case HTTP_CREATED:                   
+		result= octstr_imm("Created");					/* 201 */
+		break;
+	case HTTP_ACCEPTED:
+		result= octstr_imm("Accepted");					/* 202 */
+		break;
+	case HTTP_NO_CONTENT:
+		result= octstr_imm("No Content");				/* 204 */
+		break;
+	case HTTP_RESET_CONTENT: 
+		result= octstr_imm("Reset Content");			/* 205 */
+		break;
+	case HTTP_MOVED_PERMANENTLY:
+		result= octstr_imm("Moved Permanently"); 		/* 301 */
+		break;
+	case HTTP_FOUND:
+		result= octstr_imm("Found");					/* 302 */
+		break;
+	case HTTP_SEE_OTHER:
+		result= octstr_imm("See Other");				/* 303 */
+		break;
+	case HTTP_NOT_MODIFIED:
+		result= octstr_imm("Not Modified");				/* 304 */
+		break;
+	case HTTP_TEMPORARY_REDIRECT:
+		result= octstr_imm("Temporary Redirect");		/* 307 */
+		break;
+	case HTTP_BAD_REQUEST:
+		result= octstr_imm("Bad Request");				/* 400 */
+		break;
+	case HTTP_UNAUTHORIZED:
+		result= octstr_imm("Unauthorized");				/* 401 */
+		break;
+	case HTTP_FORBIDDEN:
+		result= octstr_imm("Forbidden");				/* 403 */
+		break;
+	case HTTP_NOT_FOUND:           
+		result= octstr_imm("Not Found");				/* 404 */
+		break;
+	case HTTP_BAD_METHOD:
+		result= octstr_imm("Method Not Allowed");		/* 405 */
+		break;
+	case HTTP_NOT_ACCEPTABLE:
+		result= octstr_imm("Not Acceptable");			/* 406 */
+		break;
+	case HTTP_REQUEST_ENTITY_TOO_LARGE:
+		result= octstr_imm("Request Entity Too Large");	/* 413 */
+		break;
+	case HTTP_UNSUPPORTED_MEDIA_TYPE:
+		result= octstr_imm("Unsupported Media Type");	/* 415 */
+		break;
+	case HTTP_INTERNAL_SERVER_ERROR:
+		result= octstr_imm("Internal Server Error");	/* 500 */
+		break;
+	case HTTP_NOT_IMPLEMENTED:
+		result= octstr_imm("Not Implemented")	;		/* 501 */
+		break;
+	case HTTP_BAD_GATEWAY:
+		result= octstr_imm("Bad Gateway");				/* 502 */
+		break;
+	}
+	return result;
+}
+
 
 void http_send_reply(HTTPClient *client, int status, List *headers, 
     	    	     Octstr *body)
@@ -2347,9 +2422,9 @@
     int ret;
 
     if (client->use_version_1_0)
-    	response = octstr_format("HTTP/1.0 %d Foo\r\n", status);
+    	response = octstr_format("HTTP/1.0 %d %S\r\n", status, http_reason_phrase(status));
     else
-    	response = octstr_format("HTTP/1.1 %d Foo\r\n", status);
+    	response = octstr_format("HTTP/1.1 %d %S\r\n", status, http_reason_phrase(status));
 
     /* identify ourselfs */
     octstr_format_append(response, "Server: " GW_NAME "/%s\r\n", GW_VERSION);

Reply via email to