Bug #1732 ยป replace_buffer_append_string_with_macros.patch
src/mod_proxy_core_protocol.c (copia locale) | ||
---|---|---|
/* append protocol name to list of names. */
|
||
if(!buffer_is_empty(protocol_names)) {
|
||
buffer_append_string(protocol_names, ", '");
|
||
BUFFER_APPEND_STRING_CONST(protocol_names, ", '");
|
||
} else {
|
||
buffer_append_string(protocol_names, "'");
|
||
BUFFER_APPEND_STRING_CONST(protocol_names, "'");
|
||
}
|
||
buffer_append_string(protocol_names, BUF_STR(protocol->name));
|
||
buffer_append_string(protocol_names, "'");
|
||
BUFFER_APPEND_STRING_CONST(protocol_names, "'");
|
||
}
|
||
proxy_protocol *proxy_get_protocol(buffer *name) {
|
src/connections.c (copia locale) | ||
---|---|---|
" <head>\n"
|
||
" <title>");
|
||
buffer_append_long(b, con->http_status);
|
||
buffer_append_string(b, " - ");
|
||
BUFFER_APPEND_STRING_CONST(b, " - ");
|
||
buffer_append_string(b, get_http_status_name(con->http_status));
|
||
buffer_append_string(b,
|
||
... | ... | |
" <body>\n"
|
||
" <h1>");
|
||
buffer_append_long(b, con->http_status);
|
||
buffer_append_string(b, " - ");
|
||
BUFFER_APPEND_STRING_CONST(b, " - ");
|
||
buffer_append_string(b, get_http_status_name(con->http_status));
|
||
buffer_append_string(b,"</h1>\n"
|
src/mod_staticfile.c (copia locale) | ||
---|---|---|
b = chunkqueue_get_append_buffer(con->send);
|
||
buffer_copy_string(b, "\r\n--");
|
||
BUFFER_COPY_STRING_CONST(b, "\r\n--");
|
||
buffer_append_string(b, boundary);
|
||
/* write Content-Range */
|
||
buffer_append_string(b, "\r\nContent-Range: bytes ");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\nContent-Range: bytes ");
|
||
buffer_append_off_t(b, r->start);
|
||
buffer_append_string(b, "-");
|
||
BUFFER_APPEND_STRING_CONST(b, "-");
|
||
buffer_append_off_t(b, r->end);
|
||
buffer_append_string(b, "/");
|
||
BUFFER_APPEND_STRING_CONST(b, "/");
|
||
buffer_append_off_t(b, sce->st.st_size);
|
||
buffer_append_string(b, "\r\nContent-Type: ");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\nContent-Type: ");
|
||
buffer_append_string_buffer(b, content_type);
|
||
/* write END-OF-HEADER */
|
||
buffer_append_string(b, "\r\n\r\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\n\r\n");
|
||
con->response.content_length += b->used - 1;
|
||
con->send->bytes_in += b->used - 1;
|
src/network.c (copia locale) | ||
---|---|---|
b = buffer_init();
|
||
buffer_copy_string_buffer(b, srv->srvconf.bindhost);
|
||
buffer_append_string(b, ":");
|
||
BUFFER_APPEND_STRING_CONST(b, ":");
|
||
buffer_append_long(b, srv->srvconf.port);
|
||
if (0 != network_server_init(srv, b, srv->config_storage[0])) {
|
src/configfile.c (copia locale) | ||
---|---|---|
if (t->input[t->offset + 1] == '>') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "=>");
|
||
BUFFER_COPY_STRING_CONST(token, "=>");
|
||
tid = TK_ARRAY_ASSIGN;
|
||
} else {
|
||
... | ... | |
if (t->input[t->offset + 1] == '=') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "==");
|
||
BUFFER_COPY_STRING_CONST(token, "==");
|
||
tid = TK_EQ;
|
||
} else if (t->input[t->offset + 1] == '~') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "=~");
|
||
BUFFER_COPY_STRING_CONST(token, "=~");
|
||
tid = TK_MATCH;
|
||
} else {
|
||
... | ... | |
if (t->input[t->offset + 1] == '=') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "!=");
|
||
BUFFER_COPY_STRING_CONST(token, "!=");
|
||
tid = TK_NE;
|
||
} else if (t->input[t->offset + 1] == '~') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "!~");
|
||
BUFFER_COPY_STRING_CONST(token, "!~");
|
||
tid = TK_NOMATCH;
|
||
} else {
|
||
... | ... | |
}
|
||
t->in_key = 1;
|
||
tid = TK_EOL;
|
||
buffer_copy_string(token, "(EOL)");
|
||
BUFFER_COPY_STRING_CONST(token, "(EOL)");
|
||
} else {
|
||
config_skip_newline(t);
|
||
t->line_pos = 1;
|
||
... | ... | |
if (t->in_brace > 0) {
|
||
tid = TK_COMMA;
|
||
buffer_copy_string(token, "(COMMA)");
|
||
BUFFER_COPY_STRING_CONST(token, "(COMMA)");
|
||
}
|
||
t->offset++;
|
||
... | ... | |
case '"':
|
||
/* search for the terminating " */
|
||
start = t->input + t->offset + 1;
|
||
buffer_copy_string(token, "");
|
||
BUFFER_COPY_STRING_CONST(token, "");
|
||
for (i = 1; t->input[t->offset + i]; i++) {
|
||
if (t->input[t->offset + i] == '\\' &&
|
||
... | ... | |
tid = TK_LPARAN;
|
||
buffer_copy_string(token, "(");
|
||
BUFFER_COPY_STRING_CONST(token, "(");
|
||
break;
|
||
case ')':
|
||
t->offset++;
|
||
... | ... | |
tid = TK_RPARAN;
|
||
buffer_copy_string(token, ")");
|
||
BUFFER_COPY_STRING_CONST(token, ")");
|
||
break;
|
||
case '$':
|
||
t->offset++;
|
||
... | ... | |
t->in_cond = 1;
|
||
t->in_key = 0;
|
||
buffer_copy_string(token, "$");
|
||
BUFFER_COPY_STRING_CONST(token, "$");
|
||
break;
|
||
case '+':
|
||
if (t->input[t->offset + 1] == '=') {
|
||
t->offset += 2;
|
||
buffer_copy_string(token, "+=");
|
||
BUFFER_COPY_STRING_CONST(token, "+=");
|
||
tid = TK_APPEND;
|
||
} else {
|
||
t->offset++;
|
||
tid = TK_PLUS;
|
||
buffer_copy_string(token, "+");
|
||
BUFFER_COPY_STRING_CONST(token, "+");
|
||
}
|
||
break;
|
||
... | ... | |
tid = TK_LCURLY;
|
||
buffer_copy_string(token, "{");
|
||
BUFFER_COPY_STRING_CONST(token, "{");
|
||
break;
|
||
... | ... | |
tid = TK_RCURLY;
|
||
buffer_copy_string(token, "}");
|
||
BUFFER_COPY_STRING_CONST(token, "}");
|
||
break;
|
||
... | ... | |
tid = TK_LBRACKET;
|
||
buffer_copy_string(token, "[");
|
||
BUFFER_COPY_STRING_CONST(token, "[");
|
||
break;
|
||
... | ... | |
tid = TK_RBRACKET;
|
||
buffer_copy_string(token, "]");
|
||
BUFFER_COPY_STRING_CONST(token, "]");
|
||
break;
|
||
case '#':
|
src/mod_scgi.c (copia locale) | ||
---|---|---|
env.ptr[env.used] = NULL;
|
||
b = buffer_init();
|
||
buffer_copy_string(b, "exec ");
|
||
BUFFER_COPY_STRING_CONST(b, "exec ");
|
||
buffer_append_string_buffer(b, host->bin_path);
|
||
/* exec the cgi */
|
src/mod_ssi_expr.c (copia locale) | ||
---|---|---|
t->offset++;
|
||
t->line_pos++;
|
||
buffer_copy_string(token, "(=)");
|
||
BUFFER_COPY_STRING_CONST(token, "(=)");
|
||
break;
|
||
case '>':
|
||
... | ... | |
tid = TK_GE;
|
||
buffer_copy_string(token, "(>=)");
|
||
BUFFER_COPY_STRING_CONST(token, "(>=)");
|
||
} else {
|
||
t->offset += 1;
|
||
t->line_pos += 1;
|
||
tid = TK_GT;
|
||
buffer_copy_string(token, "(>)");
|
||
BUFFER_COPY_STRING_CONST(token, "(>)");
|
||
}
|
||
break;
|
||
... | ... | |
tid = TK_LE;
|
||
buffer_copy_string(token, "(<=)");
|
||
BUFFER_COPY_STRING_CONST(token, "(<=)");
|
||
} else {
|
||
t->offset += 1;
|
||
t->line_pos += 1;
|
||
tid = TK_LT;
|
||
buffer_copy_string(token, "(<)");
|
||
BUFFER_COPY_STRING_CONST(token, "(<)");
|
||
}
|
||
break;
|
||
... | ... | |
tid = TK_NE;
|
||
buffer_copy_string(token, "(!=)");
|
||
BUFFER_COPY_STRING_CONST(token, "(!=)");
|
||
} else {
|
||
t->offset += 1;
|
||
t->line_pos += 1;
|
||
tid = TK_NOT;
|
||
buffer_copy_string(token, "(!)");
|
||
BUFFER_COPY_STRING_CONST(token, "(!)");
|
||
}
|
||
break;
|
||
... | ... | |
tid = TK_AND;
|
||
buffer_copy_string(token, "(&&)");
|
||
BUFFER_COPY_STRING_CONST(token, "(&&)");
|
||
} else {
|
||
log_error_write(srv, __FILE__, __LINE__, "sds",
|
||
"pos:", t->line_pos,
|
||
... | ... | |
tid = TK_OR;
|
||
buffer_copy_string(token, "(||)");
|
||
BUFFER_COPY_STRING_CONST(token, "(||)");
|
||
} else {
|
||
log_error_write(srv, __FILE__, __LINE__, "sds",
|
||
"pos:", t->line_pos,
|
||
... | ... | |
tid = TK_LPARAN;
|
||
buffer_copy_string(token, "(");
|
||
BUFFER_COPY_STRING_CONST(token, "(");
|
||
break;
|
||
case ')':
|
||
t->offset++;
|
||
... | ... | |
tid = TK_RPARAN;
|
||
buffer_copy_string(token, ")");
|
||
BUFFER_COPY_STRING_CONST(token, ")");
|
||
break;
|
||
case '$':
|
||
if (t->input[t->offset + 1] == '{') {
|
||
... | ... | |
} else if (NULL != (ds = (data_string *)array_get_element(p->ssi_vars, CONST_BUF_LEN(token)))) {
|
||
buffer_copy_string_buffer(token, ds->value);
|
||
} else {
|
||
buffer_copy_string(token, "");
|
||
BUFFER_COPY_STRING_CONST(token, "");
|
||
}
|
||
t->offset += i;
|
src/mod_webdav.c (copia locale) | ||
---|---|---|
UNUSED(con);
|
||
if (value) {
|
||
buffer_append_string(b,"<");
|
||
BUFFER_APPEND_STRING_CONST(b,"<");
|
||
buffer_append_string(b, prop_name);
|
||
buffer_append_string(b, " xmlns=\"");
|
||
BUFFER_APPEND_STRING_CONST(b, " xmlns=\"");
|
||
buffer_append_string(b, prop_ns);
|
||
buffer_append_string(b, "\">");
|
||
BUFFER_APPEND_STRING_CONST(b, "\">");
|
||
buffer_append_string(b, value);
|
||
buffer_append_string(b,"</");
|
||
BUFFER_APPEND_STRING_CONST(b,"</");
|
||
buffer_append_string(b, prop_name);
|
||
buffer_append_string(b, ">");
|
||
BUFFER_APPEND_STRING_CONST(b, ">");
|
||
} else {
|
||
buffer_append_string(b,"<");
|
||
BUFFER_APPEND_STRING_CONST(b,"<");
|
||
buffer_append_string(b, prop_name);
|
||
buffer_append_string(b, " xmlns=\"");
|
||
BUFFER_APPEND_STRING_CONST(b, " xmlns=\"");
|
||
buffer_append_string(b, prop_ns);
|
||
buffer_append_string(b, "\"/>");
|
||
BUFFER_APPEND_STRING_CONST(b, "\"/>");
|
||
}
|
||
return 0;
|
||
... | ... | |
static int webdav_gen_response_status_tag(server *srv, connection *con, physical *dst, int status, buffer *b) {
|
||
UNUSED(srv);
|
||
buffer_append_string(b,"<D:response xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:response xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
buffer_append_string(b,"<D:href>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:href>\n");
|
||
buffer_append_string_buffer(b, dst->rel_path);
|
||
buffer_append_string(b,"</D:href>\n");
|
||
buffer_append_string(b,"<D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:href>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:status>\n");
|
||
if (con->request.http_version == HTTP_VERSION_1_1) {
|
||
BUFFER_COPY_STRING_CONST(b, "HTTP/1.1 ");
|
||
... | ... | |
BUFFER_APPEND_STRING_CONST(b, " ");
|
||
buffer_append_string(b, get_http_status_name(status));
|
||
buffer_append_string(b,"</D:status>\n");
|
||
buffer_append_string(b,"</D:response>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:response>\n");
|
||
return 0;
|
||
}
|
||
... | ... | |
if (0 == strcmp(prop_name, "resourcetype")) {
|
||
if (S_ISDIR(sce->st.st_mode)) {
|
||
buffer_append_string(b, "<D:resourcetype><D:collection/></D:resourcetype>");
|
||
BUFFER_APPEND_STRING_CONST(b, "<D:resourcetype><D:collection/></D:resourcetype>");
|
||
found = 1;
|
||
}
|
||
} else if (0 == strcmp(prop_name, "getcontenttype")) {
|
||
if (S_ISDIR(sce->st.st_mode)) {
|
||
buffer_append_string(b, "<D:getcontenttype>httpd/unix-directory</D:getcontenttype>");
|
||
BUFFER_APPEND_STRING_CONST(b, "<D:getcontenttype>httpd/unix-directory</D:getcontenttype>");
|
||
found = 1;
|
||
} else if(S_ISREG(sce->st.st_mode)) {
|
||
for (k = 0; k < con->conf.mimetypes->used; k++) {
|
||
... | ... | |
if (ds->key->used == 0) continue;
|
||
if (buffer_is_equal_right_len(dst->path, ds->key, ds->key->used - 1)) {
|
||
buffer_append_string(b,"<D:getcontenttype>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:getcontenttype>");
|
||
buffer_append_string_buffer(b, ds->value);
|
||
buffer_append_string(b, "</D:getcontenttype>");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:getcontenttype>");
|
||
found = 1;
|
||
break;
|
||
... | ... | |
}
|
||
}
|
||
} else if (0 == strcmp(prop_name, "creationdate")) {
|
||
buffer_append_string(b, "<D:creationdate ns0:dt=\"dateTime.tz\">");
|
||
BUFFER_APPEND_STRING_CONST(b, "<D:creationdate ns0:dt=\"dateTime.tz\">");
|
||
strftime(ctime_buf, sizeof(ctime_buf), "%Y-%m-%dT%H:%M:%SZ", gmtime(&(sce->st.st_ctime)));
|
||
buffer_append_string(b, ctime_buf);
|
||
buffer_append_string(b, "</D:creationdate>");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:creationdate>");
|
||
found = 1;
|
||
} else if (0 == strcmp(prop_name, "getlastmodified")) {
|
||
buffer_append_string(b,"<D:getlastmodified ns0:dt=\"dateTime.rfc1123\">");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:getlastmodified ns0:dt=\"dateTime.rfc1123\">");
|
||
strftime(mtime_buf, sizeof(mtime_buf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&(sce->st.st_mtime)));
|
||
buffer_append_string(b, mtime_buf);
|
||
buffer_append_string(b, "</D:getlastmodified>");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:getlastmodified>");
|
||
found = 1;
|
||
} else if (0 == strcmp(prop_name, "getcontentlength")) {
|
||
buffer_append_string(b,"<D:getcontentlength>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:getcontentlength>");
|
||
buffer_append_off_t(b, sce->st.st_size);
|
||
buffer_append_string(b, "</D:getcontentlength>");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:getcontentlength>");
|
||
found = 1;
|
||
} else if (0 == strcmp(prop_name, "getcontentlanguage")) {
|
||
buffer_append_string(b,"<D:getcontentlanguage>");
|
||
buffer_append_string(b, "en");
|
||
buffer_append_string(b, "</D:getcontentlanguage>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:getcontentlanguage>");
|
||
BUFFER_APPEND_STRING_CONST(b, "en");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:getcontentlanguage>");
|
||
found = 1;
|
||
}
|
||
}
|
||
... | ... | |
b = chunkqueue_get_append_buffer(con->send);
|
||
buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
BUFFER_COPY_STRING_CONST(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
buffer_append_string(b,"<D:prop xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
buffer_append_string(b,"<D:lockdiscovery>\n");
|
||
buffer_append_string(b,"<D:activelock>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:prop xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:lockdiscovery>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:activelock>\n");
|
||
buffer_append_string(b,"<D:lockscope>");
|
||
buffer_append_string(b,"<D:");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:lockscope>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:");
|
||
buffer_append_string(b, lockscope);
|
||
buffer_append_string(b, "/>");
|
||
buffer_append_string(b,"</D:lockscope>\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "/>");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:lockscope>\n");
|
||
buffer_append_string(b,"<D:locktype>");
|
||
buffer_append_string(b,"<D:");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:locktype>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:");
|
||
buffer_append_string(b, locktype);
|
||
buffer_append_string(b, "/>");
|
||
buffer_append_string(b,"</D:locktype>\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "/>");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:locktype>\n");
|
||
buffer_append_string(b,"<D:depth>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:depth>");
|
||
buffer_append_string(b, depth == 0 ? "0" : "infinity");
|
||
buffer_append_string(b,"</D:depth>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:depth>\n");
|
||
buffer_append_string(b,"<D:timeout>");
|
||
buffer_append_string(b, "Second-600");
|
||
buffer_append_string(b,"</D:timeout>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:timeout>");
|
||
BUFFER_APPEND_STRING_CONST(b, "Second-600");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:timeout>\n");
|
||
buffer_append_string(b,"<D:owner>");
|
||
buffer_append_string(b,"</D:owner>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:owner>");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:owner>\n");
|
||
buffer_append_string(b,"<D:locktoken>");
|
||
buffer_append_string(b, "<D:href>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:locktoken>");
|
||
BUFFER_APPEND_STRING_CONST(b, "<D:href>");
|
||
buffer_append_string_buffer(b, locktoken);
|
||
buffer_append_string(b, "</D:href>");
|
||
buffer_append_string(b,"</D:locktoken>\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "</D:href>");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:locktoken>\n");
|
||
buffer_append_string(b,"</D:activelock>\n");
|
||
buffer_append_string(b,"</D:lockdiscovery>\n");
|
||
buffer_append_string(b,"</D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:activelock>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:lockdiscovery>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:prop>\n");
|
||
return 0;
|
||
}
|
||
... | ... | |
b = chunkqueue_get_append_buffer(con->send);
|
||
buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
BUFFER_COPY_STRING_CONST(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
buffer_append_string(b,"<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:multistatus xmlns:D=\"DAV:\" xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\">\n");
|
||
/* allprop */
|
||
... | ... | |
/* Depth: 0 */
|
||
webdav_get_props(srv, con, p, &(con->physical), req_props, prop_200, prop_404);
|
||
buffer_append_string(b,"<D:response>\n");
|
||
buffer_append_string(b,"<D:href>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:response>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:href>");
|
||
buffer_append_string_buffer(b, con->uri.scheme);
|
||
buffer_append_string(b,"://");
|
||
BUFFER_APPEND_STRING_CONST(b,"://");
|
||
buffer_append_string_buffer(b, con->uri.authority);
|
||
buffer_append_string_encoded(b, CONST_BUF_LEN(con->uri.path), ENCODING_REL_URI);
|
||
buffer_append_string(b,"</D:href>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:href>\n");
|
||
if (!buffer_is_empty(prop_200)) {
|
||
buffer_append_string(b,"<D:propstat>\n");
|
||
buffer_append_string(b,"<D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:prop>\n");
|
||
buffer_append_string_buffer(b, prop_200);
|
||
buffer_append_string(b,"</D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:prop>\n");
|
||
buffer_append_string(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
|
||
buffer_append_string(b,"</D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:propstat>\n");
|
||
}
|
||
if (!buffer_is_empty(prop_404)) {
|
||
buffer_append_string(b,"<D:propstat>\n");
|
||
buffer_append_string(b,"<D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:prop>\n");
|
||
buffer_append_string_buffer(b, prop_404);
|
||
buffer_append_string(b,"</D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:prop>\n");
|
||
buffer_append_string(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
|
||
buffer_append_string(b,"</D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:propstat>\n");
|
||
}
|
||
buffer_append_string(b,"</D:response>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:response>\n");
|
||
break;
|
||
case 1:
|
||
... | ... | |
webdav_get_props(srv, con, p, &d, req_props, prop_200, prop_404);
|
||
buffer_append_string(b,"<D:response>\n");
|
||
buffer_append_string(b,"<D:href>");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:response>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:href>");
|
||
buffer_append_string_buffer(b, con->uri.scheme);
|
||
buffer_append_string(b,"://");
|
||
BUFFER_APPEND_STRING_CONST(b,"://");
|
||
buffer_append_string_buffer(b, con->uri.authority);
|
||
buffer_append_string_encoded(b, CONST_BUF_LEN(d.rel_path), ENCODING_REL_URI);
|
||
buffer_append_string(b,"</D:href>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:href>\n");
|
||
if (!buffer_is_empty(prop_200)) {
|
||
buffer_append_string(b,"<D:propstat>\n");
|
||
buffer_append_string(b,"<D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:prop>\n");
|
||
buffer_append_string_buffer(b, prop_200);
|
||
buffer_append_string(b,"</D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:prop>\n");
|
||
buffer_append_string(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:status>HTTP/1.1 200 OK</D:status>\n");
|
||
buffer_append_string(b,"</D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:propstat>\n");
|
||
}
|
||
if (!buffer_is_empty(prop_404)) {
|
||
buffer_append_string(b,"<D:propstat>\n");
|
||
buffer_append_string(b,"<D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:prop>\n");
|
||
buffer_append_string_buffer(b, prop_404);
|
||
buffer_append_string(b,"</D:prop>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:prop>\n");
|
||
buffer_append_string(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:status>HTTP/1.1 404 Not Found</D:status>\n");
|
||
buffer_append_string(b,"</D:propstat>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:propstat>\n");
|
||
}
|
||
buffer_append_string(b,"</D:response>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:response>\n");
|
||
}
|
||
closedir(dir);
|
||
buffer_free(d.path);
|
||
... | ... | |
buffer_free(prop_200);
|
||
buffer_free(prop_404);
|
||
buffer_append_string(b,"</D:multistatus>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:multistatus>\n");
|
||
if (con->conf.log_request_handling) {
|
||
TRACE("sending XML: %s",
|
||
... | ... | |
b = chunkqueue_get_append_buffer(con->send);
|
||
buffer_copy_string(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
BUFFER_COPY_STRING_CONST(b, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||
buffer_append_string(b,"<D:multistatus xmlns:D=\"DAV:\">\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"<D:multistatus xmlns:D=\"DAV:\">\n");
|
||
buffer_append_string_buffer(b, multi_status_resp);
|
||
buffer_append_string(b,"</D:multistatus>\n");
|
||
BUFFER_APPEND_STRING_CONST(b,"</D:multistatus>\n");
|
||
if (p->conf.log_xml) {
|
||
log_error_write(srv, __FILE__, __LINE__, "sb", "XML-response-body:", b);
|
src/mod_status.c (copia locale) | ||
---|---|---|
size_t ndx = st->sorted[i];
|
||
buffer_append_string_buffer(b, st->data[ndx]->key);
|
||
buffer_append_string(b, ": ");
|
||
BUFFER_APPEND_STRING_CONST(b, ": ");
|
||
buffer_append_long(b, ((data_integer *)(st->data[ndx]))->value);
|
||
buffer_append_string(b, "\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "\n");
|
||
}
|
||
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/plain"));
|
src/http_req_test.c (copia locale) | ||
---|---|---|
"GE");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "T ");
|
||
BUFFER_COPY_STRING_CONST(b, "T ");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "/foo");
|
||
BUFFER_COPY_STRING_CONST(b, "/foo");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "bar HTTP/1.0\r");
|
||
BUFFER_COPY_STRING_CONST(b, "bar HTTP/1.0\r");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "\n"
|
src/mod_ssi.c (copia locale) | ||
---|---|---|
b = chunkqueue_get_append_buffer(con->send);
|
||
if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
|
||
buffer_copy_string(b, "(none)");
|
||
BUFFER_COPY_STRING_CONST(b, "(none)");
|
||
} else {
|
||
buffer_copy_string(b, buf);
|
||
}
|
||
... | ... | |
b = chunkqueue_get_append_buffer(con->send);
|
||
if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
|
||
buffer_copy_string(b, "(none)");
|
||
BUFFER_COPY_STRING_CONST(b, "(none)");
|
||
} else {
|
||
buffer_copy_string(b, buf);
|
||
}
|
||
... | ... | |
b = chunkqueue_get_append_buffer(con->send);
|
||
if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, gmtime(&t))) {
|
||
buffer_copy_string(b, "(none)");
|
||
BUFFER_COPY_STRING_CONST(b, "(none)");
|
||
} else {
|
||
buffer_copy_string(b, buf);
|
||
}
|
||
... | ... | |
if (NULL != (ds = (data_string *)array_get_element(p->ssi_cgi_env, var_val, strlen(var_val)))) {
|
||
buffer_copy_string_buffer(b, ds->value);
|
||
} else {
|
||
buffer_copy_string(b, "(none)");
|
||
BUFFER_COPY_STRING_CONST(b, "(none)");
|
||
}
|
||
break;
|
||
... | ... | |
case SSI_FLASTMOD:
|
||
b = chunkqueue_get_append_buffer(con->send);
|
||
if (0 == strftime(buf, sizeof(buf), p->timefmt->ptr, localtime(&t))) {
|
||
buffer_copy_string(b, "(none)");
|
||
BUFFER_COPY_STRING_CONST(b, "(none)");
|
||
} else {
|
||
buffer_copy_string(b, buf);
|
||
}
|
||
... | ... | |
if (p->if_is_false) break;
|
||
b = chunkqueue_get_append_buffer(con->send);
|
||
buffer_copy_string(b, "<pre>");
|
||
BUFFER_COPY_STRING_CONST(b, "<pre>");
|
||
for (i = 0; i < p->ssi_vars->used; i++) {
|
||
data_string *ds = (data_string *)p->ssi_vars->data[p->ssi_vars->sorted[i]];
|
||
buffer_append_string_buffer(b, ds->key);
|
||
buffer_append_string(b, ": ");
|
||
BUFFER_APPEND_STRING_CONST(b, ": ");
|
||
buffer_append_string_buffer(b, ds->value);
|
||
buffer_append_string(b, "<br />");
|
||
BUFFER_APPEND_STRING_CONST(b, "<br />");
|
||
}
|
||
buffer_append_string(b, "</pre>");
|
||
BUFFER_APPEND_STRING_CONST(b, "</pre>");
|
||
break;
|
||
case SSI_EXEC: {
|
src/mod_chunked.c (copia locale) | ||
---|---|---|
b = buffer_init();
|
||
if (len == 0) {
|
||
buffer_copy_string(b, "0");
|
||
BUFFER_COPY_STRING_CONST(b, "0");
|
||
} else {
|
||
for (i = 0; i < 8 && len; i++) {
|
||
len >>= 4;
|
||
... | ... | |
b->ptr[b->used++] = '\0';
|
||
}
|
||
buffer_append_string(b, "\r\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\n");
|
||
chunkqueue_append_buffer(cq, b);
|
||
len = b->used - 1;
|
||
src/http-header-glue.c (copia locale) | ||
---|---|---|
o = buffer_init();
|
||
if (con->conf.is_ssl) {
|
||
buffer_copy_string(o, "https://");
|
||
BUFFER_COPY_STRING_CONST(o, "https://");
|
||
} else {
|
||
buffer_copy_string(o, "http://");
|
||
BUFFER_COPY_STRING_CONST(o, "http://");
|
||
}
|
||
if (con->uri.authority->used) {
|
||
buffer_append_string_buffer(o, con->uri.authority);
|
||
... | ... | |
if (!((con->conf.is_ssl == 0 && srv->srvconf.port == 80) ||
|
||
(con->conf.is_ssl == 1 && srv->srvconf.port == 443))) {
|
||
buffer_append_string(o, ":");
|
||
BUFFER_APPEND_STRING_CONST(o, ":");
|
||
buffer_append_long(o, srv->srvconf.port);
|
||
}
|
||
}
|
||
buffer_append_string_buffer(o, con->uri.path);
|
||
buffer_append_string(o, "/");
|
||
BUFFER_APPEND_STRING_CONST(o, "/");
|
||
if (!buffer_is_empty(con->uri.query)) {
|
||
buffer_append_string(o, "?");
|
||
BUFFER_APPEND_STRING_CONST(o, "?");
|
||
buffer_append_string_buffer(o, con->uri.query);
|
||
}
|
||
src/mod_uploadprogress.c (copia locale) | ||
---|---|---|
BUFFER_APPEND_STRING_CONST(b, "'error', 'status' : 413");
|
||
} else if (post_con_entry->con == NULL) {
|
||
/* the connection is already gone */
|
||
buffer_append_string(b, "'done'");
|
||
BUFFER_APPEND_STRING_CONST(b, "'done'");
|
||
} else {
|
||
/* the upload is already done, but the connection might be still open */
|
||
buffer_append_string(b, post_con_entry->con->recv->is_closed ? "'done'" : "'uploading'");
|
src/http_req_range_test.c (copia locale) | ||
---|---|---|
log_init();
|
||
plan_tests(7);
|
||
buffer_copy_string(b, "bytes=0-0");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=0-0");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=1-2,3-4");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=1-2,3-4");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "1-2,3-4");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=-0");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=-0");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "-0");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=0-");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=0-");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=0-0,0-");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=0-0,0-");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0,0-");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=0-0,-0");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=0-0,-0");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0,-0");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
||
}
|
||
http_request_range_reset(ranges);
|
||
buffer_copy_string(b, "bytes=1-2,3-4,5-");
|
||
BUFFER_COPY_STRING_CONST(b, "bytes=1-2,3-4,5-");
|
||
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "1-2,3-4,5-");
|
||
for (r = ranges; r; r = r->next) {
|
||
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
|
src/mod_accesslog.c (copia locale) | ||
---|---|---|
b = p->conf.access_logbuffer;
|
||
if (b->used == 0) {
|
||
buffer_copy_string(b, "");
|
||
BUFFER_COPY_STRING_CONST(b, "");
|
||
}
|
||
for (j = 0; j < p->conf.parsed_format->used; j++) {
|
||
... | ... | |
break;
|
||
case FORMAT_REQUEST_LINE:
|
||
buffer_append_string(b, get_http_method_name(con->request.http_method));
|
||
buffer_append_string(b, " ");
|
||
BUFFER_APPEND_STRING_CONST(b, " ");
|
||
buffer_append_string_buffer(b, con->request.orig_uri);
|
||
buffer_append_string(b, " ");
|
||
BUFFER_APPEND_STRING_CONST(b, " ");
|
||
buffer_append_string(b, get_http_version_name(con->request.http_version));
|
||
break;
|
||
... | ... | |
break;
|
||
case FORMAT_CONNECTION_STATUS:
|
||
switch(con->keep_alive) {
|
||
case 0: buffer_append_string(b, "-"); break;
|
||
default: buffer_append_string(b, "+"); break;
|
||
case 0: BUFFER_APPEND_STRING_CONST(b, "-"); break;
|
||
default: BUFFER_APPEND_STRING_CONST(b, "+"); break;
|
||
}
|
||
break;
|
||
default:
|
src/http_resp_test.c (copia locale) | ||
---|---|---|
"HTTP");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "/1.0 ");
|
||
BUFFER_COPY_STRING_CONST(b, "/1.0 ");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "30");
|
||
BUFFER_COPY_STRING_CONST(b, "30");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "4 Not Modified\r");
|
||
BUFFER_COPY_STRING_CONST(b, "4 Not Modified\r");
|
||
b = chunkqueue_get_append_buffer(cq);
|
||
buffer_copy_string(b, "\n"
|
src/log.c (copia locale) | ||
---|---|---|
/* write b */
|
||
switch(err->mode) {
|
||
case ERRORLOG_FILE:
|
||
buffer_append_string(b, "\r\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\n");
|
||
write(err->fd, b->ptr, b->used - 1);
|
||
break;
|
||
case ERRORLOG_STDERR:
|
||
buffer_append_string(b, "\r\n");
|
||
BUFFER_APPEND_STRING_CONST(b, "\r\n");
|
||
write(STDERR_FILENO, b->ptr, b->used - 1);
|
||
break;
|
||
#ifdef HAVE_SYSLOG_H
|
src/proc_open.c (copia locale) | ||
---|---|---|
buffer_append_string(cmdline, shell);
|
||
} else {
|
||
buffer_append_string(cmdline, windir);
|
||
buffer_append_string(cmdline, "\\system32\\cmd.exe");
|
||
BUFFER_APPEND_STRING_CONST(cmdline, "\\system32\\cmd.exe");
|
||
}
|
||
buffer_append_string_len(cmdline, CONST_STR_LEN(" /c "));
|
||
buffer_append_string(cmdline, command);
|