Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@oscarh
Copy link
Contributor

@oscarh oscarh commented Sep 13, 2011

There is now a dialyzer warning, which I'd like to get rid of, but I also don't like to add code branches which canot be reached... Any suggestions on how to deal with this:
lhttpc_client.erl:577: The pattern {'http_error', Data} can never match the type {'error',_} | {'ok',binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []) | {'http_error',string()} | {'http_request','DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'TRACE' | string(),'*' | string() | {'abs_path',string()} | {'scheme',string(),string()} | {'absoluteURI','http' | 'https',string(),'undefined' | non_neg_integer(),string()},{non_neg_integer(),non_neg_integer()}} | {'http_response',{non_neg_integer(),non_neg_integer()},integer(),string()},binary()}

@uwiger
Copy link
Contributor

uwiger commented Sep 13, 2011

The man page for erlang:decode_packet/3 says:

erlang:decode_packet(Type,Bin,Options) -> {ok,Packet,Rest} |
{more,Length} | {error,Reason}

Where does the {'http_error', Data} come from?

BR,
Ulf

Den 13 september 2011 11:16 skrev Oscar Hellström
[email protected]:

There is now a dialyzer warning, which I'd like to get rid of, but I also don't like to add code branches which canot be reached... Any suggestions on how to deal with this:
lhttpc_client.erl:577: The pattern {'http_error', Data} can never match the type {'error',_} | {'ok',binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []) | {'http_error',string()} | {'http_request','DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'TRACE' | string(),'*' | string() | {'abs_path',string()} | {'scheme',string(),string()} | {'absoluteURI','http' | 'https',string(),'undefined' | non_neg_integer(),string()},{non_neg_integer(),non_neg_integer()}} | {'http_response',{non_neg_integer(),non_neg_integer()},integer(),string()},binary()}

You can merge this Pull Request by running:

 git pull https://github.com/oscarh/lhttpc-esl master

Or you can view, comment on it, or merge it online at:

 #3

-- Commit Summary --

  • add a space after : separator
  • add .gitignore files for doc and ebin directories
  • fix some edoc-warnings
  • Make lhttpc_client check the return value from lhttpc_sock:setopts, if setopts returns an error, we can't use the socket...
  • Raise the timeout again, the test fails on slow machines...
  • Add a comment about the bool() / boolean() type thing.
  • Update the default rebar.config
  • ssl seem to have stopped supporting setopts(S, [{packet, httph}]). Therefore we use erlang:decode_packet/3 instead. This should make chunked ssl work with both old and new erlang versions.
  • Update ignore pattern
  • Dialyzer made me do it. It didn' make dialyzer happy, but I'm not sure how to da that in a sain way...
  • Update changelog and prepare for releasing 1.3
  • Don't use tabs, use spaces...
  • Also deal with Other errors when reading trailers.
  • Make the version number 1.3.0, it's been like that before.
  • Merge github.com:oscarh/lhttpc

-- File Changes --

M .gitignore (3)
M CHANGELOG (7)
M rebar.config (3)
M src/lhttpc.app.src (2)
M src/lhttpc_client.erl (52)
M src/lhttpc_types.hrl (1)
M test/lhttpc_tests.erl (4)

-- Patch Links --

 https://github.com/esl/lhttpc/pull/3.patch
 https://github.com/esl/lhttpc/pull/3.diff

Reply to this email directly or view it on GitHub:
#3

@oscarh
Copy link
Contributor Author

oscarh commented Sep 13, 2011

Oh, I misinterpreted the dialyzer warning... I thought it was complaining about a clause I didn't match...

The http_error comes from the possible return value {ok, {http_error, Reason}, Tail}. Will push another commit.

@oscarh
Copy link
Contributor Author

oscarh commented Sep 13, 2011

A fix for this was pushed, should really have added a test for it though...

@eproxus
Copy link

eproxus commented Sep 15, 2011

Looks good to me. If the ssl socket options patch is "okay", then we should merge.

@oscarh
Copy link
Contributor Author

oscarh commented Sep 15, 2011

It seems that OTP will actually add support for {packet, httph} at some point, so this workaround might be useless.

http://erlang.org/pipermail/erlang-questions/2011-September/061145.html

@oscarh
Copy link
Contributor Author

oscarh commented Sep 15, 2011

I guess we can chose to remove the ssl:setopts fix (if OTP will include the fix in the next release), but I think there is some value in the rest of the commits. Well, mainly the test with broken trailers.

@eproxus
Copy link

eproxus commented Sep 16, 2011

In which version does it not exist? Or did it never exist?

@oscarh
Copy link
Contributor Author

oscarh commented Sep 16, 2011

It's missing in "new ssl". This means it doesn't work per default with OTP HEAD from here.

@oscarh
Copy link
Contributor Author

oscarh commented Oct 13, 2011

I think the fix was included in the latest OTP, I'll try to create a new pull request without the workaround this weekend.

@oscarh oscarh closed this Oct 13, 2011
@eproxus
Copy link

eproxus commented Oct 13, 2011

Ok, good stuff.

rymir pushed a commit to rymir/lhttpc that referenced this pull request Jan 25, 2013
nalundgaard referenced this pull request in alertlogic/lhttpc Sep 16, 2016
massemanet pushed a commit to campanja-forks/lhttpc that referenced this pull request Mar 9, 2017
g-andrade pushed a commit to g-andrade/lhttpc that referenced this pull request Jul 24, 2018
…e_time_warnings

Handle OTP 21 compile-time warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants