cvs commit: apache/src httpd.h http_protocol.c http_request.c mod_asis.c

1996-10-16 Thread Roy Fielding
fielding96/10/16 16:24:37

  Modified:src   httpd.h http_protocol.c http_request.c mod_asis.c
  Log:
  Reduced dependency on magic number status codes in server core
  and removed artificial restrictions on range of codes used by server,
  particularly in mod_asis where flexibility is paramount.
  Many other modules continue to use magic numbers, but those can wait.
  
  Revision  ChangesPath
  1.55  +9 -1  apache/src/httpd.h
  
  Index: httpd.h
  ===
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -C3 -r1.54 -r1.55
  *** httpd.h   1996/10/13 13:35:29 1.54
  --- httpd.h   1996/10/16 23:24:32 1.55
  ***
  *** 50,56 
 *
 */

  ! /* $Id: httpd.h,v 1.54 1996/10/13 13:35:29 ben Exp $ */

/*
 * httpd.h: header for simple (ha! not anymore) http daemon
  --- 50,56 
 *
 */

  ! /* $Id: httpd.h,v 1.55 1996/10/16 23:24:32 fielding Exp $ */

/*
 * httpd.h: header for simple (ha! not anymore) http daemon
  ***
  *** 312,317 
  --- 312,325 
#define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED
#define BAD_GATEWAY HTTP_BAD_GATEWAY
#define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
  + 
  + #define is_HTTP_INFO(x) ((x >= 100)&&(x < 200))
  + #define is_HTTP_SUCCESS(x)  ((x >= 200)&&(x < 300))
  + #define is_HTTP_REDIRECT(x) ((x >= 300)&&(x < 400))
  + #define is_HTTP_ERROR(x)((x >= 400)&&(x < 600))
  + #define is_HTTP_CLIENT_ERROR(x) ((x >= 400)&&(x < 500))
  + #define is_HTTP_SERVER_ERROR(x) ((x >= 500)&&(x < 600))
  + 

#define METHODS 8
#define M_GET 0
  
  
  
  1.57  +24 -18apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -C3 -r1.56 -r1.57
  *** http_protocol.c   1996/10/16 20:56:19 1.56
  --- http_protocol.c   1996/10/16 23:24:33 1.57
  ***
  *** 50,56 
 *
 */
  
  ! /* $Id: http_protocol.c,v 1.56 1996/10/16 20:56:19 fielding Exp $ */

/*
 * http_protocol.c --- routines which directly communicate with the
  --- 50,56 
 *
 */
  
  ! /* $Id: http_protocol.c,v 1.57 1996/10/16 23:24:33 fielding Exp $ */

/*
 * http_protocol.c --- routines which directly communicate with the
  ***
  *** 363,369 
 * to succeed if the GET was successful; ErrorDocuments *always* get 
sent.
 */

  ! if ((r->status < 200) || (r->status >= 300))
return OK;

if (if_modified_since && !r->header_only &&
  --- 363,369 
 * to succeed if the GET was successful; ErrorDocuments *always* get 
sent.
 */

  ! if (!is_HTTP_SUCCESS(r->status))
return OK;

if (if_modified_since && !r->header_only &&
  ***
  *** 650,656 

r->sent_bodyct = 0; /* bytect isn't for body */

  ! r->status = 200;/* Until further notice.
 * Only changed by die(), or (bletch!)
 * scan_script_header...
 */
  --- 650,656 

r->sent_bodyct = 0; /* bytect isn't for body */

  ! r->status = HTTP_OK;/* Until further notice.
 * Only changed by die(), or (bletch!)
 * scan_script_header...
 */
  ***
  *** 711,717 
rnew->method = "GET"; rnew->method_number = M_GET;
rnew->protocol = "INCLUDED";

  ! rnew->status = 200;

rnew->headers_in = r->headers_in;
rnew->subprocess_env = copy_table (rnew->pool, r->subprocess_env);
  --- 711,717 
rnew->method = "GET"; rnew->method_number = M_GET;
rnew->protocol = "INCLUDED";

  ! rnew->status = HTTP_OK;

rnew->headers_in = r->headers_in;
rnew->subprocess_env = copy_table (rnew->pool, r->subprocess_env);
  ***
  *** 1117,1136 
return OK;
}

  ! int should_client_block (request_rec *r) {
  !if (r->method_number != M_POST && r->method_number != M_PUT)
  !return 0;

  !if (r->proto_num >= 1001) {
  !bvputs(r->connection->client,
  ! SERVER_PROTOCOL, " 100 Continue\015\012\015\012", NULL);
  !bflush(r->connection->client);
  !}

  !return 1;
}

  ! static int rd_chunk_size (BUFF *b) {
int chunksize = 0;
int c;

  --- 1117,1142 
return OK;
}

  ! int should_client_block (request_rec *r)
  ! {
  ! /* The following should involve a test of whether the re

cvs commit: apache/src http_protocol.c

1996-10-16 Thread Roy Fielding
fielding96/10/16 13:56:20

  Modified:src   http_protocol.c
  Log:
  Added new error messages for HTTP/1.1 status codes.
  Reviewed by: Chuck Murcko
  
  Revision  ChangesPath
  1.56  +60 -18apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -C3 -r1.55 -r1.56
  *** http_protocol.c   1996/10/10 12:12:01 1.55
  --- http_protocol.c   1996/10/16 20:56:19 1.56
  ***
  *** 50,56 
 *
 */
  
  ! /* $Id: http_protocol.c,v 1.55 1996/10/10 12:12:01 fielding Exp $ */

/*
 * http_protocol.c --- routines which directly communicate with the
  --- 50,56 
 *
 */
  
  ! /* $Id: http_protocol.c,v 1.56 1996/10/16 20:56:19 fielding Exp $ */

/*
 * http_protocol.c --- routines which directly communicate with the
  ***
  *** 1296,1304 
{
conn_rec *c = r->connection;
char *custom_response;
int status = r->status;
int idx = index_of_response (status);
  - char *location = table_get (r->headers_out, "Location");

/* If status code not found, use code 500.  */
if (idx == -1) {
  --- 1296,1304 
{
conn_rec *c = r->connection;
char *custom_response;
  + char *location = table_get (r->headers_out, "Location");
int status = r->status;
int idx = index_of_response (status);

/* If status code not found, use code 500.  */
if (idx == -1) {
  ***
  *** 1336,1342 
 */
bputs("Connection: close\015\012", c->client);

  ! if ((status == REDIRECT) || (status == MOVED))
bvputs(c->client, "Location: ", location, "\015\012", NULL);

if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
  --- 1336,1342 
 */
bputs("Connection: close\015\012", c->client);

  ! if (location && (status >= 300) && (status < 400))
bvputs(c->client, "Location: ", location, "\015\012", NULL);

if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
  ***
  *** 1388,1393 
  --- 1388,1402 
bvputs(fd, "The document has moved pool, location), "\">here.\n", NULL);
break;
  + case HTTP_SEE_OTHER:
  + bvputs(fd, "The answer to your request is located pool, location), "\">here.\n", NULL);
  + break;
  + case HTTP_USE_PROXY:
  + bvputs(fd, "This resource is only accessible through the proxy\n",
  +escape_html(r->pool, location), "\nYou will need to ",
  +"configure your client to use that proxy.\n", NULL);
  + break;
case AUTH_REQUIRED:
bputs("This server could not verify that you\n", fd);
bputs("are authorized to access the document you\n", fd);
  ***
  *** 1397,1403 
bputs("the credentials required.\n", fd);
break;
case BAD_REQUEST:
  ! bputs("Your browser sent a query that\n", fd);
bputs("this server could not understand.\n", fd);
break;
case FORBIDDEN:
  --- 1406,1412 
bputs("the credentials required.\n", fd);
break;
case BAD_REQUEST:
  ! bputs("Your browser sent a request that\n", fd);
bputs("this server could not understand.\n", fd);
break;
case FORBIDDEN:
  ***
  *** 1415,1423 
   ".\n", NULL);
break;
case NOT_ACCEPTABLE:
  ! bvputs(fd, "An appropriate variant to the requested entity ",
  !escape_html(r->pool, r->uri), " could not be found "
  !"on this server.\n", NULL);
/* fall through */
case MULTIPLE_CHOICES: 
{
  --- 1424,1433 
   ".\n", NULL);
break;
case NOT_ACCEPTABLE:
  ! bvputs(fd,
  !   "An appropriate representation of the requested resource ",
  !escape_html(r->pool, r->uri),
  !" could not be found on this server.\n", NULL);
/* fall through */
case MULTIPLE_CHOICES: 
{
  ***
  *** 1431,1450 
   " requires a valid Content-length.\n", NULL);
break;
case PRECONDITION_FAILED:
  ! bvputs(fd, "The requested precondition for serving the URL ",
   escape_html(r->pool, r->uri), " evaluated to false.\n",
   NULL);
break;
  - case SERVER_ERROR:
  - bputs("The server encountered an internal error or\n", fd);
  - bputs("misconfiguration and was unable to complete\n", fd);
  - bputs("your request.\n", fd);
  - bputs("

cvs commit: apache/src http_request.c

1996-10-16 Thread Ben Laurie
ben 96/10/16 10:29:23

  Modified:src   http_request.c
  Log:
  Add missing location_walk()s.
  Reviewed by: Alexei Kosut
  
  Revision  ChangesPath
  1.17  +3 -1  apache/src/http_request.c
  
  Index: http_request.c
  ===
  RCS file: /export/home/cvs/apache/src/http_request.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -C3 -r1.16 -r1.17
  *** http_request.c1996/10/08 20:43:31 1.16
  --- http_request.c1996/10/16 17:29:22 1.17
  ***
  *** 50,56 
 *
 */

  ! /* $Id: http_request.c,v 1.16 1996/10/08 20:43:31 brian Exp $ */

/*
 * http_request.c: functions to get and process requests
  --- 50,56 
 *
 */

  ! /* $Id: http_request.c,v 1.17 1996/10/16 17:29:22 ben Exp $ */

/*
 * http_request.c: functions to get and process requests
  ***
  *** 598,603 
  --- 598,604 
 */

if ((res = directory_walk (rnew))
  + || (res = location_walk (rnew))
|| (res = file_walk (rnew))
|| (!some_auth_required (rnew) ? 0 :
 ((res = check_user_id (rnew)) || (res = check_auth (rnew
  ***
  *** 641,646 
  --- 642,648 
  make_full_path (rnew->pool, fdir, new_file));

if ((res = directory_walk (rnew))
  + || (res = location_walk (rnew))
|| (res = file_walk (rnew))
|| (res = check_access (rnew))
|| (!some_auth_required (rnew) ? 0 :