Permalink
Browse files

avoid keeping our own copy of ibrowse

Remove our copy of ibrowse in our test directory from git
control. Instead, download ibrowse master from github if we don't have
a fresh copy. Track master HEAD to make sure we have the latest.

Change test/Makefile to fetch ibrowse if needed as part of building
the "all" target.

Add test/ibrowse to .gitignore.
  • Loading branch information...
1 parent 28cb08d commit 3d1c7df55f61a2517e0c05b7f07d779e38ace890 @vinoski vinoski committed Mar 3, 2011
View
@@ -21,6 +21,8 @@ src/charset.def
src/mime_types.erl
src/yaws_configure.hrl
src/yaws_generated.erl
+test/ibrowse
+test/ibrowse.tar.gz
test/support/include.mk
test/support/include.sh
test/t1/localhost:8000/
View
@@ -2,8 +2,8 @@ include support/include.mk
SUBDIRS = t1 t2 eunit
-all: conf
- @cd ibrowse/src; $(MAKE)
+all: conf fetch_ibrowse
+ @cd ibrowse; $(MAKE)
@cd src; $(MAKE) all
@set -e ; \
for d in $(SUBDIRS) ; do \
@@ -12,12 +12,9 @@ all: conf
fi ; \
done
-
-
-
clean:
@cd src; $(MAKE) clean
- @cd ibrowse/src; $(MAKE) clean
+ rm -rf ibrowse
@set -e ; \
for d in $(SUBDIRS) ; do \
if [ -f $$d/Makefile ]; then \
@@ -32,3 +29,28 @@ test:
( cd $$d && $(MAKE) all start test ) || exit 1 ; \
fi ; \
done
+
+IBROWSE_URI = https://github.com/cmullaparthi/ibrowse.git
+IBROWSE_DOWNLOAD_URI = https://github.com/cmullaparthi/ibrowse/tarball/master
+IBROWSE_TGZ = ibrowse.tar.gz
+IBROWSE_VSN = ibrowse/.version
+
+.PHONY: fetch_ibrowse
+fetch_ibrowse:
+ set -e ; \
+ nvsn=`git ls-remote -h $(IBROWSE_URI) master | awk '{print $$1}'` ; \
+ if [ -f $(IBROWSE_VSN) ] ; then \
+ vsn=`cat $(IBROWSE_VSN)` ; \
+ [ "$$nvsn" = "$$vsn" ] || fetch=yes ; \
+ else \
+ fetch=yes ; \
+ fi ; \
+ if [ -n "$$fetch" ] ; then \
+ rm -rf ibrowse ; \
+ curl -L -o $(IBROWSE_TGZ) $(IBROWSE_DOWNLOAD_URI) ; \
+ dir=`tar ztf $(IBROWSE_TGZ) | head -1 | sed -e 's/\/$$//'` ; \
+ tar zxf $(IBROWSE_TGZ) ; \
+ mv $$dir ibrowse ; \
+ rm -f $(IBROWSE_TGZ) ; \
+ echo $$nvsn > $(IBROWSE_VSN) ; \
+ fi
View
@@ -1,10 +0,0 @@
-Copyright (c) 2006, Chandrashekhar Mullaparthi
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the T-Mobile nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -1,9 +0,0 @@
-ibrowse - a HTTP client written in erlang
-Copyright (C) 2005 Chandrashekhar Mullaparthi <chandrashekhar dot mullaparthi at gmail dot com>
-
-This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1 +0,0 @@
-cc -o ../priv/ibrowse_drv.so -I ~/R9C-0/usr/include/ -bundle -flat_namespace -undefined suppress -fno-common ibrowse_drv.c
@@ -1,162 +0,0 @@
-/* Created 07/March/2004 Chandrashekhar Mullaparthi
-
- $Id: ibrowse_drv.c,v 1.1 2005/05/05 22:28:28 chandrusf Exp $
-
- Erlang Linked in driver to URL encode a set of data
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "erl_driver.h"
-
-static ErlDrvData ibrowse_drv_start(ErlDrvPort port, char* buff);
-static void ibrowse_drv_stop(ErlDrvData handle);
-static void ibrowse_drv_command(ErlDrvData handle, char *buff, int bufflen);
-static void ibrowse_drv_finish(void);
-static int ibrowse_drv_control(ErlDrvData handle, unsigned int command,
- char* buf, int count, char** res, int res_size);
-
-/* The driver entry */
-static ErlDrvEntry ibrowse_driver_entry = {
- NULL, /* init, N/A */
- ibrowse_drv_start, /* start, called when port is opened */
- ibrowse_drv_stop, /* stop, called when port is closed */
- NULL, /* output, called when erlang has sent */
- NULL, /* ready_input, called when input descriptor
- ready */
- NULL, /* ready_output, called when output
- descriptor ready */
- "ibrowse_drv", /* char *driver_name, the argument
- to open_port */
- NULL, /* finish, called when unloaded */
- NULL, /* void * that is not used (BC) */
- ibrowse_drv_control, /* control, port_control callback */
- NULL, /* timeout, called on timeouts */
- NULL, /* outputv, vector output interface */
- NULL,
- NULL,
- NULL, /* call, synchronous call to driver */
- NULL
-};
-
-typedef struct ibrowse_drv_data {
- unsigned int count;
- void *alloc_ptr;
-} State;
-
-static State *ibrowse_drv_data;
-
-DRIVER_INIT(ibrowse_drv)
-{
- ibrowse_drv_data = NULL;
- return &ibrowse_driver_entry;
-}
-
-static ErlDrvData ibrowse_drv_start(ErlDrvPort port, char *buff)
-{
- State *state;
-
- state = driver_alloc(sizeof(State));
- state->count = 0;
- state->alloc_ptr = NULL;
-
- ibrowse_drv_data = state;
- return ((ErlDrvData) state);
-}
-
-void ibrowse_drv_stop(ErlDrvData desc)
-{
- return;
-}
-
-static int ibrowse_drv_control(ErlDrvData handle, unsigned int command,
- char *buf, int bufflen, char **rbuf, int rlen)
-{
- State* state = (State *) handle;
- unsigned int j = 0, i = 0;
- unsigned int temp = 0, rlen_1 = 0;
- char* replybuf;
-
- fprintf(stderr, "alloc_ptr -> %d\n", state->alloc_ptr);
-/* if(state->alloc_ptr != NULL) */
-/* { */
-/* driver_free(state->alloc_ptr); */
-/* } */
-
- /* Calculate encoded length. If same as bufflen, it means there is
- no encoding to do. Do return an empty list */
- rlen_1 = calc_encoded_length(buf, bufflen);
- if(rlen_1 == bufflen)
- {
- *rbuf = NULL;
- state->alloc_ptr = NULL;
- return 0;
- }
- *rbuf = driver_alloc(rlen_1);
- state->alloc_ptr = *rbuf;
- fprintf(stderr, "*rbuf -> %d\n", *rbuf);
- replybuf = *rbuf;
-
- for(i=0;i<bufflen;i++)
- {
- temp = buf[i];
- if( 'a' <= temp && temp <= 'z'
- || 'A' <= temp && temp <= 'Z'
- || '0' <= temp && temp <= '9'
- || temp == '-' || temp == '_' || temp == '.' )
- {
- replybuf[j++] = temp;
- /* printf("j -> %d\n", j); */
- }
- else
- {
- replybuf[j++] = 37;
- /* printf("temp -> %d\n", temp);
- printf("d2h(temp >> 4) -> %d\n", d2h(temp >> 4));
- printf("d2h(temp & 15) -> %d\n", d2h(temp & 15)); */
- replybuf[j++] = d2h(temp >> 4);
- replybuf[j++] = d2h(temp & 15);
- /* printf("j -> %d\n", j); */
- }
- }
- return rlen_1;
-}
-
-/* Calculates the length of the resulting buffer if a string is URL encoded */
-int calc_encoded_length(char* buf, int bufflen)
-{
- unsigned int count=0, i=0, temp=0;
-
- for(i=0;i<bufflen;i++)
- {
- temp = buf[i];
- if( 'a' <= temp && temp <= 'z'
- || 'A' <= temp && temp <= 'Z'
- || '0' <= temp && temp <= '9'
- || temp == '-' || temp == '_' || temp == '.' )
- {
- count++;
- }
- else
- {
- count = count+3;
- }
- }
- return count;
-}
-
-/* Converts an integer in the range 1-15 into it's ascii value
- 1 -> 49 (ascii value of 1)
- 10 -> 97 (ascii value of a)
-*/
-int d2h(unsigned int i)
-{
- if( i < 10 )
- {
- return i + 48;
- }
- else
- {
- return i + 97 - 10;
- }
-}
Oops, something went wrong.

0 comments on commit 3d1c7df

Please sign in to comment.