Browse Source

get things mostly working..

the performance is ok, but likely can be improved upon:
libcurl seems to not reuse connections, why not?
libcurl when using any auth, ALWAYS tries unauth'd for EVERY
  request instead of caching that this url NEEDs auth
there are some error handling cases that could be improved
tags/ggatessh-v1.0.0
John-Mark Gurney 4 years ago
parent
commit
8c7209fe1b
3 changed files with 438 additions and 372 deletions
  1. +5
    -1
      ggatehttp/Makefile
  2. +419
    -359
      ggatehttp/ggatehttp.c
  3. +14
    -12
      tests/ggatehttp_test.sh

+ 5
- 1
ggatehttp/Makefile View File

@@ -9,7 +9,11 @@ SRCS= ggatehttp.c ggate.c
CFLAGS+= -DMAX_SEND_SIZE=32768
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR:H}/shared
CFLAGS+= -I/usr/local/include
#CFLAGS+= -O0
#CFLAGS+= -fprofile-instr-generate

LDADD= -lgeom -lutil -lpthread
LDFLAGS+= -L/usr/local/lib
LDADD= -lgeom -lutil -lpthread -lcurl

.include <bsd.prog.mk>

+ 419
- 359
ggatehttp/ggatehttp.c
File diff suppressed because it is too large
View File


+ 14
- 12
tests/ggatehttp_test.sh View File

@@ -1,8 +1,8 @@
# $FreeBSD$

PIDFILE=ggated.pid
TESTURL=http://127.0.0.1:5555/somefile
TESTFILE=/home/freebsd/lf.test/webdav/data/somefile
TESTURL="$GGATEHTTP_URL"
TEMPFILE="random.data"

atf_test_case ggatehttp cleanup
ggatehttp_head()
@@ -19,8 +19,10 @@ ggatehttp_body()
us=$(alloc_ggate_dev)
src=$(alloc_md)

n1mchunks=10

atf_check -e ignore -o ignore \
dd if=/dev/random of="$TESTFILE" bs=1m count=1 conv=notrunc
dd if=/dev/random of="$TEMPFILE" bs=1m count=$n1mchunks conv=notrunc

atf_check ggatehttp create -u $us "$TESTURL"

@@ -28,20 +30,20 @@ ggatehttp_body()

wait_for_ggate_device ${ggate_dev}

# Test reading
# Test writing
atf_check -e ignore -o ignore \
dd if=${ggate_dev} of=/dev/${src} bs=1m count=1 conv=notrunc

checksum /dev/$src "$TESTFILE"
dd if="$TEMPFILE" of=${ggate_dev} bs=1m count=$n1mchunks conv=notrunc

# Test reading
atf_check -e ignore -o ignore \
dd if=/dev/random of=/dev/${src} bs=1m count=1 conv=notrunc
dd of="$TEMPFILE"2 if=${ggate_dev} bs=1m count=$n1mchunks conv=notrunc

# Test writing
atf_check -e ignore -o ignore \
dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc
ls -l "$TEMPFILE" "$TEMPFILE"2

# Verify that we read what we wrote
atf_check cmp "$TEMPFILE" "$TEMPFILE"2

checksum /dev/$src "$TESTFILE"
rm "$TEMPFILE" "$TEMPFILE"2
}

ggatehttp_cleanup()


Loading…
Cancel
Save