Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > c9cfbd1355daacaf3b34517a6d7b18cc > files > 1268

libdap-doc-3.11.0-2.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libdap++: mime_util.cc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libdap++&#160;<span id="projectnumber">Updated for version 3.8.2</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('mime__util_8cc.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>mime_util.cc</h1>  </div>
</div>
<div class="contents">
<a href="mime__util_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span>
<a name="l00005"></a>00005 <span class="comment">// Access Protocol.</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="comment">// Copyright (c) 2002,2003 OPeNDAP, Inc.</span>
<a name="l00008"></a>00008 <span class="comment">// Author: James Gallagher &lt;jgallagher@opendap.org&gt;</span>
<a name="l00009"></a>00009 <span class="comment">//         Reza Nekovei &lt;rnekovei@intcomm.net&gt;</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// This library is free software; you can redistribute it and/or</span>
<a name="l00012"></a>00012 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>
<a name="l00013"></a>00013 <span class="comment">// License as published by the Free Software Foundation; either</span>
<a name="l00014"></a>00014 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016 <span class="comment">// This library is distributed in the hope that it will be useful,</span>
<a name="l00017"></a>00017 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00018"></a>00018 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00019"></a>00019 <span class="comment">// Lesser General Public License for more details.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>
<a name="l00022"></a>00022 <span class="comment">// License along with this library; if not, write to the Free Software</span>
<a name="l00023"></a>00023 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00024"></a>00024 <span class="comment">//</span>
<a name="l00025"></a>00025 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="comment">// (c) COPYRIGHT URI/MIT 1994-2001</span>
<a name="l00028"></a>00028 <span class="comment">// Please read the full copyright statement in the file COPYRIGHT_URI.</span>
<a name="l00029"></a>00029 <span class="comment">//</span>
<a name="l00030"></a>00030 <span class="comment">// Authors:</span>
<a name="l00031"></a>00031 <span class="comment">//      jhrg,jimg       James Gallagher &lt;jgallagher@gso.uri.edu&gt;</span>
<a name="l00032"></a>00032 <span class="comment">//      reza            Reza Nekovei &lt;rnekovei@intcomm.net&gt;</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="comment">// A few useful routines which are used in CGI programs.</span>
<a name="l00035"></a>00035 <span class="comment">//</span>
<a name="l00036"></a>00036 <span class="comment">// ReZa 9/30/94</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="config_8h.html">config.h</a>&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#undef FILE_METHODS</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="keyword">static</span> <span class="keywordtype">char</span> rcsid[] <a class="code" href="config_8h.html#a05e109ec893d0b12023d5b0cf4f718c4">not_used</a> =
<a name="l00042"></a>00042     {<span class="stringliteral">&quot;$Id: mime_util.cc 22703 2010-05-11 18:10:01Z jimg $&quot;</span>
<a name="l00043"></a>00043     };
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;ctype.h&gt;</span>
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 <span class="preprocessor">#ifndef TM_IN_SYS_TIME</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#include &lt;time.h&gt;</span>
<a name="l00051"></a>00051 <span class="preprocessor">#else</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sys/time.h&gt;</span>
<a name="l00053"></a>00053 <span class="preprocessor">#endif</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a>00055 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00056"></a>00056 <span class="preprocessor">#include &lt;sys/stat.h&gt;</span>
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="preprocessor">#ifndef WIN32</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#include &lt;unistd.h&gt;</span>    <span class="comment">// for access</span>
<a name="l00060"></a>00060 <span class="preprocessor">#include &lt;sys/wait.h&gt;</span>
<a name="l00061"></a>00061 <span class="preprocessor">#else</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#include &lt;io.h&gt;</span>
<a name="l00063"></a>00063 <span class="preprocessor">#include &lt;fcntl.h&gt;</span>
<a name="l00064"></a>00064 <span class="preprocessor">#include &lt;process.h&gt;</span>
<a name="l00065"></a>00065 <span class="comment">// Win32 does not define this. 08/21/02 jhrg</span>
<a name="l00066"></a>00066 <span class="preprocessor">#define F_OK 0</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>
<a name="l00069"></a>00069 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00070"></a>00070 <span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00071"></a>00071 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00072"></a>00072 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 <span class="preprocessor">#include &quot;<a class="code" href="mime__util_8h.html">mime_util.h</a>&quot;</span>
<a name="l00075"></a>00075 <span class="preprocessor">#include &quot;<a class="code" href="Ancillary_8h.html">Ancillary.h</a>&quot;</span>
<a name="l00076"></a>00076 <span class="preprocessor">#include &quot;<a class="code" href="util_8h.html">util.h</a>&quot;</span>  <span class="comment">// This supplies flush_stream for WIN32.</span>
<a name="l00077"></a>00077 <span class="preprocessor">#include &quot;<a class="code" href="debug_8h.html">debug.h</a>&quot;</span>
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define FILE_DELIMITER &#39;\\&#39;</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#else  //  default to unix</span>
<a name="l00082"></a><a class="code" href="mime__util_8cc.html#af3473dbdf511d56454bb32d78e5885b0">00082</a> <span class="preprocessor"></span><span class="preprocessor">#define FILE_DELIMITER &#39;/&#39;</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span>
<a name="l00085"></a>00085 <span class="comment">// ...not using a const string here to avoid global objects. jhrg 12/23/05</span>
<a name="l00086"></a><a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">00086</a> <span class="preprocessor">#define CRLF &quot;\r\n&quot;             // Change here, expr-test.cc and DODSFilter.cc</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00088"></a>00088 <span class="keyword">using namespace </span>std;
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 <span class="keyword">namespace </span>libdap {
<a name="l00091"></a>00091 
<a name="l00092"></a>00092 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> TimLen = 26; <span class="comment">// length of string from asctime()</span>
<a name="l00093"></a>00093 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> CLUMP_SIZE = 1024; <span class="comment">// size of clumps to new in fmakeword()</span>
<a name="l00094"></a>00094 
<a name="l00108"></a>00108 <span class="keywordtype">bool</span>
<a name="l00109"></a><a class="code" href="namespacelibdap.html#a7e95f81049cb65e60edcc5ec41d445d7">00109</a> <a class="code" href="namespacelibdap.html#a7e95f81049cb65e60edcc5ec41d445d7" title="Send a version number.">do_version</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;script_ver, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dataset_ver)
<a name="l00110"></a>00110 {
<a name="l00111"></a>00111     fprintf(stdout, <span class="stringliteral">&quot;HTTP/1.0 200 OK%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00112"></a>00112     fprintf(stdout, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00113"></a>00113     fprintf(stdout, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00114"></a>00114     fprintf(stdout, <span class="stringliteral">&quot;XDAP: %s%s&quot;</span>, <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00115"></a>00115     fprintf(stdout, <span class="stringliteral">&quot;Content-Type: text/plain%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00116"></a>00116     fprintf(stdout, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00117"></a>00117 
<a name="l00118"></a>00118     fprintf(stdout, <span class="stringliteral">&quot;Core software version: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="keywordflow">if</span> (script_ver != <span class="stringliteral">&quot;&quot;</span>)
<a name="l00121"></a>00121         fprintf(stdout, <span class="stringliteral">&quot;Server Script Revision: %s%s&quot;</span>, script_ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00122"></a>00122 
<a name="l00123"></a>00123     <span class="keywordflow">if</span> (dataset_ver != <span class="stringliteral">&quot;&quot;</span>)
<a name="l00124"></a>00124         fprintf(stdout,  <span class="stringliteral">&quot;Dataset version: %s%s&quot;</span>, dataset_ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00125"></a>00125 
<a name="l00126"></a>00126     fflush(stdout) ;            <span class="comment">// Not sure this is needed. jhrg 12/23/05</span>
<a name="l00127"></a>00127 
<a name="l00128"></a>00128     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00129"></a>00129 }
<a name="l00130"></a>00130 
<a name="l00140"></a>00140 <span class="keywordtype">void</span>
<a name="l00141"></a><a class="code" href="namespacelibdap.html#ac76ab0ba8dd2e6d2db8e4d07175ea266">00141</a> <a class="code" href="namespacelibdap.html#ac76ab0ba8dd2e6d2db8e4d07175ea266" title="Logs an error message.">ErrMsgT</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;Msgt)
<a name="l00142"></a>00142 {
<a name="l00143"></a>00143     time_t TimBin;
<a name="l00144"></a>00144     <span class="keywordtype">char</span> TimStr[TimLen];
<a name="l00145"></a>00145 
<a name="l00146"></a>00146     <span class="keywordflow">if</span> (time(&amp;TimBin) == (time_t) - 1)
<a name="l00147"></a>00147         strncpy(TimStr, <span class="stringliteral">&quot;time() error           &quot;</span>, TimLen-1);
<a name="l00148"></a>00148     <span class="keywordflow">else</span> {
<a name="l00149"></a>00149         strncpy(TimStr, ctime(&amp;TimBin), TimLen-1);
<a name="l00150"></a>00150         TimStr[TimLen - 2] = <span class="charliteral">&#39;\0&#39;</span>; <span class="comment">// overwrite the \n</span>
<a name="l00151"></a>00151     }
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     cerr &lt;&lt; <span class="stringliteral">&quot;[&quot;</span> &lt;&lt; TimStr &lt;&lt; <span class="stringliteral">&quot;] DAP server error: &quot;</span> &lt;&lt; Msgt &lt;&lt; endl;
<a name="l00154"></a>00154 }
<a name="l00155"></a>00155 
<a name="l00156"></a>00156 <span class="comment">// Given a pathname, return just the filename component with any extension</span>
<a name="l00157"></a>00157 <span class="comment">// removed. The new string resides in newly allocated memory; the caller must</span>
<a name="l00158"></a>00158 <span class="comment">// delete it when done using the filename.</span>
<a name="l00159"></a>00159 <span class="comment">// Originally from the netcdf distribution (ver 2.3.2).</span>
<a name="l00160"></a>00160 <span class="comment">//</span>
<a name="l00161"></a>00161 <span class="comment">// *** Change to string class argument and return type. jhrg</span>
<a name="l00162"></a>00162 <span class="comment">// *** Changed so it also removes the#path#of#the#file# from decompressed</span>
<a name="l00163"></a>00163 <span class="comment">//     files.  rph.</span>
<a name="l00164"></a>00164 <span class="comment">// Returns: A filename, with path and extension information removed. If</span>
<a name="l00165"></a>00165 <span class="comment">// memory for the new name cannot be allocated, does not return!</span>
<a name="l00166"></a>00166 
<a name="l00177"></a>00177 <span class="keywordtype">string</span>
<a name="l00178"></a><a class="code" href="namespacelibdap.html#ab6f5b13bfa1cc80a83ca5e78ed97c62b">00178</a> <a class="code" href="namespacelibdap.html#ab6f5b13bfa1cc80a83ca5e78ed97c62b" title="Returns the filename portion of a pathname.">name_path</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path)
<a name="l00179"></a>00179 {
<a name="l00180"></a>00180     <span class="keywordflow">if</span> (path == <span class="stringliteral">&quot;&quot;</span>)
<a name="l00181"></a>00181         <span class="keywordflow">return</span> string(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00182"></a>00182 
<a name="l00183"></a>00183     string::size_type delim = path.find_last_of(<a class="code" href="mime__util_8cc.html#af3473dbdf511d56454bb32d78e5885b0">FILE_DELIMITER</a>);
<a name="l00184"></a>00184     string::size_type pound = path.find_last_of(<span class="stringliteral">&quot;#&quot;</span>);
<a name="l00185"></a>00185     <span class="keywordtype">string</span> new_path;
<a name="l00186"></a>00186 
<a name="l00187"></a>00187     <span class="keywordflow">if</span> (pound != string::npos)
<a name="l00188"></a>00188         new_path = path.substr(pound + 1);
<a name="l00189"></a>00189     <span class="keywordflow">else</span>
<a name="l00190"></a>00190         new_path = path.substr(delim + 1);
<a name="l00191"></a>00191 
<a name="l00192"></a>00192     <span class="keywordflow">return</span> new_path;
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 <span class="comment">// Return a MIME rfc-822 date. The grammar for this is:</span>
<a name="l00196"></a>00196 <span class="comment">//       date-time   =  [ day &quot;,&quot; ] date time        ; dd mm yy</span>
<a name="l00197"></a>00197 <span class="comment">//                                                   ;  hh:mm:ss zzz</span>
<a name="l00198"></a>00198 <span class="comment">//</span>
<a name="l00199"></a>00199 <span class="comment">//       day         =  &quot;Mon&quot;  / &quot;Tue&quot; /  &quot;Wed&quot;  / &quot;Thu&quot;</span>
<a name="l00200"></a>00200 <span class="comment">//                   /  &quot;Fri&quot;  / &quot;Sat&quot; /  &quot;Sun&quot;</span>
<a name="l00201"></a>00201 <span class="comment">//</span>
<a name="l00202"></a>00202 <span class="comment">//       date        =  1*2DIGIT month 2DIGIT        ; day month year</span>
<a name="l00203"></a>00203 <span class="comment">//                                                   ;  e.g. 20 Jun 82</span>
<a name="l00204"></a>00204 <span class="comment">//                   NB: year is 4 digit; see RFC 1123. 11/30/99 jhrg</span>
<a name="l00205"></a>00205 <span class="comment">//</span>
<a name="l00206"></a>00206 <span class="comment">//       month       =  &quot;Jan&quot;  /  &quot;Feb&quot; /  &quot;Mar&quot;  /  &quot;Apr&quot;</span>
<a name="l00207"></a>00207 <span class="comment">//                   /  &quot;May&quot;  /  &quot;Jun&quot; /  &quot;Jul&quot;  /  &quot;Aug&quot;</span>
<a name="l00208"></a>00208 <span class="comment">//                   /  &quot;Sep&quot;  /  &quot;Oct&quot; /  &quot;Nov&quot;  /  &quot;Dec&quot;</span>
<a name="l00209"></a>00209 <span class="comment">//</span>
<a name="l00210"></a>00210 <span class="comment">//       time        =  hour zone                    ; ANSI and Military</span>
<a name="l00211"></a>00211 <span class="comment">//</span>
<a name="l00212"></a>00212 <span class="comment">//       hour        =  2DIGIT &quot;:&quot; 2DIGIT [&quot;:&quot; 2DIGIT]</span>
<a name="l00213"></a>00213 <span class="comment">//                                                   ; 00:00:00 - 23:59:59</span>
<a name="l00214"></a>00214 <span class="comment">//</span>
<a name="l00215"></a>00215 <span class="comment">//       zone        =  &quot;UT&quot;  / &quot;GMT&quot;                ; Universal Time</span>
<a name="l00216"></a>00216 <span class="comment">//                                                   ; North American : UT</span>
<a name="l00217"></a>00217 <span class="comment">//                   /  &quot;EST&quot; / &quot;EDT&quot;                ;  Eastern:  - 5/ - 4</span>
<a name="l00218"></a>00218 <span class="comment">//                   /  &quot;CST&quot; / &quot;CDT&quot;                ;  Central:  - 6/ - 5</span>
<a name="l00219"></a>00219 <span class="comment">//                   /  &quot;MST&quot; / &quot;MDT&quot;                ;  Mountain: - 7/ - 6</span>
<a name="l00220"></a>00220 <span class="comment">//                   /  &quot;PST&quot; / &quot;PDT&quot;                ;  Pacific:  - 8/ - 7</span>
<a name="l00221"></a>00221 <span class="comment">//                   /  1ALPHA                       ; Military: Z = UT;</span>
<a name="l00222"></a>00222 <span class="comment">//                                                   ;  A:-1; (J not used)</span>
<a name="l00223"></a>00223 <span class="comment">//                                                   ;  M:-12; N:+1; Y:+12</span>
<a name="l00224"></a>00224 <span class="comment">//                   / ( (&quot;+&quot; / &quot;-&quot;) 4DIGIT )        ; Local differential</span>
<a name="l00225"></a>00225 <span class="comment">//                                                   ;  hours+min. (HHMM)</span>
<a name="l00226"></a>00226 
<a name="l00227"></a>00227 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *days[] =
<a name="l00228"></a>00228     {<span class="stringliteral">&quot;Sun&quot;</span>, <span class="stringliteral">&quot;Mon&quot;</span>, <span class="stringliteral">&quot;Tue&quot;</span>, <span class="stringliteral">&quot;Wed&quot;</span>, <span class="stringliteral">&quot;Thu&quot;</span>, <span class="stringliteral">&quot;Fri&quot;</span>, <span class="stringliteral">&quot;Sat&quot;</span>
<a name="l00229"></a>00229     };
<a name="l00230"></a>00230 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *months[] =
<a name="l00231"></a>00231     {<span class="stringliteral">&quot;Jan&quot;</span>, <span class="stringliteral">&quot;Feb&quot;</span>, <span class="stringliteral">&quot;Mar&quot;</span>, <span class="stringliteral">&quot;Apr&quot;</span>, <span class="stringliteral">&quot;May&quot;</span>, <span class="stringliteral">&quot;Jun&quot;</span>, <span class="stringliteral">&quot;Jul&quot;</span>,
<a name="l00232"></a>00232      <span class="stringliteral">&quot;Aug&quot;</span>, <span class="stringliteral">&quot;Sep&quot;</span>, <span class="stringliteral">&quot;Oct&quot;</span>, <span class="stringliteral">&quot;Nov&quot;</span>, <span class="stringliteral">&quot;Dec&quot;</span>
<a name="l00233"></a>00233     };
<a name="l00234"></a>00234 
<a name="l00235"></a>00235 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00236"></a>00236 <span class="preprocessor"></span><span class="preprocessor">#define snprintf sprintf_s</span>
<a name="l00237"></a>00237 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00238"></a>00238 <span class="preprocessor"></span>
<a name="l00246"></a>00246 <span class="keywordtype">string</span>
<a name="l00247"></a><a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">00247</a> <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(<span class="keyword">const</span> time_t t)
<a name="l00248"></a>00248 {
<a name="l00249"></a>00249     <span class="keyword">struct </span>tm *stm = gmtime(&amp;t);
<a name="l00250"></a>00250     <span class="keywordtype">char</span> d[256];
<a name="l00251"></a>00251 
<a name="l00252"></a>00252     snprintf(d, 255, <span class="stringliteral">&quot;%s, %02d %s %4d %02d:%02d:%02d GMT&quot;</span>, days[stm-&gt;tm_wday],
<a name="l00253"></a>00253             stm-&gt;tm_mday, months[stm-&gt;tm_mon],
<a name="l00254"></a>00254             1900 + stm-&gt;tm_year,
<a name="l00255"></a>00255             stm-&gt;tm_hour, stm-&gt;tm_min, stm-&gt;tm_sec);
<a name="l00256"></a>00256     d[255] = <span class="charliteral">&#39;\0&#39;</span>;
<a name="l00257"></a>00257     <span class="keywordflow">return</span> string(d);
<a name="l00258"></a>00258 }
<a name="l00259"></a>00259 
<a name="l00265"></a>00265 time_t
<a name="l00266"></a><a class="code" href="namespacelibdap.html#a394c0b1380a16e886f96bf4a9081ed3a">00266</a> <a class="code" href="namespacelibdap.html#a394c0b1380a16e886f96bf4a9081ed3a">last_modified_time</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;name)
<a name="l00267"></a>00267 {
<a name="l00268"></a>00268     <span class="keyword">struct </span>stat m;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     <span class="keywordflow">if</span> (stat(name.c_str(), &amp;m) == 0 &amp;&amp; (S_IFREG &amp; m.st_mode))
<a name="l00271"></a>00271         <span class="keywordflow">return</span> m.st_mtime;
<a name="l00272"></a>00272     <span class="keywordflow">else</span>
<a name="l00273"></a>00273         <span class="keywordflow">return</span> time(0);
<a name="l00274"></a>00274 }
<a name="l00275"></a>00275 
<a name="l00276"></a>00276 <span class="comment">// Send string to set the transfer (mime) type and server version</span>
<a name="l00277"></a>00277 <span class="comment">// Note that the content description filed is used to indicate whether valid</span>
<a name="l00278"></a>00278 <span class="comment">// information of an error message is contained in the document and the</span>
<a name="l00279"></a>00279 <span class="comment">// content-encoding field is used to indicate whether the data is compressed.</span>
<a name="l00280"></a>00280 <span class="comment">// If the data stream is to be compressed, arrange for a compression output</span>
<a name="l00281"></a>00281 <span class="comment">// filter so that all information sent after the header will be compressed.</span>
<a name="l00282"></a>00282 <span class="comment">//</span>
<a name="l00283"></a>00283 <span class="comment">// Returns: false if the compression output filter was to be used but could</span>
<a name="l00284"></a>00284 <span class="comment">// not be started, true otherwise.</span>
<a name="l00285"></a>00285 
<a name="l00286"></a>00286 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *descrip[] =
<a name="l00287"></a>00287     {<span class="stringliteral">&quot;unknown&quot;</span>, <span class="stringliteral">&quot;dods_das&quot;</span>, <span class="stringliteral">&quot;dods_dds&quot;</span>, <span class="stringliteral">&quot;dods_data&quot;</span>,
<a name="l00288"></a>00288      <span class="stringliteral">&quot;dods_error&quot;</span>, <span class="stringliteral">&quot;web_error&quot;</span>, <span class="stringliteral">&quot;dap4-ddx&quot;</span>, <span class="stringliteral">&quot;dap4-data&quot;</span>, <span class="stringliteral">&quot;dap4-error&quot;</span>,
<a name="l00289"></a>00289      <span class="stringliteral">&quot;dap4-data-ddx&quot;</span>, <span class="stringliteral">&quot;dods_ddx&quot;</span>
<a name="l00290"></a>00290     };
<a name="l00291"></a>00291 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *encoding[] =
<a name="l00292"></a>00292     {<span class="stringliteral">&quot;unknown&quot;</span>, <span class="stringliteral">&quot;deflate&quot;</span>, <span class="stringliteral">&quot;x-plain&quot;</span>, <span class="stringliteral">&quot;gzip&quot;</span>, <span class="stringliteral">&quot;binary&quot;</span>
<a name="l00293"></a>00293     };
<a name="l00294"></a>00294 
<a name="l00300"></a>00300 <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a>
<a name="l00301"></a><a class="code" href="namespacelibdap.html#aceb42dce2c3676ca9785ee89190ab4ce">00301</a> <a class="code" href="namespacelibdap.html#aceb42dce2c3676ca9785ee89190ab4ce">get_type</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;value)
<a name="l00302"></a>00302 {
<a name="l00303"></a>00303     <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_das&quot;</span>) | (value == <span class="stringliteral">&quot;dods-das&quot;</span>))
<a name="l00304"></a>00304         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa02461a6c30af5fa6a789ea22fef8534e">dods_das</a>;
<a name="l00305"></a>00305     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_dds&quot;</span>) | (value == <span class="stringliteral">&quot;dods-dds&quot;</span>))
<a name="l00306"></a>00306         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aae5a70721811fccc5ee73852269b01a01">dods_dds</a>;
<a name="l00307"></a>00307     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_data&quot;</span>) | (value == <span class="stringliteral">&quot;dods-data&quot;</span>))
<a name="l00308"></a>00308         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa81aaa5f03d4278cb44a2148d13384710">dods_data</a>;
<a name="l00309"></a>00309     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_error&quot;</span>) | (value == <span class="stringliteral">&quot;dods-error&quot;</span>))
<a name="l00310"></a>00310         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>;
<a name="l00311"></a>00311     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;web_error&quot;</span>) | (value == <span class="stringliteral">&quot;web-error&quot;</span>))
<a name="l00312"></a>00312         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aaa4a8434126fdf1a42a77c74409973b54">web_error</a>;
<a name="l00313"></a>00313     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-ddx&quot;</span>))
<a name="l00314"></a>00314         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa605a335e5665d5f3ac75cacf42a15ae8">dap4_ddx</a>;
<a name="l00315"></a>00315     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_data&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-data&quot;</span>))
<a name="l00316"></a>00316         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa3024d0ef2b1d655dedba800665b7f513">dap4_data</a>;
<a name="l00317"></a>00317     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_error&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-error&quot;</span>))
<a name="l00318"></a>00318         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa4913b7492696bccacfb4fc84da0bceed">dap4_error</a>;
<a name="l00319"></a>00319     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_data_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-data-ddx&quot;</span>))
<a name="l00320"></a>00320         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aae2070a684067288a7ad65cb671c73a26">dap4_data_ddx</a>;
<a name="l00321"></a>00321     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dods-ddx&quot;</span>))
<a name="l00322"></a>00322         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aaf4dc265e5be5ab5584aa717cfd6ec6b9">dods_ddx</a>;
<a name="l00323"></a>00323     <span class="keywordflow">else</span>
<a name="l00324"></a>00324         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa5ea9f0cd3ea158ca267b3c7266a215a3">unknown_type</a>;
<a name="l00325"></a>00325 }
<a name="l00326"></a>00326 
<a name="l00332"></a>00332 <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a>
<a name="l00333"></a><a class="code" href="namespacelibdap.html#a284c1c548cbcea75bb1b7c8374dc04e9">00333</a> <a class="code" href="namespacelibdap.html#a284c1c548cbcea75bb1b7c8374dc04e9">get_description_type</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;value)
<a name="l00334"></a>00334 {
<a name="l00335"></a>00335     <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_das&quot;</span>) | (value == <span class="stringliteral">&quot;dods-das&quot;</span>))
<a name="l00336"></a>00336         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa02461a6c30af5fa6a789ea22fef8534e">dods_das</a>;
<a name="l00337"></a>00337     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_dds&quot;</span>) | (value == <span class="stringliteral">&quot;dods-dds&quot;</span>))
<a name="l00338"></a>00338         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aae5a70721811fccc5ee73852269b01a01">dods_dds</a>;
<a name="l00339"></a>00339     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_data&quot;</span>) | (value == <span class="stringliteral">&quot;dods-data&quot;</span>))
<a name="l00340"></a>00340         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa81aaa5f03d4278cb44a2148d13384710">dods_data</a>;
<a name="l00341"></a>00341     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_error&quot;</span>) | (value == <span class="stringliteral">&quot;dods-error&quot;</span>))
<a name="l00342"></a>00342         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>;
<a name="l00343"></a>00343     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;web_error&quot;</span>) | (value == <span class="stringliteral">&quot;web-error&quot;</span>))
<a name="l00344"></a>00344         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aaa4a8434126fdf1a42a77c74409973b54">web_error</a>;
<a name="l00345"></a>00345     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dods-ddx&quot;</span>))
<a name="l00346"></a>00346         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aaf4dc265e5be5ab5584aa717cfd6ec6b9">dods_ddx</a>;
<a name="l00347"></a>00347     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-ddx&quot;</span>))
<a name="l00348"></a>00348         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa605a335e5665d5f3ac75cacf42a15ae8">dap4_ddx</a>;
<a name="l00349"></a>00349     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_data&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-data&quot;</span>))
<a name="l00350"></a>00350         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa3024d0ef2b1d655dedba800665b7f513">dap4_data</a>;
<a name="l00351"></a>00351     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_error&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-error&quot;</span>))
<a name="l00352"></a>00352         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa4913b7492696bccacfb4fc84da0bceed">dap4_error</a>;
<a name="l00353"></a>00353     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dap4_data_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dap4-data-ddx&quot;</span>))
<a name="l00354"></a>00354         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aae2070a684067288a7ad65cb671c73a26">dap4_data_ddx</a>;
<a name="l00355"></a>00355     <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((value == <span class="stringliteral">&quot;dods_ddx&quot;</span>) | (value == <span class="stringliteral">&quot;dods-ddx&quot;</span>))
<a name="l00356"></a>00356         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aaf4dc265e5be5ab5584aa717cfd6ec6b9">dods_ddx</a>;
<a name="l00357"></a>00357     <span class="keywordflow">else</span>
<a name="l00358"></a>00358         <span class="keywordflow">return</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa5ea9f0cd3ea158ca267b3c7266a215a3">unknown_type</a>;
<a name="l00359"></a>00359 }
<a name="l00360"></a>00360 
<a name="l00361"></a>00361 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00362"></a>00362 <span class="preprocessor"></span>
<a name="l00374"></a>00374 <span class="keywordtype">void</span>
<a name="l00375"></a>00375 <a class="code" href="namespacelibdap.html#a7a785b8fcc89e5be01284c06a9dbc97d">set_mime_text</a>(FILE *out, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00376"></a>00376               <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00377"></a>00377 {
<a name="l00378"></a>00378     fprintf(out, <span class="stringliteral">&quot;HTTP/1.0 200 OK%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00379"></a>00379     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00380"></a>00380         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00381"></a>00381         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00382"></a>00382     }
<a name="l00383"></a>00383     <span class="keywordflow">else</span> {
<a name="l00384"></a>00384         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00385"></a>00385         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00386"></a>00386     }
<a name="l00387"></a>00387     fprintf(out, <span class="stringliteral">&quot;XDAP: %s%s&quot;</span>, <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00388"></a>00388 
<a name="l00389"></a>00389     <span class="keyword">const</span> time_t t = time(0);
<a name="l00390"></a>00390     fprintf(out, <span class="stringliteral">&quot;Date: %s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00391"></a>00391 
<a name="l00392"></a>00392     fprintf(out, <span class="stringliteral">&quot;Last-Modified: &quot;</span>) ;
<a name="l00393"></a>00393     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00394"></a>00394         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00395"></a>00395     <span class="keywordflow">else</span>
<a name="l00396"></a>00396         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa605a335e5665d5f3ac75cacf42a15ae8">dap4_ddx</a>)
<a name="l00399"></a>00399         fprintf(out, <span class="stringliteral">&quot;Content-Type: text/xml%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00400"></a>00400     <span class="keywordflow">else</span>
<a name="l00401"></a>00401         fprintf(out, <span class="stringliteral">&quot;Content-Type: text/plain%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00402"></a>00402 
<a name="l00403"></a>00403     <span class="comment">// Note that Content-Description is from RFC 2045 (MIME, pt 1), not 2616.</span>
<a name="l00404"></a>00404     <span class="comment">// jhrg 12/23/05</span>
<a name="l00405"></a>00405     fprintf(out, <span class="stringliteral">&quot;Content-Description: %s%s&quot;</span>, descrip[type], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00406"></a>00406     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>) <span class="comment">// don&#39;t cache our error responses.</span>
<a name="l00407"></a>00407         fprintf(out, <span class="stringliteral">&quot;Cache-Control: no-cache%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00408"></a>00408     <span class="comment">// Don&#39;t write a Content-Encoding header for x-plain since that breaks</span>
<a name="l00409"></a>00409     <span class="comment">// Netscape on NT. jhrg 3/23/97</span>
<a name="l00410"></a>00410     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00411"></a>00411         fprintf(out, <span class="stringliteral">&quot;Content-Encoding: %s%s&quot;</span>, encoding[enc], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00412"></a>00412     fprintf(out, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 <span class="preprocessor">#endif</span>
<a name="l00415"></a>00415 <span class="preprocessor"></span>
<a name="l00428"></a>00428 <span class="keywordtype">void</span>
<a name="l00429"></a><a class="code" href="namespacelibdap.html#a7a785b8fcc89e5be01284c06a9dbc97d">00429</a> <a class="code" href="namespacelibdap.html#a7a785b8fcc89e5be01284c06a9dbc97d">set_mime_text</a>(ostream &amp;strm, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00430"></a>00430               <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00431"></a>00431 {
<a name="l00432"></a>00432     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 200 OK&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00433"></a>00433     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00434"></a>00434         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00435"></a>00435         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00436"></a>00436     }
<a name="l00437"></a>00437     <span class="keywordflow">else</span> {
<a name="l00438"></a>00438         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00439"></a>00439         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00440"></a>00440     }
<a name="l00441"></a>00441     strm &lt;&lt; <span class="stringliteral">&quot;XDAP: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00442"></a>00442 
<a name="l00443"></a>00443     <span class="keyword">const</span> time_t t = time(0);
<a name="l00444"></a>00444     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00445"></a>00445 
<a name="l00446"></a>00446     strm &lt;&lt; <span class="stringliteral">&quot;Last-Modified: &quot;</span> ;
<a name="l00447"></a>00447     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00448"></a>00448         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00449"></a>00449     <span class="keywordflow">else</span>
<a name="l00450"></a>00450         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00451"></a>00451 
<a name="l00452"></a>00452     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa605a335e5665d5f3ac75cacf42a15ae8">dap4_ddx</a>)
<a name="l00453"></a>00453         strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: text/xml&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00454"></a>00454     <span class="keywordflow">else</span>
<a name="l00455"></a>00455         strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: text/plain&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00456"></a>00456 
<a name="l00457"></a>00457     <span class="comment">// Note that Content-Description is from RFC 2045 (MIME, pt 1), not 2616.</span>
<a name="l00458"></a>00458     <span class="comment">// jhrg 12/23/05</span>
<a name="l00459"></a>00459     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00460"></a>00460     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>) <span class="comment">// don&#39;t cache our error responses.</span>
<a name="l00461"></a>00461         strm &lt;&lt; <span class="stringliteral">&quot;Cache-Control: no-cache&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00462"></a>00462     <span class="comment">// Don&#39;t write a Content-Encoding header for x-plain since that breaks</span>
<a name="l00463"></a>00463     <span class="comment">// Netscape on NT. jhrg 3/23/97</span>
<a name="l00464"></a>00464     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00465"></a>00465         strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00466"></a>00466     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00467"></a>00467 }
<a name="l00468"></a>00468 
<a name="l00469"></a>00469 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00470"></a>00470 <span class="preprocessor"></span>
<a name="l00480"></a>00480 <span class="keywordtype">void</span>
<a name="l00481"></a>00481 <a class="code" href="namespacelibdap.html#a2d47123836f484835fd6d85d66ca0129">set_mime_html</a>(FILE *out, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00482"></a>00482               <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00483"></a>00483 {
<a name="l00484"></a>00484     fprintf(out, <span class="stringliteral">&quot;HTTP/1.0 200 OK%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00485"></a>00485     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00486"></a>00486         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00487"></a>00487         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00488"></a>00488     }
<a name="l00489"></a>00489     <span class="keywordflow">else</span> {
<a name="l00490"></a>00490         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00491"></a>00491         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00492"></a>00492     }
<a name="l00493"></a>00493     fprintf(out, <span class="stringliteral">&quot;XDAP: %s%s&quot;</span>, <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00494"></a>00494 
<a name="l00495"></a>00495     <span class="keyword">const</span> time_t t = time(0);
<a name="l00496"></a>00496     fprintf(out, <span class="stringliteral">&quot;Date: %s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00497"></a>00497 
<a name="l00498"></a>00498     fprintf(out, <span class="stringliteral">&quot;Last-Modified: &quot;</span>) ;
<a name="l00499"></a>00499     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00500"></a>00500         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00501"></a>00501     <span class="keywordflow">else</span>
<a name="l00502"></a>00502         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00503"></a>00503 
<a name="l00504"></a>00504     fprintf(out, <span class="stringliteral">&quot;Content-type: text/html%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00505"></a>00505     <span class="comment">// See note above about Content-Description header. jhrg 12/23/05</span>
<a name="l00506"></a>00506     fprintf(out, <span class="stringliteral">&quot;Content-Description: %s%s&quot;</span>, descrip[type], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00507"></a>00507     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>) <span class="comment">// don&#39;t cache our error responses.</span>
<a name="l00508"></a>00508         fprintf(out, <span class="stringliteral">&quot;Cache-Control: no-cache%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00509"></a>00509     <span class="comment">// Don&#39;t write a Content-Encoding header for x-plain since that breaks</span>
<a name="l00510"></a>00510     <span class="comment">// Netscape on NT. jhrg 3/23/97</span>
<a name="l00511"></a>00511     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00512"></a>00512         fprintf(out, <span class="stringliteral">&quot;Content-Encoding: %s%s&quot;</span>, encoding[enc], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00513"></a>00513     fprintf(out, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00514"></a>00514 }
<a name="l00515"></a>00515 <span class="preprocessor">#endif</span>
<a name="l00516"></a>00516 <span class="preprocessor"></span>
<a name="l00527"></a>00527 <span class="keywordtype">void</span>
<a name="l00528"></a><a class="code" href="namespacelibdap.html#a2d47123836f484835fd6d85d66ca0129">00528</a> <a class="code" href="namespacelibdap.html#a2d47123836f484835fd6d85d66ca0129">set_mime_html</a>(ostream &amp;strm, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00529"></a>00529               <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00530"></a>00530 {
<a name="l00531"></a>00531     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 200 OK&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00532"></a>00532     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00533"></a>00533         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00534"></a>00534         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00535"></a>00535     }
<a name="l00536"></a>00536     <span class="keywordflow">else</span> {
<a name="l00537"></a>00537         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00538"></a>00538         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00539"></a>00539     }
<a name="l00540"></a>00540     strm &lt;&lt; <span class="stringliteral">&quot;XDAP: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00541"></a>00541 
<a name="l00542"></a>00542     <span class="keyword">const</span> time_t t = time(0);
<a name="l00543"></a>00543     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00544"></a>00544 
<a name="l00545"></a>00545     strm &lt;&lt; <span class="stringliteral">&quot;Last-Modified: &quot;</span> ;
<a name="l00546"></a>00546     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00547"></a>00547         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00548"></a>00548     <span class="keywordflow">else</span>
<a name="l00549"></a>00549         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00550"></a>00550 
<a name="l00551"></a>00551     strm &lt;&lt; <span class="stringliteral">&quot;Content-type: text/html&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00552"></a>00552     <span class="comment">// See note above about Content-Description header. jhrg 12/23/05</span>
<a name="l00553"></a>00553     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00554"></a>00554     <span class="keywordflow">if</span> (type == <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06aa742dd62797a6ff77549a1803a4e77d79">dods_error</a>) <span class="comment">// don&#39;t cache our error responses.</span>
<a name="l00555"></a>00555         strm &lt;&lt; <span class="stringliteral">&quot;Cache-Control: no-cache&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00556"></a>00556     <span class="comment">// Don&#39;t write a Content-Encoding header for x-plain since that breaks</span>
<a name="l00557"></a>00557     <span class="comment">// Netscape on NT. jhrg 3/23/97</span>
<a name="l00558"></a>00558     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00559"></a>00559         strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00560"></a>00560     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562 
<a name="l00563"></a>00563 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00564"></a>00564 <span class="preprocessor"></span>
<a name="l00577"></a>00577 <span class="keywordtype">void</span>
<a name="l00578"></a>00578 <a class="code" href="namespacelibdap.html#ae55c70a6b2073269d49dd7654d625710">set_mime_binary</a>(FILE *out, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00579"></a>00579                 <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00580"></a>00580 {
<a name="l00581"></a>00581     fprintf(out, <span class="stringliteral">&quot;HTTP/1.0 200 OK%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00582"></a>00582     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00583"></a>00583         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00584"></a>00584         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00585"></a>00585     }
<a name="l00586"></a>00586     <span class="keywordflow">else</span> {
<a name="l00587"></a>00587         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00588"></a>00588         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, ver.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00589"></a>00589     }
<a name="l00590"></a>00590     fprintf(out, <span class="stringliteral">&quot;XDAP: %s%s&quot;</span>, <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00591"></a>00591 
<a name="l00592"></a>00592     <span class="keyword">const</span> time_t t = time(0);
<a name="l00593"></a>00593     fprintf(out, <span class="stringliteral">&quot;Date: %s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00594"></a>00594 
<a name="l00595"></a>00595     fprintf(out, <span class="stringliteral">&quot;Last-Modified: &quot;</span>) ;
<a name="l00596"></a>00596     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00597"></a>00597         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00598"></a>00598     <span class="keywordflow">else</span>
<a name="l00599"></a>00599         fprintf(out, <span class="stringliteral">&quot;%s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00600"></a>00600 
<a name="l00601"></a>00601     fprintf(out, <span class="stringliteral">&quot;Content-Type: application/octet-stream%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00602"></a>00602     fprintf(out, <span class="stringliteral">&quot;Content-Description: %s%s&quot;</span>, descrip[type], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00603"></a>00603     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00604"></a>00604         fprintf(out, <span class="stringliteral">&quot;Content-Encoding: %s%s&quot;</span>, encoding[enc], <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00605"></a>00605 
<a name="l00606"></a>00606     fprintf(out, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00607"></a>00607 }
<a name="l00608"></a>00608 <span class="preprocessor">#endif</span>
<a name="l00609"></a>00609 <span class="preprocessor"></span>
<a name="l00623"></a>00623 <span class="keywordtype">void</span>
<a name="l00624"></a><a class="code" href="namespacelibdap.html#ae55c70a6b2073269d49dd7654d625710">00624</a> <a class="code" href="namespacelibdap.html#ae55c70a6b2073269d49dd7654d625710">set_mime_binary</a>(ostream &amp;strm, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;ver,
<a name="l00625"></a>00625                 <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc, <span class="keyword">const</span> time_t last_modified)
<a name="l00626"></a>00626 {
<a name="l00627"></a>00627     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 200 OK&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00628"></a>00628     <span class="keywordflow">if</span> (ver == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00629"></a>00629         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00630"></a>00630         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00631"></a>00631     }
<a name="l00632"></a>00632     <span class="keywordflow">else</span> {
<a name="l00633"></a>00633         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00634"></a>00634         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; ver.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00635"></a>00635     }
<a name="l00636"></a>00636     strm &lt;&lt; <span class="stringliteral">&quot;XDAP: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00637"></a>00637 
<a name="l00638"></a>00638     <span class="keyword">const</span> time_t t = time(0);
<a name="l00639"></a>00639     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00640"></a>00640 
<a name="l00641"></a>00641     strm &lt;&lt; <span class="stringliteral">&quot;Last-Modified: &quot;</span> ;
<a name="l00642"></a>00642     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00643"></a>00643         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00644"></a>00644     <span class="keywordflow">else</span>
<a name="l00645"></a>00645         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00646"></a>00646 
<a name="l00647"></a>00647     strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: application/octet-stream&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00648"></a>00648     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00649"></a>00649     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00650"></a>00650         strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00651"></a>00651 
<a name="l00652"></a>00652     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00653"></a>00653 }
<a name="l00654"></a>00654 
<a name="l00655"></a><a class="code" href="namespacelibdap.html#a8e8484bd3d54c09c120cb7afcde19d1f">00655</a> <span class="keywordtype">void</span> <a class="code" href="namespacelibdap.html#a8e8484bd3d54c09c120cb7afcde19d1f">set_mime_multipart</a>(ostream &amp;strm, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;boundary,
<a name="l00656"></a>00656         <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;start, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type,
<a name="l00657"></a>00657         <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="getdap_8cc.html#aa31f487a99743d24af9076a3e11e5425">version</a>, <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc,
<a name="l00658"></a>00658         <span class="keyword">const</span> time_t last_modified)
<a name="l00659"></a>00659 {
<a name="l00660"></a>00660     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 200 OK&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00661"></a>00661     <span class="keywordflow">if</span> (version == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00662"></a>00662         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00663"></a>00663         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00664"></a>00664     }
<a name="l00665"></a>00665     <span class="keywordflow">else</span> {
<a name="l00666"></a>00666         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; version.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00667"></a>00667         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; version.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00668"></a>00668     }
<a name="l00669"></a>00669     strm &lt;&lt; <span class="stringliteral">&quot;XDAP: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00670"></a>00670 
<a name="l00671"></a>00671     <span class="keyword">const</span> time_t t = time(0);
<a name="l00672"></a>00672     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00673"></a>00673 
<a name="l00674"></a>00674     strm &lt;&lt; <span class="stringliteral">&quot;Last-Modified: &quot;</span> ;
<a name="l00675"></a>00675     <span class="keywordflow">if</span> (last_modified &gt; 0)
<a name="l00676"></a>00676         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(last_modified).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00677"></a>00677     <span class="keywordflow">else</span>
<a name="l00678"></a>00678         strm &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00679"></a>00679 
<a name="l00680"></a>00680     strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: Multipart/Related; boundary=&quot;</span> &lt;&lt; boundary
<a name="l00681"></a>00681         &lt;&lt; <span class="stringliteral">&quot;; start=\&quot;&lt;&quot;</span> &lt;&lt; start &lt;&lt; <span class="stringliteral">&quot;&gt;\&quot;; type=\&quot;Text/xml\&quot;&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00682"></a>00682     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00683"></a>00683     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00684"></a>00684         strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00685"></a>00685 
<a name="l00686"></a>00686     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00687"></a>00687 }
<a name="l00688"></a>00688 
<a name="l00689"></a><a class="code" href="namespacelibdap.html#a387c60d25f7e78d4ced09c7907ad0662">00689</a> <span class="keywordtype">void</span> <a class="code" href="namespacelibdap.html#a387c60d25f7e78d4ced09c7907ad0662">set_mime_ddx_boundary</a>(ostream &amp;strm, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;boundary,
<a name="l00690"></a>00690         <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cid, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc)
<a name="l00691"></a>00691 {
<a name="l00692"></a>00692     strm &lt;&lt; <span class="stringliteral">&quot;--&quot;</span> &lt;&lt; boundary &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00693"></a>00693     strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: Text/xml; charset=iso-8859-1&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00694"></a>00694     strm &lt;&lt; <span class="stringliteral">&quot;Content-Id: &lt;&quot;</span> &lt;&lt; cid &lt;&lt; <span class="stringliteral">&quot;&gt;&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00695"></a>00695     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00696"></a>00696     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00697"></a>00697          strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00698"></a>00698 
<a name="l00699"></a>00699     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00700"></a>00700 }
<a name="l00701"></a>00701 
<a name="l00702"></a><a class="code" href="namespacelibdap.html#a02822649dbf10c226e3f6be5c8a89991">00702</a> <span class="keywordtype">void</span> <a class="code" href="namespacelibdap.html#a02822649dbf10c226e3f6be5c8a89991">set_mime_data_boundary</a>(ostream &amp;strm, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;boundary,
<a name="l00703"></a>00703         <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cid, <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> type, <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55" title="The type of encoding used on the current stream.">EncodingType</a> enc)
<a name="l00704"></a>00704 {
<a name="l00705"></a>00705     strm &lt;&lt; <span class="stringliteral">&quot;--&quot;</span> &lt;&lt; boundary &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00706"></a>00706     strm &lt;&lt; <span class="stringliteral">&quot;Content-Type: application/octet-stream&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00707"></a>00707     strm &lt;&lt; <span class="stringliteral">&quot;Content-Id: &lt;&quot;</span> &lt;&lt; cid &lt;&lt; <span class="stringliteral">&quot;&gt;&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00708"></a>00708     strm &lt;&lt; <span class="stringliteral">&quot;Content-Description: &quot;</span> &lt;&lt; descrip[type] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00709"></a>00709     <span class="keywordflow">if</span> (enc != <a class="code" href="namespacelibdap.html#aada86e90b40fc8068dbfe9be79f09e55ab128dd348d8e64eff653ca8efa0574f4">x_plain</a>)
<a name="l00710"></a>00710          strm &lt;&lt; <span class="stringliteral">&quot;Content-Encoding: &quot;</span> &lt;&lt; encoding[enc] &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00711"></a>00711 
<a name="l00712"></a>00712     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>;
<a name="l00713"></a>00713 }
<a name="l00714"></a>00714 
<a name="l00715"></a><a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">00715</a> <span class="keyword">const</span> <span class="keywordtype">size_t</span> <a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">line_length</a> = 1024;
<a name="l00716"></a>00716 
<a name="l00730"></a><a class="code" href="namespacelibdap.html#a138ad983bab51cd81239f2e3d0572486">00730</a> <span class="keywordtype">string</span> <a class="code" href="namespacelibdap.html#a138ad983bab51cd81239f2e3d0572486">get_next_mime_header</a>(FILE *in)
<a name="l00731"></a>00731 {
<a name="l00732"></a>00732     <span class="comment">// Get the header line and strip \r\n. Some headers end with just \n.</span>
<a name="l00733"></a>00733     <span class="comment">// If a blank line is found, return an empty string.</span>
<a name="l00734"></a>00734     <span class="keywordtype">char</span> line[<a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">line_length</a>];
<a name="l00735"></a>00735     <span class="keywordflow">while</span> (!feof(in)) {
<a name="l00736"></a>00736         <span class="keywordflow">if</span> (fgets(line, <a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">line_length</a>, in)
<a name="l00737"></a>00737                 &amp;&amp; (strncmp(line, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>, 2) == 0 || line[0] == <span class="charliteral">&#39;\n&#39;</span>))
<a name="l00738"></a>00738             <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;
<a name="l00739"></a>00739         <span class="keywordflow">else</span> {
<a name="l00740"></a>00740             <span class="keywordtype">size_t</span> slen = min(strlen(line), <a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">line_length</a>); <span class="comment">// Never &gt; line_length</span>
<a name="l00741"></a>00741             line[slen - 1] = <span class="charliteral">&#39;\0&#39;</span>; <span class="comment">// remove the newline</span>
<a name="l00742"></a>00742             <span class="keywordflow">if</span> (line[slen - 2] == <span class="charliteral">&#39;\r&#39;</span>) <span class="comment">// ...and the preceding carriage return</span>
<a name="l00743"></a>00743                 line[slen - 2] = <span class="charliteral">&#39;\0&#39;</span>;
<a name="l00744"></a>00744             <span class="keywordflow">return</span> string(line);
<a name="l00745"></a>00745         }
<a name="l00746"></a>00746     }
<a name="l00747"></a>00747 
<a name="l00748"></a>00748     <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;I expected to find a MIME header, but got EOF instead.&quot;</span>);
<a name="l00749"></a>00749 }
<a name="l00750"></a>00750 
<a name="l00758"></a><a class="code" href="namespacelibdap.html#a3853818a415408fd980e8f3a9321d5d8">00758</a> <span class="keywordtype">void</span> <a class="code" href="namespacelibdap.html#a3853818a415408fd980e8f3a9321d5d8">parse_mime_header</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;header, <span class="keywordtype">string</span> &amp;name, <span class="keywordtype">string</span> &amp;value)
<a name="l00759"></a>00759 {
<a name="l00760"></a>00760     istringstream iss(header);
<a name="l00761"></a>00761     <span class="comment">// Set downcase</span>
<a name="l00762"></a>00762     <span class="keywordtype">char</span> s[<a class="code" href="namespacelibdap.html#af4ad71f4bf4ef84acab107dd8f77749e">line_length</a>];
<a name="l00763"></a>00763     iss.getline(s, 1023, <span class="charliteral">&#39;:&#39;</span>);
<a name="l00764"></a>00764     name = s;
<a name="l00765"></a>00765 
<a name="l00766"></a>00766     iss.ignore(1023, <span class="charliteral">&#39; &#39;</span>);
<a name="l00767"></a>00767     iss.getline(s, 1023);
<a name="l00768"></a>00768     value = s;
<a name="l00769"></a>00769 
<a name="l00770"></a>00770     <a class="code" href="namespacelibdap.html#a7edce266869606fc7bb46124f8d63809">downcase</a>(name);
<a name="l00771"></a>00771     <a class="code" href="namespacelibdap.html#a7edce266869606fc7bb46124f8d63809">downcase</a>(value);
<a name="l00772"></a>00772 }
<a name="l00773"></a>00773 
<a name="l00781"></a><a class="code" href="namespacelibdap.html#adf7e4c413496dc6047a0ea00855e78cb">00781</a> <span class="keywordtype">bool</span> <a class="code" href="namespacelibdap.html#adf7e4c413496dc6047a0ea00855e78cb">is_boundary</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *line, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;boundary)
<a name="l00782"></a>00782 {
<a name="l00783"></a>00783     <span class="keywordflow">if</span> (!(line[0] == <span class="charliteral">&#39;-&#39;</span> &amp;&amp; line[1] == <span class="charliteral">&#39;-&#39;</span>))
<a name="l00784"></a>00784         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00785"></a>00785     <span class="keywordflow">else</span> {
<a name="l00786"></a>00786         <span class="keywordflow">return</span> strncmp(line, boundary.c_str(), boundary.length()) == 0;
<a name="l00787"></a>00787     }
<a name="l00788"></a>00788 }
<a name="l00789"></a>00789 
<a name="l00798"></a><a class="code" href="namespacelibdap.html#ae06585f4af69dae8595002949b3e29f5">00798</a> <span class="keywordtype">string</span> <a class="code" href="namespacelibdap.html#ae06585f4af69dae8595002949b3e29f5">read_multipart_boundary</a>(FILE *in, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;boundary)
<a name="l00799"></a>00799 {
<a name="l00800"></a>00800     <span class="keywordtype">string</span> boundary_line = <a class="code" href="namespacelibdap.html#a138ad983bab51cd81239f2e3d0572486">get_next_mime_header</a>(in);
<a name="l00801"></a>00801     <span class="comment">// If the caller passed in a value for the boundary, test for that value,</span>
<a name="l00802"></a>00802     <span class="comment">// else just see that this line starts with &#39;--&#39;.</span>
<a name="l00803"></a>00803     <span class="comment">// The value of &#39;boundary_line&#39; is returned by this function.</span>
<a name="l00804"></a>00804     <span class="keywordflow">if</span> ((!boundary.empty() &amp;&amp; <a class="code" href="namespacelibdap.html#adf7e4c413496dc6047a0ea00855e78cb">is_boundary</a>(boundary_line.c_str(), boundary))
<a name="l00805"></a>00805             || boundary_line.find(<span class="stringliteral">&quot;--&quot;</span>) != 0)
<a name="l00806"></a>00806         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(
<a name="l00807"></a>00807                 <span class="stringliteral">&quot;The DAP4 data response document is broken - missing or malformed boundary.&quot;</span>);
<a name="l00808"></a>00808 
<a name="l00809"></a>00809     <span class="keywordflow">return</span> boundary_line;
<a name="l00810"></a>00810 }
<a name="l00811"></a>00811 
<a name="l00832"></a><a class="code" href="namespacelibdap.html#a96c1d42b551af831c26287053386e244">00832</a> <span class="keywordtype">void</span> <a class="code" href="namespacelibdap.html#a96c1d42b551af831c26287053386e244">read_multipart_headers</a>(FILE *in, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;content_type,
<a name="l00833"></a>00833         <span class="keyword">const</span> <a class="code" href="namespacelibdap.html#ae7466ed8496f06654ec276eac907c06a" title="The type of object in the stream coming from the data server.">ObjectType</a> object_type, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cid)
<a name="l00834"></a>00834 {
<a name="l00835"></a>00835     <span class="keywordtype">bool</span> ct = <span class="keyword">false</span>, cd = <span class="keyword">false</span>, ci = <span class="keyword">false</span>;
<a name="l00836"></a>00836 
<a name="l00837"></a>00837     <span class="keywordtype">string</span> header = <a class="code" href="namespacelibdap.html#a138ad983bab51cd81239f2e3d0572486">get_next_mime_header</a>(in);
<a name="l00838"></a>00838     <span class="keywordflow">while</span> (!header.empty()) {
<a name="l00839"></a>00839         <span class="keywordtype">string</span> name, value;
<a name="l00840"></a>00840         <a class="code" href="namespacelibdap.html#a3853818a415408fd980e8f3a9321d5d8">parse_mime_header</a>(header, name, value);
<a name="l00841"></a>00841 
<a name="l00842"></a>00842         <span class="keywordflow">if</span> (name ==<span class="stringliteral">&quot;content-type&quot;</span>) {
<a name="l00843"></a>00843             ct = <span class="keyword">true</span>;
<a name="l00844"></a>00844             <span class="keywordflow">if</span> (value.find(content_type) == string::npos)
<a name="l00845"></a>00845                 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;Content-Type for this part of a DAP4 data response must be &quot;</span> + content_type + <span class="stringliteral">&quot;.&quot;</span>);
<a name="l00846"></a>00846         }
<a name="l00847"></a>00847         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;content-description&quot;</span>) {
<a name="l00848"></a>00848             cd = <span class="keyword">true</span>;
<a name="l00849"></a>00849             <span class="keywordflow">if</span> (<a class="code" href="namespacelibdap.html#a284c1c548cbcea75bb1b7c8374dc04e9">get_description_type</a>(value) != object_type)
<a name="l00850"></a>00850                 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;Content-Description for this part of a DAP4 data response must be dap4-ddx or dap4-data-ddx&quot;</span>);
<a name="l00851"></a>00851         }
<a name="l00852"></a>00852         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (name == <span class="stringliteral">&quot;content-id&quot;</span>) {
<a name="l00853"></a>00853             ci = <span class="keyword">true</span>;
<a name="l00854"></a>00854             <span class="keywordflow">if</span> (!cid.empty() &amp;&amp; value != cid)
<a name="l00855"></a>00855                 <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;Content-Id mismatch. Expected: &quot;</span> + cid
<a name="l00856"></a>00856                         + <span class="stringliteral">&quot;, but got: &quot;</span> + value);
<a name="l00857"></a>00857         }
<a name="l00858"></a>00858 
<a name="l00859"></a>00859         header = <a class="code" href="namespacelibdap.html#a138ad983bab51cd81239f2e3d0572486">get_next_mime_header</a>(in);
<a name="l00860"></a>00860     }
<a name="l00861"></a>00861 
<a name="l00862"></a>00862     <span class="keywordflow">if</span> (!(ct &amp;&amp; cd &amp;&amp; ci))
<a name="l00863"></a>00863         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;The DAP4 data response document is broken - missing header.&quot;</span>);
<a name="l00864"></a>00864 }
<a name="l00872"></a><a class="code" href="namespacelibdap.html#a6267c527b6792dccd24212308645026f">00872</a> <span class="keywordtype">string</span> <a class="code" href="namespacelibdap.html#a6267c527b6792dccd24212308645026f">cid_to_header_value</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cid)
<a name="l00873"></a>00873 {
<a name="l00874"></a>00874     string::size_type offset = cid.find(<span class="stringliteral">&quot;cid:&quot;</span>);
<a name="l00875"></a>00875     <span class="keywordflow">if</span> (offset != 0)
<a name="l00876"></a>00876         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1Error.html" title="A class for error processing.">Error</a>(<span class="stringliteral">&quot;expected CID to start with &#39;cid:&#39;&quot;</span>);
<a name="l00877"></a>00877 
<a name="l00878"></a>00878     <span class="keywordtype">string</span> value = <span class="stringliteral">&quot;&lt;&quot;</span>;
<a name="l00879"></a>00879     value.append(cid.substr(offset + 4));
<a name="l00880"></a>00880     value.append(<span class="stringliteral">&quot;&gt;&quot;</span>);
<a name="l00881"></a>00881     <a class="code" href="namespacelibdap.html#a7edce266869606fc7bb46124f8d63809">downcase</a>(value);
<a name="l00882"></a>00882 
<a name="l00883"></a>00883     <span class="keywordflow">return</span> value;
<a name="l00884"></a>00884 }
<a name="l00885"></a>00885 
<a name="l00886"></a>00886 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00887"></a>00887 <span class="preprocessor"></span>
<a name="l00893"></a>00893 <span class="keywordtype">void</span>
<a name="l00894"></a>00894 <a class="code" href="namespacelibdap.html#ab2d00f30883d50ec4c6a7e48e489f8c0">set_mime_error</a>(FILE *out, <span class="keywordtype">int</span> code, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;reason,
<a name="l00895"></a>00895                <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;<a class="code" href="getdap_8cc.html#aa31f487a99743d24af9076a3e11e5425">version</a>)
<a name="l00896"></a>00896 {
<a name="l00897"></a>00897     fprintf(out, <span class="stringliteral">&quot;HTTP/1.0 %d %s%s&quot;</span>, code, reason.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00898"></a>00898     <span class="keywordflow">if</span> (version == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00899"></a>00899         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00900"></a>00900         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00901"></a>00901     }
<a name="l00902"></a>00902     <span class="keywordflow">else</span> {
<a name="l00903"></a>00903         fprintf(out, <span class="stringliteral">&quot;XDODS-Server: %s%s&quot;</span>, version.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00904"></a>00904         fprintf(out, <span class="stringliteral">&quot;XOPeNDAP-Server: %s%s&quot;</span>, version.c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00905"></a>00905     }
<a name="l00906"></a>00906     fprintf(out, <span class="stringliteral">&quot;XDAP: %s%s&quot;</span>, <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00907"></a>00907 
<a name="l00908"></a>00908     <span class="keyword">const</span> time_t t = time(0);
<a name="l00909"></a>00909     fprintf(out, <span class="stringliteral">&quot;Date: %s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00910"></a>00910     fprintf(out, <span class="stringliteral">&quot;Cache-Control: no-cache%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00911"></a>00911     fprintf(out, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00912"></a>00912 }
<a name="l00913"></a>00913 <span class="preprocessor">#endif</span>
<a name="l00914"></a>00914 <span class="preprocessor"></span>
<a name="l00921"></a>00921 <span class="keywordtype">void</span>
<a name="l00922"></a><a class="code" href="namespacelibdap.html#ab2d00f30883d50ec4c6a7e48e489f8c0">00922</a> <a class="code" href="namespacelibdap.html#ab2d00f30883d50ec4c6a7e48e489f8c0">set_mime_error</a>(ostream &amp;strm, <span class="keywordtype">int</span> code, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;reason,
<a name="l00923"></a>00923                <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;version)
<a name="l00924"></a>00924 {
<a name="l00925"></a>00925     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 &quot;</span> &lt;&lt; code &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; reason.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00926"></a>00926     <span class="keywordflow">if</span> (version == <span class="stringliteral">&quot;&quot;</span>) {
<a name="l00927"></a>00927         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00928"></a>00928         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#ab2eef76504098908aacbd5ec3433d93c">DVR</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00929"></a>00929     }
<a name="l00930"></a>00930     <span class="keywordflow">else</span> {
<a name="l00931"></a>00931         strm &lt;&lt; <span class="stringliteral">&quot;XDODS-Server: &quot;</span> &lt;&lt; version.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00932"></a>00932         strm &lt;&lt; <span class="stringliteral">&quot;XOPeNDAP-Server: &quot;</span> &lt;&lt; version.c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00933"></a>00933     }
<a name="l00934"></a>00934     strm &lt;&lt; <span class="stringliteral">&quot;XDAP: &quot;</span> &lt;&lt; <a class="code" href="config_8h.html#a9757f0cc77df1fd0759b1b91a9f63ff0">DAP_PROTOCOL_VERSION</a> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00935"></a>00935 
<a name="l00936"></a>00936     <span class="keyword">const</span> time_t t = time(0);
<a name="l00937"></a>00937     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00938"></a>00938     strm &lt;&lt; <span class="stringliteral">&quot;Cache-Control: no-cache&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00939"></a>00939     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00940"></a>00940 }
<a name="l00941"></a>00941 
<a name="l00942"></a>00942 <span class="preprocessor">#if FILE_METHODS</span>
<a name="l00943"></a>00943 <span class="preprocessor"></span>
<a name="l00949"></a>00949 <span class="keywordtype">void</span>
<a name="l00950"></a>00950 <a class="code" href="namespacelibdap.html#a9ff38622675d29e932726aea56525a40" title="Send a `Not Modified&amp;#39; response.">set_mime_not_modified</a>(FILE *out)
<a name="l00951"></a>00951 {
<a name="l00952"></a>00952     fprintf(out, <span class="stringliteral">&quot;HTTP/1.0 304 NOT MODIFIED%s&quot;</span>, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00953"></a>00953     <span class="keyword">const</span> time_t t = time(0);
<a name="l00954"></a>00954     fprintf(out, <span class="stringliteral">&quot;Date: %s%s&quot;</span>, <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str(), <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00955"></a>00955     fprintf(out, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>) ;
<a name="l00956"></a>00956 }
<a name="l00957"></a>00957 <span class="preprocessor">#endif</span>
<a name="l00958"></a>00958 <span class="preprocessor"></span>
<a name="l00965"></a>00965 <span class="keywordtype">void</span>
<a name="l00966"></a><a class="code" href="namespacelibdap.html#a9ff38622675d29e932726aea56525a40">00966</a> <a class="code" href="namespacelibdap.html#a9ff38622675d29e932726aea56525a40" title="Send a `Not Modified&amp;#39; response.">set_mime_not_modified</a>(ostream &amp;strm)
<a name="l00967"></a>00967 {
<a name="l00968"></a>00968     strm &lt;&lt; <span class="stringliteral">&quot;HTTP/1.0 304 NOT MODIFIED&quot;</span> &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00969"></a>00969     <span class="keyword">const</span> time_t t = time(0);
<a name="l00970"></a>00970     strm &lt;&lt; <span class="stringliteral">&quot;Date: &quot;</span> &lt;&lt; <a class="code" href="namespacelibdap.html#ac9f9538a83379c66933c2c40d90c268e">rfc822_date</a>(t).c_str() &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00971"></a>00971     strm &lt;&lt; <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a> ;
<a name="l00972"></a>00972 }
<a name="l00973"></a>00973 
<a name="l00982"></a>00982 <span class="keywordtype">bool</span>
<a name="l00983"></a><a class="code" href="namespacelibdap.html#a505f2ae07c56035f983661b3fbe927a0">00983</a> <a class="code" href="namespacelibdap.html#a505f2ae07c56035f983661b3fbe927a0">found_override</a>(<span class="keywordtype">string</span> name, <span class="keywordtype">string</span> &amp;doc)
<a name="l00984"></a>00984 {
<a name="l00985"></a>00985     ifstream ifs((name + <span class="stringliteral">&quot;.ovr&quot;</span>).c_str());
<a name="l00986"></a>00986     <span class="keywordflow">if</span> (!ifs)
<a name="l00987"></a>00987         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00988"></a>00988 
<a name="l00989"></a>00989     <span class="keywordtype">char</span> tmp[256];
<a name="l00990"></a>00990     doc = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00991"></a>00991     <span class="keywordflow">while</span> (!ifs.eof()) {
<a name="l00992"></a>00992         ifs.getline(tmp, 255);
<a name="l00993"></a>00993         strcat(tmp, <span class="stringliteral">&quot;\n&quot;</span>);
<a name="l00994"></a>00994         doc += tmp;
<a name="l00995"></a>00995     }
<a name="l00996"></a>00996 
<a name="l00997"></a>00997         ifs.close();
<a name="l00998"></a>00998     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00999"></a>00999 }
<a name="l01000"></a>01000 
<a name="l01009"></a>01009 <span class="keywordtype">bool</span>
<a name="l01010"></a><a class="code" href="namespacelibdap.html#a84080cf0736578f62620dde0fd3f2110">01010</a> <a class="code" href="namespacelibdap.html#a84080cf0736578f62620dde0fd3f2110" title="Read and discard the MIME header of the stream in.">remove_mime_header</a>(FILE *in)
<a name="l01011"></a>01011 {
<a name="l01012"></a>01012     <span class="keywordtype">char</span> tmp[256];
<a name="l01013"></a>01013     <span class="keywordflow">while</span> (!feof(in)) {
<a name="l01014"></a>01014         <span class="keywordtype">char</span> *s = fgets(tmp, 255, in);
<a name="l01015"></a>01015         <span class="keywordflow">if</span> (s &amp;&amp; strncmp(s, <a class="code" href="mime__util_8cc.html#a6cb23a858b0a21bdaa644b9181dc415f">CRLF</a>, 2) == 0)
<a name="l01016"></a>01016             <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01017"></a>01017     }
<a name="l01018"></a>01018 
<a name="l01019"></a>01019     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01020"></a>01020 }
<a name="l01021"></a>01021 
<a name="l01022"></a>01022 } <span class="comment">// namespace libdap</span>
<a name="l01023"></a>01023 
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="mime__util_8cc.html">mime_util.cc</a>      </li>
      <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>