X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_bounce.cpp;h=9675190828f3b88ef49acc730943fc0989cadf70;hb=c980063f75d50d0869ea15fc5385bb9dd7072d85;hp=ac50f00f8525cf1133453989f6840299e4a43db3;hpb=9f255f52501e9429f643772a186cc7a72a5e8893;p=metaproxy-moved-to-github.git diff --git a/src/filter_bounce.cpp b/src/filter_bounce.cpp index ac50f00..9675190 100644 --- a/src/filter_bounce.cpp +++ b/src/filter_bounce.cpp @@ -1,12 +1,24 @@ -/* $Id: filter_bounce.cpp,v 1.1 2006-08-31 13:01:09 marc Exp $ - Copyright (c) 2005-2006, Index Data. +/* This file is part of Metaproxy. + Copyright (C) 2005-2010 Index Data - See the LICENSE file for details - */ +Metaproxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "filter_bounce.hpp" -#include "package.hpp" -#include "util.hpp" +#include +#include #include "gduutil.hpp" #include @@ -45,53 +57,45 @@ yf::Bounce::~Bounce() void yf::Bounce::process(mp::Package &package) const { - - if (! m_p->bounce ){ + if (! m_p->bounce ) + { package.move(); return; } - - package.session().close(); - + Z_GDU *zgdu = package.request().get(); - + if (!zgdu) return; - + //std::string message("BOUNCE "); std::ostringstream message; message << "BOUNCE " << *zgdu; - + metaproxy_1::odr odr; - - if (zgdu->which == Z_GDU_Z3950){ - Z_APDU *apdu_res = 0; + + if (zgdu->which == Z_GDU_Z3950) + { + Z_APDU *apdu_res = 0; apdu_res = odr.create_close(zgdu->u.z3950, Z_Close_systemProblem, message.str().c_str()); package.response() = apdu_res; } - else if (zgdu->which == Z_GDU_HTTP_Request){ - Z_GDU *zgdu_res = 0; - zgdu_res - = odr.create_HTTP_Response(package.session(), - zgdu->u.HTTP_Request, 400); - - //zgdu_res->u.HTTP_Response->content_len = message.str().size(); - //zgdu_res->u.HTTP_Response->content_buf - // = (char*) odr_malloc(odr, zgdu_res->u.HTTP_Response->content_len); - - //strncpy(zgdu_res->u.HTTP_Response->content_buf, - // message.str().c_str(), zgdu_res->u.HTTP_Response->content_len); - - // z_HTTP_header_add(o, &hres->headers, - // "Content-Type", content_type.c_str()); - package.response() = zgdu_res; + else if (zgdu->which == Z_GDU_HTTP_Request) + { + Z_GDU *zgdu_res = 0; + zgdu_res + = odr.create_HTTP_Response(package.session(), + zgdu->u.HTTP_Request, 400); + + package.response() = zgdu_res; } - else if (zgdu->which == Z_GDU_HTTP_Response){ + else if (zgdu->which == Z_GDU_HTTP_Response) + { } - + return; } @@ -113,8 +117,9 @@ extern "C" { /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil - * c-file-style: "stroustrup" * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +