lib: Prefix URLs with lower-case protocol names/schemes #597

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@MoSal
Contributor
MoSal commented Jan 8, 2016

Before this patch, if a URL does not start with the protocol
name/scheme, effective URLs would be prefixed with upper-case
protocol names/schemes. This behavior might not be expected by
library users or end users.

For example, if CURLOPT_DEFAULT_PROTOCOL is set to "https". And
the URL is "hostname/path". The effective URL would be
"HTTPS://hostname/path" instead of "https://hostname/path".

After this patch, effective URLs would be prefixed with
a lower-case protocol name/scheme.

@bagder
Member
bagder commented Jan 10, 2016

I think the suggestion is good. But why not sprintf() the new string first and then lower case the protocol part within that, then you won't have to copy the protocol first into a fixed-sized array?

@bagder bagder self-assigned this Jan 10, 2016
MoSal added some commits Jan 8, 2016
@MoSal MoSal lib: Prefix URLs with lower-case protocol names/schemes
  Before this patch, if a URL does not start with the protocol
  name/scheme, effective URLs would be prefixed with upper-case
  protocol names/schemes. This behavior might not be expected by
  library users or end users.

  For example, if `CURLOPT_DEFAULT_PROTOCOL` is set to "https". And
  the URL is "hostname/path". The effective URL would be
  "HTTPS://hostname/path" instead of "https://hostname/path".

  After this patch, effective URLs would be prefixed with
  a lower-case protocol name/scheme.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
7bdf617
@MoSal MoSal tests: Update test 1213 with lower-case protocol name
c708ce7
@MoSal
Contributor
MoSal commented Jan 11, 2016

I think the suggestion is good. But why not sprintf() the new string first and then lower case the protocol part within that, then you won't have to copy the protocol first into a fixed-sized array?

Done.

@bagder bagder added a commit that closed this pull request Jan 11, 2016
@MoSal @bagder MoSal + bagder lib: Prefix URLs with lower-case protocol names/schemes
Before this patch, if a URL does not start with the protocol
name/scheme, effective URLs would be prefixed with upper-case protocol
names/schemes. This behavior might not be expected by library users or
end users.

For example, if `CURLOPT_DEFAULT_PROTOCOL` is set to "https". And the
URL is "hostname/path". The effective URL would be
"HTTPS://hostname/path" instead of "https://hostname/path".

After this patch, effective URLs would be prefixed with a lower-case
protocol name/scheme.

Closes #597

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
3d209b5
@bagder bagder closed this in 3d209b5 Jan 11, 2016
@bagder
Member
bagder commented Jan 11, 2016

Thanks!

@MoSal MoSal deleted the saldl:lower_case_proto branch Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment