Re: [PATCH] Reason pharses into the HTTP response

Guillaume Cottenceau <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Zoltán Dudás <zoltan.dudas 'at' sei.hu> writes:

> Hi All !
> 
> We use the Kannel for our project and we made some little modifications on it.
> I am going to send these patches back to the community.
> The first one is a very simply modification, it changes the constant 'foo' 
> word to real reason phrases 
> (http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html) in the status-line of 
> the HTTP response. 
> 
> Index: gateway/gwlib/http.c
> ===================================================================
> RCS file: /home/cvs/gateway/gwlib/http.c,v
> retrieving revision 1.217
> diff -r1.217 http.c
> 2350c2350
> <     	response = octstr_format("HTTP/1.0 %d Foo\r\n", status);
> ---
> >     	response = octstr_format("HTTP/1.0 %d %s\r\n", status, 

FAQ reads:

"If you want to send us modifications, please send the output of
cvs diff -u (-u makes cvs use unified diffs, instead of plain
diffs; unified diffs are easier to read, since they provide more
context and can be applied to a later version of the same file)"

Unified diffs are the way to go.


[...]

> > static char *http_error_messages[] = {
> >     "OK",						/* 200 */
> >     "Created",					/* 201 */
> >     "Accepted",					/* 202 */
> >     "No Content",				/* 204 */

[...]

> > 	switch (status) {
> > 	case HTTP_OK:
> > 		result= http_error_messages[0];
> > 		break;
> > 	case HTTP_CREATED:                   
> > 		result= http_error_messages[1];
> > 		break;
> > 	case HTTP_ACCEPTED:
> > 		result= http_error_messages[2];
> > 		break;
> > 	case HTTP_NO_CONTENT:
> > 		result= http_error_messages[3];
> > 		break;

Hum you really don't have another solution that to hardcode the
row number of the char* array? This is inelegant IMHO since it
duplicates information. And I'm not sure Kannel people don't
prefer octstr over char* pretty much :).

-- 
Guillaume Cottenceau
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.