Lines Matching full:s

83 static struct webclient_state s;  variable
89 return s.mimetype; in webclient_mimetype()
95 return s.file; in webclient_filename()
101 return s.host; in webclient_hostname()
107 return s.port; in webclient_port()
119 s.state = WEBCLIENT_STATE_STATUSLINE; in init_connection()
121 s.getrequestleft = sizeof(http_get) - 1 + 1 + in init_connection()
127 strlen(s.file) + strlen(s.host); in init_connection()
128 s.getrequestptr = 0; in init_connection()
130 s.httpheaderlineptr = 0; in init_connection()
136 s.state = WEBCLIENT_STATE_CLOSE; in webclient_close()
162 s.port = port; in webclient_get()
163 strncpy(s.file, file, sizeof(s.file)); in webclient_get()
164 strncpy(s.host, host, sizeof(s.host)); in webclient_get()
185 if(s.getrequestleft > 0) { in senddata()
189 cptr = copy_string(cptr, s.file, strlen(s.file)); in senddata()
196 cptr = copy_string(cptr, s.host, strlen(s.host)); in senddata()
202 len = s.getrequestleft > uip_mss()? in senddata()
204 s.getrequestleft; in senddata()
205 uip_send(&(getrequest[s.getrequestptr]), len); in senddata()
214 if(s.getrequestleft > 0) { in acked()
215 len = s.getrequestleft > uip_mss()? in acked()
217 s.getrequestleft; in acked()
218 s.getrequestleft -= len; in acked()
219 s.getrequestptr += len; in acked()
228 while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) { in parse_statusline()
229 s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; in parse_statusline()
232 if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) { in parse_statusline()
234 if((strncmp(s.httpheaderline, http_10, in parse_statusline()
236 (strncmp(s.httpheaderline, http_11, in parse_statusline()
238 cptr = &(s.httpheaderline[9]); in parse_statusline()
239 s.httpflag = HTTPFLAG_NONE; in parse_statusline()
242 s.httpflag = HTTPFLAG_OK; in parse_statusline()
247 s.httpflag = HTTPFLAG_MOVED; in parse_statusline()
249 s.httpheaderline[s.httpheaderlineptr - 1] = 0; in parse_statusline()
259 s.httpheaderlineptr = 0; in parse_statusline()
260 s.state = WEBCLIENT_STATE_HEADERS; in parse_statusline()
263 ++s.httpheaderlineptr; in parse_statusline()
296 while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) { in parse_headers()
297 s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata; in parse_headers()
300 if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) { in parse_headers()
301 /* We have an entire HTTP header line in s.httpheaderline, so in parse_headers()
303 if(s.httpheaderline[0] == ISO_cr) { in parse_headers()
307 s.state = WEBCLIENT_STATE_DATA; in parse_headers()
311 s.httpheaderline[s.httpheaderlineptr - 1] = 0; in parse_headers()
313 if(casecmp(s.httpheaderline, http_content_type, in parse_headers()
316 cptr = strchr(s.httpheaderline, ';'); in parse_headers()
320 strncpy(s.mimetype, s.httpheaderline + in parse_headers()
321 sizeof(http_content_type) - 1, sizeof(s.mimetype)); in parse_headers()
322 } else if(casecmp(s.httpheaderline, http_location, in parse_headers()
324 cptr = s.httpheaderline + in parse_headers()
329 for(i = 0; i < s.httpheaderlineptr - 7; ++i) { in parse_headers()
334 s.host[i] = 0; in parse_headers()
337 s.host[i] = *cptr; in parse_headers()
341 strncpy(s.file, cptr, sizeof(s.file)); in parse_headers()
342 /* s.file[s.httpheaderlineptr - i] = 0;*/ in parse_headers()
348 s.httpheaderlineptr = 0; in parse_headers()
350 ++s.httpheaderlineptr; in parse_headers()
363 if(s.state == WEBCLIENT_STATE_STATUSLINE) { in newdata()
367 if(s.state == WEBCLIENT_STATE_HEADERS && len > 0) { in newdata()
371 if(len > 0 && s.state == WEBCLIENT_STATE_DATA && in newdata()
372 s.httpflag != HTTPFLAG_MOVED) { in newdata()
381 s.timer = 0; in webclient_appcall()
382 s.state = WEBCLIENT_STATE_STATUSLINE; in webclient_appcall()
388 if(s.state == WEBCLIENT_STATE_CLOSE) { in webclient_appcall()
403 s.timer = 0; in webclient_appcall()
407 s.timer = 0; in webclient_appcall()
415 ++s.timer; in webclient_appcall()
416 if(s.timer == WEBCLIENT_TIMEOUT) { in webclient_appcall()
425 if(s.httpflag != HTTPFLAG_MOVED) { in webclient_appcall()
429 if(resolv_lookup(s.host) == NULL) { in webclient_appcall()
430 resolv_query(s.host); in webclient_appcall()
432 webclient_get(s.host, s.port, s.file); in webclient_appcall()