Example #1
0
void service::add_http_head(int status, char *s_status, char *filetype)
{
	add_status_line(status, s_status);
	add_date();
	add_content_length(m_file_stat.st_size);
	add_blank_line();

}
Example #2
0
utility_retcode_t build_request_string(struct rtsp_request *request)
{
	utility_retcode_t ret;

	FUNC_ENTER;

	if (NULL == request->buf) {
		request->buf = syscalls_malloc(RTSP_MAX_REQUEST_LEN);
		request->buflen = RTSP_MAX_REQUEST_LEN;

		if (NULL == request->buf) {
			ERRR("Failed to allocate %d bytes for request\n",
			     RTSP_MAX_REQUEST_LEN);
			ret = UTILITY_FAILURE;
			goto out;
		}

	} else {
		syscalls_memset(request->buf, 0, request->buflen);
	}

	request->bufp = request->buf;
	request->bytes_remaining = request->buflen;

	build_request_line(request);
	build_headers(request);
	add_blank_line(request);

	if (NULL != request->msg_body) {
		syscalls_strncpy(request->bufp,
				 request->msg_body,
				 request->bytes_remaining);
	}

	request->request_length = syscalls_strlen(request->buf);

	ret = UTILITY_SUCCESS;
out:
	FUNC_RETURN;
	return ret;
}