summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/ubrowser/Makefile20
-rw-r--r--noncore/net/ubrowser/Makefile.in18
-rw-r--r--noncore/net/ubrowser/httpcomm.cpp49
3 files changed, 63 insertions, 24 deletions
diff --git a/noncore/net/ubrowser/Makefile b/noncore/net/ubrowser/Makefile
index 4d92441..69aaf20 100644
--- a/noncore/net/ubrowser/Makefile
+++ b/noncore/net/ubrowser/Makefile
@@ -1,253 +1,253 @@
1############################################################################# 1#############################################################################
2# Automatically generated from noncore/ubrowser/Makefile.in 2# Automatically generated from noncore/net/ubrowser/Makefile.in
3# Build options from 3# Build options from
4############################################################################# 4#############################################################################
5 5
6# Compiling 6# Compiling
7 INTERFACE_DECL_PATH = . 7 INTERFACE_DECL_PATH = .
8 SYSCONF_CXX = arm-linux-g++ 8 SYSCONF_CXX = arm-linux-g++
9 SYSCONF_CC = arm-linux-gcc 9 SYSCONF_CC = arm-linux-gcc
10 DASHCROSS = -arm 10 DASHCROSS = -arm
11 11
12# Compiling with support libraries 12# Compiling with support libraries
13 SYSCONF_CXXFLAGS_X11= 13 SYSCONF_CXXFLAGS_X11=
14 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include 14 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include
15 SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include 15 SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include
16 16
17# Compiling YACC output 17# Compiling YACC output
18SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses 18SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
19 19
20# Linking with support libraries 20# Linking with support libraries
21 SYSCONF_RPATH_X11= 21 SYSCONF_RPATH_X11=
22 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib 22 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib
23 SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib 23 SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib
24 24
25# Linking with support libraries 25# Linking with support libraries
26# X11 26# X11
27 SYSCONF_LFLAGS_X11= 27 SYSCONF_LFLAGS_X11=
28 SYSCONF_LIBS_X11= 28 SYSCONF_LIBS_X11=
29# Qt, Qt+OpenGL 29# Qt, Qt+OpenGL
30 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib 30 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib
31 SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) 31 SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX)
32 SYSCONF_LIBS_QT_OPENGL= 32 SYSCONF_LIBS_QT_OPENGL=
33# OpenGL 33# OpenGL
34 SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib 34 SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib
35 SYSCONF_LIBS_OPENGL= 35 SYSCONF_LIBS_OPENGL=
36# Yacc 36# Yacc
37 SYSCONF_LIBS_YACC= 37 SYSCONF_LIBS_YACC=
38 38
39# Linking applications 39# Linking applications
40 SYSCONF_LINK = arm-linux-gcc 40 SYSCONF_LINK = arm-linux-gcc
41 SYSCONF_LFLAGS = 41 SYSCONF_LFLAGS =
42 SYSCONF_LIBS = 42 SYSCONF_LIBS =
43 43
44# Link flags for shared objects 44# Link flags for shared objects
45 SYSCONF_LFLAGS_SHOBJ= -shared 45 SYSCONF_LFLAGS_SHOBJ= -shared
46 46
47# Flags for threading 47# Flags for threading
48 SYSCONF_CFLAGS_THREAD= -D_REENTRANT 48 SYSCONF_CFLAGS_THREAD= -D_REENTRANT
49 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT 49 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT
50 SYSCONF_LFLAGS_THREAD= 50 SYSCONF_LFLAGS_THREAD=
51 SYSCONF_LIBS_THREAD= -lpthread 51 SYSCONF_LIBS_THREAD= -lpthread
52 52
53# Meta-object compiler 53# Meta-object compiler
54 SYSCONF_MOC = $(QTDIR)/bin/moc 54 SYSCONF_MOC = $(QTDIR)/bin/moc
55 55
56# UI compiler 56# UI compiler
57 SYSCONF_UIC = $(QTDIR)/bin/uic 57 SYSCONF_UIC = $(QTDIR)/bin/uic
58 58
59# Linking shared libraries 59# Linking shared libraries
60# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 60# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
61# - Place target in $(DESTDIR) - which has a trailing / 61# - Place target in $(DESTDIR) - which has a trailing /
62# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) 62# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
63# 63#
64 SYSCONF_LINK_SHLIB= arm-linux-gcc 64 SYSCONF_LINK_SHLIB= arm-linux-gcc
65 SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) 65 SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH)
66 SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ 66 SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
67 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ 67 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
68 $(OBJECTS) $(OBJMOC) $(LIBS) && \ 68 $(OBJECTS) $(OBJMOC) $(LIBS) && \
69 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ 69 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
70 cd $(DESTDIR) && \ 70 cd $(DESTDIR) && \
71 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ 71 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \
72 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ 72 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
73 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ 73 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \
74 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) 74 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
75 75
76# Linking static libraries 76# Linking static libraries
77# - Build the $(TARGET) library, eg. lib$(TARGET).a 77# - Build the $(TARGET) library, eg. lib$(TARGET).a
78# - Place target in $(DESTDIR) - which has a trailing / 78# - Place target in $(DESTDIR) - which has a trailing /
79# 79#
80 SYSCONF_AR = arm-linux-ar cqs 80 SYSCONF_AR = arm-linux-ar cqs
81SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a 81SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
82 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ 82 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
83 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) 83 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
84# Compiling application source 84# Compiling application source
85 SYSCONF_CXXFLAGS= -pipe -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W 85 SYSCONF_CXXFLAGS= -pipe -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W
86 SYSCONF_CFLAGS = -pipe -O2 -Wall -W 86 SYSCONF_CFLAGS = -pipe -O2 -Wall -W
87# Default link type (static linking is still be used where required) 87# Default link type (static linking is still be used where required)
88 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED) 88 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED)
89 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED) 89 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED)
90# Compiling library source 90# Compiling library source
91 SYSCONF_CXXFLAGS_LIB= -fPIC 91 SYSCONF_CXXFLAGS_LIB= -fPIC
92 SYSCONF_CFLAGS_LIB= -fPIC 92 SYSCONF_CFLAGS_LIB= -fPIC
93# Compiling shared-object source 93# Compiling shared-object source
94 SYSCONF_CXXFLAGS_SHOBJ= -fPIC 94 SYSCONF_CXXFLAGS_SHOBJ= -fPIC
95 SYSCONF_CFLAGS_SHOBJ= -fPIC 95 SYSCONF_CFLAGS_SHOBJ= -fPIC
96# Linking Qt 96# Linking Qt
97 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) 97 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
98# Linking Qt applications 98# Linking Qt applications
99 SYSCONF_LIBS_QTAPP= 99 SYSCONF_LIBS_QTAPP=
100############################################################################# 100#############################################################################
101 101
102####### Compiler, tools and options 102####### Compiler, tools and options
103 103
104 CXX =$(SYSCONF_CXX) $(QT_CXX_MT) 104 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
105 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) 105 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
106 CC =$(SYSCONF_CC) $(QT_C_MT) 106 CC =$(SYSCONF_CC) $(QT_C_MT)
107 CFLAGS =$(SYSCONF_CFLAGS) 107 CFLAGS =$(SYSCONF_CFLAGS)
108 INCPATH =-I$(OPIEDIR)/include 108 INCPATH =-I../../../include
109 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) 109 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
110 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) 110 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
111 MOC =$(SYSCONF_MOC) 111 MOC =$(SYSCONF_MOC)
112 UIC =$(SYSCONF_UIC) 112 UIC =$(SYSCONF_UIC)
113 113
114####### Target 114####### Target
115 115
116DESTDIR = $(OPIEDIR)/bin/ 116DESTDIR = ../../../bin/
117VER_MAJ = 1 117VER_MAJ = 1
118VER_MIN = 0 118VER_MIN = 0
119VER_PATCH = 0 119VER_PATCH = 0
120 TARGET= ubrowser 120 TARGET= ubrowser
121TARGET1 = lib$(TARGET).so.$(VER_MAJ) 121TARGET1 = lib$(TARGET).so.$(VER_MAJ)
122 122
123####### Files 123####### Files
124 124
125 HEADERS =mainview.h \ 125 HEADERS =mainview.h \
126 httpfactory.h \ 126 httpfactory.h \
127 httpcomm.h 127 httpcomm.h
128 SOURCES =main.cpp \ 128 SOURCES =main.cpp \
129 mainview.cpp \ 129 mainview.cpp \
130 httpfactory.cpp \ 130 httpfactory.cpp \
131 httpcomm.cpp 131 httpcomm.cpp
132 OBJECTS =main.o \ 132 OBJECTS =main.o \
133 mainview.o \ 133 mainview.o \
134 httpfactory.o \ 134 httpfactory.o \
135 httpcomm.o 135 httpcomm.o
136INTERFACES = 136INTERFACES =
137UICDECLS = 137UICDECLS =
138UICIMPLS = 138UICIMPLS =
139 SRCMOC =moc_mainview.cpp \ 139 SRCMOC =moc_mainview.cpp \
140 moc_httpcomm.cpp 140 moc_httpcomm.cpp
141 OBJMOC =moc_mainview.o \ 141 OBJMOC =moc_mainview.o \
142 moc_httpcomm.o 142 moc_httpcomm.o
143 143
144 144
145####### Implicit rules 145####### Implicit rules
146 146
147.SUFFIXES: .cpp .cxx .cc .C .c 147.SUFFIXES: .cpp .cxx .cc .C .c
148 148
149.cpp.o: 149.cpp.o:
150 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 150 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
151 151
152.cxx.o: 152.cxx.o:
153 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 153 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
154 154
155.cc.o: 155.cc.o:
156 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 156 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
157 157
158.C.o: 158.C.o:
159 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 159 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
160 160
161.c.o: 161.c.o:
162 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< 162 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
163 163
164####### Build rules 164####### Build rules
165 165
166 166
167all: $(DESTDIR)$(TARGET) 167all: $(DESTDIR)$(TARGET)
168 168
169$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) 169$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
170 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) 170 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
171 171
172moc: $(SRCMOC) 172moc: $(SRCMOC)
173 173
174tmake: 174tmake:
175 tmake ubrowser.pro 175 tmake ubrowser.pro
176 176
177clean: 177clean:
178 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) 178 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
179 -rm -f *~ core 179 -rm -f *~ core
180 -rm -f allmoc.cpp 180 -rm -f allmoc.cpp
181 181
182####### Extension Modules 182####### Extension Modules
183 183
184listpromodules: 184listpromodules:
185 @echo 185 @echo
186 186
187listallmodules: 187listallmodules:
188 @echo 188 @echo
189 189
190listaddonpromodules: 190listaddonpromodules:
191 @echo 191 @echo
192 192
193listaddonentmodules: 193listaddonentmodules:
194 @echo 194 @echo
195 195
196 196
197REQUIRES= 197REQUIRES=
198 198
199####### Sub-libraries 199####### Sub-libraries
200 200
201 201
202###### Combined headers 202###### Combined headers
203 203
204 204
205 205
206####### Compile 206####### Compile
207 207
208main.o: main.cpp \ 208main.o: main.cpp \
209 $(OPIEDIR)/include/qpe/qpeapplication.h \ 209 ../../../include/qpe/qpeapplication.h \
210 mainview.h \ 210 mainview.h \
211 $(OPIEDIR)/include/qpe/resource.h \ 211 ../../../include/qpe/resource.h \
212 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 212 ../../../include/qpe/qpetoolbar.h \
213 httpfactory.h \ 213 httpfactory.h \
214 httpcomm.h 214 httpcomm.h
215 215
216mainview.o: mainview.cpp \ 216mainview.o: mainview.cpp \
217 mainview.h \ 217 mainview.h \
218 $(OPIEDIR)/include/qpe/resource.h \ 218 ../../../include/qpe/resource.h \
219 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 219 ../../../include/qpe/qpetoolbar.h \
220 httpfactory.h \ 220 httpfactory.h \
221 httpcomm.h 221 httpcomm.h
222 222
223httpfactory.o: httpfactory.cpp \ 223httpfactory.o: httpfactory.cpp \
224 httpfactory.h \ 224 httpfactory.h \
225 httpcomm.h 225 httpcomm.h
226 226
227httpcomm.o: httpcomm.cpp \ 227httpcomm.o: httpcomm.cpp \
228 httpcomm.h 228 httpcomm.h
229 229
230moc_mainview.o: moc_mainview.cpp \ 230moc_mainview.o: moc_mainview.cpp \
231 mainview.h \ 231 mainview.h \
232 $(OPIEDIR)/include/qpe/resource.h \ 232 ../../../include/qpe/resource.h \
233 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 233 ../../../include/qpe/qpetoolbar.h \
234 httpfactory.h \ 234 httpfactory.h \
235 httpcomm.h 235 httpcomm.h
236 236
237moc_httpcomm.o: moc_httpcomm.cpp \ 237moc_httpcomm.o: moc_httpcomm.cpp \
238 httpcomm.h 238 httpcomm.h
239 239
240moc_mainview.cpp: mainview.h 240moc_mainview.cpp: mainview.h
241 $(MOC) mainview.h -o moc_mainview.cpp 241 $(MOC) mainview.h -o moc_mainview.cpp
242 242
243moc_httpcomm.cpp: httpcomm.h 243moc_httpcomm.cpp: httpcomm.h
244 $(MOC) httpcomm.h -o moc_httpcomm.cpp 244 $(MOC) httpcomm.h -o moc_httpcomm.cpp
245 245
246 246
247 247
248lupdate: 248lupdate:
249 lupdate ubrowser.pro 249 lupdate ubrowser.pro
250 250
251lrelease: 251lrelease:
252 lrelease ubrowser.pro 252 lrelease ubrowser.pro
253 253
diff --git a/noncore/net/ubrowser/Makefile.in b/noncore/net/ubrowser/Makefile.in
index 010f16f..43b5111 100644
--- a/noncore/net/ubrowser/Makefile.in
+++ b/noncore/net/ubrowser/Makefile.in
@@ -1,147 +1,147 @@
1############################################################################# 1#############################################################################
2 2
3####### Compiler, tools and options 3####### Compiler, tools and options
4 4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT) 5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) 6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
7 CC =$(SYSCONF_CC) $(QT_C_MT) 7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) 8 CFLAGS =$(SYSCONF_CFLAGS)
9 INCPATH =-I$(OPIEDIR)/include 9 INCPATH =-I../../../include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) 10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) 11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC) 12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC) 13 UIC =$(SYSCONF_UIC)
14 14
15####### Target 15####### Target
16 16
17DESTDIR = $(OPIEDIR)/bin/ 17DESTDIR = ../../../bin/
18VER_MAJ = 1 18VER_MAJ = 1
19VER_MIN = 0 19VER_MIN = 0
20VER_PATCH = 0 20VER_PATCH = 0
21 TARGET= ubrowser 21 TARGET= ubrowser
22TARGET1 = lib$(TARGET).so.$(VER_MAJ) 22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23 23
24####### Files 24####### Files
25 25
26 HEADERS =mainview.h \ 26 HEADERS =mainview.h \
27 httpfactory.h \ 27 httpfactory.h \
28 httpcomm.h 28 httpcomm.h
29 SOURCES =main.cpp \ 29 SOURCES =main.cpp \
30 mainview.cpp \ 30 mainview.cpp \
31 httpfactory.cpp \ 31 httpfactory.cpp \
32 httpcomm.cpp 32 httpcomm.cpp
33 OBJECTS =main.o \ 33 OBJECTS =main.o \
34 mainview.o \ 34 mainview.o \
35 httpfactory.o \ 35 httpfactory.o \
36 httpcomm.o 36 httpcomm.o
37INTERFACES = 37INTERFACES =
38UICDECLS = 38UICDECLS =
39UICIMPLS = 39UICIMPLS =
40 SRCMOC =moc_mainview.cpp \ 40 SRCMOC =moc_mainview.cpp \
41 moc_httpcomm.cpp 41 moc_httpcomm.cpp
42 OBJMOC =moc_mainview.o \ 42 OBJMOC =moc_mainview.o \
43 moc_httpcomm.o 43 moc_httpcomm.o
44 44
45 45
46####### Implicit rules 46####### Implicit rules
47 47
48.SUFFIXES: .cpp .cxx .cc .C .c 48.SUFFIXES: .cpp .cxx .cc .C .c
49 49
50.cpp.o: 50.cpp.o:
51 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 51 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
52 52
53.cxx.o: 53.cxx.o:
54 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 54 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
55 55
56.cc.o: 56.cc.o:
57 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 57 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
58 58
59.C.o: 59.C.o:
60 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< 60 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
61 61
62.c.o: 62.c.o:
63 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< 63 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
64 64
65####### Build rules 65####### Build rules
66 66
67 67
68all: $(DESTDIR)$(TARGET) 68all: $(DESTDIR)$(TARGET)
69 69
70$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) 70$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
71 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) 71 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
72 72
73moc: $(SRCMOC) 73moc: $(SRCMOC)
74 74
75tmake: 75tmake:
76 tmake ubrowser.pro 76 tmake ubrowser.pro
77 77
78clean: 78clean:
79 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) 79 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
80 -rm -f *~ core 80 -rm -f *~ core
81 -rm -f allmoc.cpp 81 -rm -f allmoc.cpp
82 82
83####### Extension Modules 83####### Extension Modules
84 84
85listpromodules: 85listpromodules:
86 @echo 86 @echo
87 87
88listallmodules: 88listallmodules:
89 @echo 89 @echo
90 90
91listaddonpromodules: 91listaddonpromodules:
92 @echo 92 @echo
93 93
94listaddonentmodules: 94listaddonentmodules:
95 @echo 95 @echo
96 96
97 97
98REQUIRES= 98REQUIRES=
99 99
100####### Sub-libraries 100####### Sub-libraries
101 101
102 102
103###### Combined headers 103###### Combined headers
104 104
105 105
106 106
107####### Compile 107####### Compile
108 108
109main.o: main.cpp \ 109main.o: main.cpp \
110 $(OPIEDIR)/include/qpe/qpeapplication.h \ 110 ../../../include/qpe/qpeapplication.h \
111 mainview.h \ 111 mainview.h \
112 $(OPIEDIR)/include/qpe/resource.h \ 112 ../../../include/qpe/resource.h \
113 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 113 ../../../include/qpe/qpetoolbar.h \
114 httpfactory.h \ 114 httpfactory.h \
115 httpcomm.h 115 httpcomm.h
116 116
117mainview.o: mainview.cpp \ 117mainview.o: mainview.cpp \
118 mainview.h \ 118 mainview.h \
119 $(OPIEDIR)/include/qpe/resource.h \ 119 ../../../include/qpe/resource.h \
120 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 120 ../../../include/qpe/qpetoolbar.h \
121 httpfactory.h \ 121 httpfactory.h \
122 httpcomm.h 122 httpcomm.h
123 123
124httpfactory.o: httpfactory.cpp \ 124httpfactory.o: httpfactory.cpp \
125 httpfactory.h \ 125 httpfactory.h \
126 httpcomm.h 126 httpcomm.h
127 127
128httpcomm.o: httpcomm.cpp \ 128httpcomm.o: httpcomm.cpp \
129 httpcomm.h 129 httpcomm.h
130 130
131moc_mainview.o: moc_mainview.cpp \ 131moc_mainview.o: moc_mainview.cpp \
132 mainview.h \ 132 mainview.h \
133 $(OPIEDIR)/include/qpe/resource.h \ 133 ../../../include/qpe/resource.h \
134 $(OPIEDIR)/include/qpe/qpetoolbar.h \ 134 ../../../include/qpe/qpetoolbar.h \
135 httpfactory.h \ 135 httpfactory.h \
136 httpcomm.h 136 httpcomm.h
137 137
138moc_httpcomm.o: moc_httpcomm.cpp \ 138moc_httpcomm.o: moc_httpcomm.cpp \
139 httpcomm.h 139 httpcomm.h
140 140
141moc_mainview.cpp: mainview.h 141moc_mainview.cpp: mainview.h
142 $(MOC) mainview.h -o moc_mainview.cpp 142 $(MOC) mainview.h -o moc_mainview.cpp
143 143
144moc_httpcomm.cpp: httpcomm.h 144moc_httpcomm.cpp: httpcomm.h
145 $(MOC) httpcomm.h -o moc_httpcomm.cpp 145 $(MOC) httpcomm.h -o moc_httpcomm.cpp
146 146
147 147
diff --git a/noncore/net/ubrowser/httpcomm.cpp b/noncore/net/ubrowser/httpcomm.cpp
index 51068db..54f7acf 100644
--- a/noncore/net/ubrowser/httpcomm.cpp
+++ b/noncore/net/ubrowser/httpcomm.cpp
@@ -1,256 +1,295 @@
1/* 1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing 2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens 3Copyright (C) 2002 Thomas Stephens
4 4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include "httpcomm.h" 17#include "httpcomm.h"
18 18
19HttpComm::HttpComm(QSocket *newSocket, QTextBrowser *newBrowser):QObject() 19HttpComm::HttpComm(QSocket *newSocket, QTextBrowser *newBrowser):QObject()
20{ 20{
21 socket = newSocket; 21 socket = newSocket;
22 22
23 connect(socket, SIGNAL(hostFound()), this, SLOT(hostFound()) ); 23 connect(socket, SIGNAL(hostFound()), this, SLOT(hostFound()) );
24 connect(socket, SIGNAL(connected()), this, SLOT(connected()) ); 24 connect(socket, SIGNAL(connected()), this, SLOT(connected()) );
25 connect(socket, SIGNAL(readyRead()), this, SLOT(incoming()) ); 25 connect(socket, SIGNAL(readyRead()), this, SLOT(incoming()) );
26 connect(socket, SIGNAL(connectionClosed()), this, SLOT(connectionClosed()) ); 26 connect(socket, SIGNAL(connectionClosed()), this, SLOT(connectionClosed()) );
27 27
28 headerRead=false; 28 headerRead=false;
29 length = 0; 29 length = 0;
30 bRead = 0; 30 bRead = 0;
31 chunked=false; 31 chunked=false;
32 lengthset=false; 32 lengthset=false;
33 33
34 browser=newBrowser; 34 browser=newBrowser;
35} 35}
36 36
37void HttpComm::setUp(QString *newName) 37void HttpComm::setUp(QString *newName)
38{ 38{
39 name = newName; 39 name = newName;
40} 40}
41 41
42void HttpComm::setStuff(QString newHost, QString newPortS, QString newFile, QTextDrag *newText) 42void HttpComm::setStuff(QString newHost, QString newPortS, QString newFile, QTextDrag *newText)
43{ 43{
44 host = newHost; 44 host = newHost;
45 portS = newPortS; 45 portS = newPortS;
46 file = newFile; 46 file = newFile;
47 text = newText; 47 text = newText;
48} 48}
49 49
50void HttpComm::hostFound() 50void HttpComm::hostFound()
51{ 51{
52 printf("HttpComm::hostFound: host found\n"); 52 printf("HttpComm::hostFound: host found\n");
53} 53}
54 54
55void HttpComm::connected() 55void HttpComm::connected()
56{ 56{
57 QString request("GET " + file + " HTTP/1.1\r\nHost: " + host + ':' + portS + "\r\nConnection: close\r\n\r\n"); 57 QString request("GET " + file + " HTTP/1.1\r\nHost: " + host + ':' + portS + "\r\nConnection: close\r\n\r\n");
58 //QString request("GET " + file + " HTTP/1.0\r\n\r\n"); 58 //QString request("GET " + file + " HTTP/1.0\r\n\r\n");
59 printf("HttpComm::data: bytes written: %d\n", socket->writeBlock(request.latin1(), request.length()) ); 59 printf("HttpComm::data: bytes written: %d\n", socket->writeBlock(request.latin1(), request.length()) );
60 printf("HttpComm::data: request sent:\n%s", request.latin1()); 60 printf("HttpComm::data: request sent:\n%s", request.latin1());
61 61
62 headerRead=false; 62 headerRead=false;
63 bRead=0; 63 bRead=0;
64 length = 0; 64 length = 0;
65 header=""; 65 header="";
66 body=""; 66 body="";
67 chunked=false; 67 chunked=false;
68 lengthset=false; 68 lengthset=false;
69} 69}
70 70
71void HttpComm::incoming() 71void HttpComm::incoming()
72{ 72{
73 int ba=socket->bytesAvailable(), i=0, j=0, semi=0; 73 int ba=socket->bytesAvailable(), i=0, j=0, semi=0;
74 char *tempString = new char [ba]; 74 char *tempString = new char [ba];
75 bool nextChunk=false; 75 bool nextChunk=false;
76 bool done=false; 76 bool done=false;
77 socket->readBlock(tempString, ba); 77 socket->readBlock(tempString, ba);
78 printf("HttpComm::incoming: ba: %d\n", ba); 78 printf("HttpComm::incoming: ba: %d\n", ba);
79 QString sclength; 79 QString sclength;
80 80
81 if(headerRead == false) 81 if(headerRead == false)
82 { 82 {
83 for(i=0; i<ba; i++) 83 for(i=0; i<ba; i++)
84 { 84 {
85 if(tempString[i] != '\r') 85 if(tempString[i] != '\r')
86 { 86 {
87 if(tempString[i] == '\n' && header[header.length()-1] == '\n') 87 if(tempString[i] == '\n' && header[header.length()-1] == '\n')
88 { 88 {
89 j=i; 89 j=i;
90 headerRead = true; 90 headerRead = true;
91 parseHeader(); 91 parseHeader();
92 goto body; 92 goto body;
93 } 93 }
94 else 94 else
95 { 95 {
96 header+=tempString[i]; 96 header+=tempString[i];
97 } 97 }
98 } 98 }
99 // printf("%d %d\n", ba, i); 99 // printf("%d %d\n", ba, i);
100 } 100 }
101 } 101 }
102 else 102 else
103 { 103 {
104 body: 104 body:
105 printf("HttpComm::incoming: reading body\n"); 105 printf("HttpComm::incoming: reading body\n");
106 printf("HttpComm::incoming: j is: %d\n", j); 106 printf("HttpComm::incoming: j is: %d\n", j);
107 if(!chunked) 107 if(!chunked)
108 { 108 {
109//make sure we didnt just leave that break above... 109//make sure we didnt just leave that break above...
110 if(j != 0) 110 if(j != 0)
111 { 111 {
112 for( ; j<ba ; j++) 112 for( ; j<ba ; j++)
113 { 113 {
114 body+=tempString[j]; 114 body+=tempString[j];
115 bRead++; 115 bRead++;
116 // printf("bRead1: %d\n", bRead); 116 // printf("bRead1: %d\n", bRead);
117 } 117 }
118 } 118 }
119 else 119 else
120 { 120 {
121 body += tempString; 121 body += tempString;
122 bRead+=ba; 122 bRead+=ba;
123 // printf("bRead2: %d\n", bRead); 123 // printf("bRead2: %d\n", bRead);
124 } 124 }
125 125
126 if(bRead >= length) 126 if(bRead >= length)
127 { 127 {
128 printf("HttpComm::incoming: finished reading body\n"); 128 printf("HttpComm::incoming: finished reading body\n");
129 processBody(); 129 processBody();
130 socket->close(); 130 socket->close();
131 } 131 }
132 } 132 }
133 else 133 else
134 { 134 {
135 QString tempQString = tempString; 135 QString tempQString = tempString;
136 //remove the http header, if one exists 136 //remove the http header, if one exists
137 if(j != 0) 137 if(j != 0)
138 { 138 {
139 tempQString.remove(0, j); 139 tempQString.remove(0, j+1);
140 printf("HttpComm::incoming: removing http header. Result: \n%s", tempQString.latin1());
140 } 141 }
141 while(!done) 142 while(!done)
142 { 143 {
143 switch(status) 144 switch(status)
144 { 145 {
145 //case 0=need to read chunk length 146 //case 0=need to read chunk length
146 case 0: 147 case 0:
147 j = tempQString.find('\n'); 148 j = tempQString.find('\n');
148 sclength = tempQString; 149 sclength = tempQString;
149 sclength.truncate(j); 150 sclength.truncate(j);
150 clength = sclength.toUInt(0, 16); 151 clength = sclength.toUInt(0, 16);
151 printf("HttpComm::Incoming: chunk length: %d\n", clength); 152 printf("HttpComm::Incoming: chunk length: %d\n", clength);
153 //end of data
152 if(clength==0) 154 if(clength==0)
153 { 155 {
154 processBody(); 156 processBody();
155 done=true; 157 done=true;
156 } 158 }
159 //still more, but it hasnt been recieved yet
157 if(ba <= j) 160 if(ba <= j)
158 { 161 {
159 status=1; 162 status=1;
160 done=true; 163 done=true;
161 // break; 164 break;
162 } 165 }
166 //still more data waiting
163 else 167 else
164 { 168 {
165 done=false; 169 done=false;
170 //remove the chunk length header
171 tempQString.remove(0,j+1);
166 } 172 }
167 bRead=0; 173 bRead=0;
168 break; 174 // break;
169 //if there is more fall through to: 175 //if there is more fall through to:
170 //chunk length just read, still more in tempQstring 176 //chunk length just read, still more in tempQstring
171 case 1: 177 case 1:
172 //the current data extends beyond the end of the chunk 178 //the current data extends beyond the end of the chunk
173 if(bRead + tempQString.length() > clength) 179 if(bRead + tempQString.length() > clength)
174 { 180 {
175 QString newTQstring = tempQString; 181 QString newTQstring = tempQString;
176 newTQstring.truncate(clength-bRead); 182 newTQstring.truncate(clength-bRead);
183 bRead+=newTQstring.length();
177 body+=newTQstring; 184 body+=newTQstring;
178 printf("HttpComm::incoming: start new body piece 1: \n"); 185 printf("HttpComm::incoming: start new body piece 1: \n");
179 printf("%s", newTQstring.latin1() ); 186 printf("%s", newTQstring.latin1() );
180 printf("HttpComm::incoming: end new body piece 1.\n"); 187 printf("HttpComm::incoming: end new body piece 1.\n");
181 status=0; 188 status=0;
182 j=clength-bRead; 189 j=clength-bRead;
183 done=false; 190 done=false;
184 break; 191 // break;
185 } 192 }
186 //the chunk extends beyond the current data; 193 //the chunk extends beyond the current data;
187 else 194 else
188 { 195 {
189 body+=tempQString; 196 body+=tempQString;
190 bRead+=ba; 197 bRead+=ba;
191 printf("HttpComm::incoming: start new body piece 2: \n"); 198 printf("HttpComm::incoming: start new body piece 2: \n");
192 printf("%s", tempQString.latin1() ); 199 printf("%s", tempQString.latin1() );
193 printf("HttpComm::incoming: end new body piece 2.\n"); 200 printf("HttpComm::incoming: end new body piece 2.\n");
194 done=true; 201 done=true;
195 break; 202 status=2;
203 // break;
204 }
205 break;
206 //just got data in, continue reading chunk
207 case 2:
208 //the current data extends beyond the end of the chunk
209 if(bRead + tempQString.length() > clength)
210 {
211 QString newTQstring = tempQString;
212 newTQstring.truncate(clength-bRead);
213 bRead+=newTQstring.length();
214 body+=newTQstring;
215 printf("HttpComm::incoming: start new body piece 3: \n");
216 printf("%s", newTQstring.latin1() );
217 printf("HttpComm::incoming: end new body piece 3.\n");
218 status=0;
219 j=clength-bRead;
220 done=false;
221 // break;
222 }
223 //the chunk extends beyond the current data;
224 else
225 {
226 body+=tempQString;
227 bRead+=ba;
228 printf("HttpComm::incoming: start new body piece 4: \n");
229 printf("%s", tempQString.latin1() );
230 printf("HttpComm::incoming: end new body piece 4.\n");
231 done=true;
232 status=2;
233 // break;
196 } 234 }
197 break; 235 break;
198 } 236 }
237 printf("HttpComm::incoming: chunked encoding: bRead: %d\n", bRead);
199 } 238 }
200 } 239 }
201 } 240 }
202 delete tempString; 241 delete tempString;
203} 242}
204 243
205void HttpComm::connectionClosed() 244void HttpComm::connectionClosed()
206{ 245{
207 printf("HttpComm::connectionClosed: connection closed\n"); 246 printf("HttpComm::connectionClosed: connection closed\n");
208 processBody(); 247 processBody();
209} 248}
210 249
211void HttpComm::parseHeader() 250void HttpComm::parseHeader()
212{ 251{
213 QStringList headerLines, tempList; 252 QStringList headerLines, tempList;
214 int i; 253 int i;
215 254
216 printf("HttpComm::parseHeader: start header\n\n"); 255 printf("HttpComm::parseHeader: start header\n\n");
217 printf("%s", header.latin1()); 256 printf("%s", header.latin1());
218 printf("HttpComm::parseHeader: end header\n"); 257 printf("HttpComm::parseHeader: end header\n");
219 258
220 headerLines = QStringList::split('\n', header); 259 headerLines = QStringList::split('\n', header);
221 260
222 for(i=0; i<headerLines.count(); i++) 261 for(i=0; i<headerLines.count(); i++)
223 { 262 {
224 if(headerLines[i].startsWith("Content-Length:") ) 263 if(headerLines[i].startsWith("Content-Length:") )
225 { 264 {
226 tempList = QStringList::split(':', headerLines[i]); 265 tempList = QStringList::split(':', headerLines[i]);
227 tempList[1].stripWhiteSpace(); 266 tempList[1].stripWhiteSpace();
228 length = tempList[1].toUInt(); 267 length = tempList[1].toUInt();
229 } 268 }
230 else if(headerLines[i].startsWith("Transfer-Encoding: chunked") ) 269 else if(headerLines[i].startsWith("Transfer-Encoding: chunked") )
231 { 270 {
232 printf("HttpComm::parseHeader: using chunked encoding\n"); 271 printf("HttpComm::parseHeader: using chunked encoding\n");
233 chunked = true; 272 chunked = true;
234 status=0; 273 status=0;
235 } 274 }
236 } 275 }
237 276
238 printf("HttpConn::parseHeader: content-length: %d\n", length); 277 printf("HttpConn::parseHeader: content-length: %d\n", length);
239} 278}
240 279
241void HttpComm::processBody() 280void HttpComm::processBody()
242{ 281{
243 //printf("HttpComm::processBody: start body\n\n"); 282 //printf("HttpComm::processBody: start body\n\n");
244 //printf("%s", body.latin1()); 283 //printf("%s", body.latin1());
245 //printf("HttpComm::processBody: end body\n"); 284 //printf("HttpComm::processBody: end body\n");
246 285
247 int lastSlash = file.findRev('/'); 286 int lastSlash = file.findRev('/');
248 287
249 QString end = file; 288 QString end = file;
250 end.truncate(lastSlash-1); 289 end.truncate(lastSlash-1);
251 QString context("http://"+host+':'+portS+end); 290 QString context("http://"+host+':'+portS+end);
252 291
253 browser->setTextFormat(RichText); 292 browser->setTextFormat(RichText);
254 browser->setText(body, context); 293 browser->setText(body, context);
255 printf("%s\n", context.latin1() ); 294 printf("%s\n", context.latin1() );
256} 295}