mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Added support to v1.0 http (which apache's ab tool uses)
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@191 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
parent
26e256c758
commit
ab9ddd16f5
@ -85,6 +85,7 @@ struct connstruct
|
|||||||
int numbytes;
|
int numbytes;
|
||||||
char databuf[BLOCKSIZE];
|
char databuf[BLOCKSIZE];
|
||||||
uint8_t is_ssl;
|
uint8_t is_ssl;
|
||||||
|
uint8_t is_v1_0;
|
||||||
uint8_t close_when_done;
|
uint8_t close_when_done;
|
||||||
time_t if_modified_since;
|
time_t if_modified_since;
|
||||||
|
|
||||||
|
19
httpd/proc.c
19
httpd/proc.c
@ -103,7 +103,7 @@ static int procheadelem(struct connstruct *cn, char *buf)
|
|||||||
if ((delim = strchr(value, ' ')) == NULL) /* expect HTTP type */
|
if ((delim = strchr(value, ' ')) == NULL) /* expect HTTP type */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*delim = 0;
|
*delim++ = 0;
|
||||||
urldecode(value);
|
urldecode(value);
|
||||||
|
|
||||||
if (sanitizefile(value) == 0)
|
if (sanitizefile(value) == 0)
|
||||||
@ -118,6 +118,8 @@ static int procheadelem(struct connstruct *cn, char *buf)
|
|||||||
my_strncpy(cn->filereq, value, MAXREQUESTLENGTH);
|
my_strncpy(cn->filereq, value, MAXREQUESTLENGTH);
|
||||||
#endif
|
#endif
|
||||||
cn->if_modified_since = -1;
|
cn->if_modified_since = -1;
|
||||||
|
if (strcmp(delim, "HTTP/1.0") == 0) /* v1.0 HTTP? */
|
||||||
|
cn->is_v1_0 = 1;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(buf, "Host:") == 0)
|
else if (strcasecmp(buf, "Host:") == 0)
|
||||||
{
|
{
|
||||||
@ -315,7 +317,7 @@ void procreadhead(struct connstruct *cn)
|
|||||||
rv = special_read(cn, buf, sizeof(buf)-1);
|
rv = special_read(cn, buf, sizeof(buf)-1);
|
||||||
if (rv <= 0)
|
if (rv <= 0)
|
||||||
{
|
{
|
||||||
if (rv < 0) /* really dead? */
|
if (rv < 0 || !cn->is_ssl) /* really dead? */
|
||||||
removeconnection(cn);
|
removeconnection(cn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -512,9 +514,14 @@ void procreadfile(struct connstruct *cn)
|
|||||||
if (cn->close_when_done) /* close immediately */
|
if (cn->close_when_done) /* close immediately */
|
||||||
removeconnection(cn);
|
removeconnection(cn);
|
||||||
else
|
else
|
||||||
{ /* keep socket open - HTTP 1.1 */
|
{
|
||||||
cn->state = STATE_WANT_TO_READ_HEAD;
|
if (cn->is_v1_0) /* die now */
|
||||||
cn->numbytes = 0;
|
removeconnection(cn);
|
||||||
|
else /* keep socket open - HTTP 1.1 */
|
||||||
|
{
|
||||||
|
cn->state = STATE_WANT_TO_READ_HEAD;
|
||||||
|
cn->numbytes = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -853,7 +860,7 @@ void read_post_data(struct connstruct *cn)
|
|||||||
rv = special_read(cn, buf, sizeof(buf)-1);
|
rv = special_read(cn, buf, sizeof(buf)-1);
|
||||||
if (rv <= 0)
|
if (rv <= 0)
|
||||||
{
|
{
|
||||||
if (rv < 0) /* really dead? */
|
if (rv < 0 || !cn->is_ssl) /* really dead? */
|
||||||
removeconnection(cn);
|
removeconnection(cn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user