#include "squid.h"
#include "comm.h"
#include "comm/Read.h"
#include "comm/Write.h"
#include "errorpage.h"
#include "fd.h"
#include "FwdState.h"
#include "globals.h"
#include "html_quote.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "MemBuf.h"
#include "mime.h"
#include "parser/Tokenizer.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
#include "tools.h"
#include "DelayPools.h"
#include "MemObject.h"

Go to the source code of this file.
Classes | |
class | GopherStateData |
Macros | |
#define | GOPHER_FILE '0' |
#define | GOPHER_DIRECTORY '1' |
#define | GOPHER_CSO '2' |
#define | GOPHER_ERROR '3' |
#define | GOPHER_MACBINHEX '4' |
#define | GOPHER_DOSBIN '5' |
#define | GOPHER_UUENCODED '6' |
#define | GOPHER_INDEX '7' |
#define | GOPHER_TELNET '8' |
#define | GOPHER_BIN '9' |
#define | GOPHER_REDUNT '+' |
#define | GOPHER_3270 'T' |
#define | GOPHER_GIF 'g' |
#define | GOPHER_IMAGE 'I' |
#define | GOPHER_HTML 'h' |
#define | GOPHER_INFO 'i' |
#define | GOPHER_WWW 'w' |
W3 address. More... | |
#define | GOPHER_SOUND 's' |
#define | GOPHER_PLUS_IMAGE ':' |
#define | GOPHER_PLUS_MOVIE ';' |
#define | GOPHER_PLUS_SOUND '<' |
#define | GOPHER_PORT 70 |
#define | TAB '\t' |
#define | TEMP_BUF_SIZE 4096 |
#define | MAX_CSO_RESULT 1024 |
Functions | |
static void | gopherMimeCreate (GopherStateData *) |
static void | gopher_request_parse (const HttpRequest *req, char *type_id, char *request) |
static void | gopherEndHTML (GopherStateData *) |
static void | gopherToHTML (GopherStateData *, char *inbuf, int len) |
static void | gopherStateFree (const CommCloseCbParams ¶ms) |
int | gopherCachable (const HttpRequest *req) |
static void | gopherHTMLHeader (StoreEntry *e, const char *title, const char *substring) |
static void | gopherHTMLFooter (StoreEntry *e) |
static void | gopherTimeout (const CommTimeoutCbParams &io) |
static void | gopherReadReply (const Comm::ConnectionPointer &conn, char *buf, size_t len, Comm::Flag flag, int xerrno, void *data) |
static void | gopherSendComplete (const Comm::ConnectionPointer &conn, char *, size_t size, Comm::Flag errflag, int xerrno, void *data) |
static void | gopherSendRequest (int, void *data) |
void | gopherStart (FwdState *fwd) |
Variables | |
static CLCB | gopherStateFree |
static CTCB | gopherTimeout |
static IOCB | gopherReadReply |
static IOCB | gopherSendComplete |
static PF | gopherSendRequest |
static char | def_gopher_bin [] = "www/unknown" |
static char | def_gopher_text [] = "text/plain" |
Macro Definition Documentation
◆ GOPHER_3270
◆ GOPHER_BIN
◆ GOPHER_CSO
◆ GOPHER_DIRECTORY
◆ GOPHER_DOSBIN
◆ GOPHER_ERROR
◆ GOPHER_FILE
◆ GOPHER_GIF
◆ GOPHER_HTML
◆ GOPHER_IMAGE
◆ GOPHER_INDEX
◆ GOPHER_INFO
◆ GOPHER_MACBINHEX
◆ GOPHER_PLUS_IMAGE
◆ GOPHER_PLUS_MOVIE
◆ GOPHER_PLUS_SOUND
◆ GOPHER_PORT
◆ GOPHER_REDUNT
◆ GOPHER_SOUND
◆ GOPHER_TELNET
◆ GOPHER_UUENCODED
◆ GOPHER_WWW
◆ MAX_CSO_RESULT
◆ TAB
◆ TEMP_BUF_SIZE
Function Documentation
◆ gopher_request_parse()
|
static |
Parse a gopher request into components. By Anawat.
Definition at line 259 of file gopher.cc.
References GOPHER_DIRECTORY, MAX_URL, AnyP::Uri::path(), request(), rfc1738_unescape(), SBufToCstring(), and HttpRequest::url.
Referenced by gopherCachable(), and gopherStart().
◆ gopherEndHTML()
|
static |
Definition at line 348 of file gopher.cc.
References GopherStateData::entry, gopherHTMLFooter(), gopherHTMLHeader(), GopherStateData::HTML_header_added, GopherStateData::HTML_pre, NULL, and storeAppendPrintf().
Referenced by gopherReadReply().
◆ gopherHTMLFooter()
|
static |
Definition at line 336 of file gopher.cc.
References getMyHostname(), mkrfc1123(), squid_curtime, storeAppendPrintf(), and visible_appname_string.
Referenced by gopherEndHTML(), and gopherToHTML().
◆ gopherHTMLHeader()
|
static |
Definition at line 323 of file gopher.cc.
References storeAppendPrintf().
Referenced by gopherEndHTML(), and gopherToHTML().
◆ gopherMimeCreate()
|
static |
Create MIME Header for Gopher Data
Definition at line 181 of file gopher.cc.
References assert, StoreEntry::buffer(), Http::CONTENT_ENCODING, def_gopher_bin, def_gopher_text, GopherStateData::entry, GOPHER_BIN, GOPHER_CSO, GOPHER_DIRECTORY, GOPHER_DOSBIN, GOPHER_FILE, GOPHER_GIF, GOPHER_HTML, GOPHER_IMAGE, GOPHER_INDEX, GOPHER_MACBINHEX, GOPHER_PLUS_IMAGE, GOPHER_PLUS_MOVIE, GOPHER_PLUS_SOUND, GOPHER_SOUND, GOPHER_UUENCODED, GOPHER_WWW, Http::Message::header, StoreEntry::isEmpty(), mimeGetContentEncoding(), mimeGetContentType(), NULL, HttpHeader::putStr(), StoreEntry::replaceHttpReply(), GopherStateData::reply_, GopherStateData::request, Http::scOkay, HttpReply::setHeaders(), and GopherStateData::type_id.
Referenced by gopherSendComplete(), and gopherStart().
◆ gopherReadReply()
|
static |
This will be called when data is ready to be read from fd. Read until error or connection closed.
Definition at line 724 of file gopher.cc.
References FwdState::al, StatCounters::all, StoreEntry::append(), assert, HierarchyLogEntry::bodyBytesRead, buf, BUFSIZ, DelayId::bytesIn(), DelayId::bytesWanted(), Comm::Connection::close(), comm_read(), commCbCall(), commSetConnTimeout(), FwdState::complete(), Config, conn, GopherStateData::conversion, data, DBG_IMPORTANT, debugs, EBIT_TEST, GopherStateData::entry, ENTRY_ABORTED, Comm::ERR_CLOSING, ERR_READ_ERROR, ERR_ZERO_SIZE_OBJECT, FwdState::fail(), StoreEntry::flags, StoreEntry::flush(), GopherStateData::fwd, IoStats::Gopher, gopherEndHTML(), gopherReadReply, gopherToHTML(), HERE(), HttpRequest::hier, ignoreErrno(), IOStats, StoreEntry::isEmpty(), len, StoreEntry::mem_obj, MemObject::mostBytesAllowed(), MYNAME, Store::nil, GopherStateData::NORMAL, Comm::OK, StatCounters::other, SquidConfig::read, IoStats::read_hist, IoStats::reads, GopherStateData::reply_, GopherStateData::replybuf, FwdState::request, Http::scInternalServerError, Http::scServiceUnavailable, StatCounters::server, GopherStateData::serverConn, Http::Message::sources, Http::Message::srcGopher, statCounter, SquidConfig::Timeout, StoreEntry::timestampsSet(), and xstrerr().
◆ gopherSendComplete()
|
static |
This will be called when request write is complete. Schedule read of reply.
Definition at line 828 of file gopher.cc.
References FwdState::al, StatCounters::all, StoreEntry::buffer(), BUFSIZ, Comm::Connection::close(), commCbCall(), conn, GopherStateData::conversion, GopherStateData::cso_recno, data, debugs, StoreEntry::delayAwareRead(), GopherStateData::entry, ERR_WRITE_ERROR, FwdState::fail(), fd_bytes(), FD_WRITE, StoreEntry::flush(), GopherStateData::fwd, GOPHER_CSO, GOPHER_DIRECTORY, GOPHER_INDEX, gopherMimeCreate(), gopherReadReply, HERE(), GopherStateData::HTML_CSO_RESULT, GopherStateData::HTML_DIR, GopherStateData::HTML_header_added, GopherStateData::HTML_INDEX_RESULT, GopherStateData::NORMAL, StatCounters::other, AnyP::Uri::port(), GopherStateData::replybuf, FwdState::request, Http::scServiceUnavailable, StatCounters::server, GopherStateData::serverConn, size, statCounter, GopherStateData::type_id, HttpRequest::url, StoreEntry::url(), and xstrdup.
◆ gopherSendRequest()
|
static |
This will be called when connect completes. Write request.
Definition at line 894 of file gopher.cc.
References MemBuf::append(), Packable::appendf(), commCbCall(), data, debugs, GopherStateData::entry, GOPHER_CSO, GOPHER_INDEX, gopherSendComplete, MemBuf::init(), StoreEntry::makePrivate(), StoreEntry::makePublic(), GopherStateData::request, GopherStateData::serverConn, GopherStateData::type_id, and Comm::Write().
◆ gopherStateFree()
|
static |
Definition at line 148 of file gopher.cc.
References CommCommonCbParams::data, GopherStateData::deleteThis(), and NULL.
◆ gopherTimeout()
|
static |
Definition at line 708 of file gopher.cc.
References FwdState::al, Comm::Connection::close(), CommCommonCbParams::conn, CommCommonCbParams::data, debugs, GopherStateData::entry, ERR_READ_TIMEOUT, FwdState::fail(), GopherStateData::fwd, HERE(), Comm::IsConnOpen(), FwdState::request, Http::scGatewayTimeout, and StoreEntry::url().
◆ gopherToHTML()
|
static |
Convert Gopher to HTML.
Borrow part of code from libwww2 came with Mosaic distribution.
Definition at line 368 of file gopher.cc.
References StoreEntry::append(), String::append(), GopherStateData::buf, String::clean(), code, GopherStateData::conversion, GopherStateData::cso_recno, DBG_IMPORTANT, debugs, GopherStateData::entry, StoreEntry::flush(), GOPHER_3270, GOPHER_BIN, GOPHER_CSO, GOPHER_DIRECTORY, GOPHER_DOSBIN, GOPHER_FILE, GOPHER_GIF, GOPHER_HTML, GOPHER_IMAGE, GOPHER_INDEX, GOPHER_INFO, GOPHER_MACBINHEX, GOPHER_PLUS_IMAGE, GOPHER_PLUS_MOVIE, GOPHER_PLUS_SOUND, GOPHER_SOUND, GOPHER_TELNET, GOPHER_UUENCODED, gopherHTMLFooter(), gopherHTMLHeader(), GopherStateData::HTML_CSO_PAGE, GopherStateData::HTML_CSO_RESULT, GopherStateData::HTML_DIR, GopherStateData::HTML_header_added, GopherStateData::HTML_INDEX_PAGE, GopherStateData::HTML_INDEX_RESULT, GopherStateData::HTML_pre, html_quote(), GopherStateData::len, len, LOCAL_ARRAY, mimeGetIconURL(), NULL, port, String::rawBuf(), rfc1738_escape_part, rfc1738_escape_unescaped, safe_free, String::size(), storeAppendPrintf(), TAB, TEMP_BUF_SIZE, StoreEntry::url(), and xstrdup.
Referenced by gopherReadReply(), and gopherStart().
Variable Documentation
◆ def_gopher_bin
|
static |
Definition at line 143 of file gopher.cc.
Referenced by gopherMimeCreate().
◆ def_gopher_text
|
static |
Definition at line 145 of file gopher.cc.
Referenced by gopherMimeCreate().
◆ gopherReadReply
|
static |
Definition at line 139 of file gopher.cc.
Referenced by gopherReadReply(), and gopherSendComplete().
◆ gopherSendComplete
|
static |
Definition at line 140 of file gopher.cc.
Referenced by gopherSendRequest().
◆ gopherSendRequest
|
static |
Definition at line 141 of file gopher.cc.
Referenced by gopherStart().
◆ gopherStateFree
|
static |
Definition at line 131 of file gopher.cc.
Referenced by gopherStart().
◆ gopherTimeout
|
static |
Definition at line 138 of file gopher.cc.
Referenced by gopherStart().