src/server/webdav/davparser.cpp

changeset 48
37a512d7b8f6
parent 44
3da1f7b6847f
child 59
ab25c0a231d0
equal deleted inserted replaced
47:ce9790523346 48:37a512d7b8f6
52 if(!xcinit) { 52 if(!xcinit) {
53 /* TODO: create webdav module init function */ 53 /* TODO: create webdav module init function */
54 XMLPlatformUtils::Initialize(); 54 XMLPlatformUtils::Initialize();
55 xcinit = 1; 55 xcinit = 1;
56 } 56 }
57 PropfindRequest *davrq = (PropfindRequest*)pool_malloc( 57 PropfindRequest *davrq = (PropfindRequest*)pool_calloc(
58 sn->pool, 58 sn->pool,
59 1,
59 sizeof(PropfindRequest)); 60 sizeof(PropfindRequest));
60 davrq->allprop = 0; 61 davrq->allprop = 0;
61 davrq->propname = 0; 62 davrq->propname = 0;
62 davrq->prop = 0; 63 davrq->prop = 0;
63 davrq->properties = NULL; 64 davrq->properties = NULL;
65 davrq->forbiddenProps = NULL;
66 davrq->notFoundProps = NULL;
64 // create xml parser 67 // create xml parser
65 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader(); 68 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
66 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); 69 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
67 70
68 PropfindHandler handler(davrq, sn->pool); 71 PropfindHandler handler(davrq, sn->pool);
83 } 86 }
84 catch (...) { 87 catch (...) {
85 printf("davaparser Exception\n"); 88 printf("davaparser Exception\n");
86 } 89 }
87 90
88 91 delete parser;
89 92
90 93
91 return davrq; 94 return davrq;
95 }
96
97 void dav_free_propfind(PropfindRequest *rq) {
98 ucx_dlist_free(rq->forbiddenProps);
99 ucx_dlist_free(rq->notFoundProps);
100 //ucx_dlist_free(rq->properties); // uses pool
101 sbuf_free(rq->out);
92 } 102 }
93 103
94 ProppatchRequest* dav_parse_proppatch( 104 ProppatchRequest* dav_parse_proppatch(
95 Session *sn, 105 Session *sn,
96 Request *rq, 106 Request *rq,
100 if(!xcinit) { 110 if(!xcinit) {
101 /* TODO: create webdav module init function */ 111 /* TODO: create webdav module init function */
102 XMLPlatformUtils::Initialize(); 112 XMLPlatformUtils::Initialize();
103 xcinit = 1; 113 xcinit = 1;
104 } 114 }
105 ProppatchRequest *davrq = (ProppatchRequest*)pool_malloc( 115 ProppatchRequest *davrq = (ProppatchRequest*)pool_calloc(
106 sn->pool, 116 sn->pool,
117 1,
107 sizeof(PropfindRequest)); 118 sizeof(PropfindRequest));
108 davrq->nsmap = xmlnsmap_create(); 119 davrq->nsmap = xmlnsmap_create(sn->pool);
109 120
110 121
111 122
112 // create xml parser 123 // create xml parser
113 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader(); 124 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
131 } 142 }
132 catch (...) { 143 catch (...) {
133 printf("davaparser Exception\n"); 144 printf("davaparser Exception\n");
134 } 145 }
135 146
136 147 delete parser;
137 148
138 149
139 return davrq; 150 return davrq;
140 } 151 }
152
153 void dav_free_proppatch(ProppatchRequest *rq) {
154 ucx_dlist_free(rq->removeProps);
155 ucx_dlist_free(rq->setProps);
156 xmlnsmap_free(rq->nsmap);
157 ucx_map_free(rq->propstat->map);
158 ucx_dlist_free(rq->propstat->okprop);
159 }

mercurial