📄 lib_4.0c_1.fix
字号:
extern BOOL HTRequest_removeDestination (HTRequest * dest);- extern BOOL HTRequest_destinationsReady (HTRequest * me); extern BOOL HTRequest_linkDestination (HTRequest * dest); extern BOOL HTRequest_unlinkDestination (HTRequest * dest);--- 199,204 ----diff -c Library/Repository/Implementation/HTSocket.c:2.19.2.1 Library/Repository/Implementation/HTSocket.c:2.19*** Library/Repository/Implementation/HTSocket.c:2.19.2.1 Tue Jan 23 16:31:32 1996--- Library/Repository/Implementation/HTSocket.c Tue Jan 23 16:31:33 1996****************** 114,121 **** net->cbf, net->priority); return HT_WOULD_BLOCK; } else { /* We have a real error */! HTRequest_addSystemError(request, ERR_FATAL, socerrno, NO,! "NETREAD"); return HT_ERROR; } } else if (!b_read) {--- 114,122 ---- net->cbf, net->priority); return HT_WOULD_BLOCK; } else { /* We have a real error */! if (PROT_TRACE)! TTYPrint(TDEST, "Read Socket. READ ERROR %d\n",! socerrno); return HT_ERROR; } } else if (!b_read) {diff -c Library/Repository/Implementation/HTTP.c:1.111.2.1 Library/Repository/Implementation/HTTP.c:1.111*** Library/Repository/Implementation/HTTP.c:1.111.2.1 Tue Jan 23 16:31:34 1996--- Library/Repository/Implementation/HTTP.c Tue Jan 23 16:31:34 1996****************** 61,69 **** HTTP_BEGIN = 0, HTTP_NEED_CONNECTION, HTTP_NEED_REQUEST,! HTTP_PERM_REDIRECT,! HTTP_TEMP_REDIRECT, HTTP_NOT_MODIFIED, HTTP_AA } HTTPState; --- 61,69 ---- HTTP_BEGIN = 0, HTTP_NEED_CONNECTION, HTTP_NEED_REQUEST,! HTTP_REDIRECTION, HTTP_NOT_MODIFIED,+ HTTP_EXPIRED, HTTP_AA } HTTPState; ****************** 104,112 **** http_info *http = (http_info *) net->context; /* Free stream with data TO network */! if (HTRequest_isDestination(req))! HTRequest_removeDestination(req);! else if (req->input_stream) { if (status == HT_INTERRUPTED) (*req->input_stream->isa->abort)(req->input_stream, NULL); else--- 104,110 ---- http_info *http = (http_info *) net->context; /* Free stream with data TO network */! if (!HTRequest_isDestination(req) && req->input_stream) { if (status == HT_INTERRUPTED) (*req->input_stream->isa->abort)(req->input_stream, NULL); else****************** 114,129 **** req->input_stream = NULL; } - /* Free user part of stream pipe if error */- if (!net->target && req->output_stream)- (*req->output_stream->isa->abort)(req->output_stream, NULL);- /* Remove the request object and our own context structure for http */! HTNet_delete(net, req->internal ? HT_IGNORE : status); FREE(http); return YES; } /* ** This is a big switch handling all HTTP return codes. It puts in any ** appropiate error message and decides whether we should expect data--- 112,163 ---- req->input_stream = NULL; } /* Remove the request object and our own context structure for http */! HTNet_delete(net, status); FREE(http); return YES; } + + PRIVATE BOOL HTTPAuthentication (HTRequest * request)+ {+ HTAAScheme scheme;+ HTList *valid_schemes = HTList_new();+ HTAssocList **scheme_specifics = NULL;+ char *tmplate = NULL;+ + if (request->WWWAAScheme) {+ if ((scheme = HTAAScheme_enum(request->WWWAAScheme)) != HTAA_UNKNOWN) {+ HTList_addObject(valid_schemes, (void *) scheme);+ if (!scheme_specifics) {+ int i;+ scheme_specifics = (HTAssocList**)+ malloc(HTAA_MAX_SCHEMES * sizeof(HTAssocList*));+ if (!scheme_specifics)+ outofmem(__FILE__, "HTTPAuthentication");+ for (i=0; i < HTAA_MAX_SCHEMES; i++)+ scheme_specifics[i] = NULL;+ }+ scheme_specifics[scheme] = HTAA_parseArgList(request->WWWAARealm);+ } else if (PROT_TRACE) {+ HTRequest_addError(request, ERR_INFO, NO, HTERR_UNKNOWN_AA,+ (void *) request->WWWAAScheme, 0, "HTTPAuthentication");+ return NO;+ }+ }+ if (request->WWWprotection) {+ if (PROT_TRACE)+ TTYPrint(TDEST, "Protection template set to `%s'\n",+ request->WWWprotection);+ StrAllocCopy(tmplate, request->WWWprotection);+ }+ request->valid_schemes = valid_schemes;+ request->scheme_specifics = scheme_specifics;+ request->prot_template = tmplate;+ return YES;+ }+ + /* ** This is a big switch handling all HTTP return codes. It puts in any ** appropiate error message and decides whether we should expect data****************** 135,183 **** case 0: /* 0.9 response */ case 200:- me->http->next = HTTP_GOT_DATA;- break;- case 201:- HTRequest_addError(me->request, ERR_INFO, NO, HTERR_CREATED,- me->reason, (int) strlen(me->reason),- "HTTPNextState");- me->http->next = HTTP_GOT_DATA;- break;- case 202:- HTRequest_addError(me->request, ERR_INFO, NO, HTERR_ACCEPTED,- me->reason, (int) strlen(me->reason),- "HTTPNextState");- me->http->next = HTTP_GOT_DATA;- break;- case 203:- HTRequest_addError(me->request, ERR_INFO, NO, HTERR_PARTIAL,- me->reason, (int) strlen(me->reason),- "HTTPNextState"); me->http->next = HTTP_GOT_DATA; break; case 204: /* No Response */- HTRequest_addError(me->request, ERR_INFO, NO, HTERR_NO_CONTENT,- me->reason, (int) strlen(me->reason),- "HTTPNextState"); me->http->next = HTTP_NO_DATA; break; case 301: /* Moved */- HTRequest_addError(me->request, ERR_INFO, NO, HTERR_MOVED,- me->reason, (int) strlen(me->reason),- "HTTPNextState");- me->http->next = HTTP_PERM_REDIRECT;- break;- case 302: /* Found */! HTRequest_addError(me->request, ERR_INFO, NO, HTERR_FOUND,! me->reason, (int) strlen(me->reason),! "HTTPNextState");! me->http->next = HTTP_TEMP_REDIRECT; break; case 303: /* Method */--- 169,187 ---- case 0: /* 0.9 response */ case 200: case 201: case 202: case 203: me->http->next = HTTP_GOT_DATA; break; case 204: /* No Response */ me->http->next = HTTP_NO_DATA; break; case 301: /* Moved */ case 302: /* Found */! me->http->next = HTTP_REDIRECTION; break; case 303: /* Method */****************** 188,196 **** break; case 304: /* Not Modified */- HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_NOT_MODIFIED,- me->reason, (int) strlen(me->reason),- "HTTPNextState"); me->http->next = HTTP_NOT_MODIFIED; break; --- 192,197 ----****************** 350,356 **** *ptr = '\0'; /* Set up the streams */! if (me->status==200) { HTStream *s; me->target = HTStreamStack(WWW_MIME, req->output_format, req->output_stream, req, NO);--- 351,357 ---- *ptr = '\0'; /* Set up the streams */! if (me->status==200 && req->method==METHOD_GET) { HTStream *s; me->target = HTStreamStack(WWW_MIME, req->output_format, req->output_stream, req, NO);****************** 492,499 **** int status = HT_ERROR; HTNet *net = request->net; /* Generic protocol information */ http_info *http; /* Specific protocol information */! HTParentAnchor *anchor = HTRequest_anchor(request);! /* ** Initiate a new http structure and bind to request structure ** This is actually state HTTP_BEGIN, but it can't be in the state--- 493,499 ---- int status = HT_ERROR; HTNet *net = request->net; /* Generic protocol information */ http_info *http; /* Specific protocol information */! /* ** Initiate a new http structure and bind to request structure ** This is actually state HTTP_BEGIN, but it can't be in the state****************** 501,516 **** */ if (ops == FD_NONE) { if (PROT_TRACE) TTYPrint(TDEST, "HTTP........ Looking for `%s\'\n",! HTAnchor_physical(anchor)); if ((http = (http_info *) calloc(1, sizeof(http_info))) == NULL) outofmem(__FILE__, "HTLoadHTTP"); http->state = HTTP_BEGIN; http->next = HTTP_ERROR; net->context = http; } else if (ops == FD_CLOSE) { /* Interrupted */! HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,! NULL, 0, "HTLoadHTTP");! HTTPCleanup(request, HT_INTERRUPTED); return HT_OK; } else http = (http_info *) net->context; /* Get existing copy */--- 501,521 ---- */ if (ops == FD_NONE) { if (PROT_TRACE) TTYPrint(TDEST, "HTTP........ Looking for `%s\'\n",! HTAnchor_physical(request->anchor)); if ((http = (http_info *) calloc(1, sizeof(http_info))) == NULL) outofmem(__FILE__, "HTLoadHTTP"); http->state = HTTP_BEGIN; http->next = HTTP_ERROR; net->context = http; } else if (ops == FD_CLOSE) { /* Interrupted */! #if 1! if (HTRequest_isPostWeb(request))! #else! if(HTRequest_isPostWeb(request)&&!HTRequest_isMainDestination(request))! #endif! HTTPCleanup(request, HT_IGNORE);! else! HTTPCleanup(request, HT_INTERRUPTED); return HT_OK; } else http = (http_info *) net->context; /* Get existing copy */****************** 538,544 **** break; case HTTP_NEED_CONNECTION: /* Now let's set up a connection */! status = HTDoConnect(net, HTAnchor_physical(anchor), HTTP_PORT); if (status == HT_OK) { --- 543,549 ---- break; case HTTP_NEED_CONNECTION: /* Now let's set up a connection */! status = HTDoConnect(net, HTAnchor_physical(request->anchor), HTTP_PORT); if (status == HT_OK) { ****************** 566,572 **** ** before all destinations are ready. If destination then ** register the input stream and get ready for read */! if (HTRequest_isDestination(request)) { HTEvent_Register(net->sockfd, request, (SockOps) FD_READ, HTLoadHTTP, net->priority); HTRequest_linkDestination(request);--- 571,577 ---- ** before all destinations are ready. If destination then ** register the input stream and get ready for read */! if (HTRequest_isPostWeb(request)) { HTEvent_Register(net->sockfd, request, (SockOps) FD_READ, HTLoadHTTP, net->priority); HTRequest_linkDestination(request);****************** 574,581 **** /* Set up stream FROM network and corresponding read buffer */ net->isoc = HTInputSocket_new(net->sockfd);- net->target = HTTPStatus_new(request, http); http->state = HTTP_NEED_REQUEST; } else if (status == HT_WOULD_BLOCK || status == HT_PERSISTENT) return HT_OK;--- 579,587 ---- /* Set up stream FROM network and corresponding read buffer */ net->isoc = HTInputSocket_new(net->sockfd); + /* @@@ USE STREAM STACK @@@ */+ net->target = HTTPStatus_new(request, http); http->state = HTTP_NEED_REQUEST; } else if (status == HT_WOULD_BLOCK || status == HT_PERSISTENT) return HT_OK;****************** 588,599 **** if (ops == FD_WRITE || ops == FD_NONE) { if (HTRequest_isDestination(request)) { HTNet *srcnet = request->source->net;! if (srcnet) {! HTEvent_Register(srcnet->sockfd, request->source,! (SockOps) FD_READ,! srcnet->cbf, srcnet->priority);! HTEvent_UnRegister(net->sockfd, FD_WRITE);! } return HT_OK; } status = request->PostCallback ?--- 594,603 ---- if (ops == FD_WRITE || ops == FD_NONE) { if (HTRequest_isDestination(request)) { HTNet *srcnet = request->source->net;! TTYPrint(TDEST,"File Serve. HERE!\n"); ! HTEvent_Register(srcnet->sockfd, request->source,! (SockOps) FD_READ,! srcnet->cbf, srcnet->priority); return HT_OK; } status = request->PostCallback ?****************** 609,614 ****--- 613,620 ---- return HT_OK; else if (status == HT_LOADED) http->state = http->next; /* Jump to next state */+ else if (status == HT_RELOAD)+ http->state = HTTP_EXPIRED; else http->state = HTTP_ERROR; } else {****************** 620,719 **** http->state = HTTP_ERROR; break; ! case HTTP_PERM_REDIRECT:! if (HTRequest_isPostWeb(request)) {! if (HTRequest_isDestination(request)) {! HTLink *link =! HTAnchor_findLink((HTAnchor *) request->source->anchor,! (HTAnchor *) anchor);! HTLink_setResult(link, HT_LINK_ERROR);! } HTRequest_killPostWeb(request);! }! HTTPCleanup(request, HT_PERM_REDIRECT);! return HT_OK;! break;! ! case HTTP_TEMP_REDIRECT:! if (HTRequest_isPostWeb(request)) {! if (HTRequest_isDestination(request)) {! HTLin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -