Skip to content

Commit

Permalink
Changed location to meta refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroennijhof committed May 24, 2014
1 parent a1c46e9 commit bf8edd5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions websense.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void websns_accept(int fd, struct websns_req *websns_request) {
void websns_deny(int fd, struct websns_req *websns_request, char *redirect_url) {
struct websns_resp websns_resp_deny;
int urlsize = 0;
int i = 0;

websns_resp_deny.size = htons(WEBSNS_HDR);
websns_resp_deny.vers_maj = websns_request->vers_maj;
Expand All @@ -56,15 +55,13 @@ void websns_deny(int fd, struct websns_req *websns_request, char *redirect_url)
websns_resp_deny.desc = htons(1);
websns_resp_deny.cat = htons(0);
websns_resp_deny.urlsize = htons(0);
snprintf(websns_resp_deny.url, 11, "Location: ");

if (redirect_url != NULL) {
urlsize = strlen(redirect_url) + 10 + 1;
snprintf(websns_resp_deny.url, URL_SIZE, "<HTML><HEAD><META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=%s\"></HEAD></HTML>", redirect_url);
urlsize = strlen(websns_resp_deny.url) + 1;
if (urlsize < (URL_SIZE - WEBSNS_HDR)) {
websns_resp_deny.size = htons(WEBSNS_HDR + urlsize);
websns_resp_deny.urlsize = htons(urlsize);
for(i = 0; i < urlsize; i++)
websns_resp_deny.url[10 + i] = redirect_url[i];
}
}

Expand Down

0 comments on commit bf8edd5

Please sign in to comment.