Server-Side Gopher Internals
[Server-Side Gopher API]
|
Classes | |
| struct | gopher_ds |
Defines | |
| #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' |
| #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 |
Typedefs | |
| typedef struct gopher_ds | GopherStateData |
Functions | |
| static void | gopherStateFree (int fdnotused, void *data) |
| static void | gopherMimeCreate (GopherStateData *) |
| static void | gopher_request_parse (const HttpRequest *req, char *type_id, char *request) |
| static void | gopherHTMLHeader (StoreEntry *e, const char *title, const char *substring) |
| static void | gopherHTMLFooter (StoreEntry *e) |
| static void | gopherEndHTML (GopherStateData *gopherState) |
| static void | gopherToHTML (GopherStateData *, char *inbuf, int len) |
| static void | gopherTimeout (int fd, void *data) |
| static void | gopherReadReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data) |
| static void | gopherSendComplete (int fd, char *buf, size_t size, comm_err_t errflag, int xerrno, void *data) |
| static void | gopherSendRequest (int fd, void *data) |
| CBDATA_TYPE (GopherStateData) | |
Variables | |
| static char | def_gopher_bin [] = "www/unknown" |
| static char | def_gopher_text [] = "text/plain" |
Detailed Description
Gopher is somewhat complex and gross because it must convert from the Gopher protocol to HTTP.
Define Documentation
| #define GOPHER_3270 'T' |
Definition at line 82 of file gopher.cc.
Referenced by gopherToHTML().
| #define GOPHER_BIN '9' |
Definition at line 78 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_CSO '2' |
Definition at line 64 of file gopher.cc.
Referenced by gopherMimeCreate(), gopherSendComplete(), gopherSendRequest(), and gopherToHTML().
| #define GOPHER_DIRECTORY '1' |
Definition at line 62 of file gopher.cc.
Referenced by gopher_request_parse(), gopherMimeCreate(), gopherSendComplete(), and gopherToHTML().
| #define GOPHER_DOSBIN '5' |
Definition at line 70 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_FILE '0' |
Definition at line 60 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_GIF 'g' |
Definition at line 84 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_HTML 'h' |
Definition at line 89 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_IMAGE 'I' |
Definition at line 86 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_INDEX '7' |
Definition at line 74 of file gopher.cc.
Referenced by gopherMimeCreate(), gopherSendComplete(), gopherSendRequest(), and gopherToHTML().
| #define GOPHER_INFO 'i' |
Definition at line 91 of file gopher.cc.
Referenced by gopherToHTML().
| #define GOPHER_MACBINHEX '4' |
Definition at line 68 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_PLUS_IMAGE ':' |
Definition at line 101 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_PLUS_MOVIE ';' |
Definition at line 103 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_PLUS_SOUND '<' |
Definition at line 105 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_SOUND 's' |
Definition at line 98 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_TELNET '8' |
Definition at line 76 of file gopher.cc.
Referenced by gopherToHTML().
| #define GOPHER_UUENCODED '6' |
Definition at line 72 of file gopher.cc.
Referenced by gopherMimeCreate(), and gopherToHTML().
| #define GOPHER_WWW 'w' |
| #define TAB '\t' |
Definition at line 111 of file gopher.cc.
Referenced by gopherToHTML().
| #define TEMP_BUF_SIZE 4096 |
- Todo:
- CODE: should this be a protocol-specific thing?
Definition at line 114 of file gopher.cc.
Referenced by gopherToHTML().
Typedef Documentation
| typedef struct gopher_ds GopherStateData |
Function Documentation
| CBDATA_TYPE | ( | GopherStateData | ) |
| static void gopher_request_parse | ( | const HttpRequest * | req, | |
| char * | type_id, | |||
| char * | request | |||
| ) | [static] |
Parse a gopher request into components. By Anawat.
Definition at line 266 of file gopher.cc.
References GOPHER_DIRECTORY, MAX_URL, rfc1738_unescape(), String::termedBuf(), HttpRequest::urlpath, and xstrncpy().
| static void gopherEndHTML | ( | GopherStateData * | gopherState | ) | [static] |
Definition at line 356 of file gopher.cc.
References gopher_ds::entry, gopherHTMLFooter(), gopherHTMLHeader(), gopher_ds::HTML_header_added, gopher_ds::HTML_pre, NULL, and storeAppendPrintf().
Referenced by gopherReadReply().
| static void gopherHTMLFooter | ( | StoreEntry * | e | ) | [static] |
Definition at line 343 of file gopher.cc.
References getMyHostname(), mkrfc1123(), squid_curtime, storeAppendPrintf(), and visible_appname_string.
Referenced by gopherEndHTML(), and gopherToHTML().
| static void gopherHTMLHeader | ( | StoreEntry * | e, | |
| const char * | title, | |||
| const char * | substring | |||
| ) | [static] |
Definition at line 329 of file gopher.cc.
References storeAppendPrintf().
Referenced by gopherEndHTML(), and gopherToHTML().
| static void gopherMimeCreate | ( | GopherStateData * | gopherState | ) | [static] |
Create MIME Header for Gopher Data
Definition at line 187 of file gopher.cc.
References assert, StoreEntry::buffer(), def_gopher_bin, def_gopher_text, EBIT_CLR, gopher_ds::entry, ENTRY_FWD_HDR_WAIT, StoreEntry::flags, 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, HDR_CONTENT_ENCODING, HttpMsg::header, HTTP_OK, StoreEntry::isEmpty(), mimeGetContentEncoding(), mimeGetContentType(), NULL, HttpHeader::putStr(), StoreEntry::replaceHttpReply(), gopher_ds::request, HttpReply::setHeaders(), and gopher_ds::type_id.
Referenced by gopherSendComplete().
| static void gopherReadReply | ( | int | fd, | |
| char * | buf, | |||
| size_t | len, | |||
| comm_err_t | flag, | |||
| int | xerrno, | |||
| void * | data | |||
| ) | [static] |
This will be called when data is ready to be read from fd. Read until error or connection closed.
Definition at line 770 of file gopher.cc.
References _StatCounters::all, StoreEntry::append(), assert, BUFSIZ, DelayId::bytesIn(), DelayId::bytesWanted(), comm_close, COMM_ERR_CLOSING, COMM_OK, comm_read(), commSetTimeout(), Config, gopher_ds::conversion, debugs, EBIT_TEST, gopher_ds::entry, ENTRY_ABORTED, ERR_READ_ERROR, ERR_ZERO_SIZE_OBJECT, errno, errorCon(), StoreEntry::flags, StoreEntry::flush(), gopher_ds::fwd, _iostats::Gopher, gopherEndHTML(), gopherReadReply, gopherToHTML(), HTTP_INTERNAL_SERVER_ERROR, HTTP_SERVICE_UNAVAILABLE, ignoreErrno(), IOStats, StoreEntry::isEmpty(), kb_incr(), StoreEntry::mem_obj, MemObject::mostBytesAllowed(), gopher_ds::NORMAL, NULL, _StatCounters::other, SquidConfig::read, _iostats::read_hist, _iostats::reads, gopher_ds::replybuf, _StatCounters::server, statCounter, SquidConfig::Timeout, StoreEntry::timestampsSet(), ErrorState::xerrno, and xstrerror().
| static void gopherSendComplete | ( | int | fd, | |
| char * | buf, | |||
| size_t | size, | |||
| comm_err_t | errflag, | |||
| int | xerrno, | |||
| void * | data | |||
| ) | [static] |
This will be called when request write is complete. Schedule read of reply.
Definition at line 879 of file gopher.cc.
References _StatCounters::all, StoreEntry::buffer(), BUFSIZ, comm_close, commCbCall(), gopher_ds::conversion, gopher_ds::cso_recno, debugs, StoreEntry::delayAwareRead(), gopher_ds::entry, ERR_WRITE_ERROR, errno, errorCon(), fd_bytes(), FD_WRITE, StoreEntry::flush(), gopher_ds::fwd, GOPHER_CSO, GOPHER_DIRECTORY, GOPHER_INDEX, gopherMimeCreate(), gopherReadReply, gopher_ds::HTML_CSO_RESULT, gopher_ds::HTML_DIR, gopher_ds::HTML_header_added, gopher_ds::HTML_INDEX_RESULT, HTTP_SERVICE_UNAVAILABLE, kb_incr(), MEM_4K_BUF, memFree(), gopher_ds::NORMAL, _StatCounters::other, HttpRequest::port, ErrorState::port, gopher_ds::replybuf, gopher_ds::req, _StatCounters::server, statCounter, gopher_ds::type_id, StoreEntry::url(), ErrorState::url, ErrorState::xerrno, and xstrdup().
| static void gopherSendRequest | ( | int | fd, | |
| void * | data | |||
| ) | [static] |
This will be called when connect completes. Write request.
Definition at line 954 of file gopher.cc.
References comm_write(), debugs, EBIT_TEST, gopher_ds::entry, ENTRY_CACHABLE, StoreEntry::flags, GOPHER_CSO, GOPHER_INDEX, gopherSendComplete, MEM_4K_BUF, memAllocate(), NULL, gopher_ds::request, StoreEntry::setPublicKey(), and gopher_ds::type_id.
| static void gopherStateFree | ( | int | fdnotused, | |
| void * | data | |||
| ) | [static] |
Definition at line 162 of file gopher.cc.
References gopher_ds::buf, cbdataFree, gopher_ds::entry, gopher_ds::fwd, HTTPMSGUNLOCK, MEM_4K_BUF, memFree(), NULL, gopher_ds::req, and StoreEntry::unlock().
| static void gopherTimeout | ( | int | fd, | |
| void * | data | |||
| ) | [static] |
Definition at line 753 of file gopher.cc.
References comm_close, debugs, gopher_ds::entry, ERR_READ_TIMEOUT, errorCon(), gopher_ds::fwd, HTTP_GATEWAY_TIMEOUT, and StoreEntry::url().
| static void gopherToHTML | ( | GopherStateData * | gopherState, | |
| char * | inbuf, | |||
| int | len | |||
| ) | [static] |
Convert Gopher to HTML.
- Borrow part of code from libwww2 came with Mosaic distribution.
Definition at line 377 of file gopher.cc.
References StoreEntry::append(), String::append(), gopher_ds::buf, String::clean(), code, gopher_ds::conversion, gopher_ds::cso_recno, debugs, gopher_ds::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(), gopher_ds::HTML_CSO_PAGE, gopher_ds::HTML_CSO_RESULT, gopher_ds::HTML_DIR, gopher_ds::HTML_header_added, gopher_ds::HTML_INDEX_PAGE, gopher_ds::HTML_INDEX_RESULT, gopher_ds::HTML_pre, html_quote(), gopher_ds::len, LOCAL_ARRAY, mimeGetIconURL(), name, NULL, port, String::rawBuf(), rfc1738_escape_part, rfc1738_escape_unescaped, safe_free, String::size(), storeAppendPrintf(), TAB, TEMP_BUF_SIZE, StoreEntry::url(), xstrdup(), and xstrncpy().
Referenced by gopherReadReply().
Variable Documentation
char def_gopher_bin[] = "www/unknown" [static] |
Definition at line 155 of file gopher.cc.
Referenced by gopherMimeCreate().
char def_gopher_text[] = "text/plain" [static] |
Definition at line 158 of file gopher.cc.
Referenced by gopherMimeCreate().
Search
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Help Out
- Getting Squid
- Donate
- Squid Deployment Case-Studies
Documentation
- FAQ | Wiki | Book
- Configuration Reference
- Configuration Guide - Visolve
- Configuration Examples
- Users guide
- Non-English
- Security Advisories
- More...
Support
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products
