--- netwerk/protocol/http/src/nsHTTPRequest.cpp.orig Fri Apr 21 11:28:24 2000 +++ netwerk/protocol/http/src/nsHTTPRequest.cpp Fri Apr 21 11:36:14 2000 @@ -18,6 +18,8 @@ * Rights Reserved. * * Contributor(s): + * Andrew Daviel, Vancouver Webpages, April 2000 + * experimental code to set geo.position */ #include "nspr.h" @@ -349,6 +351,48 @@ // SetHeader(nsHTTPAtoms::Accept, "image/gif, image/x-xbitmap, image/jpeg, // image/pjpeg, image/png, */*"); SetHeader (nsHTTPAtoms::Accept, "*/*"); + + // set geo.position, geo.region if available + // as per draft-daviel-http-geo-header-01.txt + // (see http://geotags.com/geo) + // quick dirty code - should all be defined through preferences etc. + // locale/geo.position optionally contains a single string like "49;-123" (without '"') + // locale/geo.region optionally contains a single string like "CA-BC". + FILE *exh ; + exh = fopen("/usr/share/locale/geo.position","r"); + if (exh) { + char exbuf[80] ; int lenb ; + while (!feof(exh) && fgets(exbuf, sizeof(exbuf)-1, exh) != NULL) { + lenb = strlen(exbuf); + if (lenb > 0) { + if (exbuf[lenb-1] == '\n' || exbuf[lenb-1] == '\r') + exbuf[lenb-1] = '\0'; + else + exbuf[sizeof(exbuf)-1] = '\0'; + } + SetHeader (nsHTTPAtoms::Geo_Position, exbuf) ; + } + fclose(exh) ; + } + exh = fopen("/usr/share/locale/geo.region","r"); + if (exh) { + char exbuf[10] ; int lenb ; + while (!feof(exh) && fgets(exbuf, sizeof(exbuf)-1, exh) != NULL) { + lenb = strlen(exbuf); + if (lenb > 0) { + if (exbuf[lenb-1] == '\n' || exbuf[lenb-1] == '\r') + exbuf[lenb-1] = '\0'; + else + exbuf[sizeof(exbuf)-1] = '\0'; + } + SetHeader (nsHTTPAtoms::Geo_Region, exbuf) ; + } + fclose(exh) ; + } + + + //SetHeader (nsHTTPAtoms::Geo_Position, "49;-123"); + //SetHeader (nsHTTPAtoms::Geo_Region, "CA-BC") ; nsXPIDLCString acceptLanguages; // Add the Accept-Language header --- netwerk/protocol/http/src/nsHTTPAtomList.h.orig Fri Apr 21 11:28:38 2000 +++ netwerk/protocol/http/src/nsHTTPAtomList.h Fri Apr 21 11:31:14 2000 @@ -18,6 +18,8 @@ * Rights Reserved. * * Contributor(s): + * Andrew Daviel, Vancouver Webpages, April 2000 + * experimental code to set geo.position */ /****** @@ -102,3 +104,5 @@ HTTP_ATOM(Warning, "warning") HTTP_ATOM(WWW_Authenticate, "www-authenticate") HTTP_ATOM(Set_Cookie, "set-cookie") +HTTP_ATOM(Geo_Position, "geo.position") +HTTP_ATOM(Geo_Region, "geo.region")