/* parse a 0-terminating buffer and fill internal structures; returns true on success */ void 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, sline->reason ? sline->reason : httpStatusString(sline->status)); packerPrintf(p, HttpStatusLineFormat, sline->version, sline->status, httpStatusLineReason(sline)); }
void httpRedirectReply(HttpReply * reply, http_status status, const char *loc) { HttpHeader *hdr; http_version_t ver; assert(reply); 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); httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, 0); httpHeaderPutStr(hdr, HDR_LOCATION, loc); reply->date = squid_curtime; reply->content_length = 0; }
const char * httpStatusLineReason(const HttpStatusLine * sline) { assert(sline); return sline->reason ? sline->reason : httpStatusString(sline->status); }