summaryrefslogtreecommitdiff
path: root/noncore/net/ubrowser
Unidiff
Diffstat (limited to 'noncore/net/ubrowser') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/ubrowser/Makefile253
-rw-r--r--noncore/net/ubrowser/Makefile.in147
-rw-r--r--noncore/net/ubrowser/gnu-license-header15
-rw-r--r--noncore/net/ubrowser/httpcomm.cpp256
-rw-r--r--noncore/net/ubrowser/httpcomm.h57
-rw-r--r--noncore/net/ubrowser/httpcomm.obin0 -> 13884 bytes
-rw-r--r--noncore/net/ubrowser/httpfactory.cpp104
-rw-r--r--noncore/net/ubrowser/httpfactory.h38
-rw-r--r--noncore/net/ubrowser/httpfactory.obin0 -> 5788 bytes
-rw-r--r--noncore/net/ubrowser/main.cpp29
-rw-r--r--noncore/net/ubrowser/main.obin0 -> 1396 bytes
-rw-r--r--noncore/net/ubrowser/mainview.cpp88
-rw-r--r--noncore/net/ubrowser/mainview.h48
-rw-r--r--noncore/net/ubrowser/mainview.obin0 -> 7156 bytes
-rw-r--r--noncore/net/ubrowser/moc_httpcomm.cpp102
-rw-r--r--noncore/net/ubrowser/moc_httpcomm.obin0 -> 4716 bytes
-rw-r--r--noncore/net/ubrowser/moc_mainview.cpp88
-rw-r--r--noncore/net/ubrowser/moc_mainview.obin0 -> 11012 bytes
-rw-r--r--noncore/net/ubrowser/new_chunked_algo_thoughts12
-rw-r--r--noncore/net/ubrowser/old_chunked_algo57
-rw-r--r--noncore/net/ubrowser/ubrowser.pro9
21 files changed, 1303 insertions, 0 deletions
diff --git a/noncore/net/ubrowser/Makefile b/noncore/net/ubrowser/Makefile
new file mode 100644
index 0000000..4d92441
--- a/dev/null
+++ b/noncore/net/ubrowser/Makefile
@@ -0,0 +1,253 @@
1#############################################################################
2# Automatically generated from noncore/ubrowser/Makefile.in
3# Build options from
4#############################################################################
5
6# Compiling
7 INTERFACE_DECL_PATH = .
8 SYSCONF_CXX = arm-linux-g++
9 SYSCONF_CC = arm-linux-gcc
10 DASHCROSS = -arm
11
12# Compiling with support libraries
13 SYSCONF_CXXFLAGS_X11=
14 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include
15 SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include
16
17# Compiling YACC output
18SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
19
20# Linking with support libraries
21 SYSCONF_RPATH_X11=
22 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib
23 SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib
24
25# Linking with support libraries
26# X11
27 SYSCONF_LFLAGS_X11=
28 SYSCONF_LIBS_X11=
29# Qt, Qt+OpenGL
30 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib
31 SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX)
32 SYSCONF_LIBS_QT_OPENGL=
33# OpenGL
34 SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib
35 SYSCONF_LIBS_OPENGL=
36# Yacc
37 SYSCONF_LIBS_YACC=
38
39# Linking applications
40 SYSCONF_LINK = arm-linux-gcc
41 SYSCONF_LFLAGS =
42 SYSCONF_LIBS =
43
44# Link flags for shared objects
45 SYSCONF_LFLAGS_SHOBJ= -shared
46
47# Flags for threading
48 SYSCONF_CFLAGS_THREAD= -D_REENTRANT
49 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT
50 SYSCONF_LFLAGS_THREAD=
51 SYSCONF_LIBS_THREAD= -lpthread
52
53# Meta-object compiler
54 SYSCONF_MOC = $(QTDIR)/bin/moc
55
56# UI compiler
57 SYSCONF_UIC = $(QTDIR)/bin/uic
58
59# Linking shared libraries
60# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
61# - Place target in $(DESTDIR) - which has a trailing /
62# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
63#
64 SYSCONF_LINK_SHLIB= arm-linux-gcc
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) \
67 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
68 $(OBJECTS) $(OBJMOC) $(LIBS) && \
69 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
70 cd $(DESTDIR) && \
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; \
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)
75
76# Linking static libraries
77# - Build the $(TARGET) library, eg. lib$(TARGET).a
78# - Place target in $(DESTDIR) - which has a trailing /
79#
80 SYSCONF_AR = arm-linux-ar cqs
81SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
82 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
83 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
84# Compiling application source
85 SYSCONF_CXXFLAGS= -pipe -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W
86 SYSCONF_CFLAGS = -pipe -O2 -Wall -W
87# Default link type (static linking is still be used where required)
88 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED)
89 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED)
90# Compiling library source
91 SYSCONF_CXXFLAGS_LIB= -fPIC
92 SYSCONF_CFLAGS_LIB= -fPIC
93# Compiling shared-object source
94 SYSCONF_CXXFLAGS_SHOBJ= -fPIC
95 SYSCONF_CFLAGS_SHOBJ= -fPIC
96# Linking Qt
97 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
98# Linking Qt applications
99 SYSCONF_LIBS_QTAPP=
100#############################################################################
101
102####### Compiler, tools and options
103
104 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
105 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
106 CC =$(SYSCONF_CC) $(QT_C_MT)
107 CFLAGS =$(SYSCONF_CFLAGS)
108 INCPATH =-I$(OPIEDIR)/include
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)
111 MOC =$(SYSCONF_MOC)
112 UIC =$(SYSCONF_UIC)
113
114####### Target
115
116DESTDIR = $(OPIEDIR)/bin/
117VER_MAJ = 1
118VER_MIN = 0
119VER_PATCH = 0
120 TARGET= ubrowser
121TARGET1 = lib$(TARGET).so.$(VER_MAJ)
122
123####### Files
124
125 HEADERS =mainview.h \
126 httpfactory.h \
127 httpcomm.h
128 SOURCES =main.cpp \
129 mainview.cpp \
130 httpfactory.cpp \
131 httpcomm.cpp
132 OBJECTS =main.o \
133 mainview.o \
134 httpfactory.o \
135 httpcomm.o
136INTERFACES =
137UICDECLS =
138UICIMPLS =
139 SRCMOC =moc_mainview.cpp \
140 moc_httpcomm.cpp
141 OBJMOC =moc_mainview.o \
142 moc_httpcomm.o
143
144
145####### Implicit rules
146
147.SUFFIXES: .cpp .cxx .cc .C .c
148
149.cpp.o:
150 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
151
152.cxx.o:
153 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
154
155.cc.o:
156 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
157
158.C.o:
159 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
160
161.c.o:
162 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
163
164####### Build rules
165
166
167all: $(DESTDIR)$(TARGET)
168
169$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
170 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
171
172moc: $(SRCMOC)
173
174tmake:
175 tmake ubrowser.pro
176
177clean:
178 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
179 -rm -f *~ core
180 -rm -f allmoc.cpp
181
182####### Extension Modules
183
184listpromodules:
185 @echo
186
187listallmodules:
188 @echo
189
190listaddonpromodules:
191 @echo
192
193listaddonentmodules:
194 @echo
195
196
197REQUIRES=
198
199####### Sub-libraries
200
201
202###### Combined headers
203
204
205
206####### Compile
207
208main.o: main.cpp \
209 $(OPIEDIR)/include/qpe/qpeapplication.h \
210 mainview.h \
211 $(OPIEDIR)/include/qpe/resource.h \
212 $(OPIEDIR)/include/qpe/qpetoolbar.h \
213 httpfactory.h \
214 httpcomm.h
215
216mainview.o: mainview.cpp \
217 mainview.h \
218 $(OPIEDIR)/include/qpe/resource.h \
219 $(OPIEDIR)/include/qpe/qpetoolbar.h \
220 httpfactory.h \
221 httpcomm.h
222
223httpfactory.o: httpfactory.cpp \
224 httpfactory.h \
225 httpcomm.h
226
227httpcomm.o: httpcomm.cpp \
228 httpcomm.h
229
230moc_mainview.o: moc_mainview.cpp \
231 mainview.h \
232 $(OPIEDIR)/include/qpe/resource.h \
233 $(OPIEDIR)/include/qpe/qpetoolbar.h \
234 httpfactory.h \
235 httpcomm.h
236
237moc_httpcomm.o: moc_httpcomm.cpp \
238 httpcomm.h
239
240moc_mainview.cpp: mainview.h
241 $(MOC) mainview.h -o moc_mainview.cpp
242
243moc_httpcomm.cpp: httpcomm.h
244 $(MOC) httpcomm.h -o moc_httpcomm.cpp
245
246
247
248lupdate:
249 lupdate ubrowser.pro
250
251lrelease:
252 lrelease ubrowser.pro
253
diff --git a/noncore/net/ubrowser/Makefile.in b/noncore/net/ubrowser/Makefile.in
new file mode 100644
index 0000000..010f16f
--- a/dev/null
+++ b/noncore/net/ubrowser/Makefile.in
@@ -0,0 +1,147 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS)
9 INCPATH =-I$(OPIEDIR)/include
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)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = $(OPIEDIR)/bin/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= ubrowser
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =mainview.h \
27 httpfactory.h \
28 httpcomm.h
29 SOURCES =main.cpp \
30 mainview.cpp \
31 httpfactory.cpp \
32 httpcomm.cpp
33 OBJECTS =main.o \
34 mainview.o \
35 httpfactory.o \
36 httpcomm.o
37INTERFACES =
38UICDECLS =
39UICIMPLS =
40 SRCMOC =moc_mainview.cpp \
41 moc_httpcomm.cpp
42 OBJMOC =moc_mainview.o \
43 moc_httpcomm.o
44
45
46####### Implicit rules
47
48.SUFFIXES: .cpp .cxx .cc .C .c
49
50.cpp.o:
51 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
52
53.cxx.o:
54 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
55
56.cc.o:
57 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
58
59.C.o:
60 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
61
62.c.o:
63 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
64
65####### Build rules
66
67
68all: $(DESTDIR)$(TARGET)
69
70$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
71 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
72
73moc: $(SRCMOC)
74
75tmake:
76 tmake ubrowser.pro
77
78clean:
79 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
80 -rm -f *~ core
81 -rm -f allmoc.cpp
82
83####### Extension Modules
84
85listpromodules:
86 @echo
87
88listallmodules:
89 @echo
90
91listaddonpromodules:
92 @echo
93
94listaddonentmodules:
95 @echo
96
97
98REQUIRES=
99
100####### Sub-libraries
101
102
103###### Combined headers
104
105
106
107####### Compile
108
109main.o: main.cpp \
110 $(OPIEDIR)/include/qpe/qpeapplication.h \
111 mainview.h \
112 $(OPIEDIR)/include/qpe/resource.h \
113 $(OPIEDIR)/include/qpe/qpetoolbar.h \
114 httpfactory.h \
115 httpcomm.h
116
117mainview.o: mainview.cpp \
118 mainview.h \
119 $(OPIEDIR)/include/qpe/resource.h \
120 $(OPIEDIR)/include/qpe/qpetoolbar.h \
121 httpfactory.h \
122 httpcomm.h
123
124httpfactory.o: httpfactory.cpp \
125 httpfactory.h \
126 httpcomm.h
127
128httpcomm.o: httpcomm.cpp \
129 httpcomm.h
130
131moc_mainview.o: moc_mainview.cpp \
132 mainview.h \
133 $(OPIEDIR)/include/qpe/resource.h \
134 $(OPIEDIR)/include/qpe/qpetoolbar.h \
135 httpfactory.h \
136 httpcomm.h
137
138moc_httpcomm.o: moc_httpcomm.cpp \
139 httpcomm.h
140
141moc_mainview.cpp: mainview.h
142 $(MOC) mainview.h -o moc_mainview.cpp
143
144moc_httpcomm.cpp: httpcomm.h
145 $(MOC) httpcomm.h -o moc_httpcomm.cpp
146
147
diff --git a/noncore/net/ubrowser/gnu-license-header b/noncore/net/ubrowser/gnu-license-header
new file mode 100644
index 0000000..9973e8c
--- a/dev/null
+++ b/noncore/net/ubrowser/gnu-license-header
@@ -0,0 +1,15 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/ \ No newline at end of file
diff --git a/noncore/net/ubrowser/httpcomm.cpp b/noncore/net/ubrowser/httpcomm.cpp
new file mode 100644
index 0000000..51068db
--- a/dev/null
+++ b/noncore/net/ubrowser/httpcomm.cpp
@@ -0,0 +1,256 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include "httpcomm.h"
18
19HttpComm::HttpComm(QSocket *newSocket, QTextBrowser *newBrowser):QObject()
20{
21 socket = newSocket;
22
23 connect(socket, SIGNAL(hostFound()), this, SLOT(hostFound()) );
24 connect(socket, SIGNAL(connected()), this, SLOT(connected()) );
25 connect(socket, SIGNAL(readyRead()), this, SLOT(incoming()) );
26 connect(socket, SIGNAL(connectionClosed()), this, SLOT(connectionClosed()) );
27
28 headerRead=false;
29 length = 0;
30 bRead = 0;
31 chunked=false;
32 lengthset=false;
33
34 browser=newBrowser;
35}
36
37void HttpComm::setUp(QString *newName)
38{
39 name = newName;
40}
41
42void HttpComm::setStuff(QString newHost, QString newPortS, QString newFile, QTextDrag *newText)
43{
44 host = newHost;
45 portS = newPortS;
46 file = newFile;
47 text = newText;
48}
49
50void HttpComm::hostFound()
51{
52 printf("HttpComm::hostFound: host found\n");
53}
54
55void HttpComm::connected()
56{
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");
59 printf("HttpComm::data: bytes written: %d\n", socket->writeBlock(request.latin1(), request.length()) );
60 printf("HttpComm::data: request sent:\n%s", request.latin1());
61
62 headerRead=false;
63 bRead=0;
64 length = 0;
65 header="";
66 body="";
67 chunked=false;
68 lengthset=false;
69}
70
71void HttpComm::incoming()
72{
73 int ba=socket->bytesAvailable(), i=0, j=0, semi=0;
74 char *tempString = new char [ba];
75 bool nextChunk=false;
76 bool done=false;
77 socket->readBlock(tempString, ba);
78 printf("HttpComm::incoming: ba: %d\n", ba);
79 QString sclength;
80
81 if(headerRead == false)
82 {
83 for(i=0; i<ba; i++)
84 {
85 if(tempString[i] != '\r')
86 {
87 if(tempString[i] == '\n' && header[header.length()-1] == '\n')
88 {
89 j=i;
90 headerRead = true;
91 parseHeader();
92 goto body;
93 }
94 else
95 {
96 header+=tempString[i];
97 }
98 }
99 // printf("%d %d\n", ba, i);
100 }
101 }
102 else
103 {
104 body:
105 printf("HttpComm::incoming: reading body\n");
106 printf("HttpComm::incoming: j is: %d\n", j);
107 if(!chunked)
108 {
109//make sure we didnt just leave that break above...
110 if(j != 0)
111 {
112 for( ; j<ba ; j++)
113 {
114 body+=tempString[j];
115 bRead++;
116 // printf("bRead1: %d\n", bRead);
117 }
118 }
119 else
120 {
121 body += tempString;
122 bRead+=ba;
123 // printf("bRead2: %d\n", bRead);
124 }
125
126 if(bRead >= length)
127 {
128 printf("HttpComm::incoming: finished reading body\n");
129 processBody();
130 socket->close();
131 }
132 }
133 else
134 {
135 QString tempQString = tempString;
136 //remove the http header, if one exists
137 if(j != 0)
138 {
139 tempQString.remove(0, j);
140 }
141 while(!done)
142 {
143 switch(status)
144 {
145 //case 0=need to read chunk length
146 case 0:
147 j = tempQString.find('\n');
148 sclength = tempQString;
149 sclength.truncate(j);
150 clength = sclength.toUInt(0, 16);
151 printf("HttpComm::Incoming: chunk length: %d\n", clength);
152 if(clength==0)
153 {
154 processBody();
155 done=true;
156 }
157 if(ba <= j)
158 {
159 status=1;
160 done=true;
161 // break;
162 }
163 else
164 {
165 done=false;
166 }
167 bRead=0;
168 break;
169 //if there is more fall through to:
170 //chunk length just read, still more in tempQstring
171 case 1:
172 //the current data extends beyond the end of the chunk
173 if(bRead + tempQString.length() > clength)
174 {
175 QString newTQstring = tempQString;
176 newTQstring.truncate(clength-bRead);
177 body+=newTQstring;
178 printf("HttpComm::incoming: start new body piece 1: \n");
179 printf("%s", newTQstring.latin1() );
180 printf("HttpComm::incoming: end new body piece 1.\n");
181 status=0;
182 j=clength-bRead;
183 done=false;
184 break;
185 }
186 //the chunk extends beyond the current data;
187 else
188 {
189 body+=tempQString;
190 bRead+=ba;
191 printf("HttpComm::incoming: start new body piece 2: \n");
192 printf("%s", tempQString.latin1() );
193 printf("HttpComm::incoming: end new body piece 2.\n");
194 done=true;
195 break;
196 }
197 break;
198 }
199 }
200 }
201 }
202 delete tempString;
203}
204
205void HttpComm::connectionClosed()
206{
207 printf("HttpComm::connectionClosed: connection closed\n");
208 processBody();
209}
210
211void HttpComm::parseHeader()
212{
213 QStringList headerLines, tempList;
214 int i;
215
216 printf("HttpComm::parseHeader: start header\n\n");
217 printf("%s", header.latin1());
218 printf("HttpComm::parseHeader: end header\n");
219
220 headerLines = QStringList::split('\n', header);
221
222 for(i=0; i<headerLines.count(); i++)
223 {
224 if(headerLines[i].startsWith("Content-Length:") )
225 {
226 tempList = QStringList::split(':', headerLines[i]);
227 tempList[1].stripWhiteSpace();
228 length = tempList[1].toUInt();
229 }
230 else if(headerLines[i].startsWith("Transfer-Encoding: chunked") )
231 {
232 printf("HttpComm::parseHeader: using chunked encoding\n");
233 chunked = true;
234 status=0;
235 }
236 }
237
238 printf("HttpConn::parseHeader: content-length: %d\n", length);
239}
240
241void HttpComm::processBody()
242{
243 //printf("HttpComm::processBody: start body\n\n");
244 //printf("%s", body.latin1());
245 //printf("HttpComm::processBody: end body\n");
246
247 int lastSlash = file.findRev('/');
248
249 QString end = file;
250 end.truncate(lastSlash-1);
251 QString context("http://"+host+':'+portS+end);
252
253 browser->setTextFormat(RichText);
254 browser->setText(body, context);
255 printf("%s\n", context.latin1() );
256}
diff --git a/noncore/net/ubrowser/httpcomm.h b/noncore/net/ubrowser/httpcomm.h
new file mode 100644
index 0000000..c20fe72
--- a/dev/null
+++ b/noncore/net/ubrowser/httpcomm.h
@@ -0,0 +1,57 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include <qobject.h>
18#include <qstring.h>
19#include <qsocket.h>
20#include <qstringlist.h>
21#include <qdragobject.h>
22#include <qtextbrowser.h>
23
24#include <stdio.h>
25
26class HttpComm : public QObject
27{
28Q_OBJECT
29public:
30 HttpComm(QSocket *newSocket, QTextBrowser *newBrowser);
31 void setUp(QString *newName);
32 void setStuff(QString newHost, QString newPortS, QString newFile, QTextDrag *newText);
33 void parseHeader();
34 void processBody();
35public slots:
36 void hostFound();
37 void connected();
38 void connectionClosed();
39 void incoming();
40private:
41 QString *name;
42 QSocket *socket;
43 QString host;
44 QString portS;
45 QString file;
46 bool headerRead;
47 QString header;
48 QString body;
49 unsigned int length;
50 unsigned int bRead;
51 QTextDrag *text;
52 QTextBrowser *browser;
53 bool chunked;
54 bool lengthset;
55 unsigned int clength;
56 int status;
57};
diff --git a/noncore/net/ubrowser/httpcomm.o b/noncore/net/ubrowser/httpcomm.o
new file mode 100644
index 0000000..144d123
--- a/dev/null
+++ b/noncore/net/ubrowser/httpcomm.o
Binary files differ
diff --git a/noncore/net/ubrowser/httpfactory.cpp b/noncore/net/ubrowser/httpfactory.cpp
new file mode 100644
index 0000000..92718fb
--- a/dev/null
+++ b/noncore/net/ubrowser/httpfactory.cpp
@@ -0,0 +1,104 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include "httpfactory.h"
18
19HttpFactory::HttpFactory(QTextBrowser *newBrowser):QMimeSourceFactory()
20{
21 socket = new QSocket;
22 text = new QTextDrag;
23 browser=newBrowser;
24 comm = new HttpComm(socket, browser);
25}
26
27const QMimeSource * HttpFactory::data(const QString &abs_name) const
28{
29 printf("HttpFactory::data: using absolute data func\n");
30
31 int port=80, addrEnd, portSep;
32 QString host, file, portS, name, tempString;
33 bool done=false;
34
35 comm->setUp((QString *)&abs_name);
36
37 name = abs_name;
38 //name = name.lower();
39 name = name.stripWhiteSpace();
40
41 printf("%s\n", name.latin1());
42
43 if(name.startsWith("http://"))
44 {
45 name = name.remove(0, 7);
46 }
47 else
48 {
49 return 0;
50 }
51
52 addrEnd = name.find('/');
53 if(addrEnd == -1)
54 {
55 name += '/';
56 addrEnd = name.length()-1;
57 }
58
59 host = name;
60 file = name;
61
62 host.truncate(addrEnd);
63 file.remove(0, addrEnd);
64
65 portSep = host.find(':');
66 if(portSep != -1)
67 {
68 portS=host;
69 host.truncate(portSep);
70 portS.remove(0, portSep+1);
71 port = portS.toInt();
72 }
73
74 printf("%s %s %d\n", host.latin1(), file.latin1(), port);
75
76 if(port == 80)
77 {
78 portS="80";
79 }
80
81 comm->setStuff(host, portS, file, text);
82
83 socket->connectToHost(host, port);
84
85 text->setText("");
86
87 return text;
88}
89
90const QMimeSource * HttpFactory::data(const QString &abs_or_rel_name, const QString & context) const
91{
92 printf("HttpFactory::data: using relative data func\n");
93
94 if(abs_or_rel_name.startsWith(context))
95 {
96 return data(abs_or_rel_name);
97 }
98 else
99 {
100 return data(context + abs_or_rel_name);
101 }
102
103 return 0;
104}
diff --git a/noncore/net/ubrowser/httpfactory.h b/noncore/net/ubrowser/httpfactory.h
new file mode 100644
index 0000000..bb7615b
--- a/dev/null
+++ b/noncore/net/ubrowser/httpfactory.h
@@ -0,0 +1,38 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include <qmime.h>
18#include <qsocket.h>
19#include <qstring.h>
20#include <qdragobject.h>
21#include <qtextbrowser.h>
22
23#include <stdio.h>
24
25#include "httpcomm.h"
26
27class HttpFactory : public QMimeSourceFactory
28{
29public:
30 HttpFactory(QTextBrowser *newBrowser);
31 const QMimeSource * data(const QString &abs_name) const;
32 const QMimeSource * data(const QString &abs_or_rel_name, const QString & context) const;
33private:
34 QSocket *socket;
35 HttpComm *comm;
36 QTextDrag *text;
37 QTextBrowser *browser;
38};
diff --git a/noncore/net/ubrowser/httpfactory.o b/noncore/net/ubrowser/httpfactory.o
new file mode 100644
index 0000000..949d943
--- a/dev/null
+++ b/noncore/net/ubrowser/httpfactory.o
Binary files differ
diff --git a/noncore/net/ubrowser/main.cpp b/noncore/net/ubrowser/main.cpp
new file mode 100644
index 0000000..fe0f243
--- a/dev/null
+++ b/noncore/net/ubrowser/main.cpp
@@ -0,0 +1,29 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include <qpe/qpeapplication.h>
18
19#include "mainview.h"
20
21int main( int argc, char **argv )
22{
23 QPEApplication a( argc, argv );
24 MainView w;
25
26 a.setMainWidget( &w );
27 w.showMaximized();
28 return a.exec();
29}
diff --git a/noncore/net/ubrowser/main.o b/noncore/net/ubrowser/main.o
new file mode 100644
index 0000000..417abd2
--- a/dev/null
+++ b/noncore/net/ubrowser/main.o
Binary files differ
diff --git a/noncore/net/ubrowser/mainview.cpp b/noncore/net/ubrowser/mainview.cpp
new file mode 100644
index 0000000..87a7d6a
--- a/dev/null
+++ b/noncore/net/ubrowser/mainview.cpp
@@ -0,0 +1,88 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17
18#include "mainview.h"
19
20MainView::MainView(QWidget *parent=0, const char *name=0) : QMainWindow(parent, name)
21{
22 setCaption("uBrowser");
23
24 QPEToolBar *toolbar = new QPEToolBar(this, "toolbar");
25 back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back");
26 forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward");
27 home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home");
28 location = new QComboBox(true, toolbar, "location");
29 go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go");
30
31 toolbar->setStretchableWidget(location);
32 toolbar->setHorizontalStretchable(true);
33
34 addToolBar(toolbar);
35
36 browser = new QTextBrowser(this, "browser");
37 setCentralWidget(browser);
38
39//make the button take you to the location
40 connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) );
41 connect(location->lineEdit(), SIGNAL(returnPressed()), this, SLOT(goClicked()) );
42
43//make back, forward and home do their thing (isnt QTextBrowser great?)
44 connect(back, SIGNAL(clicked()), browser, SLOT(backward()) );
45 connect(forward, SIGNAL(clicked()), browser, SLOT(forward()) );
46 connect(home, SIGNAL(clicked()), browser, SLOT(home()) );
47
48//make back and forward buttons be enabled, only when you can go back or forward (again, i love QTextBrowser)
49//this doesnt seem to work, but doesnt break anything either...
50 connect(browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setOn(bool)) );
51 connect(browser, SIGNAL(forwardAvailable(bool)), forward, SLOT(setOn(bool)) );
52
53//notify me when the text of the browser has changed (like when the user clicks a link)
54 connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()) );
55
56 http = new HttpFactory(browser);
57}
58
59void MainView::goClicked()
60{
61 if(location->currentText().startsWith("http://") )
62 {
63 location->setEditText(location->currentText().lower());
64 browser->setMimeSourceFactory(http);
65 printf("MainView::goClicked: using http source factory\n");
66 }
67 else
68 {
69 browser->setMimeSourceFactory(QMimeSourceFactory::defaultFactory());
70 printf("MainView::goClicked: using default source factory\n");
71 }
72
73 browser->setSource(location->currentText());
74}
75
76void MainView::textChanged()
77{
78 if(browser->documentTitle().isNull())
79 {
80 setCaption(browser->source() + " - uBrowser");
81 }
82 else
83 {
84 setCaption(browser->documentTitle() + " - uBrowser");
85 }
86
87 location->setEditText(browser->source());
88}
diff --git a/noncore/net/ubrowser/mainview.h b/noncore/net/ubrowser/mainview.h
new file mode 100644
index 0000000..bd9d19c
--- a/dev/null
+++ b/noncore/net/ubrowser/mainview.h
@@ -0,0 +1,48 @@
1/*
2Opie-uBrowser. a very small web browser, using on QTextBrowser for html display/parsing
3Copyright (C) 2002 Thomas Stephens
4
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
7version.
8
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
11Public License for more details.
12
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
15*/
16
17#include <qpe/resource.h>
18#include <qpe/qpetoolbar.h>
19
20#include <qmainwindow.h>
21#include <qwidget.h>
22#include <qtextbrowser.h>
23#include <qtoolbutton.h>
24#include <qcombobox.h>
25#include <qlayout.h>
26#include <qlineedit.h>
27
28#include <stdio.h>
29
30#include "httpfactory.h"
31
32class MainView : public QMainWindow
33{
34 Q_OBJECT
35public:
36 MainView(QWidget *parent=0, const char *name=0);
37public slots:
38 void goClicked();
39 void textChanged();
40private:
41 QToolButton *back;
42 QToolButton *forward;
43 QToolButton *home;
44 QToolButton *go;
45 QComboBox *location;
46 QTextBrowser *browser;
47 HttpFactory *http;
48};
diff --git a/noncore/net/ubrowser/mainview.o b/noncore/net/ubrowser/mainview.o
new file mode 100644
index 0000000..d86c4fc
--- a/dev/null
+++ b/noncore/net/ubrowser/mainview.o
Binary files differ
diff --git a/noncore/net/ubrowser/moc_httpcomm.cpp b/noncore/net/ubrowser/moc_httpcomm.cpp
new file mode 100644
index 0000000..0078968
--- a/dev/null
+++ b/noncore/net/ubrowser/moc_httpcomm.cpp
@@ -0,0 +1,102 @@
1/****************************************************************************
2** HttpComm meta object code from reading C++ file 'httpcomm.h'
3**
4** Created: Thu Jun 27 17:57:53 2002
5** by: The Qt MOC ($Id$)
6**
7** WARNING! All changes made in this file will be lost!
8*****************************************************************************/
9
10#if !defined(Q_MOC_OUTPUT_REVISION)
11#define Q_MOC_OUTPUT_REVISION 9
12#elif Q_MOC_OUTPUT_REVISION != 9
13#error "Moc format conflict - please regenerate all moc files"
14#endif
15
16#include "httpcomm.h"
17#include <qmetaobject.h>
18#include <qapplication.h>
19
20
21
22const char *HttpComm::className() const
23{
24 return "HttpComm";
25}
26
27QMetaObject *HttpComm::metaObj = 0;
28
29void HttpComm::initMetaObject()
30{
31 if ( metaObj )
32 return;
33 if ( qstrcmp(QObject::className(), "QObject") != 0 )
34 badSuperclassWarning("HttpComm","QObject");
35 (void) staticMetaObject();
36}
37
38#ifndef QT_NO_TRANSLATION
39
40QString HttpComm::tr(const char* s)
41{
42 return qApp->translate( "HttpComm", s, 0 );
43}
44
45QString HttpComm::tr(const char* s, const char * c)
46{
47 return qApp->translate( "HttpComm", s, c );
48}
49
50#endif // QT_NO_TRANSLATION
51
52QMetaObject* HttpComm::staticMetaObject()
53{
54 if ( metaObj )
55 return metaObj;
56 (void) QObject::staticMetaObject();
57#ifndef QT_NO_PROPERTIES
58#endif // QT_NO_PROPERTIES
59 typedef void (HttpComm::*m1_t0)();
60 typedef void (QObject::*om1_t0)();
61 typedef void (HttpComm::*m1_t1)();
62 typedef void (QObject::*om1_t1)();
63 typedef void (HttpComm::*m1_t2)();
64 typedef void (QObject::*om1_t2)();
65 typedef void (HttpComm::*m1_t3)();
66 typedef void (QObject::*om1_t3)();
67 m1_t0 v1_0 = &HttpComm::hostFound;
68 om1_t0 ov1_0 = (om1_t0)v1_0;
69 m1_t1 v1_1 = &HttpComm::connected;
70 om1_t1 ov1_1 = (om1_t1)v1_1;
71 m1_t2 v1_2 = &HttpComm::connectionClosed;
72 om1_t2 ov1_2 = (om1_t2)v1_2;
73 m1_t3 v1_3 = &HttpComm::incoming;
74 om1_t3 ov1_3 = (om1_t3)v1_3;
75 QMetaData *slot_tbl = QMetaObject::new_metadata(4);
76 QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(4);
77 slot_tbl[0].name = "hostFound()";
78 slot_tbl[0].ptr = (QMember)ov1_0;
79 slot_tbl_access[0] = QMetaData::Public;
80 slot_tbl[1].name = "connected()";
81 slot_tbl[1].ptr = (QMember)ov1_1;
82 slot_tbl_access[1] = QMetaData::Public;
83 slot_tbl[2].name = "connectionClosed()";
84 slot_tbl[2].ptr = (QMember)ov1_2;
85 slot_tbl_access[2] = QMetaData::Public;
86 slot_tbl[3].name = "incoming()";
87 slot_tbl[3].ptr = (QMember)ov1_3;
88 slot_tbl_access[3] = QMetaData::Public;
89 metaObj = QMetaObject::new_metaobject(
90 "HttpComm", "QObject",
91 slot_tbl, 4,
92 0, 0,
93#ifndef QT_NO_PROPERTIES
94 0, 0,
95 0, 0,
96#endif // QT_NO_PROPERTIES
97 0, 0 );
98 metaObj->set_slot_access( slot_tbl_access );
99#ifndef QT_NO_PROPERTIES
100#endif // QT_NO_PROPERTIES
101 return metaObj;
102}
diff --git a/noncore/net/ubrowser/moc_httpcomm.o b/noncore/net/ubrowser/moc_httpcomm.o
new file mode 100644
index 0000000..dd52a15
--- a/dev/null
+++ b/noncore/net/ubrowser/moc_httpcomm.o
Binary files differ
diff --git a/noncore/net/ubrowser/moc_mainview.cpp b/noncore/net/ubrowser/moc_mainview.cpp
new file mode 100644
index 0000000..009ee1b
--- a/dev/null
+++ b/noncore/net/ubrowser/moc_mainview.cpp
@@ -0,0 +1,88 @@
1/****************************************************************************
2** MainView meta object code from reading C++ file 'mainview.h'
3**
4** Created: Mon Jun 10 19:05:57 2002
5** by: The Qt MOC ($Id$)
6**
7** WARNING! All changes made in this file will be lost!
8*****************************************************************************/
9
10#if !defined(Q_MOC_OUTPUT_REVISION)
11#define Q_MOC_OUTPUT_REVISION 9
12#elif Q_MOC_OUTPUT_REVISION != 9
13#error "Moc format conflict - please regenerate all moc files"
14#endif
15
16#include "mainview.h"
17#include <qmetaobject.h>
18#include <qapplication.h>
19
20
21
22const char *MainView::className() const
23{
24 return "MainView";
25}
26
27QMetaObject *MainView::metaObj = 0;
28
29void MainView::initMetaObject()
30{
31 if ( metaObj )
32 return;
33 if ( qstrcmp(QMainWindow::className(), "QMainWindow") != 0 )
34 badSuperclassWarning("MainView","QMainWindow");
35 (void) staticMetaObject();
36}
37
38#ifndef QT_NO_TRANSLATION
39
40QString MainView::tr(const char* s)
41{
42 return qApp->translate( "MainView", s, 0 );
43}
44
45QString MainView::tr(const char* s, const char * c)
46{
47 return qApp->translate( "MainView", s, c );
48}
49
50#endif // QT_NO_TRANSLATION
51
52QMetaObject* MainView::staticMetaObject()
53{
54 if ( metaObj )
55 return metaObj;
56 (void) QMainWindow::staticMetaObject();
57#ifndef QT_NO_PROPERTIES
58#endif // QT_NO_PROPERTIES
59 typedef void (MainView::*m1_t0)();
60 typedef void (QObject::*om1_t0)();
61 typedef void (MainView::*m1_t1)();
62 typedef void (QObject::*om1_t1)();
63 m1_t0 v1_0 = &MainView::goClicked;
64 om1_t0 ov1_0 = (om1_t0)v1_0;
65 m1_t1 v1_1 = &MainView::textChanged;
66 om1_t1 ov1_1 = (om1_t1)v1_1;
67 QMetaData *slot_tbl = QMetaObject::new_metadata(2);
68 QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(2);
69 slot_tbl[0].name = "goClicked()";
70 slot_tbl[0].ptr = (QMember)ov1_0;
71 slot_tbl_access[0] = QMetaData::Public;
72 slot_tbl[1].name = "textChanged()";
73 slot_tbl[1].ptr = (QMember)ov1_1;
74 slot_tbl_access[1] = QMetaData::Public;
75 metaObj = QMetaObject::new_metaobject(
76 "MainView", "QMainWindow",
77 slot_tbl, 2,
78 0, 0,
79#ifndef QT_NO_PROPERTIES
80 0, 0,
81 0, 0,
82#endif // QT_NO_PROPERTIES
83 0, 0 );
84 metaObj->set_slot_access( slot_tbl_access );
85#ifndef QT_NO_PROPERTIES
86#endif // QT_NO_PROPERTIES
87 return metaObj;
88}
diff --git a/noncore/net/ubrowser/moc_mainview.o b/noncore/net/ubrowser/moc_mainview.o
new file mode 100644
index 0000000..cd48c62
--- a/dev/null
+++ b/noncore/net/ubrowser/moc_mainview.o
Binary files differ
diff --git a/noncore/net/ubrowser/new_chunked_algo_thoughts b/noncore/net/ubrowser/new_chunked_algo_thoughts
new file mode 100644
index 0000000..8ca9318
--- a/dev/null
+++ b/noncore/net/ubrowser/new_chunked_algo_thoughts
@@ -0,0 +1,12 @@
1use a switch case, with each case being one potential way that the data is when the function is entered, or
2another one exits.
3
4while(!done)
5{
6 switch(status)
7 {
8 case chunk header:
9 case after chunk header:
10 case no chunk header:
11 }
12} \ No newline at end of file
diff --git a/noncore/net/ubrowser/old_chunked_algo b/noncore/net/ubrowser/old_chunked_algo
new file mode 100644
index 0000000..9b4ccda
--- a/dev/null
+++ b/noncore/net/ubrowser/old_chunked_algo
@@ -0,0 +1,57 @@
1readchunk:
2 if(semi != 0)
3 {
4 printf("HttpComm::incoming: semi !=0\n");
5 QString newBody = tempString;
6 if(i != 0)
7 {
8 printf("HttpComm::incoming: striping header2\n");
9 newBody.remove(0,i);
10 }
11 newBody=newBody.remove(0, semi);
12 if(newBody.length() > clength)
13 {
14 newBody.truncate(clength);
15 nextChunk = true;
16 }
17 body += newBody;
18 bRead += newBody.length();
19 printf("HttpComm::incoming: start body chunk1\n");
20 printf("%s", newBody.latin1());
21 printf("\nHttpComm::incoming: end body chunk\n");
22 printf("HttpComm::incoming: bRead: %d\n", bRead);
23 if(nextChunk)
24 {
25 QString tmpQString = tempString;
26 tmpQString=tmpQString.remove(0, clength);
27 tempString = (char *)tmpQString.latin1();
28 lengthset=false;
29 goto topchunk;
30 }
31 }
32 else
33 {
34 if( (bRead + ba) > clength)
35 {
36 // int bRead2=bRead;
37 for(; bRead < clength; bRead++)
38 {
39 body+=tempString[j];
40 // bRead++;
41 }
42 }
43 else
44 {
45 body += tempString;
46 bRead += ba;
47 }
48 printf("HttpComm::incoming: start body chunk2\n");
49 printf("%s", tempString);
50 printf("\nHttpComm::incoming: end body chunk\n");
51 printf("HttpComm::incoming: bRead: %d\n", bRead);
52 }
53 if(bRead >= clength)
54 {
55 printf("HttpComm::incoming: end chunk\n");
56 lengthset=false;
57 } \ No newline at end of file
diff --git a/noncore/net/ubrowser/ubrowser.pro b/noncore/net/ubrowser/ubrowser.pro
new file mode 100644
index 0000000..3704a48
--- a/dev/null
+++ b/noncore/net/ubrowser/ubrowser.pro
@@ -0,0 +1,9 @@
1 TEMPLATE=app
2 CONFIG +=qt warn_on release
3 DESTDIR =../../../bin
4 HEADERS = mainview.h httpfactory.h httpcomm.h
5 SOURCES = main.cpp mainview.cpp httpfactory.cpp httpcomm.cpp
6 INCLUDEPATH+=../../../include
7 DEPENDPATH+=../../../include
8 LIBS += -lqpe
9TARGET = ubrowser