src/server/daemon/httpparser.c

changeset 385
a1f4cb076d2f
parent 351
5533db9b64e2
child 415
d938228c382e
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
185 185
186 parser->request->method.ptr = line.ptr; 186 parser->request->method.ptr = line.ptr;
187 for(;i<line.length;i++) { 187 for(;i<line.length;i++) {
188 if(!ns && line.ptr[i] == ' ') { 188 if(!ns && line.ptr[i] == ' ') {
189 ns = 1; 189 ns = 1;
190 //line.ptr[i] = 0; // TODO: remove
191 parser->request->method.length = i; 190 parser->request->method.length = i;
192 } else if(ns) { 191 } else if(ns) {
193 if(line.ptr[i] != ' ') { 192 if(line.ptr[i] != ' ') {
194 break; 193 break;
195 } 194 }
198 197
199 parser->request->uri.ptr = line.ptr + i; 198 parser->request->uri.ptr = line.ptr + i;
200 ns = 0; 199 ns = 0;
201 int s = i; 200 int s = i;
202 for(;i<line.length;i++) { 201 for(;i<line.length;i++) {
203 if(!ns && line.ptr[i] < 33) { 202 if(!ns && isspace(line.ptr[i])) {
204 ns = 1; 203 ns = 1;
205 //line.ptr[i] = 0; // TODO: remove
206 parser->request->uri.length = i - s; 204 parser->request->uri.length = i - s;
207 } else if(ns) { 205 } else if(ns) {
208 if(line.ptr[i] > 32) { 206 if(line.ptr[i] > 32) {
209 break; 207 break;
210 } 208 }
213 211
214 parser->request->httpv.ptr = line.ptr + i; 212 parser->request->httpv.ptr = line.ptr + i;
215 ns = 0; 213 ns = 0;
216 s = i; 214 s = i;
217 for(;i<line.length;i++) { 215 for(;i<line.length;i++) {
218 if(!ns && line.ptr[i] < 33) { 216 if(!ns && isspace(line.ptr[i])) {
219 ns = 1; 217 ns = 1;
220 //line.ptr[i] = 0; // TODO: remove
221 parser->request->httpv.length = i - s; 218 parser->request->httpv.length = i - s;
222 } else if(ns) { 219 } else if(ns) {
223 if(line.ptr[i] > 32) { 220 if(line.ptr[i] > 32) {
224 break; 221 break;
225 } 222 }

mercurial