void httpStatusLineClean(HttpStatusLine * sline) { http_version_t version; httpBuildVersion(&version, 0, 0); httpStatusLineSet(sline, version, HTTP_INTERNAL_SERVER_ERROR, NULL); }
void httpStatusLineInit(HttpStatusLine * sline) { http_version_t version; httpBuildVersion(&version, 0, 0); httpStatusLineSet(sline, version, HTTP_STATUS_NONE, NULL); }
void httpReplySetHeaders(HttpReply * reply, http_version_t ver, http_status status, const char *reason, const char *ctype, squid_off_t clen, time_t lmt, time_t expires) { HttpHeader *hdr; assert(reply); httpStatusLineSet(&reply->sline, ver, status, reason); hdr = &reply->header; httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string); httpHeaderPutStr(hdr, HDR_MIME_VERSION, "1.0"); httpHeaderPutTime(hdr, HDR_DATE, squid_curtime); if (ctype) { httpHeaderPutStr(hdr, HDR_CONTENT_TYPE, ctype); stringInit(&reply->content_type, ctype); } else reply->content_type = StringNull; if (clen >= 0) httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, clen); if (expires >= 0) httpHeaderPutTime(hdr, HDR_EXPIRES, expires); if (lmt > 0) /* this used to be lmt != 0 @?@ */ httpHeaderPutTime(hdr, HDR_LAST_MODIFIED, lmt); reply->date = squid_curtime; reply->content_length = clen; reply->expires = expires; reply->last_modified = lmt; }
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; }
static int process_error_page(clientHttpRequest *http, HttpReply* rep) { debug(115, 4)("mod_customized_server_side_error_page process_error_page\n"); error_page_private_data* pd = (error_page_private_data*) cc_get_mod_private_data(REQUEST_PRIVATE_DATA,http,mod); char tmpPattern[200]; strncpy(tmpPattern,pd->OptionalHttpStatusPattern,strlen(pd->OptionalHttpStatusPattern)); if(pd->recusive_time==0) { pd->old_status = rep->sline.status; } if((pd->OfflineTimeToLive>0) && pd->recusive_time<2 && (isMatchedStatus(pd->old_status, tmpPattern) || rep->sline.status == HTTP_SPECIAL)) { debug(115, 4) ("mod_customized_server_side_error_page process_error_page in module customized_server_side_error_page entered: and rep status line is: %d,and recusive_time is: %d, the private-data's ResponseStatus is %d, OptionalHttpStatusPattern is: %s\n",rep->sline.status,pd->recusive_time,pd->ResponseStatus,pd->OptionalHttpStatusPattern); if(pd->recusive_time) { httpStatusLineSet(&rep->sline,rep->sline.version,pd->ResponseStatus,NULL); } pd->recusive_time++; } return 0; }
void httpStatusLineClean(HttpStatusLine * sline) { httpStatusLineSet(sline, 0.0, HTTP_INTERNAL_SERVER_ERROR, NULL); }
void httpStatusLineInit(HttpStatusLine * sline) { httpStatusLineSet(sline, 0.0, HTTP_STATUS_NONE, NULL); }