Annotation of libwww/Library/src/HTTP.c, revision 1.29
1.1 timbl 1: /* HyperText Tranfer Protocol - Client implementation HTTP.c
2: ** ==========================
1.2 timbl 3: **
4: ** Bugs:
5: ** Not implemented:
6: ** Forward
7: ** Redirection
8: ** Error handling
1.1 timbl 9: */
10:
11: /* Module parameters:
12: ** -----------------
13: **
14: ** These may be undefined and redefined by syspec.h
15: */
1.2 timbl 16:
17: /* Implements:
18: */
19: #include "HTTP.h"
20:
21: #define HTTP_VERSION "HTTP/1.0"
22: #define HTTP2 /* Version is greater than 0.9 */
23:
24: #define INIT_LINE_SIZE 1024 /* Start with line buffer this big */
25: #define LINE_EXTEND_THRESH 256 /* Minimum read size */
26: #define VERSION_LENGTH 20 /* for returned protocol version */
27:
28: /* Uses:
29: */
1.1 timbl 30: #include "HTParse.h"
31: #include "HTUtils.h"
32: #include "tcp.h"
33: #include "HTTCP.h"
34: #include "HTFormat.h"
1.2 timbl 35: #include <ctype.h>
36: #include "HTAlert.h"
37: #include "HTMIME.h"
1.5 timbl 38: #include "HTML.h" /* SCW */
39: #include "HTInit.h" /* SCW */
1.21 luotonen 40: #include "HTAccess.h" /* HTRequest */
1.14 luotonen 41: #include "HTAABrow.h" /* Access Authorization */
1.20 timbl 42: #include "HTTee.h" /* Tee off a cache stream */
43: #include "HTFWriter.h" /* Write to cache file */
1.1 timbl 44:
1.2 timbl 45: struct _HTStream {
46: HTStreamClass * isa; /* all we need to know */
47: };
48:
1.25 luotonen 49: #ifdef NeXT
1.26 luotonen 50: #include "sys/types.h"
51: #include "sys/stat.h"
1.25 luotonen 52: #define S_ISDIR(m) (m & S_IFDIR)
53: #define S_ISREG(m) (m & S_IFREG)
54: #endif
1.2 timbl 55:
1.6 timbl 56: extern char * HTAppName; /* Application name: please supply */
57: extern char * HTAppVersion; /* Application version: please supply */
58:
1.19 timbl 59: PUBLIC BOOL HTCacheHTTP = YES; /* Enable caching of HTTP-retrieved files */
1.23 luotonen 60:
61:
1.21 luotonen 62: PRIVATE void parse_401_headers ARGS2(HTRequest *, req,
63: HTInputSocket *, isoc)
64: {
65: HTAAScheme scheme;
66: char *line;
67: int num_schemes = 0;
68: HTList *valid_schemes = HTList_new();
69: HTAssocList **scheme_specifics = NULL;
70: char *template = NULL;
71:
72: /* Read server reply header lines */
73:
74: if (TRACE)
75: fprintf(stderr, "Server 401 reply header lines:\n");
76:
77: while (NULL != (line = HTInputSocket_getUnfoldedLine(isoc)) &&
78: *line != 0) {
79:
80: if (TRACE) fprintf(stderr, "%s\n", line);
81:
82: if (strchr(line, ':')) { /* Valid header line */
83:
84: char *p = line;
85: char *fieldname = HTNextField(&p);
86: char *arg1 = HTNextField(&p);
87: char *args = p;
88:
89: if (0==strcasecomp(fieldname, "WWW-Authenticate:")) {
90: if (HTAA_UNKNOWN != (scheme = HTAAScheme_enum(arg1))) {
91: HTList_addObject(valid_schemes, (void*)scheme);
92: if (!scheme_specifics) {
93: int i;
94: scheme_specifics = (HTAssocList**)
95: malloc(HTAA_MAX_SCHEMES * sizeof(HTAssocList*));
96: if (!scheme_specifics)
97: outofmem(__FILE__, "parse_401_headers");
98: for (i=0; i < HTAA_MAX_SCHEMES; i++)
99: scheme_specifics[i] = NULL;
100: }
101: scheme_specifics[scheme] = HTAA_parseArgList(args);
102: num_schemes++;
103: }
104: else if (TRACE) {
105: fprintf(stderr, "Unknown scheme `%s' %s\n",
106: (arg1 ? arg1 : "(null)"),
107: "in WWW-Authenticate: field");
108: }
109: }
110:
111: else if (0==strcasecomp(fieldname, "WWW-Protection-Template:")) {
112: if (TRACE)
113: fprintf(stderr, "Protection template set to `%s'\n", arg1);
114: StrAllocCopy(template, arg1);
115: }
116:
117: } /* if a valid header line */
118: else if (TRACE) {
119: fprintf(stderr, "Invalid header line `%s' ignored\n", line);
120: } /* else invalid header line */
121: } /* while header lines remain */
122:
123: req->valid_schemes = valid_schemes;
124: req->scheme_specifics = scheme_specifics;
125: req->prot_template = template;
126: }
127:
128:
129:
1.1 timbl 130: /* Load Document from HTTP Server HTLoadHTTP()
131: ** ==============================
132: **
133: ** Given a hypertext address, this routine loads a document.
134: **
135: **
136: ** On entry,
137: ** arg is the hypertext reference of the article to be loaded.
138: **
139: ** On exit,
140: ** returns >=0 If no error, a good socket number
141: ** <0 Error.
142: **
143: ** The socket must be closed by the caller after the document has been
144: ** read.
145: **
146: */
1.19 timbl 147: PUBLIC int HTLoadHTTP ARGS1 (HTRequest *, request)
1.1 timbl 148: {
1.22 luotonen 149: CONST char * arg = NULL;
1.1 timbl 150: int s; /* Socket number for returned data */
151: int status; /* tcp return */
1.10 timbl 152: char crlf[3]; /* A CR LF equivalent string */
1.3 timbl 153: HTStream * target = NULL; /* Unconverted data */
154:
1.2 timbl 155: CONST char* gate = 0; /* disable this feature */
1.1 timbl 156: SockA soc_address; /* Binary network address */
157: SockA * sin = &soc_address;
1.2 timbl 158: BOOL extensions = YES; /* Assume good HTTP server */
1.27 luotonen 159: char * cache_file_name = NULL;
1.17 timbl 160:
1.22 luotonen 161: if (request->reason == HTAA_OK_GATEWAY) {
162: arg = request->translated;
1.23 luotonen 163:
164: /*
165: ** Cache lookup
166: */
1.29 ! luotonen 167: #ifdef NOT_USED_YET
1.27 luotonen 168: if (request->method == METHOD_GET &&
169: !request->authorization &&
170: !request->arg_keywords) {
1.23 luotonen 171:
1.27 luotonen 172: if (HTCacheLookupOrCreate(arg, &cache_file_name)) {
1.23 luotonen 173:
1.27 luotonen 174: FILE * cache_file = fopen(cache_file_name, "r");
1.23 luotonen 175:
1.27 luotonen 176: if (cache_file) {
177: HTFileCopy(cache_file, request->output_stream);
178: fclose(cache_file);
179: free(cache_file_name);
180: (*request->output_stream->isa->free)(request->output_stream);
181: return HT_LOADED;
182: }
183: free(cache_file_name);
184: cache_file_name = NULL;
185: } /* Cache lookup */
186: } /* Can use cache? */
1.29 ! luotonen 187: #endif /* NOT_USED_YET */
1.27 luotonen 188: } /* I'm a gateway */
1.22 luotonen 189: else {
190: arg = HTAnchor_physical(request->anchor);
191: StrAllocCopy(request->argument, arg);
192: }
193:
1.1 timbl 194: if (!arg) return -3; /* Bad if no name sepcified */
195: if (!*arg) return -2; /* Bad if name had zero length */
196:
197: /* Set up defaults:
198: */
199: #ifdef DECNET
1.2 timbl 200: sin->sdn_family = AF_DECnet; /* Family = DECnet, host order */
201: sin->sdn_objnum = DNP_OBJ; /* Default: http object number */
1.1 timbl 202: #else /* Internet */
1.2 timbl 203: sin->sin_family = AF_INET; /* Family = internet, host order */
204: sin->sin_port = htons(TCP_PORT); /* Default: http port */
1.1 timbl 205: #endif
206:
1.10 timbl 207: sprintf(crlf, "%c%c", CR, LF); /* To be corect on Mac, VM, etc */
208:
1.1 timbl 209: if (TRACE) {
210: if (gate) fprintf(stderr,
211: "HTTPAccess: Using gateway %s for %s\n", gate, arg);
212: else fprintf(stderr, "HTTPAccess: Direct access for %s\n", arg);
213: }
214:
215: /* Get node name and optional port number:
216: */
217: {
218: char *p1 = HTParse(gate ? gate : arg, "", PARSE_HOST);
219: int status = HTParseInet(sin, p1); /* TBL 920622 */
220: free(p1);
221: if (status) return status; /* No such host for example */
222: }
223:
1.15 luotonen 224: /*
225: ** Compose authorization information (this was moved here
226: ** from after the making of the connection so that the connection
227: ** wouldn't have to wait while prompting username and password
228: ** from the user). -- AL 13.10.93
229: */
230: #ifdef ACCESS_AUTH
1.21 luotonen 231: HTAA_composeAuth(request);
232: if (TRACE) {
233: if (request->authorization)
234: fprintf(stderr, "HTTP: Sending Authorization: %s\n",
235: request->authorization);
236: else
237: fprintf(stderr, "HTTP: Not sending authorization (yet)\n");
1.15 luotonen 238: }
239: #endif /* ACCESS_AUTH */
1.1 timbl 240:
1.10 timbl 241: /* Now, let's get a socket set up from the server for the data:
1.1 timbl 242: */
243: #ifdef DECNET
244: s = socket(AF_DECnet, SOCK_STREAM, 0);
245: #else
246: s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
247: #endif
248: status = connect(s, (struct sockaddr*)&soc_address, sizeof(soc_address));
249: if (status < 0) {
250: if (TRACE) fprintf(stderr,
251: "HTTP: Unable to connect to remote host for `%s' (errno = %d).\n", arg, errno);
1.17 timbl 252:
1.1 timbl 253: return HTInetStatus("connect");
254: }
255:
256: if (TRACE) fprintf(stderr, "HTTP connected, socket %d\n", s);
257:
1.17 timbl 258:
259: /* Compose and send command
260: ** ------------------------
261: */
262: {
263: char *command; /* The whole command */
264:
1.1 timbl 265: /* Ask that node for the document,
266: ** omitting the host name & anchor if not gatewayed.
267: */
1.17 timbl 268: if (gate) {
269: command = malloc(4 + strlen(arg)+ 2 + 31);
270: if (command == NULL) outofmem(__FILE__, "HTLoadHTTP");
271: strcpy(command, "GET ");
272: strcat(command, arg);
273: } else { /* not gatewayed */
274: char * p1 = HTParse(arg, "", PARSE_PATH|PARSE_PUNCTUATION);
275: command = malloc(4 + strlen(p1)+ 2 + 31);
276: if (command == NULL) outofmem(__FILE__, "HTLoadHTTP");
1.23 luotonen 277: if (request->method != METHOD_INVALID) {
278: strcpy(command, HTMethod_name(request->method));
1.22 luotonen 279: strcat(command, " ");
280: }
281: else {
282: strcpy(command, "GET ");
283: }
1.17 timbl 284: strcat(command, p1);
285: free(p1);
286: }
1.2 timbl 287: #ifdef HTTP2
1.17 timbl 288: if (extensions) {
289: strcat(command, " ");
290: strcat(command, HTTP_VERSION);
291: }
1.2 timbl 292: #endif
1.17 timbl 293:
294: strcat(command, crlf); /* CR LF, as in rfc 977 */
295:
296: if (extensions) {
1.21 luotonen 297:
1.17 timbl 298: int i;
299: HTAtom * present = WWW_PRESENT;
300: char line[256]; /*@@@@ */
1.21 luotonen 301: HTList *conversions[2];
302:
1.22 luotonen 303: if (!HTConversions) {
304: HTConversions = HTList_new();
305: HTFormatInit(HTConversions);
306: }
1.28 timbl 307:
1.21 luotonen 308: conversions[0] = HTConversions;
309: conversions[1] = request->conversions;
310:
311: for (i=0; i<2; i++) {
312: HTList *cur = conversions[i];
313: HTPresentation *pres;
314:
315: while ((pres = (HTPresentation*)HTList_nextObject(cur))) {
316: if (pres->rep_out == present) {
317: if (pres->quality != 1.0) {
318: sprintf(line, "Accept: %s q=%.3f%c%c",
319: HTAtom_name(pres->rep),
320: pres->quality, CR, LF);
321: } else {
322: sprintf(line, "Accept: %s%c%c",
323: HTAtom_name(pres->rep), CR, LF);
324: }
325: StrAllocCat(command, line);
1.17 timbl 326: }
327: }
1.2 timbl 328: }
1.22 luotonen 329:
330: sprintf(line, "User-Agent: %s%s %s/%s libwww/%s%c%c",
331: request->user_agent ? request->user_agent : "",
332: request->user_agent ? " VIA Gateway" : "",
1.17 timbl 333: HTAppName ? HTAppName : "unknown",
334: HTAppVersion ? HTAppVersion : "0.0",
335: HTLibraryVersion, CR, LF);
336: StrAllocCat(command, line);
337:
1.22 luotonen 338: if (request->from) {
339: sprintf(line, "From: %s%c%c", request->from, CR, LF);
340: StrAllocCat(command, line);
341: }
342:
1.14 luotonen 343: #ifdef ACCESS_AUTH
1.21 luotonen 344: if (request->authorization != NULL) {
345: sprintf(line, "Authorization: %s%c%c",
346: request->authorization, CR, LF);
1.17 timbl 347: StrAllocCat(command, line);
348: }
349: #endif /* ACCESS_AUTH */
1.22 luotonen 350:
351: if (request->content_type) {
352: sprintf(line, "Content-Type: %s%c%c",
353: HTAtom_name(request->content_type), CR, LF);
354: StrAllocCat(command, line);
355: }
356:
357: if (request->content_length > 0) {
358: sprintf(line, "Content-Length: %d%c%c",
359: request->content_length, CR, LF);
360: StrAllocCat(command, line);
361: }
362:
363:
1.14 luotonen 364: }
1.17 timbl 365:
366: StrAllocCat(command, crlf); /* Blank line means "end" */
367:
368: if (TRACE) fprintf(stderr, "HTTP Tx: %s\n", command);
369:
370: /* Translate into ASCII if necessary
371: */
1.4 timbl 372: #ifdef NOT_ASCII
1.17 timbl 373: {
374: char * p;
375: for(p = command; *p; p++) {
376: *p = TOASCII(*p);
377: }
1.1 timbl 378: }
1.3 timbl 379: #endif
1.17 timbl 380:
381: status = NETWRITE(s, command, (int)strlen(command));
382: free(command);
383: if (status<0) {
384: if (TRACE) fprintf(stderr,
385: "HTTPAccess: Unable to send command.\n");
1.1 timbl 386: return HTInetStatus("send");
1.17 timbl 387: }
388: } /* compose and send command */
389:
1.2 timbl 390:
1.17 timbl 391: /* Read the response
392: ** -----------------
1.11 timbl 393: **
394: ** HTTP0 servers must return ASCII style text, though it can in
395: ** principle be just text without any markup at all.
396: ** Full HTTP servers must return a response
397: ** line and RFC822 style header. The response must therefore in
398: ** either case have a CRLF somewhere soon.
399: **
400: ** This is the theory. In practice, there are (1993) unfortunately
401: ** many binary documents just served up with HTTP0.9. This
402: ** means we have to preserve the binary buffer (on the assumption that
403: ** conversion from ASCII may lose information) in case it turns
404: ** out that we want the binary original.
1.2 timbl 405: */
1.3 timbl 406:
1.22 luotonen 407: if (request->reason == HTAA_OK_GATEWAY) {
1.24 luotonen 408:
1.22 luotonen 409: /*
410: ** Server as a gateway -- send body of the message
411: ** received from client (if any).
412: */
413: if (request->isoc && request->content_length > 0) {
414: int remain = request->content_length;
415: int i = remain;
416: char * buf;
417:
418: while (remain > 0 &&
419: (buf = HTInputSocket_getBlock(request->isoc, &i))) {
420: int status = NETWRITE(s, buf, i);
421: if (status < 0) {
1.27 luotonen 422: CTRACE(stderr, "HTTPAccess.. Unable to forward body\n");
1.22 luotonen 423: return HTInetStatus("send");
424: }
425: remain -= i;
426: i = remain;
427: }
428: }
1.23 luotonen 429:
430: /*
431: ** Cache the document if it a GET request,
432: ** not protected and not a search request.
433: */
1.27 luotonen 434: if (cache_file_name) {
435: FILE * cache_file = fopen(cache_file_name, "w");
1.23 luotonen 436:
1.27 luotonen 437: if (cache_file) {
438: request->output_stream = HTTee(request->output_stream,
439: HTFWriter_new(cache_file));
440: CTRACE(stderr, "Gateway..... writing to cache file\n");
441: }
442: else {
1.29 ! luotonen 443: #ifdef NOT_USED_YET
1.27 luotonen 444: HTCacheCancel(arg);
1.29 ! luotonen 445: #endif /* NOT_USED_YET */
1.27 luotonen 446: free(cache_file_name);
447: cache_file_name = NULL;
448: CTRACE(stderr, "Gateway..... couldn't create cache file\n");
1.23 luotonen 449: }
450: }
1.27 luotonen 451: else CTRACE(stderr, "Gateway..... not caching\n");
1.23 luotonen 452:
1.22 luotonen 453: /*
454: ** Load results directly to client
455: */
456: HTCopy(s, request->output_stream);
1.25 luotonen 457: (*request->output_stream->isa->free)(request->output_stream);
1.27 luotonen 458: if (cache_file_name) {
1.29 ! luotonen 459: #ifdef NOT_USED_YET
1.27 luotonen 460: HTCacheCreated(arg, (time_t)0);
1.29 ! luotonen 461: #endif /* NOT_USED_YET */
1.27 luotonen 462: free(cache_file_name);
1.24 luotonen 463: }
1.22 luotonen 464: return HT_LOADED;
465: }
466: else { /* read response */
1.21 luotonen 467:
1.17 timbl 468: HTFormat format_in; /* Format arriving in the message */
1.21 luotonen 469: HTInputSocket *isoc = HTInputSocket_new(s);
470: char * status_line = HTInputSocket_getStatusLine(isoc);
1.2 timbl 471:
1.11 timbl 472: /* Kludge to trap binary responses from illegal HTTP0.9 servers.
473: ** First time we have enough, look at the stub in ASCII
474: ** and get out of here if it doesn't look right.
475: **
476: ** We also check for characters above 128 in the first few bytes, and
477: ** if we find them we forget the html default.
478: **
479: ** Bugs: A HTTP0.9 server returning a document starting "HTTP/"
480: ** will be taken as a HTTP 1.0 server. Failure.
481: ** An HTTP 0.9 server returning a binary document with
482: ** characters < 128 will be read as ASCII.
483: */
1.21 luotonen 484: if (!status_line) { /* HTTP0 response */
485: if (HTInputSocket_seemsBinary(isoc)) {
486: format_in = HTAtom_for("www/unknown");
487: }
488: else {
489: format_in = WWW_HTML;
490: }
491: goto copy;
492: } /* end kludge */
493:
494: if (status_line) { /* Decode full HTTP response */
495: /*
496: ** We now have a terminated server status line, and we have
497: ** checked that it is most probably a legal one. Parse it.
498: */
499: char server_version[VERSION_LENGTH+1];
500: int server_status;
501:
502: if (TRACE)
503: fprintf(stderr, "HTTP Status Line: Rx: %.70s\n", status_line);
1.17 timbl 504:
1.21 luotonen 505: sscanf(status_line, "%20s%d", server_version, &server_status);
1.2 timbl 506:
1.21 luotonen 507: format_in = HTAtom_for("www/mime");
1.7 timbl 508:
1.21 luotonen 509: switch (server_status / 100) {
1.2 timbl 510:
1.21 luotonen 511: default: /* bad number */
512: HTAlert("Unknown status reply from server!");
513: break;
1.17 timbl 514:
1.21 luotonen 515: case 3: /* Various forms of redirection */
516: HTAlert(
1.17 timbl 517: "Redirection response from server is not handled by this client");
1.21 luotonen 518: break;
1.17 timbl 519:
1.21 luotonen 520: case 4: /* Access Authorization problem */
1.14 luotonen 521: #ifdef ACCESS_AUTH
1.21 luotonen 522: switch (server_status) {
523: case 401:
524: parse_401_headers(request, isoc);
525:
526: if (TRACE) fprintf(stderr, "%s %d %s\n",
527: "HTTP: close socket", s,
528: "to retry with Access Authorization");
529: HTInputSocket_free(isoc);
530: (void)NETCLOSE(s);
1.24 luotonen 531: if (HTAA_retryWithAuth(request, HTLoadHTTP)) {
1.21 luotonen 532: status = HT_LOADED;/* @@ THIS ONLY WORKS ON LINEMODE */
533: goto clean_up;
534: }
535: /* else falltrough */
536: default:
1.14 luotonen 537: {
1.21 luotonen 538: char *p1 = HTParse(gate ? gate : arg, "",
539: PARSE_HOST);
540: char * message;
541:
542: if (!(message = (char*)malloc(strlen(status_line) +
543: strlen(p1) + 100)))
544: outofmem(__FILE__, "HTTP 4xx status");
1.14 luotonen 545: sprintf(message,
1.21 luotonen 546: "HTTP server at %s replies:\n%s\n\n%s\n",
547: p1, status_line,
548: ((server_status == 401)
549: ? "Access Authorization package giving up.\n"
550: : ""));
1.22 luotonen 551: status = HTLoadError(request, server_status, message);
1.14 luotonen 552: free(message);
553: free(p1);
554: goto clean_up;
555: }
1.21 luotonen 556: } /* switch */
557: goto clean_up;
558: break;
559: #else
560: /* case 4 without Access Authorization falls through */
561: /* to case 5 (previously "I think I goofed"). -- AL */
562: #endif /* ACCESS_AUTH */
563:
564: case 5: /* I think you goofed */
565: {
566: char *p1 = HTParse(gate ? gate : arg, "", PARSE_HOST);
567: char * message = (char*)malloc(strlen(status_line) +
568: strlen(p1) + 100);
569: if (!message) outofmem(__FILE__, "HTTP 5xx status");
570: sprintf(message,
571: "HTTP server at %s replies:\n%s", p1, status_line);
1.22 luotonen 572: status = HTLoadError(request, server_status, message);
1.21 luotonen 573: free(message);
574: free(p1);
575: goto clean_up;
576: }
577: break;
1.17 timbl 578:
1.21 luotonen 579: case 2: /* Good: Got MIME object */
580: break;
1.17 timbl 581:
1.21 luotonen 582: } /* switch on response code */
1.17 timbl 583:
1.21 luotonen 584: } /* Full HTTP reply */
1.17 timbl 585:
586:
1.3 timbl 587: /* Set up the stream stack to handle the body of the message
588: */
1.21 luotonen 589:
1.13 duns 590: copy:
1.21 luotonen 591:
1.18 timbl 592: target = HTStreamStack(format_in, request);
1.21 luotonen 593:
1.17 timbl 594: if (!target) {
595: char buffer[1024]; /* @@@@@@@@ */
596: sprintf(buffer, "Sorry, no known way of converting %s to %s.",
597: HTAtom_name(format_in), HTAtom_name(request->output_format));
598: fprintf(stderr, "HTTP: %s", buffer);
1.22 luotonen 599: status = HTLoadError(request, 501, buffer);
1.17 timbl 600: goto clean_up;
601: }
602:
1.19 timbl 603: /* @@ Bug: The decision of whether or not to cache should also be
1.21 luotonen 604: ** made contingent on a IP address match or non match.
605: */
1.19 timbl 606: if (HTCacheHTTP) {
607: target = HTTee(target, HTCacheWriter(request, NULL, format_in,
1.21 luotonen 608: request->output_format,
609: request->output_stream));
1.19 timbl 610: }
611:
1.11 timbl 612: /* Push the data down the stream
1.3 timbl 613: ** We have to remember the end of the first buffer we just read
1.2 timbl 614: */
1.17 timbl 615: if (format_in == WWW_HTML) {
616: target = HTNetToText(target); /* Pipe through CR stripper */
617: }
1.21 luotonen 618:
1.17 timbl 619: (*target->isa->put_block)(target,
1.21 luotonen 620: isoc->input_pointer,
621: isoc->input_limit - isoc->input_pointer);
622: HTInputSocket_free(isoc);
1.17 timbl 623: HTCopy(s, target);
624:
625: (*target->isa->free)(target);
626: status = HT_LOADED;
1.11 timbl 627:
1.2 timbl 628: /* Clean up
1.1 timbl 629: */
1.17 timbl 630:
631: clean_up:
632: if (TRACE) fprintf(stderr, "HTTP: close socket %d.\n", s);
633: (void) NETCLOSE(s);
634:
635: return status; /* Good return */
1.3 timbl 636:
1.17 timbl 637: } /* read response */
638: } /* load HTTP */
1.1 timbl 639:
640: /* Protocol descriptor
641: */
642:
1.17 timbl 643: GLOBALDEF PUBLIC HTProtocol HTTP = { "http", HTLoadHTTP, 0, 0 };
1.21 luotonen 644:
Webmaster