It is with pleasure that I announce the return of rawman support through the HTTP...
[asterisk/asterisk.git] / main / manager.c
index a96818e..decc65e 100644 (file)
@@ -2809,16 +2809,17 @@ static struct ast_str *generic_http_callback(enum output_format format,
        if (s->f != NULL) {     /* have temporary output */
                char *buf;
                size_t l = ftell(s->f);
-
-               if (format == FORMAT_XML || format == FORMAT_HTML) {
-                       if (l) {
-                               if ((buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, 0))) {
+               
+               if (l) {
+                       if ((buf = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, 0))) {
+                               if (format == FORMAT_XML || format == FORMAT_HTML)
                                        xml_translate(&out, buf, params, format);
-                                       munmap(buf, l);
-                               }
-                       } else {
-                               xml_translate(&out, "", params, format);
+                               else
+                                       ast_str_append(&out, 0, buf);
+                               munmap(buf, l);
                        }
+               } else if (format == FORMAT_XML || format == FORMAT_HTML) {
+                       xml_translate(&out, "", params, format);
                }
                fclose(s->f);
                s->f = NULL;