You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1997/10/16 23:13:51 UTC

[PATCH] Suggestion for HTTP_PROTO(maj,min) macro

I sometimes wondered if there was a better (or more intuitive) way to say...
    if (r->proto_num >= 1001) ...
I would prefer, like,
    if (r->proto_num >= HTTP_PROTO(1,1)) ...

Here's a patch against the former beta-1 candidate (with just a 2-line
offset when applied against the current to-be-1.3b2-source:
    patching file `src/main/http_request.c'
    Hunk #1 succeeded at 982 (offset 2 lines).
) which introduces the HTTP_PROTO() macro for encapsulation (and eventually
modification) of the internal representation of the proto_num field.
I've done a recuresive grep for proto_num and the modified places were
all I could find. With this encapsulation, it would be a one-line-change to
change the internal representation to, say, ((major<<16)+minor)
if one should ever want to.     ;-)

Enjoy, (and vote -- for 1.3b3 perhaps?)

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Suggestion for HTTP_PROTO(maj,min) macro

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Oct 17, 1997 at 12:13:51AM +0200, Martin Kraemer wrote:
> +    if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor)
					  ^^ ^^
Are there any platforms which don't eat %u in sscanf? If so,
it can of course be replaced by %d. BTW: Linux sscanf("-3", "%u", &result)
happily converts the "-3" to an ((unsigned) -3), i.e. a _large_
positive number.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Suggestion for HTTP_PROTO(maj,min) macro

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Thu, Oct 16, 1997 at 03:26:00PM -0700, sameer wrote:
> 	I thought this was already +1'd.

By concept, yes. I've made a separate patch out of it so that it doesn't
interfere with other changes. It's easier to make separate commits for
each individual change, rather than committing all of it at once.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request