-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: httpclient fails to compile without -d:ssl #4797
Comments
Oh yeah, I forgot to fix this. I didn't realise that a compiler bug was hiding amongst it. I guess for now we can add that hack to the |
@Araq Please take a look at this. |
I really like how the whole thing is moving towards deduplicating sync and async code (primary example being proc code*(response: Response): HttpCode {.raises: [ValueError].} =
return parseEnum[HttpCode](response.status) This looks innocent enough (except restricting the range of acceptable codes), but, if we look at type HttpCode = enum
...
Http404 = "404 Not Found",
... So now our code won't work if someone switches a status message. type HttpCode = distinct range[100..599] We get enough type safety this way, with less cognitive load. |
Glad you like it. @zah suggested it way back in the day (before I even implemented async await), and while fixing
That would then require me to write ``HttpCode(404) So yeah, I will do that. |
After 3ad368f importing
httpclient
module without-d:ssl
results in following error:The problem stems from
HttpClientBase
definition (previouslyAsyncHttpClient
), which has been made generic. Apparently, generic type definitions do not respectwhen
rules. Here's an example of the same bug:This fails with
undeclared identifier: 'NoSuchType'
.As a temporary workaround I tried a following quick hack:
This seems to work (at least the module compiles), but only if added to
net
module. If this is added tohttpclient
(so that the hack remains local), compilation fails withError: redefinition of 'SslContext'
, even thoughSslContext
is not defined in this case.The text was updated successfully, but these errors were encountered: