<commit_before>#include "davix_stat.hpp"

#include <ostream>
#include <sstream>
#include <string>
#include <cstring>
#include <status/davixstatusrequest.hpp>
#include <fileops/fileutils.hpp>

#include <contextinternal.h>

namespace Davix{

void fill_stat_from_fileproperties(struct stat* st, const  FileProperties & prop){
    memset(st, 0, sizeof(struct stat));
    st->st_mtime = prop.mtime;
    st->st_atime = prop.atime;
    st->st_ctime = prop.ctime;
    st->st_size = prop.size;
    st->st_mode = prop.mode;
}


int DavPosix::stat(const RequestParams * _params, const std::string & url, struct stat* st, DavixError** err){
    davix_log_debug(" -> davix_stat");
    RequestParams params(_params);
    DavixError* tmp_err=NULL;

    int ret =-1;
    DavPropXMLParser parser;
    std::auto_ptr<HttpRequest> req( static_cast<HttpRequest*>(context->_intern->getSessionFactory()->create_request(url, &tmp_err)));
    if( req.get() != NULL){
        req->set_parameters(params);

        const std::vector<char> & res = req_webdav_propfind(req.get(), &tmp_err);
        if(!tmp_err){
            if( (ret = parser.parseChuck((const char*) & res.at(0), res.size()) ) < 0){
                DavixError::propagateError(err, parser.getLastErr());
                return -1;
            }

            std::deque<FileProperties> & props = parser.getProperties();
            if( props.size() < 1){<commit_msg> minor bugfix for stat req<commit_after>#include "davix_stat.hpp"

#include <ostream>
#include <sstream>
#include <string>
#include <cstring>
#include <status/davixstatusrequest.hpp>
#include <fileops/fileutils.hpp>

#include <contextinternal.h>

namespace Davix{

void fill_stat_from_fileproperties(struct stat* st, const  FileProperties & prop){
    memset(st, 0, sizeof(struct stat));
    st->st_mtime = prop.mtime;
    st->st_atime = prop.atime;
    st->st_ctime = prop.ctime;
    st->st_size = prop.size;
    st->st_mode = prop.mode;
}


int DavPosix::stat(const RequestParams * _params, const std::string & url, struct stat* st, DavixError** err){
    davix_log_debug(" -> davix_stat");
    RequestParams params(_params);
    DavixError* tmp_err=NULL;

    int ret =-1;
    DavPropXMLParser parser;
    std::auto_ptr<HttpRequest> req( static_cast<HttpRequest*>(context->_intern->getSessionFactory()->create_request(url, &tmp_err)));
    if( req.get() != NULL){
        req->set_parameters(params);

        const std::vector<char> & res = req_webdav_propfind(req.get(), &tmp_err);
        if(!tmp_err){
            if( (ret = parser.parseChuck((const char*) & res.at(0), res.size() -1) ) < 0){
                DavixError::propagateError(err, parser.getLastErr());
                return -1;
            }

            std::deque<FileProperties> & props = parser.getProperties();
            if( props.size() < 1){
{'fraction_non_alphanumeric': 0.14918497519489723, 'fraction_numerical': 0.004606661941885188, 'mean_word_length': 3.495222929936306, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4005342', 'n_tokens_mistral': 957, 'n_tokens_neox': 930, 'n_words': 191}