Thread: My HTTP-Lib doesnt load the full content at some HTTPS-sites.

  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    2

    My HTTP-Lib doesnt load the full content at some HTTPS-sites.

    Hello, i'm a newbie and need help. my HTTP-Library doesn't load the full content of some HTTPS sites...
    Code:
    $ git clone https://github.com/JanHelbling/libmicrohttp.git
    $ cd libmicrohttp
    $ sed 's/ccczh.ch/facebook.com/g' -i main.c 
    $ make
    The Result:
    Code:
    gcc -c  -g -Iinclude main.c -lssl -lcrypto
    gcc -g -Iinclude parse_url.o http_func.o main.o -o main -lssl -lcrypto
    ./main
    [DEBUG][main.c][main]: Running main(), execute http_func()...
    [DEBUG][src/parse_url.c][parse_url]: parse url 'https://www.facebook.com/'...
    [DEBUG][src/http_func.c][do_connect]: resolve ip-address from host 'www.facebook.com'...
    [DEBUG][src/http_func.c][do_connect]: creating socket and connect to '31.13.86.36'...
    [DEBUG][src/http_func.c][http_func] Connected with ECDHE-ECDSA-AES128-GCM-SHA256 encryption
    [DEBUG][src/http_func.c][ShowCerts]: Server certificates:
    [DEBUG][src/http_func.c][ShowCerts]: Subject: /C=US/ST=CA/L=Menlo Park/O=Facebook, Inc./CN=*.facebook.com
    [DEBUG][src/http_func.c][ShowCerts]: Issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
    [DEBUG][main.c][main]: http_func() has returned HTTP-CODE[200]
    [DEBUG][main.c][main]: Do you want print the data in stdout? (y/n) y
    HTTP/1.1 200 OK
    Cache-Control: private, no-cache, no-store, must-revalidate
    Pragma: no-cache
    Strict-Transport-Security: max-age=15552000; preload
    Vary: Accept-Encoding
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-XSS-Protection: 0
    Expires: Sat, 01 Jan 2000 00:00:00 GMT
    Content-Type: text/html; charset="utf-8"
    X-FB-Debug: rEDcZ0bvO9KUp9s9kfPQXKHYm1jBy7J5dVSXku6llnpwxddEsktYQ8lwKWHDfyXFqzFR3kTM91FE2UAb5CPLFQ==
    Date: Sun, 21 Apr 2019 16:46:35 GMT
    Connection: close
    
    <!DOCTYPE html>
    <html lang="de" id="facebook" class="no_js">
    <head><meta charset="utf-8" /><meta name="referrer" content="default" id="meta_referrer" /><script>window._cstart=+new Date();</script><script>function envFlush(a){function b(b){for(var c in a)b[c]=a[c]}window.requireLazy?window.requireLazy(["Env"],b):(window.Env=window.Env||{},b(window.Env))}envFlush({"defer_cookies":true,"ajaxpipe_token":"AXiokPUDmTcB0AVv","timeslice_heartbeat_config":{"pollIntervalMs":33,"idleGapThresholdMs":60,"ignoredTimesliceNames":{"requestAnimationFrame":true,"Event listenHandler mousemove":true,"Event listenHandler mouseover":true,"Event listenHandler mouseout":true,"Event listenHandler scroll":true},"isHeartbeatEnabled":true,"isArtilleryOn":false},"shouldLogCounters":true,"timeslice_categories":{"react_render":true,"reflow":true},
    "sample_continuation_stacktraces":true,"dom_mutation_flag":true,"stack_trace_limit":30,"deferred_stack_trace_rate":1000,
    "timesliceBufferSize":5000,"show_invariant_decoder":false,"i

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > int status_code = http_func(URL,buf,8192*2,GET);
    Presumably, because you limit how much data you want to return.

    Maybe you could supply a buffer pointer, and let http_func fetch and realloc as needed.
    Code:
    int http_func(const char *fullurl, char **buffer, int *num, int method)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    2

    Cool Ive solved it

    Quote Originally Posted by Salem View Post
    > int status_code = http_func(URL,buf,8192*2,GET);
    Presumably, because you limit how much data you want to return.

    Maybe you could supply a buffer pointer, and let http_func fetch and realloc as needed.
    Code:
    int http_func(const char *fullurl, char **buffer, int *num, int method)
    I've found the error.
    Instead of read all bytes at once, i read each byte individually...
    Now it works!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HTTPS POST with C Socket
    By pobri19 in forum Networking/Device Communication
    Replies: 14
    Last Post: 05-02-2010, 11:21 PM
  2. Downloading from HTTPS
    By (TNT) in forum C# Programming
    Replies: 3
    Last Post: 01-06-2007, 01:52 AM
  3. sending https request
    By sreenu_daram in forum Networking/Device Communication
    Replies: 1
    Last Post: 08-05-2006, 09:08 AM
  4. Using WinINet with HTTPS
    By KonArtis in forum Networking/Device Communication
    Replies: 1
    Last Post: 06-06-2005, 06:28 AM

Tags for this Thread