mirror of https://github.com/adamdruppe/arsd.git
bug fixes and version out misplaced code
This commit is contained in:
parent
7ecd24393f
commit
fa257c076d
15
http.d
15
http.d
|
@ -1,5 +1,6 @@
|
|||
// Copyright 2013, Adam D. Ruppe. All Rights Reserved.
|
||||
module arsd.http2;
|
||||
module arsd.http;
|
||||
|
||||
import std.socket;
|
||||
|
||||
// FIXME: check Transfer-Encoding: gzip always
|
||||
|
||||
|
@ -313,7 +314,7 @@ body {
|
|||
final switch(state) {
|
||||
case 0: // reading hex
|
||||
char c = response[a];
|
||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
|
||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) {
|
||||
// just keep reading
|
||||
} else {
|
||||
int power = 1;
|
||||
|
@ -326,7 +327,7 @@ body {
|
|||
if(cc >= '0' && cc <= '9')
|
||||
val = cc - '0';
|
||||
else
|
||||
val = cc - 'A';
|
||||
val = cc - 'A' + 10;
|
||||
|
||||
size += power * val;
|
||||
power *= 16;
|
||||
|
@ -347,8 +348,8 @@ body {
|
|||
case 2: // reading data
|
||||
hr.content ~= response[a..a+size];
|
||||
a += size;
|
||||
a+= 2; // skipping a 13 10
|
||||
start = a;
|
||||
a+= 1; // skipping a 13 10
|
||||
start = a + 1;
|
||||
state = 0;
|
||||
break;
|
||||
case 3: // reading footers
|
||||
|
@ -370,6 +371,8 @@ void main(string args[]) {
|
|||
}
|
||||
*/
|
||||
|
||||
version(none):
|
||||
|
||||
struct Url {
|
||||
string url;
|
||||
}
|
||||
|
|
8
http2.d
8
http2.d
|
@ -488,7 +488,7 @@ class HttpRequest {
|
|||
final switch(bodyReadingState.chunkedState) {
|
||||
case 0: // reading hex
|
||||
char c = data[a];
|
||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
|
||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) {
|
||||
// just keep reading
|
||||
} else {
|
||||
int power = 1;
|
||||
|
@ -501,7 +501,7 @@ class HttpRequest {
|
|||
if(cc >= '0' && cc <= '9')
|
||||
val = cc - '0';
|
||||
else
|
||||
val = cc - 'A';
|
||||
val = cc - 'A' + 10;
|
||||
|
||||
bodyReadingState.contentLengthRemaining += power * val;
|
||||
power *= 16;
|
||||
|
@ -524,8 +524,8 @@ class HttpRequest {
|
|||
responseData.content ~= data[a .. a + bodyReadingState.contentLengthRemaining];
|
||||
|
||||
a += bodyReadingState.contentLengthRemaining;
|
||||
a += 2; // skipping a 13 10
|
||||
data = data[a .. $];
|
||||
a += 1; // skipping a 13 10
|
||||
data = data[a+1 .. $];
|
||||
bodyReadingState.chunkedState = 0;
|
||||
goto start_over;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue