Created
August 7, 2011 06:32
-
-
Save jnorthrup/1130131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_VPLUGIN_ char * | |
virtm_http_handler (void *cli, char *err, int max_len, | |
const char *base_uri, const char *content, | |
const char *params, const char **lines, int n_lines, | |
char **head_ret, const char **options, int n_options, char **diag_ret, | |
int compile_only) | |
{ | |
zend_file_handle file_handle; | |
char *ret_str; | |
box_t *hret; | |
vreq_t req; | |
TSRMLS_FETCH (); | |
/* cannot execute DAV content with this implementation of the PHP plugin */ | |
if (content) | |
sqlr_new_error ("22023", "PHP01", | |
"The PHP hosting module does not support execution of WebDAV content."); | |
memset (&req, 0, sizeof (req)); | |
req.base_uri = base_uri; | |
req.content = content; | |
req.params = params; | |
req.lines = lines; | |
req.n_lines = n_lines; | |
req.head_ret = head_ret; | |
req.options = options; | |
req.n_options = n_options; | |
req.diag_ret = diag_ret; | |
req.compile_only = compile_only; | |
req.ret_session = strses_allocate (); | |
req.s_hdr_session = strses_allocate (); | |
req.r_hdr_session = strses_allocate (); | |
req.post_length = box_length (params) - 1; | |
SG (server_context) = &req; | |
init_request_info (TSRMLS_C); | |
memset (&file_handle, 0, sizeof (file_handle)); | |
file_handle.type = ZEND_HANDLE_FILENAME; | |
file_handle.filename = SG (request_info).path_translated; | |
file_handle.free_filename = 0; | |
if (php_request_startup (TSRMLS_C) != FAILURE) | |
{ | |
php_execute_script (&file_handle TSRMLS_CC); | |
php_request_shutdown (NULL); | |
} | |
hret = (box_t *) dk_alloc_box (2 * sizeof (caddr_t), DV_ARRAY_OF_POINTER); | |
hret[0] = (box_t) strses_string (req.s_hdr_session); | |
hret[1] = (box_t) strses_string (req.r_hdr_session); | |
*head_ret = (char *) hret; | |
ret_str = req.ret_session; | |
strses_free (req.s_hdr_session); | |
strses_free (req.r_hdr_session); | |
return ret_str; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment