int dav_mkdir(HTTP_CONNECTION *connection, const char *dir) { if(http_exec(connection, HTTP_MKCOL, dir, dav_mkdir_on_request_header, NULL, NULL, NULL, NULL) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 200 || http_exec_error(connection) == 201); };
int dav_unlock(HTTP_CONNECTION *connection, const char *resource) { if(http_exec(connection, HTTP_UNLOCK, resource, dav_unlock_on_request_header, NULL, NULL, NULL, NULL) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 204); }
int dav_lock(HTTP_CONNECTION *connection, const char *resource, const char *owner) { if(http_exec(connection, HTTP_LOCK, resource, dav_lock_on_request_header, dav_lock_on_request_entity, dav_lock_on_response_header, dav_lock_on_response_entity, (void *) owner) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 200); }
int dav_copy_to_server(HTTP_CONNECTION *connection, const char *src, const char *dest) { DAV_COPY_TO_SERVER_INSTANCE instance; memset(&instance, 0, sizeof(DAV_COPY_TO_SERVER_INSTANCE)); instance.src_filepath = src; if(http_exec(connection, HTTP_PUT, dest, dav_copy_to_server_on_request_header, dav_copy_to_server_on_request_entity, NULL, NULL, (void *) &instance) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 200 || http_exec_error(connection) == 201); }
int dav_copy_from_server(HTTP_CONNECTION *connection, const char *src, const char *dest) { DAV_COPY_FROM_SERVER_INSTANCE instance; memset(&instance, 0, sizeof(DAV_COPY_FROM_SERVER_INSTANCE)); instance.dest_filepath = dest; if(http_exec(connection, HTTP_GET, src, NULL, NULL, dav_copy_from_server_on_response_header, NULL, (void *) &instance) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 200); }
int dav_delete(HTTP_CONNECTION *connection, const char *resource) { if(http_exec(connection, HTTP_DELETE, resource, dav_delete_on_request_header, NULL, NULL, NULL, NULL) != HT_OK) { return HT_FALSE; } if(http_exec_error(connection) == 204) { dav_remove_lockentry_from_database(http_hoststring(connection), resource); } return (http_exec_error(connection) == 204); }
int conn_exec( conn_t *conn ) { if( conn->proto == PROTO_FTP && !conn->proxy ) { if( !ftp_command( conn->ftp, "RETR %s", conn->file ) ) return( 0 ); return( ftp_wait( conn->ftp ) / 100 == 1 ); } else { if( !http_exec( conn->http ) ) return( 0 ); return( conn->http->status / 100 == 2 ); } }
unsigned http_event(enum event_e event, unsigned evdata_tcp_soc_n) { switch(event) { case E_EXEC: http_exec(); break; case E_INIT: http_init(); break; case E_PARSE_TCP: http_parsing(evdata_tcp_soc_n); break; } return 0; }
int dav_opendir_ex_helper(HTTP_CONNECTION *connection, const char *directory, unsigned int directory_length, const char *additional_prop, DAV_OPENDIR_DATA *oddata) { DAV_PROPFIND *propfind = NULL; if(oddata == NULL || directory == NULL) { return HT_FALSE; } memset(oddata, 0, sizeof(DAV_OPENDIR_DATA)); oddata->directory_length = directory_length; oddata->additional_prop = additional_prop; if(http_exec(connection, HTTP_PROPFIND, directory, dav_opendir_on_request_header, dav_opendir_on_request_entity, dav_opendir_on_response_header, dav_opendir_on_response_entity, (void *) oddata) != HT_OK) { return HT_FALSE; } return (http_exec_error(connection) == 207); }