cvs commit: apache/src/modules/proxy proxy_http.c

1997-08-20 Thread Roy Fielding
fielding97/08/20 19:24:32

  Modified:src/modules/proxy Tag: APACHE_1_2_X proxy_http.c
  Log:
  Fix bug introduced by last change in 1.2.3, resulting in the proxy
  always making requests with the full-URI instead of just the URI path.
  
  Submitted by: Marc Slemko
  Reviewed by:  Roy Fielding
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.17.2.4  +1 -1  apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.17.2.3
  retrieving revision 1.17.2.4
  diff -u -r1.17.2.3 -r1.17.2.4
  --- proxy_http.c  1997/08/17 21:00:48 1.17.2.3
  +++ proxy_http.c  1997/08/21 02:24:30 1.17.2.4
  @@ -250,7 +250,7 @@
   bpushfd(f, sock, sock);
   
   hard_timeout (proxy send, r);
  -bvputs(f, r-method,  , url,  HTTP/1.0\015\012, NULL);
  +bvputs(f, r-method,  , urlptr,  HTTP/1.0\015\012, NULL);
   bvputs(f, Host: , desthost, NULL);
   if (destportstr != NULL  destport != DEFAULT_PORT)
bvputs(f, :, destportstr, \015\012, NULL);
  
  
  


cvs commit: apache/src/modules/proxy proxy_http.c

1997-08-20 Thread Roy Fielding
fielding97/08/20 19:44:31

  Modified:src  Tag: APACHE_1_2_X CHANGES
   src/modules/proxy Tag: APACHE_1_2_X proxy_http.c
  Log:
  Modify last fix so that it uses the full-URI for ProxyRemote requests
  and the URI path for normal requests.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.286.2.51 +1 -1  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.50
  retrieving revision 1.286.2.51
  diff -u -r1.286.2.50 -r1.286.2.51
  --- CHANGES   1997/08/21 02:28:53 1.286.2.50
  +++ CHANGES   1997/08/21 02:44:27 1.286.2.51
  @@ -3,7 +3,7 @@
   
 *) The ProxyRemote change in 1.2.3 introduced a bug resulting in the proxy
always making requests with the full-URI instead of just the URI path.
  - [Marc Slemko]
  + [Marc Slemko, Roy Fielding]
   
   Changes with Apache 1.2.3
   
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.17.2.5  +2 -1  apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.17.2.4
  retrieving revision 1.17.2.5
  diff -u -r1.17.2.4 -r1.17.2.5
  --- proxy_http.c  1997/08/21 02:24:30 1.17.2.4
  +++ proxy_http.c  1997/08/21 02:44:30 1.17.2.5
  @@ -250,7 +250,8 @@
   bpushfd(f, sock, sock);
   
   hard_timeout (proxy send, r);
  -bvputs(f, r-method,  , urlptr,  HTTP/1.0\015\012, NULL);
  +bvputs(f, r-method,  , proxyhost ? url : urlptr,  HTTP/1.0\015\012,
  +   NULL);
   bvputs(f, Host: , desthost, NULL);
   if (destportstr != NULL  destport != DEFAULT_PORT)
bvputs(f, :, destportstr, \015\012, NULL);
  
  
  


cvs commit: apache/src/modules/proxy proxy_http.c

1997-08-17 Thread Ralf S. Engelschall
rse 97/08/17 14:00:49

  Modified:src  Tag: APACHE_1_2_X CHANGES
   src/modules/proxy Tag: APACHE_1_2_X proxy_http.c
  Log:
  Fix URL mangling in mod_proxy for HTTP requests.
  
  PR:   260,656,699,713,812
  Submitted by: Lars Eilebrecht
  Reviewed by:  Marc Slemko, Dean Gaudet
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.286.2.49 +5 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.48
  retrieving revision 1.286.2.49
  diff -u -r1.286.2.48 -r1.286.2.49
  --- CHANGES   1997/08/17 20:35:48 1.286.2.48
  +++ CHANGES   1997/08/17 21:00:46 1.286.2.49
  @@ -1,6 +1,11 @@
   
   Changes with Apache 1.2.3
   
  +  *) The request to a remote proxy was mangled if it was generated as the
  + result of a ProxyPass directive. URL schemes other than http:// were not
  + supported when ProxyRemote was used. PR#260, PR#656, PR#699, PR#713,
  + PR#812 [Lars Eilebrecht]
  +
 *) Fixed proxy-pass-through feature of mod_rewrite; Added error logging
information for case where proxy module is not available. [Marc Slemko]
   
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.17.2.3  +11 -9 apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.17.2.2
  retrieving revision 1.17.2.3
  diff -u -r1.17.2.2 -r1.17.2.3
  --- proxy_http.c  1997/08/15 17:08:56 1.17.2.2
  +++ proxy_http.c  1997/08/17 21:00:48 1.17.2.3
  @@ -156,6 +156,7 @@
   const long int zero=0L;
   int destport = 0;
   char *destportstr = NULL;
  +char *urlptr = NULL;
   
   void *sconf = r-server-module_config;
   proxy_server_conf *conf =
  @@ -169,19 +170,21 @@
   
   /* We break the URL into host, port, path-search */
   
  -url += 7;  /* skip http:// */
  +urlptr = strstr(url,://);
  +if (urlptr == NULL) return BAD_REQUEST;
  +urlptr += 3;
   destport = DEFAULT_PORT;
  -p = strchr(url, '/');
  +p = strchr(urlptr, '/');
   if (p == NULL)
   {
  -desthost = pstrdup(pool, url);
  -url = /;
  +desthost = pstrdup(pool, urlptr);
  +urlptr = /;
   } else
   {
  -char *q = palloc(pool, p-url+1);
  -memcpy(q, url, p-url);
  -q[p-url] = '\0';
  -url = p;
  +char *q = palloc(pool, p-urlptr+1);
  +memcpy(q, urlptr, p-urlptr);
  +q[p-urlptr] = '\0';
  +urlptr = p;
   desthost = q;
   }
   
  @@ -207,7 +210,6 @@
   
   if (proxyhost != NULL)
   {
  - url = r-uri;   /* restore original URL */
server.sin_port = htons(proxyport);
err = proxy_host2addr(proxyhost, server_hp);
if (err != NULL) return DECLINED;  /* try another */
  
  
  


cvs commit: apache/src/modules/proxy proxy_http.c

1997-07-12 Thread Marc Slemko
marc97/07/12 13:33:05

  Modified:src/modules/proxy  proxy_http.c
  Log:
  First problem: if a client sends a Host: header with a different case than
  Host:, the proxy won't see it and it will end up with two Host: headers
  with different capitalization.
  
  Second problem: if the proxy connects to a HTTP/0.9 server, the
  first line returned will be corrupt because len was tampered with.
  
  Reviewed by:Dean Gaudet, Marc Slemko
  Submitted by:   Kenichi Hori [EMAIL PROTECTED]
  PR: 813,814
  
  Revision  ChangesPath
  1.20  +3 -5  apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -C3 -r1.19 -r1.20
  *** proxy_http.c  1997/06/16 19:32:53 1.19
  --- proxy_http.c  1997/07/12 20:33:04 1.20
  ***
  *** 260,266 
for (i=0; i  reqhdrs_arr-nelts; i++)
{
if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
  !   || !strcmp(reqhdrs[i].key, Host))   /* already sent if there */
continue;
bvputs(f, reqhdrs[i].key, : , reqhdrs[i].val, \015\012, NULL);
}
  --- 260,266 
for (i=0; i  reqhdrs_arr-nelts; i++)
{
if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
  !   || !strcasecmp(reqhdrs[i].key, Host))  /* already sent if there */
continue;
bvputs(f, reqhdrs[i].key, : , reqhdrs[i].val, \015\012, NULL);
}
  ***
  *** 331,339 
 * one type
 */

  - len = resp_hdrs-nelts;
hdr = (struct hdr_entry *)resp_hdrs-elts;
  ! for (i=0; i  len; i++)
{
if (hdr[i].value[0] == '\0') continue;
p = hdr[i].field;
  --- 331,338 
 * one type
 */

hdr = (struct hdr_entry *)resp_hdrs-elts;
  ! for (i=0; i  resp_hdrs-nelts; i++)
{
if (hdr[i].value[0] == '\0') continue;
p = hdr[i].field;
  ***
  *** 371,378 
cache = proxy_cache_error(c);

/* send headers */
  ! len = resp_hdrs-nelts;
  ! for (i=0; i  len; i++)
{
if (hdr[i].field == NULL || hdr[i].value == NULL ||
hdr[i].value[0] == '\0') continue;
  --- 370,376 
cache = proxy_cache_error(c);

/* send headers */
  ! for (i=0; i  resp_hdrs-nelts; i++)
{
if (hdr[i].field == NULL || hdr[i].value == NULL ||
hdr[i].value[0] == '\0') continue;
  
  
  


cvs commit: apache/src/modules/proxy proxy_http.c

1997-02-19 Thread Chuck Murcko
chuck   97/02/19 21:16:26

  Modified:src/modules/proxy  proxy_http.c
  Log:
  Changed HTTP status check mask from HTTP/#.# ### * to HTTP/#.# ###*
  to be more lenient about servers which don't return all of a legal HTTP/1.x
  status.
  
  Revision  ChangesPath
  1.14  +1 -1  apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -C3 -r1.13 -r1.14
  *** proxy_http.c  1997/01/20 04:28:33 1.13
  --- proxy_http.c  1997/02/20 05:16:25 1.14
  ***
  *** 276,282 
}

/* Is it an HTTP/1 response? */
  ! if (checkmask(buffer,  HTTP/#.# ### *))
{
/* If not an HTTP/1 messsage or if the status line was  8192 bytes */
if (buffer[5] != '1' || buffer[len-1] != '\n')
  --- 276,282 
}

/* Is it an HTTP/1 response? */
  ! if (checkmask(buffer,  HTTP/#.# ###*))
{
/* If not an HTTP/1 messsage or if the status line was  8192 bytes */
if (buffer[5] != '1' || buffer[len-1] != '\n')
  
  
  


cvs commit: apache/src/modules/proxy proxy_http.c

1996-12-09 Thread Chuck Murcko
chuck   96/12/09 14:40:18

  Modified:src/modules/proxy  proxy_http.c
  Log:
  1) fixes possible NULL pointer reference w/NoCache
  2) fixes NoCache behavior when using ProxyRemote (ProxyRemote host would
   cache nothing if it was in the local domain, and the local domain
   was in the NoCache list)
  3) Adds Host: header when not available
  4) Some code cleanup and clarification
  
  1) and 2) were reported by Martin Kraemer, with patches. The function,
  though not the form, of Martin's stuff is adhered to here.
  
  Revision  ChangesPath
  1.7   +40 -25apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** proxy_http.c  1996/11/25 11:22:05 1.6
  --- proxy_http.c  1996/12/09 22:40:17 1.7
  ***
  *** 142,149 
 const char *proxyhost, int proxyport)
{
char *p;
  ! const char *err, *host;
  ! int port, i, sock, len;
array_header *reqhdrs_arr, *resp_hdrs;
table_entry *reqhdrs;
struct sockaddr_in server;
  --- 142,149 
 const char *proxyhost, int proxyport)
{
char *p;
  ! const char *err, *desthost;
  ! int i, sock, len;
array_header *reqhdrs_arr, *resp_hdrs;
table_entry *reqhdrs;
struct sockaddr_in server;
  ***
  *** 152,157 
  --- 152,159 
char buffer[HUGE_STRING_LEN], inprotocol[9], outprotocol[9];
pool *pool=r-pool;
const long int zero=0L;
  + int destport = 0;
  + char *destportstr = NULL;

void *sconf = r-server-module_config;
proxy_server_conf *conf =
  ***
  *** 162,182 
memset(server, '\0', sizeof(server));
server.sin_family = AF_INET;

  ! if (proxyhost != NULL)
  ! {
  ! server.sin_port = htons(proxyport);
  ! err = proxy_host2addr(proxyhost, server.sin_addr);
  ! if (err != NULL) return DECLINED;  /* try another */
  ! host = proxyhost;
  ! } else
{
url += 7;  /* skip http:// */
  ! /* We break the URL into host, port, path-search */
  ! port = DEFAULT_PORT;
p = strchr(url, '/');
if (p == NULL)
{
  ! host = pstrdup(pool, url);
url = /;
} else
{
  --- 164,179 
memset(server, '\0', sizeof(server));
server.sin_family = AF_INET;

  ! /* We break the URL into host, port, path-search */
  ! 
  ! if ((desthost = table_get(r-headers_in, Host:)) == NULL)
{
url += 7;  /* skip http:// */
  ! destport = DEFAULT_PORT;
p = strchr(url, '/');
if (p == NULL)
{
  ! desthost = pstrdup(pool, url);
url = /;
} else
{
  ***
  *** 184,200 
memcpy(q, url, p-url);
q[p-url] = '\0';
url = p;
  ! host = q;
}

  ! p = strchr(host, ':');
  ! if (p != NULL)
  ! {
  ! *(p++) = '\0';
  ! port = atoi(p);
  ! }
  ! server.sin_port = htons(port);
  ! err = proxy_host2addr(host, server.sin_addr);
if (err != NULL) return proxyerror(r, err); /* give up */
}

  --- 181,208 
memcpy(q, url, p-url);
q[p-url] = '\0';
url = p;
  ! desthost = q;
}
  + }

  ! p = strchr(desthost, ':');
  ! if (p != NULL)
  ! {
  ! *(p++) = '\0';
  ! destport = atoi(p);
  ! destportstr = p;
  ! }
  ! 
  ! if (proxyhost != NULL)
  ! {
  ! url = r-uri;   /* restore original URL */
  ! server.sin_port = htons(proxyport);
  ! err = proxy_host2addr(proxyhost, server.sin_addr);
  ! if (err != NULL) return DECLINED;  /* try another */
  ! } else
  ! {
  ! server.sin_port = htons(destport);
  ! err = proxy_host2addr(desthost, server.sin_addr);
if (err != NULL) return proxyerror(r, err); /* give up */
}

  ***
  *** 213,231 
else return proxyerror(r, Could not connect to remote machine);
}

  ! clear_connection(r-headers_in);   /* Strip connection-based headers */

f = bcreate(pool, B_RDWR);
bpushfd(f, sock, sock);

hard_timeout (proxy send, r);
bvputs(f, r-method,  , url,  HTTP/1.0\015\012, NULL);

reqhdrs_arr = table_elts (r-headers_in);
reqhdrs = (table_entry *)reqhdrs_arr-elts;
for (i=0; i  reqhdrs_arr-nelts; i++)
{
  ! if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL) continue;
bvputs(f, reqhdrs[i].key, : , reqhdrs[i].val, \015\012, NULL);
}

  --- 221,246 
else return proxyerror(r, Could 

cvs commit: apache/src/modules/proxy proxy_http.c

1996-12-09 Thread Chuck Murcko
chuck   96/12/09 19:12:07

  Modified:src/modules/proxy  proxy_http.c
  Log:
  Reviewed by:  Roy Fielding
  Correct thinko in table_get() arg. Add protection against URLs like
  http://somehost:/foo/bar with an isdigit() test on the char following
  the colon after a hostname.
  
  Revision  ChangesPath
  1.8   +6 -3  apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -C3 -r1.7 -r1.8
  *** proxy_http.c  1996/12/09 22:40:17 1.7
  --- proxy_http.c  1996/12/10 03:12:05 1.8
  ***
  *** 166,172 

/* We break the URL into host, port, path-search */

  ! if ((desthost = table_get(r-headers_in, Host:)) == NULL)
{
url += 7;  /* skip http:// */
destport = DEFAULT_PORT;
  --- 166,172 

/* We break the URL into host, port, path-search */

  ! if ((desthost = table_get(r-headers_in, Host)) == NULL)
{
url += 7;  /* skip http:// */
destport = DEFAULT_PORT;
  ***
  *** 189,196 
if (p != NULL)
{
*(p++) = '\0';
  ! destport = atoi(p);
  ! destportstr = p;
}

if (proxyhost != NULL)
  --- 189,199 
if (p != NULL)
{
*(p++) = '\0';
  ! if (isdigit(*p))
  ! {
  ! destport = atoi(p);
  ! destportstr = p;
  ! }
}

if (proxyhost != NULL)