Skip to content

Instantly share code, notes, and snippets.

@netskink
Last active October 30, 2017 19:52
Show Gist options
  • Save netskink/f4dbace2bec83a6c0123851cc5687de3 to your computer and use it in GitHub Desktop.
Save netskink/f4dbace2bec83a6c0123851cc5687de3 to your computer and use it in GitHub Desktop.
Ok this works finally
gcc -I/home/davis/progs/notmine/custom//usr/local/include/ -g -Wall -v -c testy-curl.c -o testy-curl.o
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18)
COLLECT_GCC_OPTIONS='-I' '/home/davis/progs/notmine/custom//usr/local/include/' '-g' '-Wall' '-v' '-c' '-o' 'testy-curl.o' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/6/cc1 -quiet -v -I /home/davis/progs/notmine/custom//usr/local/include/ -imultiarch x86_64-linux-gnu testy-curl.c -quiet -dumpbase testy-curl.c -mtune=generic -march=x86-64 -auxbase-strip testy-curl.o -g -Wall -version -o /tmp/ccu4yEwd.s
GNU C11 (Debian 6.3.0-18) version 6.3.0 20170516 (x86_64-linux-gnu)
compiled by GNU C version 6.3.0 20170516, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/davis/progs/notmine/custom//usr/local/include/
/usr/lib/gcc/x86_64-linux-gnu/6/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C11 (Debian 6.3.0-18) version 6.3.0 20170516 (x86_64-linux-gnu)
compiled by GNU C version 6.3.0 20170516, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0fe3e671dc62e01e15c40cc5df58cb5f
testy-curl.c: In function ‘test_one’:
testy-curl.c:30:11: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
CURLcode result;
^~~~~~
testy-curl.c: In function ‘test_two’:
testy-curl.c:57:11: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
CURLcode result;
^~~~~~
testy-curl.c: In function ‘test_three’:
testy-curl.c:90:11: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
CURLcode result;
^~~~~~
testy-curl.c: In function ‘test_four’:
testy-curl.c:134:11: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
CURLcode result;
^~~~~~
testy-curl.c: In function ‘test_five’:
testy-curl.c:180:16: warning: unused variable ‘pData’ [-Wunused-variable]
unsigned char pData[4] = { '1', '2', '3', '4'};
^~~~~
COLLECT_GCC_OPTIONS='-I' '/home/davis/progs/notmine/custom//usr/local/include/' '-g' '-Wall' '-v' '-c' '-o' 'testy-curl.o' '-mtune=generic' '-march=x86-64'
as -v -I /home/davis/progs/notmine/custom//usr/local/include/ --64 -o testy-curl.o /tmp/ccu4yEwd.s
GNU assembler version 2.28 (x86_64-linux-gnu) using BFD version (GNU Binutils for Debian) 2.28
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-I' '/home/davis/progs/notmine/custom//usr/local/include/' '-g' '-Wall' '-v' '-c' '-o' 'testy-curl.o' '-mtune=generic' '-march=x86-64'
gcc testy-curl.o -Wall -L/home/davis/progs/notmine/custom//usr/local/lib/ -L/usr/local/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu -L/usr/local/lib64 -L/lib64 -L/usr/lib64 -L/usr/local/lib -L/lib -L/usr/lib -L/usr/x86_64-linux-gnu/lib64 -L/usr/x86_64-linux-gnu/lib -lcurl -lz -lpthread -lssl -lcrypto -o testy-curl
# this makefile works with system libcurl or libcurl built by
# me.
#
# myversion of lib curl is in :
#LIBCURL_DIR=/home/davis/progs/notmine/curl
#MYINC=${LIBCURL_DIR}/include/
#MYLIB=${LIBCURL_DIR}/lib/.libs/
LIBCURL_DIR=/home/davis/progs/notmine/custom/
MYINC=${LIBCURL_DIR}/usr/local/include/
#MYLIB=${LIBCURL_DIR}/usr/local/lib/:/usr/local/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/local/lib64:/lib64:/usr/lib64:/usr/local/lib:/lib:/usr/lib:/usr/x86_64-linux-gnu/lib64:/usr/x86_64-linux-gnu/lib
MYLIB=${LIBCURL_DIR}/usr/local/lib/
MYLIB1=/usr/local/lib/x86_64-linux-gnu
MYLIB2=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu
MYLIB3=/usr/local/lib64
MYLIB4=/lib64
MYLIB5=/usr/lib64
MYLIB6=/usr/local/lib
MYLIB7=/lib
MYLIB8=/usr/lib
MYLIB9=/usr/x86_64-linux-gnu/lib64
MYLIBA=/usr/x86_64-linux-gnu/lib
MY_LIBS=-L$(MYLIB1) -L$(MYLIB2) -L$(MYLIB3) -L$(MYLIB4) -L$(MYLIB5) -L$(MYLIB6) -L$(MYLIB7) -L$(MYLIB8) -L$(MYLIB9) -L$(MYLIBA)
TARGET = testy-curl
LIBS = -lcurl -lz -lpthread -lssl -lcrypto
CC = gcc
CFLAGS = -g -Wall -v
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)
%.o: %.c $(HEADERS)
$(CC) -I$(MYINC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -Wall -L$(MYLIB) $(MY_LIBS) $(LIBS) -o $@
[1] ~/progs/libcurl/Makefile [make] utf-8 unix enH row:1/58 (001%) col:000 Top
"Makefile" 58L, 1738C
avis@debian:~/progs/libcurl$ sudo ngrep -q -d enp0s3 -W byline host posttestserver.com and port 80
[sudo] password for davis:
interface: enp0s3 (192.168.1.0/255.255.255.0)
filter: (ip or ip6) and ( host posttestserver.com and port 80 )
T 192.168.1.4:34496 -> 107.170.47.130:80 [AP]
POST /post.php HTTP/1.1.
Host: posttestserver.com.
Accept: */*.
Content-Length: 179570.
Content-Type: multipart/form-data; boundary=------------------------00e658dda8d506bf.
Expect: 100-continue.
.
T 107.170.47.130:80 -> 192.168.1.4:34496 [AP]
HTTP/1.1 100 Continue.
.
T 192.168.1.4:34496 -> 107.170.47.130:80 [A]
--------------------------00e658dda8d506bf.
Content-Disposition: form-data; name="name".
.
John.
--------------------------00e658dda8d506bf.
Content-Disposition: form-data; name="project".
.
secret squirrel.
--------------------------00e658dda8d506bf.
Content-Disposition: form-data; name="logotype-image"; filename="curl.png".
Content-Type: image/png.
.
.PNG.
.
....IHDR.............@.;.....IDATx...y..Uu.....s..S.0
..8..U..Z...@F. Td.Ah.....Z..j.....$!..Im...T;.U...d.pss.s....~..s. 3I..}.^.Kr.....g.u.^.......G..M..V...@...~...;.}.q`.9....x.......0c:..7f....8[....?...kp'....o...k.
...y.....d..
.... <StuFF SNIPPED>
T 192.168.1.4:34634 -> 107.170.47.130:80 [AP]
.<{..Af.5.,nT._E..........I......$..I.;...YJ..T}..#.f.....;...PO8............<...~.n..H.M.]L........[.$....|[email protected].../)..l..9^...n 3.......G.z.....Q&.....9H...
.h...^.q.I.
V.T=I.pU....tIap...3....:#.: :..0...o.....g$6Q........?.F....6`.:..Reh....^.......6....m..7b.....r....G......c1./.q8.<J..qx^..V..V.~$.3.?.E.J.i.E..(e.~_d.......sb....:...J'.....J.p6.I...5L.........A*..T..i..y.U..QE.=..Bg.sg.......
G...X.....a....Rr... ..8./....]M6...8...8t....:*.%"""....DDD......7bE...(Y..3h.q@?.X..Ob....
.......G.n....MO..JT.B~.......#[%u..d.,U...R....h.".*....}.........]..=..........g../.Y]>.0...O..:W.......k..^XEo.j."^ut.3.yp..).6...._......(..a.....|]...s..H,!~"...*3KDDDf...DDD..4....[...+<..:..4J;m.M.g.9...z........<[email protected]`g @_..J.c*S...L........UJY..=....F.......2Wg[1...|n.....=....EU..`..c.D+FZ..............H<....:....tx........X3^.'...9.h.......*#........j
t.....%0...+..}......$..$>...x6..`.0..4....4..."...K.f2.$..1....C.PJ...g.o.H.. ..L..H......3.1..7B.#......T\..XZJ.....K..1&.t,1..I..1.y2:..H.N4:..`.;...m@+B.D..m..5h{h....._G......_a...k....{..S.ADDDd...M.I.........IEND.B`..
--------------------------813f67f6d95366dd--.
T 107.170.47.130:80 -> 192.168.1.4:34634 [AP]
HTTP/1.1 200 OK.
Date: Mon, 30 Oct 2017 19:48:56 GMT.
Server: Apache/2.4.18 (Ubuntu).
Access-Control-Allow-Origin: *.
Vary: Accept-Encoding.
Content-Length: 127.
Content-Type: text/html; charset=UTF-8.
.
Successfully dumped 2 post variables.
View it at http://www.posttestserver.com/data/2017/10/30/19.48.572009713569
No Post body.
davis@debian:~/progs/libcurl$ ./testy-curl
Testy-Curl. A program to test libcurl
===================== Test five ================
Successfully dumped 2 post variables.
View it at http://www.posttestserver.com/data/2017/10/30/19.48.572009713569
No Post body.davis@debian:~/progs/libcurl$
// header file is at
// /usr/include/x86_64-linux-gnu/curl/curl.h
#include <stdlib.h>
#include <unistd.h>
#include <curl/curl.h>
//#include <syslog.h>
// umask
//#include <sys/types.h>
//#include <sys/stat.h>
// printf
#include <stdio.h>
// time
//#include <time.h>
// sd_notify
//#include <systemd/sd-daemon.h>
#include "main.h"
int test_one() {
CURLcode result;
//
// Test # 1
//
printf("===================== Test One ================\n");
// Init the easy handle
CURL *curl = curl_easy_init();
// Do the work
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com");
result = curl_easy_perform(curl);
//printf("Result is : %s\n", result);
curl_easy_cleanup(curl);
}
return RC_OK;
[2] ~/progs/libcurl/testy-curl.c [c] utf-8 unix enH row:1/250 (000%) col:000 Top
"testy-curl.c" 250L, 4517C
@netskink
Copy link
Author

hmm. i just noticed the gvim select all copy and paste is only showing what's visible. I must have dorked that up since I recently changed my .vimrc file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment