It is currently Thu Jul 18, 2019 10:14 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: PB 5.70 HTTPMemory()
PostPosted: Fri Apr 12, 2019 4:39 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4255
Location: Germany
The bug depends on the interpretation :wink:

In the help is written that HTTPMemory() returns the full raw received packet.
But it only returns the 'body' and not the header.

Or it is a bug in the documentation.

But without the full raw packet, it is not possible to extract cookies for example.

So I would say it is a real bug and not a documentation bug.
Code:
InitNetwork()

HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.terra-institute.eu/en/cookies/")
If HttpRequest
 
  *Response = HTTPMemory(HTTPRequest)
  If *Response
    Response$ = PeekS(*Response, MemorySize(*Response), #PB_UTF8)
    Debug Response$
    Pos = FindString(Response$, "Cookie:")
    If Pos
      Pos + 7
      Debug "Cookie = " + Mid(Response$, Pos, FindString(Header$, #CRLF$, Pos) - Pos)
    Else
      Debug "No Cookie found"
    EndIf
    FreeMemory(*Response)
  EndIf
 
  FinishHTTP(HTTPRequest)
Else
  Debug "Request creation failed"
EndIf


A new reason why I stay with my own libcurl.pbi


Top
 Profile  
Reply with quote  
 Post subject: Re: PB 5.70 HTTPMemory()
PostPosted: Sun Apr 14, 2019 7:26 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 440
+1


Top
 Profile  
Reply with quote  
 Post subject: Re: PB 5.70 HTTPMemory()
PostPosted: Thu May 30, 2019 4:23 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1624
+1 (should be a feature request)

I have been happily using HTTPRequest() more and more, but now I hit a brick wall as soon as I need access to the responded HTTP headers (cookies, etc.).

I wish for another HTTPInfo flag...
Code:
HTTPInfo(#PB_HTTP_Headers)


Top
 Profile  
Reply with quote  
 Post subject: Re: PB 5.70 HTTPMemory()
PostPosted: Fri May 31, 2019 10:54 am 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 4255
Location: Germany
It is a feature request. With a good chance to be implemented soon.

viewtopic.php?f=3&t=72649


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye