src/server/webdav/saxhandler.cpp

changeset 59
ab25c0a231d0
parent 50
4d39adda7a38
child 71
069c152f6272
equal deleted inserted replaced
58:66c22e54aa90 59:ab25c0a231d0
86 // Fixed or not? It works 86 // Fixed or not? It works
87 87
88 size_t nslen = strlen(ns); 88 size_t nslen = strlen(ns);
89 size_t namelen = strlen(name); 89 size_t namelen = strlen(name);
90 if(nslen > 0) { 90 if(nslen > 0) {
91 property->xmlns = (char*)pool_malloc(pool, nslen + 1); 91 //property->xmlns = (char*)pool_malloc(pool, nslen + 1);
92 property->xmlns[nslen] = 0; 92 //property->xmlns[nslen] = 0;
93 memcpy(property->xmlns, ns, nslen); 93 property->xmlns = xmlnsmap_put(davrq->nsmap, ns);
94 //memcpy(property->xmlns, ns, nslen);
94 } else { 95 } else {
95 property->xmlns = NULL; 96 property->xmlns = NULL;
96 } 97 }
97 98
98 if(namelen > 0) { 99 if(namelen > 0) {
116 { 117 {
117 char *ns = XMLString::transcode(uri); 118 char *ns = XMLString::transcode(uri);
118 char *name = XMLString::transcode(localname); 119 char *name = XMLString::transcode(localname);
119 120
120 if(property != NULL) { 121 if(property != NULL) {
121 const char *xmlns = (property->xmlns) ? property->xmlns : ""; 122 const char *xmlns = (property->xmlns) ? property->xmlns->xmlns : "";
122 123
123 if(!strcmp(ns, xmlns) && !strcmp(name, property->name)) { 124 if(!strcmp(ns, xmlns) && !strcmp(name, property->name)) {
124 // add property to DavRequest 125 // add property to DavRequest
125 UcxDlist *elm = (UcxDlist*)pool_malloc(pool, sizeof(UcxDlist)); 126 UcxDlist *elm = (UcxDlist*)pool_malloc(pool, sizeof(UcxDlist));
126 elm->prev = NULL; 127 elm->prev = NULL;
179 updateMode = 1; 180 updateMode = 1;
180 } else if(!strcmp(ns, "DAV:") && !strcmp(name, "prop")) { 181 } else if(!strcmp(ns, "DAV:") && !strcmp(name, "prop")) {
181 davPropTag = true; 182 davPropTag = true;
182 } else if(davPropTag) { 183 } else if(davPropTag) {
183 newElement = (XmlElement*)pool_calloc(pool, 1, sizeof(XmlElement)); 184 newElement = (XmlElement*)pool_calloc(pool, 1, sizeof(XmlElement));
184 newElement->name = sstr(pool_strdup(pool, name)); 185 newElement->name = pool_strdup(pool, name);
185 newElement->xmlns = xmlnsmap_put(davrq->nsmap, ns); 186 newElement->xmlns = xmlnsmap_put(davrq->nsmap, ns);
186 187
187 /* 188 /*
188 * the xml stack manages the xml hierarchy 189 * the xml stack manages the xml hierarchy
189 * new elements will be added to the top element on the stack 190 * new elements will be added to the top element on the stack
274 if(currentElm) { 275 if(currentElm) {
275 xmlch_t *str = (xmlch_t*)pool_calloc(pool, sizeof(xmlch_t), length + 1); 276 xmlch_t *str = (xmlch_t*)pool_calloc(pool, sizeof(xmlch_t), length + 1);
276 for(int i=0;i<length;i++) { 277 for(int i=0;i<length;i++) {
277 str[i] = chars[i]; 278 str[i] = chars[i];
278 } 279 }
280 str[length] = 0;
279 281
280 currentElm->content = str; 282 currentElm->content = str;
281 currentElm->ctlen = length; 283 currentElm->ctlen = length;
282 } 284 }
283 } 285 }

mercurial