HTTP request string

Just starting out? Need help? Post your questions and find answers here.
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

HTTP request string

Post 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.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: HTTP request string

Post 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?
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: HTTP request string

Post by RichAlgeni »

To the moderator: this thread should probably should be in Coding Questions.
User avatar
Kiffi
Addict
Addict
Posts: 1509
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: HTTP request string

Post 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
Hygge
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

Re: HTTP request string

Post 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.
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

Re: HTTP request string

Post by DaylightDreamer »

But thanks for the example.
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

Re: HTTP request string

Post 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.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: HTTP request string

Post 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
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

Re: HTTP request string

Post by DaylightDreamer »

Yes this is it.

However i need a pretty stable solution with HTTPS support.
User avatar
RichAlgeni
Addict
Addict
Posts: 935
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: HTTP request string

Post 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.
DaylightDreamer
User
User
Posts: 52
Joined: Wed Feb 04, 2009 8:11 am
Location: Armenia

Re: HTTP request string

Post 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.
Post Reply