Skip to content

Commit

Permalink
detects 403 forbidden on downloads. SSL bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Jun 23, 2017
1 parent 641532d commit 48bd9fd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
CC = cc
CC = gcc
VERSION = 1.2.1
CFLAGS = -g -O2
LIBS = -lz
INSTALL=/usr/bin/install -c
LIBS = -lcrypto -lssl -lz
INSTALL=/bin/install -c
prefix=/usr/local
bindir=$(prefix)${exec_prefix}/bin
DESTDIR=
FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64
FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1
OBJ=common.o settings.o containerfiles.o outputfiles.o servicetypes.o extract_text.o download.o display.o players.o selectformat.o ehow.o ign.o youtube.o

all: $(OBJ)
Expand Down
8 changes: 7 additions & 1 deletion download.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ListNode *DownloadQueue=NULL;
STREAM *ConnectAndSendHeaders(const char *URL, int Flags, double BytesRange)
{
STREAM *Con;
char *Tempstr=NULL, *Method=NULL, *ptr;
char *Tempstr=NULL, *Method=NULL, *ptr, *rcode;
HTTPInfoStruct *Info;
static char *LastPage=NULL;

Expand Down Expand Up @@ -44,6 +44,12 @@ if ((! Con) && (! (Flags & FLAG_QUIET)))
if (StrValid(Info->ResponseCode)) fprintf(stderr,"ERROR: Server %s item '%s' not retrieved\nResponseCode: %s\n",Info->Host, Info->Doc,Info->ResponseCode);
else fprintf(stderr,"ERROR: Connection failed to %s can't get file=%s \n",Info->Host, Info->Doc);
}
else if (StrValid(Info->ResponseCode) && (*Info->ResponseCode !='2'))
{
fprintf(stderr,"ERROR: Document unavailable. HTTP-Response: %s \n",STREAMGetValue(Con, "HTTP:ResponseCode"));
STREAMClose(Con);
Con=NULL;
}
else if (Flags & FLAG_DEBUG)
{
ptr=STREAMGetValue(Con, "SSL-Cipher");
Expand Down
4 changes: 2 additions & 2 deletions libUseful-2.8/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CC = gcc
VERSION = 0.0.1
CFLAGS = -g -O2
LIBS = -lc -lc -lc -lc
FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_LIBC=1 -DHAVE_UNSHARE=1 -DHAVE_LIBC=1 -DHAVE_UMOUNT2=1 -DHAVE_LIBC=1 -DHAVE_UMOUNT=1 -DHAVE_MKOSTMP=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK
LIBS = -lz -lcrypto -lssl -lc -lc -lc -lc -lc
FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_LIBC=1 -DHAVE_UNSHARE=1 -DHAVE_LIBC=1 -DHAVE_UMOUNT2=1 -DHAVE_LIBC=1 -DHAVE_UMOUNT=1 -DHAVE_LIBC=1 -DHAVE_MKOSTEMP=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_EVP_BF_CBC=1 -DHAVE_EVP_RC2_CBC=1 -DHAVE_EVP_RC4=1 -DHAVE_EVP_DES_CBC=1 -DHAVE_EVP_DESX_CBC=1 -DHAVE_EVP_CAST5_CBC=1 -DHAVE_EVP_IDEA_CBC=1 -DHAVE_EVP_AES_128_CBC=1 -DHAVE_EVP_AES_256_CBC=1 -DUSE_OPENSSL_ADD_ALL_ALGORITHMS=1 -DHAVE_LIBZ=1 -DHAVE_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK
prefix=/usr/local
OBJ=string.o list.o socket.o unix_socket.o file.o tar.o Terminal.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o g711.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o whirlpool.o jh_ref.o Hash.o ssh.o Compression.o oauth.o libsettings.o Vars.o Time.o Markup.o SpawnPrograms.o Tokenizer.o PatternMatch.o URL.o DataParser.o ConnectionChain.o openssl.o Process.o Encodings.o RawData.o securemem.o

Expand Down
8 changes: 6 additions & 2 deletions libUseful-2.8/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,11 @@ else
diff=0;
}

if (S->InStart > (S->BuffSize / 2))
//if buffer is half full, or full 'cept for space at the start, then make room
if (
(S->InStart > (S->BuffSize / 2)) ||
((S->InEnd >= S->BuffSize) && (S->InStart > 0))
)
{
memmove(S->InputBuff,S->InputBuff + S->InStart,diff);
S->InStart=0;
Expand Down Expand Up @@ -1081,7 +1085,7 @@ if (read_result==0)
if (S->State & SS_SSL)
{
read_result=SSL_read((SSL *) SSL_CTX, tmpBuff, S->BuffSize-S->InEnd);
S->State |= SS_EMBARGOED;
// S->State |= SS_EMBARGOED;
}
else
#endif
Expand Down

0 comments on commit 48bd9fd

Please sign in to comment.