author | spiralman <spiralman> | 2002-07-22 22:37:22 (UTC) |
---|---|---|
committer | spiralman <spiralman> | 2002-07-22 22:37:22 (UTC) |
commit | c19b6cccd243107eb774c5e0bdb269265f3b5abe (patch) (unidiff) | |
tree | 9c888fb5a6a09d102df3143b9458465c11e7380a /noncore/net | |
parent | 0433711d6f7190073c476a2f771dfce879ef87e5 (diff) | |
download | opie-c19b6cccd243107eb774c5e0bdb269265f3b5abe.zip opie-c19b6cccd243107eb774c5e0bdb269265f3b5abe.tar.gz opie-c19b6cccd243107eb774c5e0bdb269265f3b5abe.tar.bz2 |
fixed some bugs with chunked transfer encoding, still doesnt work though
-rw-r--r-- | noncore/net/ubrowser/Makefile | 20 | ||||
-rw-r--r-- | noncore/net/ubrowser/Makefile.in | 18 | ||||
-rw-r--r-- | noncore/net/ubrowser/httpcomm.cpp | 49 |
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,8 +1,8 @@ | |||
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++ |
@@ -102,21 +102,21 @@ SYSCONF_LIBS_QTAPP = | |||
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 | ||
116 | DESTDIR = $(OPIEDIR)/bin/ | 116 | DESTDIR = ../../../bin/ |
117 | VER_MAJ = 1 | 117 | VER_MAJ = 1 |
118 | VER_MIN = 0 | 118 | VER_MIN = 0 |
119 | VER_PATCH = 0 | 119 | VER_PATCH = 0 |
120 | TARGET= ubrowser | 120 | TARGET= ubrowser |
121 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | 121 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) |
122 | 122 | ||
@@ -203,37 +203,37 @@ REQUIRES= | |||
203 | 203 | ||
204 | 204 | ||
205 | 205 | ||
206 | ####### Compile | 206 | ####### Compile |
207 | 207 | ||
208 | main.o: main.cpp \ | 208 | main.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 | ||
216 | mainview.o: mainview.cpp \ | 216 | mainview.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 | ||
223 | httpfactory.o: httpfactory.cpp \ | 223 | httpfactory.o: httpfactory.cpp \ |
224 | httpfactory.h \ | 224 | httpfactory.h \ |
225 | httpcomm.h | 225 | httpcomm.h |
226 | 226 | ||
227 | httpcomm.o: httpcomm.cpp \ | 227 | httpcomm.o: httpcomm.cpp \ |
228 | httpcomm.h | 228 | httpcomm.h |
229 | 229 | ||
230 | moc_mainview.o: moc_mainview.cpp \ | 230 | moc_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 | ||
237 | moc_httpcomm.o: moc_httpcomm.cpp \ | 237 | moc_httpcomm.o: moc_httpcomm.cpp \ |
238 | httpcomm.h | 238 | httpcomm.h |
239 | 239 | ||
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 | |||
@@ -3,21 +3,21 @@ | |||
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 | ||
17 | DESTDIR = $(OPIEDIR)/bin/ | 17 | DESTDIR = ../../../bin/ |
18 | VER_MAJ = 1 | 18 | VER_MAJ = 1 |
19 | VER_MIN = 0 | 19 | VER_MIN = 0 |
20 | VER_PATCH = 0 | 20 | VER_PATCH = 0 |
21 | TARGET= ubrowser | 21 | TARGET= ubrowser |
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | 22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) |
23 | 23 | ||
@@ -104,37 +104,37 @@ REQUIRES= | |||
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | ####### Compile | 107 | ####### Compile |
108 | 108 | ||
109 | main.o: main.cpp \ | 109 | main.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 | ||
117 | mainview.o: mainview.cpp \ | 117 | mainview.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 | ||
124 | httpfactory.o: httpfactory.cpp \ | 124 | httpfactory.o: httpfactory.cpp \ |
125 | httpfactory.h \ | 125 | httpfactory.h \ |
126 | httpcomm.h | 126 | httpcomm.h |
127 | 127 | ||
128 | httpcomm.o: httpcomm.cpp \ | 128 | httpcomm.o: httpcomm.cpp \ |
129 | httpcomm.h | 129 | httpcomm.h |
130 | 130 | ||
131 | moc_mainview.o: moc_mainview.cpp \ | 131 | moc_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 | ||
138 | moc_httpcomm.o: moc_httpcomm.cpp \ | 138 | moc_httpcomm.o: moc_httpcomm.cpp \ |
139 | httpcomm.h | 139 | httpcomm.h |
140 | 140 | ||
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 | |||
@@ -133,72 +133,111 @@ void HttpComm::incoming() | |||
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 | ||