Пример #1
0
/** @brief Sends a redirect to the web browser 
 * @param r The request 
 * @param url The url to redirect to
 * @param text The text to include in the redirect header and the manual redirect link title.  NULL is acceptable */
void http_send_redirect(request *r, char *url, char *text)
{
		char *message = NULL;
		char *header = NULL;
		char *response = NULL;
							/* Re-direct them to auth server */
		debug(LOG_DEBUG, "Redirecting client browser to %s", url);
		safe_asprintf(&header, "Location: %s",
			url
		);
		if(text) {
			safe_asprintf(&response, "307 %s\n",
				text
			);	
		}
		else {
			safe_asprintf(&response, "307 %s\n",
				"Redirecting"
			);		
		}	
		httpdSetResponse(r, response);
		httpdAddHeader(r, header);
		free(response);
		free(header);	
		safe_asprintf(&message, "Please <a href='%s'>click here</a>.", url);
		send_http_page(r, text ? text : "Redirection to message", message);
		free(message);
}
Пример #2
0
void
http_nodogsplash_redirect(request *r, const char url[])
{
	char *header;

	httpdSetResponse(r, "302 Found");
	safe_asprintf(&header, "Location: %s",url);
	httpdAddHeader(r, header);

	httpdPrintf(r, "<html><head></head><body><a href='%s'>Click here to continue to<br>%s</a></body></html>",url,url);

	free(header);
}
Пример #3
0
void
http_nodogsplash_redirect(request *r, const char url[]) 
{
	char *header;
	debug(LOG_DEBUG,"Redirect client %s to %s",r->clientAddr,url);
	httpdSetResponse(r, "302 Found\n");
	safe_asprintf(&header, "Location: http://%s",url);
	httpdAddHeader(r, header);

	httpdPrintf(r, "<html><head></head><body><a href='%s'>Click here to continue to<br>%s</a></body></html>",url,url);

	free(header);
}