Springen naar inhoud


zakalibit

Lid geworden: 24 dec 2012
Offline Laatste activiteit: 03 apr 2023 11:36
-----

Berichten die ik gemaakt heb

In Topic:merge requests for PLi's git

15 september 2014 - 18:26

Hi,

 

again something for httpsream, I found that not all redirect codes are handled, just 302, I came across at least one service returning 301 which is a valid redirect code so could we change 

if (statuscode == 302 && strncasecmp(linebuf, "location: ", 10) == 0)

as per rfc to 

if ((statuscode==301 || statuscode==302 || statuscode==303 || statuscode==307 || statuscode==308) && strncasecmp(linebuf, "location: ", 10) == 0)

In Topic:merge requests for PLi's git

8 augustus 2014 - 10:22

Zakalibit, comitted. I forgot to mention your credit, excuse!

I think there is no need to check for status code, I think the code should be as I posted above, it will work as is now as well, but code checking does not give anything useful there.

And could you please bring all strcmp() to the same form, i.e. !strcmp(), as we have strcmp() == 0 variation as well


In Topic:merge requests for PLi's git

8 augustus 2014 - 10:17

Zakalibit, comitted. I forgot to mention your credit, excuse!

 

Not a problem, very good that it is done quickly :) 


In Topic:merge requests for PLi's git

8 augustus 2014 - 07:35

a bit better impl would be:

if (!isChunked && strncasecmp(linebuf, "transfer-encoding: chunked", strlen("transfer-encoding: chunked")) == 0)
{
    isChunked = true;
}

to avoid excessive string comparisons 


In Topic:merge requests for PLi's git

7 augustus 2014 - 21:41

I found where is the problem :)

 

this wont work anyway due to the incorrect string comparison expected value:

 

if (statuscode == 206 && strncasecmp(linebuf, "transfer-encoding: chunked", strlen("transfer-encoding: chunked")))
 

 

 

it needs to be changed to:

 

if (statuscode == 206 && strncasecmp(linebuf, "transfer-encoding: chunked", strlen("transfer-encoding: chunked")) == 0)
 

 

 

so to make it work for 200 and 206, we should simply do:

 

if (strncasecmp(linebuf, "transfer-encoding: chunked", strlen("transfer-encoding: chunked")) == 0)
{
    isChunked = true;
}