Page 1 of 1
HTTP request string
Posted: Wed Oct 17, 2012 11:43 am
by DaylightDreamer
Is it possible to retrieve the HTTP request as string without actually storing its content in a file first ?
Something to make POST requests would be also very nice.
Re: HTTP request string
Posted: Wed Oct 17, 2012 7:35 pm
by RichAlgeni
Yes, but you will need to write the code to receive the request, to replace the code that writes it to a file.
Writing POST requests are similar to GET requests. Before we jump in and overwhelm you with code, have you written a GET request before? Have you written any network code?
Re: HTTP request string
Posted: Wed Oct 17, 2012 7:38 pm
by RichAlgeni
To the moderator: this thread should probably should be in Coding Questions.
Re: HTTP request string
Posted: Wed Oct 17, 2012 9:50 pm
by Kiffi
DaylightDreamer wrote:Is it possible to retrieve the HTTP request as string without actually storing its content in a file first ?
http://www.purebasic.fr/english/viewtop ... 12&t=44954
Greetings ... Kiffi
Re: HTTP request string
Posted: Wed Oct 24, 2012 8:12 am
by DaylightDreamer
Hello,
Yes I`m aware of this examples. And yes I`m familiar with the request format.
However I`m talking about the native support on memory level (to be able to write a versatile client server applications base on just web server)
Also i don't think these examples are covering HTTPS support.
Re: HTTP request string
Posted: Wed Oct 24, 2012 8:13 am
by DaylightDreamer
But thanks for the example.
Re: HTTP request string
Posted: Mon Dec 10, 2012 7:34 am
by DaylightDreamer
For example GetHTTPHeader(URL$) function gets the header of specifed url.
It shouldn't be difficult to ad additional parameter to this function to retrieve the entire http package.
Re: HTTP request string
Posted: Mon Dec 10, 2012 6:49 pm
by RichAlgeni
Take a look at this:
http://www.purebasic.fr/english/viewtop ... 12&t=51072
This will show you how to use native PB and windows code to read a socket into memory. This will include the entire packet sent in by a browser, not just the header. Is this what you are asking for?
Let me know if you have any questions.
Rich
Re: HTTP request string
Posted: Wed Dec 26, 2012 2:15 pm
by DaylightDreamer
Yes this is it.
However i need a pretty stable solution with HTTPS support.
Re: HTTP request string
Posted: Thu Dec 27, 2012 2:12 am
by RichAlgeni
This is what I would do (and have done), and in my opinion, is the best way (and easiest) to do a Secure Sockets Layer (SSL) Server. Utilize a proxy server process like Apache, running on a machine that is accessible to the internet. Your PureBasic Server process will be running on a separate machine, connected to the proxy server machine via a non-routeable IP address, like 192.169.1.x. Apache will handle the 'secure' part of the connection, and forward requests to the PureBasic server. The PB server will fulfill the requests, sending data back out through the proxy server.
This solves a number of problems, not the least of which is that writing an SSL is extremely complicated! This also adds a layer of security as your main server is not accessible itself on the internet.
Re: HTTP request string
Posted: Thu Dec 27, 2012 8:07 am
by DaylightDreamer
Yes i`m aware of that thank you.
Also i was thinking of using a hidden WebGadget to make this interchange.
But not sure if it will work.