From: adrian <> Date: Mon, 13 Nov 2000 19:25:11 +0000 (+0000) Subject: Convert http_ver from a float to http_version_t which is a struct containing X-Git-Tag: SQUID_3_0_PRE1~1774 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccf44862a7afef089080039a3b3b322230a1697e;p=thirdparty%2Fsquid.git Convert http_ver from a float to http_version_t which is a struct containing two integers. Submitted by: Robert Collins --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index d7e4f4585f..a9e50d18b9 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.cc,v 1.7 2000/03/06 16:23:28 wessels Exp $ + * $Id: HttpMsg.cc,v 1.8 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -89,9 +89,9 @@ httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const ch /* returns true if connection should be "persistent" * after processing this message */ int -httpMsgIsPersistent(float http_ver, const HttpHeader * hdr) +httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr) { - if (http_ver >= 1.1) { + if ((http_ver.major>=1) && (http_ver.minor >= 1)) { /* * for modern versions of HTTP: persistent unless there is * a "Connection: close" header. diff --git a/src/HttpReply.cc b/src/HttpReply.cc index aeaac40792..c91f31a747 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.42 2000/05/16 07:06:02 wessels Exp $ + * $Id: HttpReply.cc,v 1.43 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -194,7 +194,7 @@ httpReplySwapOut(const HttpReply * rep, StoreEntry * e) } MemBuf -httpPackedReply(double ver, http_status status, const char *ctype, +httpPackedReply(http_version_t ver, http_status status, const char *ctype, int clen, time_t lmt, time_t expires) { HttpReply *rep = httpReplyCreate(); @@ -228,7 +228,7 @@ httpPacked304Reply(const HttpReply * rep) } void -httpReplySetHeaders(HttpReply * reply, double ver, http_status status, const char *reason, +httpReplySetHeaders(HttpReply * reply, http_version_t ver, http_status status, const char *reason, const char *ctype, int clen, time_t lmt, time_t expires) { HttpHeader *hdr; @@ -259,8 +259,10 @@ void httpRedirectReply(HttpReply * reply, http_status status, const char *loc) { HttpHeader *hdr; + http_version_t ver; assert(reply); - httpStatusLineSet(&reply->sline, 1.0, status, httpStatusString(status)); + httpBuildVersion(&ver,1,0); + httpStatusLineSet(&reply->sline, ver, status, httpStatusString(status)); hdr = &reply->header; httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string); httpHeaderPutTime(hdr, HDR_DATE, squid_curtime); diff --git a/src/HttpStatusLine.cc b/src/HttpStatusLine.cc index 6775b5dacf..3b9101a970 100644 --- a/src/HttpStatusLine.cc +++ b/src/HttpStatusLine.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.cc,v 1.19 2000/03/06 16:23:28 wessels Exp $ + * $Id: HttpStatusLine.cc,v 1.20 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 57 HTTP Status-line * AUTHOR: Alex Rousskov @@ -37,23 +37,27 @@ /* local constants */ -const char *HttpStatusLineFormat = "HTTP/%3.1f %3d %s\r\n"; +const char *HttpStatusLineFormat = "HTTP/%d.%d %3d %s\r\n"; void httpStatusLineInit(HttpStatusLine * sline) { - httpStatusLineSet(sline, 0.0, HTTP_STATUS_NONE, NULL); + http_version_t version; + httpBuildVersion(&version,0,0); + httpStatusLineSet(sline, version , HTTP_STATUS_NONE, NULL); } void httpStatusLineClean(HttpStatusLine * sline) { - httpStatusLineSet(sline, 0.0, HTTP_INTERNAL_SERVER_ERROR, NULL); + http_version_t version; + httpBuildVersion(&version,0,0); + httpStatusLineSet(sline, version, HTTP_INTERNAL_SERVER_ERROR, NULL); } /* set values */ void -httpStatusLineSet(HttpStatusLine * sline, double version, http_status status, const char *reason) +httpStatusLineSet(HttpStatusLine * sline, http_version_t version, http_status status, const char *reason) { assert(sline); sline->version = version; @@ -68,10 +72,11 @@ httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p) { assert(sline && p); debug(57, 9) ("packing sline %p using %p:\n", sline, p); - debug(57, 9) (HttpStatusLineFormat, sline->version, sline->status, + debug(57, 9) (HttpStatusLineFormat, sline->version.major, + sline->version.minor, sline->status, sline->reason ? sline->reason : httpStatusString(sline->status)); - packerPrintf(p, HttpStatusLineFormat, - sline->version, sline->status, httpStatusLineReason(sline)); + packerPrintf(p, HttpStatusLineFormat, sline->version.major, + sline->version.minor, sline->status, httpStatusLineReason(sline)); } /* pack fields using Packer */ @@ -85,7 +90,9 @@ httpStatusLineParse(HttpStatusLine * sline, const char *start, const char *end) start += 5; if (!xisdigit(*start)) return 0; - sline->version = atof(start); + if (sscanf(start, "%d.%d", &sline->version.major, &sline->version.minor)!=2){ + debug(57, 7) ("httpStatusLineParse: Invalid HTTP identifier.\n"); + } if (!(start = strchr(start, ' '))) return 0; sline->status = atoi(++start); diff --git a/src/access_log.cc b/src/access_log.cc index d62e77a847..cb78057627 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.61 2000/11/01 04:50:25 wessels Exp $ + * $Id: access_log.cc,v 1.62 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -215,13 +215,13 @@ accessLogCommon(AccessLogEntry * al) client = fqdncache_gethostbyaddr(al->cache.caddr, 0); if (client == NULL) client = inet_ntoa(al->cache.caddr); - logfilePrintf(logfile, "%s %s - [%s] \"%s %s HTTP/%.1f\" %d %d %s:%s", + logfilePrintf(logfile, "%s %s - [%s] \"%s %s HTTP/%d.%d\" %d %d %s:%s", client, al->cache.ident, mkhttpdlogtime(&squid_curtime), al->private.method_str, al->url, - al->http.version, + al->http.version.major, al->http.version.minor, al->http.code, al->cache.size, log_tags[al->cache.code], diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 9cdd9aa72a..43caa145de 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.cc,v 1.22 2000/05/16 07:06:03 wessels Exp $ + * $Id: cache_manager.cc,v 1.23 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -253,11 +253,13 @@ cachemgrStart(int fd, request_t * request, StoreEntry * entry) if (a->flags.atomic) storeBuffer(entry); { + http_version_t version; HttpReply *rep = entry->mem_obj->reply; /* prove there are no previous reply headers around */ assert(0 == rep->sline.status); + httpBuildVersion(&version,1,0); httpReplySetHeaders(rep, - (double) 1.0, + version, HTTP_OK, NULL, "text/plain", diff --git a/src/client_side.cc b/src/client_side.cc index 348332afd5..0802e3a48a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.511 2000/11/09 20:20:52 wessels Exp $ + * $Id: client_side.cc,v 1.512 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -575,6 +575,7 @@ clientPurgeRequest(clientHttpRequest * http) ErrorState *err = NULL; HttpReply *r; http_status status; + http_version_t version; debug(33, 3) ("Config2.onoff.enable_purge = %d\n", Config2.onoff.enable_purge); if (!Config2.onoff.enable_purge) { http->log_type = LOG_TCP_DENIED; @@ -602,7 +603,8 @@ clientPurgeRequest(clientHttpRequest * http) */ http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); httpReplyReset(r = http->entry->mem_obj->reply); - httpReplySetHeaders(r, 1.0, status, NULL, NULL, 0, 0, -1); + httpBuildVersion(&version,1,0); + httpReplySetHeaders(r, version, status, NULL, NULL, 0, 0, -1); httpReplySwapOut(r, http->entry); storeComplete(http->entry); } @@ -917,8 +919,8 @@ clientSetKeepaliveFlag(clientHttpRequest * http) { request_t *request = http->request; const HttpHeader *req_hdr = &request->header; - debug(33, 3) ("clientSetKeepaliveFlag: http_ver = %3.1f\n", - request->http_ver); + debug(33, 3) ("clientSetKeepaliveFlag: http_ver = %d.%d\n", + request->http_ver.major, request->http_ver.minor); debug(33, 3) ("clientSetKeepaliveFlag: method = %s\n", RequestMethodStr[request->method]); if (!Config.onoff.client_pconns) @@ -1277,7 +1279,7 @@ clientBuildReply(clientHttpRequest * http, const char *buf, size_t size) size_t k = headersEnd(buf, size); if (k && httpReplyParse(rep, buf, k)) { /* enforce 1.0 reply version */ - rep->sline.version = 1.0; + httpBuildVersion(&rep->sline.version,1,0); /* do header conversions */ clientBuildReplyHeader(http, rep); /* if we do ranges, change status to "Partial Content" */ @@ -2075,6 +2077,7 @@ clientProcessRequest(clientHttpRequest * http) request_t *r = http->request; int fd = http->conn->fd; HttpReply *rep; + http_version_t version; debug(33, 4) ("clientProcessRequest: %s '%s'\n", RequestMethodStr[r->method], url); @@ -2091,7 +2094,8 @@ clientProcessRequest(clientHttpRequest * http) storeReleaseRequest(http->entry); storeBuffer(http->entry); rep = httpReplyCreate(); - httpReplySetHeaders(rep, 1.0, HTTP_OK, NULL, "text/plain", + httpBuildVersion(&version,1,0); + httpReplySetHeaders(rep, version, HTTP_OK, NULL, "text/plain", httpRequestPrefixLen(r), 0, squid_curtime); httpReplySwapOut(rep, http->entry); httpReplyDestroy(rep); @@ -2227,7 +2231,7 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, char *mstr = NULL; char *url = NULL; char *req_hdr = NULL; - float http_ver; + http_version_t http_ver; char *token = NULL; char *t = NULL; char *end; @@ -2304,12 +2308,16 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status, if (token == NULL) { debug(33, 3) ("parseHttpRequest: Missing HTTP identifier\n"); #if RELAXED_HTTP_PARSER - http_ver = (float) 0.9; /* wild guess */ + httpBuildVersion(&http_ver,0,9); /* wild guess */ #else return parseHttpRequestAbort(conn, "error:missing-http-ident"); #endif } else { - http_ver = (float) atof(token + 5); + if (sscanf(token+5, "%d.%d", &http_ver.major, &http_ver.minor)!=2){ + debug(33, 3) ("parseHttpRequest: Invalid HTTP identifier.\n"); + return parseHttpRequestAbort(conn, "error: invalid HTTP-ident"); + } + debug(33, 6) ("parseHttpRequest: Client HTTP version %d.%d.\n",http_ver.major, http_ver.minor); } /* diff --git a/src/errorpage.cc b/src/errorpage.cc index a0b8be61ce..f00564af9d 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.155 2000/11/04 23:04:10 hno Exp $ + * $Id: errorpage.cc,v 1.156 2000/11/13 12:25:11 adrian Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -499,10 +499,10 @@ errorConvert(char token, ErrorState * err) case 'R': if (NULL != r) { Packer p; - memBufPrintf(&mb, "%s %s HTTP/%3.1f\n", + memBufPrintf(&mb, "%s %s HTTP/%d.%d\n", RequestMethodStr[r->method], strLen(r->urlpath) ? strBuf(r->urlpath) : "/", - (double) r->http_ver); + r->http_ver.major, r->http_ver.minor); packerToMemInit(&p, &mb); httpHeaderPackInto(&r->header, &p); packerClean(&p); @@ -574,8 +574,10 @@ errorBuildReply(ErrorState * err) { HttpReply *rep = httpReplyCreate(); MemBuf content = errorBuildContent(err); + http_version_t version; /* no LMT for error pages; error pages expire immediately */ - httpReplySetHeaders(rep, 1.0, err->http_status, NULL, "text/html", content.size, 0, squid_curtime); + httpBuildVersion(&version,1,0); + httpReplySetHeaders(rep, version, err->http_status, NULL, "text/html", content.size, 0, squid_curtime); /* * include some information for downstream caches. Implicit * replaceable content. This isn't quite sufficient. xerrno is not diff --git a/src/ftp.cc b/src/ftp.cc index a1a2f0538a..ec08aded7e 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.297 2000/11/04 23:04:10 hno Exp $ + * $Id: ftp.cc,v 1.298 2000/11/13 12:25:12 adrian Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -2462,6 +2462,7 @@ ftpAppendSuccessHeader(FtpStateData * ftpState) StoreEntry *e = ftpState->entry; StoreEntry *pe = NULL; http_reply *reply = e->mem_obj->reply; + http_version_t version; if (ftpState->flags.http_header_sent) return; ftpState->flags.http_header_sent = 1; @@ -2493,12 +2494,14 @@ ftpAppendSuccessHeader(FtpStateData * ftpState) HttpHdrRangeSpec range_spec; range_spec.offset = ftpState->restarted_offset; range_spec.length = ftpState->size - ftpState->restarted_offset; - httpReplySetHeaders(reply, 1.0, HTTP_PARTIAL_CONTENT, "Gatewaying", + httpBuildVersion(&version,1,0); + httpReplySetHeaders(reply, version, HTTP_PARTIAL_CONTENT, "Gatewaying", mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2); httpHeaderAddContRange(&reply->header, range_spec, ftpState->size); } else { /* Full reply */ - httpReplySetHeaders(reply, 1.0, HTTP_OK, "Gatewaying", + httpBuildVersion(&version,1,0); + httpReplySetHeaders(reply, version, HTTP_OK, "Gatewaying", mime_type, ftpState->size, ftpState->mdtm, -2); } /* additional info */ diff --git a/src/http.cc b/src/http.cc index a73aec9e03..33cee575eb 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.369 2000/11/01 04:03:14 wessels Exp $ + * $Id: http.cc,v 1.370 2000/11/13 12:25:12 adrian Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1017,3 +1017,9 @@ httpSendRequestEntryDone(int fd, char *bufnotused, size_t size, int errflag, voi comm_write(fd, "\r\n", 2, httpSendComplete, data, NULL); } } + +void +httpBuildVersion(http_version_t *version, unsigned int major,unsigned int minor) { + version->major=major; + version->minor=minor; +} diff --git a/src/internal.cc b/src/internal.cc index f076d4fb90..774c5977a6 100644 --- a/src/internal.cc +++ b/src/internal.cc @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.18 2000/03/06 16:23:32 wessels Exp $ + * $Id: internal.cc,v 1.19 2000/11/13 12:25:12 adrian Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -44,6 +44,7 @@ internalStart(request_t * request, StoreEntry * entry) { ErrorState *err; const char *upath = strBuf(request->urlpath); + http_version_t version; debug(76, 3) ("internalStart: %s requesting '%s'\n", inet_ntoa(request->client_addr), upath); if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) { @@ -54,8 +55,9 @@ internalStart(request_t * request, StoreEntry * entry) #else const char *msgbuf = "This cache does not suport Cache Digests.\n"; #endif + httpBuildVersion(&version,1,0); httpReplySetHeaders(entry->mem_obj->reply, - 1.0, + version, HTTP_NOT_FOUND, "Not Found", "text/plain", diff --git a/src/mime.cc b/src/mime.cc index e3320cd0fc..94ef8e8994 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -1,6 +1,6 @@ /* - * $Id: mime.cc,v 1.94 2000/05/16 07:06:05 wessels Exp $ + * $Id: mime.cc,v 1.95 2000/11/13 12:25:12 adrian Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -394,6 +394,7 @@ mimeLoadIconFile(const char *icon) char *buf; const char *type = mimeGetContentType(icon); HttpReply *reply; + http_version_t version; if (type == NULL) fatal("Unknown icon format while reading mime.conf\n"); buf = internalLocalUri("/squid-internal-static/icons/", icon); @@ -421,7 +422,8 @@ mimeLoadIconFile(const char *icon) storeBuffer(e); e->mem_obj->request = requestLink(urlParse(METHOD_GET, url)); httpReplyReset(reply = e->mem_obj->reply); - httpReplySetHeaders(reply, 1.0, HTTP_OK, NULL, + httpBuildVersion(&version,1,0); + httpReplySetHeaders(reply, version, HTTP_OK, NULL, type, (int) sb.st_size, sb.st_mtime, -1); reply->cache_control = httpHdrCcCreate(); httpHdrCcSetMaxAge(reply->cache_control, 86400); diff --git a/src/net_db.cc b/src/net_db.cc index 78cf656a70..0e1b24cfce 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.151 2000/10/31 23:48:14 wessels Exp $ + * $Id: net_db.cc,v 1.152 2000/11/13 12:25:12 adrian Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -919,6 +919,7 @@ void netdbBinaryExchange(StoreEntry * s) { http_reply *reply = s->mem_obj->reply; + http_version_t version; #if USE_ICMP netdbEntry *n; int i; @@ -928,7 +929,8 @@ netdbBinaryExchange(StoreEntry * s) struct in_addr addr; storeBuffer(s); httpReplyReset(reply); - httpReplySetHeaders(reply, 1.0, HTTP_OK, "OK", + httpBuildVersion(version,1,0); + httpReplySetHeaders(reply, version, HTTP_OK, "OK", NULL, -1, squid_curtime, -2); httpReplySwapOut(reply, s); rec_sz = 0; @@ -970,7 +972,8 @@ netdbBinaryExchange(StoreEntry * s) memFree(buf, MEM_4K_BUF); #else httpReplyReset(reply); - httpReplySetHeaders(reply, 1.0, HTTP_BAD_REQUEST, "Bad Request", + httpBuildVersion(&version,1,0); + httpReplySetHeaders(reply, version, HTTP_BAD_REQUEST, "Bad Request", NULL, -1, squid_curtime, -2); storeAppendPrintf(s, "NETDB support not compiled into this Squid cache.\n"); #endif diff --git a/src/protos.h b/src/protos.h index 1605948cf3..35e939a15f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.386 2000/11/01 04:03:15 wessels Exp $ + * $Id: protos.h,v 1.387 2000/11/13 12:25:12 adrian Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -269,6 +269,7 @@ extern int gopherCachable(const char *); extern void whoisStart(FwdState *); +/* http.c */ extern int httpCachable(method_t); extern void httpStart(FwdState *); extern void httpParseReplyHeaders(const char *, http_reply *); @@ -283,6 +284,7 @@ extern void httpAnonInitModule(void); extern int httpAnonHdrAllowed(http_hdr_type hdr_id); extern int httpAnonHdrDenied(http_hdr_type hdr_id); extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, http_state_flags); +extern void httpBuildVersion(http_version_t *version,unsigned int major,unsigned int minor); /* ETag */ extern int etagParseInit(ETag * etag, const char *str); @@ -293,7 +295,7 @@ extern int etagIsEqual(const ETag * tag1, const ETag * tag2); extern void httpStatusLineInit(HttpStatusLine * sline); extern void httpStatusLineClean(HttpStatusLine * sline); /* set/get values */ -extern void httpStatusLineSet(HttpStatusLine * sline, double version, +extern void httpStatusLineSet(HttpStatusLine * sline, http_version_t version, http_status status, const char *reason); extern const char *httpStatusLineReason(const HttpStatusLine * sline); /* parse/pack */ @@ -432,7 +434,7 @@ extern void httpHeaderEntryPackInto(const HttpHeaderEntry * e, Packer * p); extern void httpHeaderStoreReport(StoreEntry * e); /* Http Msg (currently in HttpReply.c @?@ ) */ -extern int httpMsgIsPersistent(float http_ver, const HttpHeader * hdr); +extern int httpMsgIsPersistent(http_version_t http_ver, const HttpHeader * hdr); extern int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end); /* Http Reply */ @@ -453,10 +455,10 @@ extern MemBuf httpReplyPack(const HttpReply * rep); /* swap: create swap-based packer, pack, destroy packer */ extern void httpReplySwapOut(const HttpReply * rep, StoreEntry * e); /* set commonly used info with one call */ -extern void httpReplySetHeaders(HttpReply * rep, double ver, http_status status, +extern void httpReplySetHeaders(HttpReply * rep, http_version_t ver, http_status status, const char *reason, const char *ctype, int clen, time_t lmt, time_t expires); /* do everything in one call: init, set, pack, clean, return MemBuf */ -extern MemBuf httpPackedReply(double ver, http_status status, const char *ctype, +extern MemBuf httpPackedReply(http_version_t ver, http_status status, const char *ctype, int clen, time_t lmt, time_t expires); /* construct 304 reply and pack it into MemBuf, return MemBuf */ extern MemBuf httpPacked304Reply(const HttpReply * rep); diff --git a/src/structs.h b/src/structs.h index 2d972b5116..0254c55834 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.360 2000/11/10 09:04:51 adrian Exp $ + * $Id: structs.h,v 1.361 2000/11/13 12:25:13 adrian Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -93,6 +93,11 @@ struct _String { char *buf; }; +struct _http_version_t { + unsigned int major; + unsigned int minor; +}; + #if SQUID_SNMP struct _snmp_request_t { @@ -650,7 +655,10 @@ struct _Packer { /* http status line */ struct _HttpStatusLine { /* public, read only */ + http_version_t version; +#if 0 float version; +#endif const char *reason; /* points to a _constant_ string (default or supplied), never free()d */ http_status status; }; @@ -838,7 +846,7 @@ struct _AccessLogEntry { method_t method; int code; const char *content_type; - float version; + http_version_t version; } http; struct { icp_opcode opcode; @@ -880,7 +888,7 @@ struct _clientHttpRequest { const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */ #endif struct timeval start; - float http_ver; + http_version_t http_ver; int redirect_state; aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */ clientHttpRequest *next; @@ -1436,7 +1444,7 @@ struct _request_t { request_flags flags; HttpHdrCc *cache_control; HttpHdrRange *range; - float http_ver; + http_version_t http_ver; time_t ims; int imslen; int max_forwards; diff --git a/src/typedefs.h b/src/typedefs.h index b112697b7c..d6660bd028 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.110 2000/10/17 08:06:05 adrian Exp $ + * $Id: typedefs.h,v 1.111 2000/11/13 12:25:13 adrian Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -177,6 +177,8 @@ typedef struct _RemovalPurgeWalker RemovalPurgeWalker; typedef struct _RemovalPolicyNode RemovalPolicyNode; typedef struct _RemovalPolicySettings RemovalPolicySettings; +typedef struct _http_version_t http_version_t; + #if SQUID_SNMP typedef variable_list *(oid_ParseFn) (variable_list *, snint *); typedef struct _snmp_request_t snmp_request_t; diff --git a/src/urn.cc b/src/urn.cc index 3f4b2432ee..2be95d0cf9 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -1,6 +1,6 @@ /* - * $Id: urn.cc,v 1.60 2000/06/06 19:34:31 hno Exp $ + * $Id: urn.cc,v 1.61 2000/11/13 12:25:13 adrian Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -185,6 +185,7 @@ urnHandleReply(void *data, char *buf, ssize_t size) ErrorState *err; int i; int urlcnt = 0; + http_version_t version; debug(52, 3) ("urnHandleReply: Called with size=%d.\n", size); if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) { @@ -272,7 +273,8 @@ urnHandleReply(void *data, char *buf, ssize_t size) full_appname_string, getMyHostname()); rep = e->mem_obj->reply; httpReplyReset(rep); - httpReplySetHeaders(rep, 1.0, HTTP_MOVED_TEMPORARILY, NULL, + httpBuildVersion(&version,1,0); + httpReplySetHeaders(rep, version, HTTP_MOVED_TEMPORARILY, NULL, "text/html", mb.size, 0, squid_curtime); if (urnState->flags.force_menu) { debug(51, 3) ("urnHandleReply: forcing menu\n");