/************************************************************************* * * HTCd - Copyright (C) 1998-2006 Henrik Rydberg * * This program 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 of the License, or * (at your option) any later version. * * This program 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 #include httpReq::httpReq() { } int httpReq::Special(sref line) { sref first,rest=line; Split(first,rest); method=first; Split(first,rest); uri=first; arg.clear(); Split(first,rest); version=first; int pos=uri.find('?'); if(pos>=0) { arg=uri.right(pos+1); uri.resize(pos); } return 1; } int httpReq::Handle(const sref& name, const sref& rawval, const sref& val, const rrpile& opts) { if(HTTP::Handle(name,rawval,val,opts)) return 1; else if(eqn(name,auth_tag)) auth=val; else if(eqn(name,expect_tag)) expect=val; else if(eqn(name,from_tag)) from=val; else if(eqn(name,host_tag)) host=val; else if(eqn(name,if_match_tag)) if_match=val; else if(eqn(name,if_mod_tag)) if_mod=val; else if(eqn(name,if_none_tag)) if_none=val; else if(eqn(name,if_range_tag)) if_range=val; else if(eqn(name,if_unmod_tag)) if_unmod=val; else if(eqn(name,max_forwards_tag)) max_forwards=val; else if(eqn(name,proxy_tag)) proxy=val; else if(eqn(name,range_tag)) range=val; else if(eqn(name,referer_tag)) referer=val; else if(eqn(name,te_tag)) te=val; else if(eqn(name,user_agent_tag)) user_agent=val; else if(eqn(name,cookie_tag)) { for(rrpile::const_iterator p=opts.begin();p!=opts.end();p++) cookies.push_back(sstring(p->first,p->second)); } else return 0; return 1; } void httpReq::putHead(mstream& out) const { out<first,p->second); else putopt(out,p->first,p->second); } putend(out); } }