On Tue, 2002-04-09 at 14:10, Guillaume Cottenceau wrote: > Guillaume Lécroart <[EMAIL PROTECTED]> writes: > > > After tracing the grip requests to http cddb servers, I found out that the > > HTTP version string was wrong. "HTTP 1,1" is sent instead of "HTTP 1.1". > > This dot-to-coma swap seems to offend squid very hard, which makes it return > > HTTP error 400 (Bad Request) back to grip. > > > > What part of the code is responsible for generating the HTTP version string? > > Is it in libghttp or grip? I d/lded both SRPMS and can't figure out! > > `libghttp' is doing the request, and is writing the version of > the http request via the `sprintf' function; and it shoots itself > in the foot because grip has told the glibc to use a locale for > which the radix character is ',' rather than '.'. > > I think there is no "straightforward" way to tell sprintf/glibc > to fall back to the POSIX locale in libghttp, since libghttp is > not itself using the locale stuff. To avoid a dependency on the > locale stuff only because of that problem, the best is probably > to use a small self-written floating point pretty printer, for > example the one used by the dietlibc[1], or even a simpler one. >
probably best replaced with sprintf(buf, "%i.%i", httpMajor, httpMinor); And not treat an http revision as a floating point number. > (it could also be a good idea to take the opportunity to replace > the `sprintf' by `asprintf'; or `snprintf' if compatibility > beyond GNU and BSD is important) > > Ref: > [1] >http://www.linux-mandrake.com/cgi-bin/cvsweb.cgi/gi/mdk-stage1/dietlibc/lib/__dtostr.c > > -- > Guillaume Cottenceau - http://www.frozen-bubble.org/ >