Giter Club home page Giter Club logo

minihttp's People

Contributors

apollo-time avatar cat-ion avatar fgenesis avatar sisong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

minihttp's Issues

SIGSEV: mbedtls::Download - I believe you're accessing a non-allocated memory chunk?

This should explain it all:

[email protected]_W723_V_Typ_A_1_01_012 ~/W/IceTea $ lldb ./out/icetea
(lldb) target create "./out/icetea"
Current executable set to './out/icetea' (x86_64).
(lldb) process launch -- -e 'minihttp.Download("https://google.com")'
Process 47108 launched: './out/icetea' (x86_64)
-- url: https://google.com
Process 47108 stopped
* thread #1: tid = 0xc5d60d, 0x000000010000ce51 icetea`minihttp::DLSocket::_OnRequestDone(this=0x00007fff5fbfc3e0) + 33 at minihttp.cpp:1357, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010000ce51 icetea`minihttp::DLSocket::_OnRequestDone(this=0x00007fff5fbfc3e0) + 33 at minihttp.cpp:1357
   1354     void _OnRequestDone()
   1355     {
   1356         finished = true;
-> 1357         buf[bufsz] = 0; // zero-terminate
   1358     }
   1359 
   1360     void _OnRecv(void *incoming, unsigned size)
(lldb) bt
* thread #1: tid = 0xc5d60d, 0x000000010000ce51 icetea`minihttp::DLSocket::_OnRequestDone(this=0x00007fff5fbfc3e0) + 33 at minihttp.cpp:1357, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000000010000ce51 icetea`minihttp::DLSocket::_OnRequestDone(this=0x00007fff5fbfc3e0) + 33 at minihttp.cpp:1357
    frame #1: 0x0000000100004ad6 icetea`minihttp::HttpSocket::_FinishRequest(this=0x00007fff5fbfc3e0) + 86 at minihttp.cpp:1013
    frame #2: 0x00000001000049e3 icetea`minihttp::HttpSocket::_OnUpdate(this=0x00007fff5fbfc3e0) + 131 at minihttp.cpp:832
    frame #3: 0x0000000100003d0a icetea`minihttp::TcpSocket::update(this=0x00007fff5fbfc3e0) + 26 at minihttp.cpp:720
    frame #4: 0x00000001000086ee icetea`minihttp::Download(url="https://google.com", sz=0x0000000000000000, post=0x0000000000000000) + 510 at minihttp.cpp:1393
    frame #5: 0x0000000100001125 icetea`IceTeaHTTP::Download(os=0x0000000100600010, params=1, closure_values=0, need_ret_values=1, userData=0x0000000000000000) + 245 at minihttp.cpp:21
    frame #6: 0x0000000100126329 icetea`ObjectScript::OS::Core::callFT(this=0x000000010200f4a8, start_pos=25, call_params=3, ret_values=1, self_for_proto=0x0000000000000000, call_enter=OS_CALLENTER_ALLOW_ONLY_ENTER, call_type=OS_CALLTYPE_AUTO, call_this_usage=OS_CALLTHIS_KEEP_STACK_VALUE) + 2249 at objectscript.cpp:26729
    frame #7: 0x000000010011fb98 icetea`ObjectScript::OS::Core::execute(this=0x000000010200f4a8) + 32568 at objectscript.cpp:20618
    frame #8: 0x0000000100126214 icetea`ObjectScript::OS::Core::callFT(this=0x000000010200f4a8, start_pos=21, call_params=2, ret_values=1, self_for_proto=0x0000000000000000, call_enter=OS_CALLENTER_EXECUTE_AND_RETURN, call_type=OS_CALLTYPE_FUNC, call_this_usage=OS_CALLTHIS_KEEP_STACK_VALUE) + 1972 at objectscript.cpp:26712
    frame #9: 0x00000001000fb078 icetea`ObjectScript::OS::Core::callFT(this=0x000000010200f4a8, params=2, ret_values=1, call_type=OS_CALLTYPE_FUNC, call_this_usage=OS_CALLTHIS_KEEP_STACK_VALUE) + 104 at objectscript.cpp:26831
    frame #10: 0x000000010013b890 icetea`ObjectScript::OS::eval(this=0x0000000100600010, str=0x00007fff5fbfec90, params=0, ret_values=1, source_code_type=OS_SOURCECODE_PLAIN, check_utf8_bom=true, handle_exception=false) + 160 at objectscript.cpp:27026
    frame #11: 0x000000010013a4b6 icetea`ObjectScript::OS::eval(this=0x0000000100600010, str="minihttp.Download(\"https://google.com\")", params=0, ret_values=1, source_code_type=OS_SOURCECODE_PLAIN, check_utf8_bom=true, handle_exception=false) + 118 at objectscript.cpp:27016
    frame #12: 0x00000001000a1cde icetea`IceTea::eval(this=0x0000000100600010, code=<unavailable>, expected=1) + 302 at IceTea.cpp:392
    frame #13: 0x00000001000a1a1f icetea`IceTea::checkAndRunInline(this=0x0000000100600010, rt=0x00007fff5fbff6fc) + 3935 at IceTea.cpp:320
    frame #14: 0x00000001000a31b1 icetea`IceTea::run(this=0x0000000100600010) + 1089 at IceTea.cpp:467
    frame #15: 0x00000001000c78de icetea`main(argc=3, argv=0x00007fff5fbff9e8) + 62 at main.cpp:18
    frame #16: 0x00007fff9bad65ad libdyld.dylib`start + 1
    frame #17: 0x00007fff9bad65ad libdyld.dylib`start + 1

I mimiced the mbedtls API in the scripting language, and -e executes a string. From thereon out, you should see where this is going :)

Enums within namespaces: Clang warning, C++11 feature

Whilst building, I encountered a warning several times - here is a snippet:

> ./ext/./minihttp/minihttp.cpp:37:44: warning: use of enumeration in a nested name specifier is a C++11 extension [-Wc++11-extensions]
>             {OS_TEXT("SSLR_OK"), minihttp::SSLResult::SSLR_OK},
>                                            ^

I was confused at first, but when I put the warning into google, I ended up here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150112/121520.html
If you scroll down, you can see a testcase, which demonstrates this:

+namespace PR16951 {
+  namespace ns {
+    enum an_enumeration {
+      ENUMERATOR  // expected-note{{'ENUMERATOR' declared here}}
+    };
+  }
+
+  int x1 = ns::an_enumeration::ENUMERATOR; // expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}

So as it turns out, putting an enum into a namespace is C++11 and upwards. I myself was...well, surprised wouldn't suit it. But I would have assumed that naturally, anything can go into a namespace - turns out this is wrong.

So I'd like to ask for these enums to be moved upwards and renamed. It's just two anyway:

  • minihttp::SSLResult -> minihttp_SSLResult
  • minihttp::HttpCode -> minihttp_HttpCode

I am just suggesting these, but they would make the most sense, and allow non-C++11 compilers to not become confused :)

PolarSSL -> mbedTLS

https://tls.mbed.org/

Basically they changed names. This might affect this library. For backwards compatibility, I'd just suggest adding MINIHTTP_USE_MBEDTLS analogous to MINIHTTP_USE_POLARSSL.

Kind regards,
Ingwie

Direct way to download and buffer?

Hey.

I am trying to implement the download and buffer method. I.e.:

std::string mydata = ht->Download("http://google.com");

Kind regards, Ingwie

Got HTTP Status 401

I try minihttp::Download but I got http 401 status.

Got HTTP Status 401

How can I process it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.