X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=frontend%2Fcgi%2Fcgi.c;h=7b8ac55704d7f7b0d27470f8c0bf3bb15bd3632e;hb=8a02d1a30b33beac701b39549683c0536ad093ef;hp=549794143cbe5c997e41ca15307a08921f302c3a;hpb=ae014b80ad5df77250ab19d502245759661c3e7e;p=cascardo%2Fatompub.git diff --git a/frontend/cgi/cgi.c b/frontend/cgi/cgi.c index 5497941..7b8ac55 100644 --- a/frontend/cgi/cgi.c +++ b/frontend/cgi/cgi.c @@ -33,26 +33,33 @@ cgi_serve_request (AtomCtx *ctx) return; if (path == NULL) { - path = atom_config_get_str (ctx, "cgi", "index"); + if ((path = atom_config_get_str (ctx, "cgi", "index")) == NULL) + { + /* We do not want to disclose our configuration is empty. + * The requester cannot distinguish an empty configuration + * from a non-existent index. + */ + fprintf (stdout, "Status: 404 Not Found\n\n"); + } } if (!strcmp (method, "GET")) { - IRI *iri = iri_new (); - AtomEntry *atom; + AtomID *id; + AtomResource *atom; AtomError *error; - iri_set_path (iri, path); - atom = atom_retrieve_resource (ctx, iri); - iri_delete (iri); + id = atom_id_new (path); + atom = atom_retrieve_resource (ctx, id); + atom_id_delete (id); if (atom) { char * str; size_t len; char *header = "Content-type: application/atom+xml\n\n"; write (1, header, strlen (header)); - atom_entry_string (atom, &str, &len); + atom_resource_string (atom, &str, &len); write (1, str, len); g_free (str); - atom_entry_delete (atom); + atom_resource_delete (atom); } else if ((error = atom_error_get (ctx)) != NULL) {