You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/12/17 13:32:16 UTC
cvs commit: apache-2.0/src/lib/apr/network_io/win32 sockets.c
rbb 99/12/17 04:32:16
Modified: src/lib/apr/test ab_apr.c testproc.c
src/lib/apr/include apr_win.h
src/lib/apr/network_io/win32 sockets.c
Log:
Various fixes for Win32 APR. The test cases all almost work again on
windows. The 1 second sleep that has been added to testproc is so that
Windows has time to notice the update to the file system.
Submitted by: Allan Edwards
Reviewed by: Ryan Bloom
Revision Changes Path
1.13 +15 -15 apache-2.0/src/lib/apr/test/ab_apr.c
Index: ab_apr.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/test/ab_apr.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ab_apr.c 1999/12/03 16:12:25 1.12
+++ ab_apr.c 1999/12/17 12:32:13 1.13
@@ -1,4 +1,4 @@
-/* ====================================================================
+ /* ====================================================================
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -146,8 +146,8 @@
#define ap_max(a,b) ((a)>(b))?(a):(b)
/* --------------------- GLOBALS ---------------------------- */
-API_VAR_IMPORT char *optarg; /* argument associated with option */
-API_VAR_IMPORT int optind;
+API_VAR_IMPORT char *ap_optarg; /* argument associated with option */
+API_VAR_IMPORT int ap_optind;
int verbosity = 0; /* no verbosity by default */
int posting = 0; /* GET by default */
@@ -900,11 +900,11 @@
ap_make_time(&start, cntxt);
ap_make_time(&endtime, cntxt);
- optind = 1;
+ ap_optind = 1;
while (ap_getopt(cntxt, argc, argv, "n:c:t:T:p:v:kVhwx:y:z:", &c) == APR_SUCCESS) {
switch (c) {
case 'n':
- requests = atoi(optarg);
+ requests = atoi(ap_optarg);
if (!requests) {
err("Invalid number of requests\n");
}
@@ -913,10 +913,10 @@
keepalive = 1;
break;
case 'c':
- concurrency = atoi(optarg);
+ concurrency = atoi(ap_optarg);
break;
case 'p':
- if (0 == (r = open_postfile(optarg))) {
+ if (0 == (r = open_postfile(ap_optarg))) {
posting = 1;
}
else if (postdata) {
@@ -924,14 +924,14 @@
}
break;
case 'v':
- verbosity = atoi(optarg);
+ verbosity = atoi(ap_optarg);
break;
case 't':
- tlimit = atoi(optarg);
+ tlimit = atoi(ap_optarg);
requests = MAX_REQUESTS; /* need to size data array on something */
break;
case 'T':
- strcpy(content_type, optarg);
+ strcpy(content_type, ap_optarg);
break;
case 'V':
copyright();
@@ -943,15 +943,15 @@
/* if any of the following three are used, turn on html output automatically */
case 'x':
use_html = 1;
- tablestring = optarg;
+ tablestring = ap_optarg;
break;
case 'y':
use_html = 1;
- trstring = optarg;
+ trstring = ap_optarg;
break;
case 'z':
use_html = 1;
- tdstring = optarg;
+ tdstring = ap_optarg;
break;
case 'h':
usage(argv[0]);
@@ -962,12 +962,12 @@
break;
}
}
- if (optind != argc - 1) {
+ if (ap_optind != argc - 1) {
fprintf(stderr, "%s: wrong number of arguments\n", argv[0]);
usage(argv[0]);
}
- if (parse_url(argv[optind++])) {
+ if (parse_url(argv[ap_optind++])) {
fprintf(stderr, "%s: invalid URL\n", argv[0]);
usage(argv[0]);
}
1.7 +1 -0 apache-2.0/src/lib/apr/test/testproc.c
Index: testproc.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testproc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- testproc.c 1999/12/03 15:18:36 1.6
+++ testproc.c 1999/12/17 12:32:14 1.7
@@ -168,6 +168,7 @@
}
else fprintf(stderr, "Read failed.\n");
+ Sleep(1000);
fprintf(stdout, "Removing directory.......");
if (ap_remove_dir("proctest", context) != APR_SUCCESS) {
fprintf(stderr, "Could not remove directory.\n");
1.9 +1 -0 apache-2.0/src/lib/apr/include/apr_win.h
Index: apr_win.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_win.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- apr_win.h 1999/12/15 00:40:15 1.8
+++ apr_win.h 1999/12/17 12:32:15 1.9
@@ -74,6 +74,7 @@
#include <stddef.h>
#include <stdio.h>
#include <time.h>
+#include <process.h>
#define ap_inline
#define __attribute__(__x)
1.16 +9 -5 apache-2.0/src/lib/apr/network_io/win32/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockets.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- sockets.c 1999/11/02 21:49:27 1.15
+++ sockets.c 1999/12/17 12:32:16 1.16
@@ -85,6 +85,8 @@
(*new)->cntxt = cont;
(*new)->local_addr = (struct sockaddr_in *)ap_pcalloc((*new)->cntxt,
sizeof(struct sockaddr_in));
+ (*new)->remote_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt,
+ sizeof(struct sockaddr_in));
if ((*new)->local_addr == NULL) {
return APR_ENOMEM;
@@ -165,6 +167,8 @@
(*new)->cntxt = connection_context;
(*new)->local_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt,
sizeof(struct sockaddr_in));
+ (*new)->remote_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt,
+ sizeof(struct sockaddr_in));
memcpy((*new)->local_addr, sock->local_addr, sizeof(struct sockaddr_in));
(*new)->addr_len = sizeof(struct sockaddr_in);
@@ -193,12 +197,12 @@
if (*hostname >= '0' && *hostname <= '9' &&
strspn(hostname, "0123456789.") == strlen(hostname)) {
- sock->local_addr->sin_addr.s_addr = inet_addr(hostname);
+ sock->remote_addr->sin_addr.s_addr = inet_addr(hostname);
}
else {
hp = gethostbyname(hostname);
- memcpy((char *)&sock->local_addr->sin_addr, hp->h_addr_list[0], hp->h_length);
- sock->addr_len = sizeof(*sock->local_addr);
+ memcpy((char *)&sock->remote_addr->sin_addr, hp->h_addr_list[0], hp->h_length);
+ sock->addr_len = sizeof(*sock->remote_addr);
if (!hp) {
if (h_errno == TRY_AGAIN) {
return EAGAIN;
@@ -207,9 +211,9 @@
}
}
- sock->local_addr->sin_family = AF_INET;
+ sock->remote_addr->sin_family = AF_INET;
- if (connect(sock->sock, (const struct sockaddr *)sock->local_addr,
+ if (connect(sock->sock, (const struct sockaddr *)sock->remote_addr,
sock->addr_len) == 0) {
return APR_SUCCESS;
}