03-23-2009 02:49 AM
10-23-2009 02:35 PM
I see that this is a very old posting, however, it's now become relevant to me. I was wondering, you mention, "Note that the connection it will be closed after each response." How does the connection close after each reponse? Wouldn't it only it only close if I call the Close_TCP_Connection VI? I'm trying to talk to a radio and the first message after the open connection seems to be ok, but subsequent messages don't get a reply. I'm pretty sure that the http I'm sending is ill-formed. Regardless, can't I keep the connection open till done? I have a number of messages that I want to send back and forth and I didn't plan on closing the connection until the user wants to. Is that a problem?
Also, outside of the Internet Toolkit, are there any VIs that help construct well-formed http. I'm having to manually construct all of my headers/body, and this is prone to errors.
10-25-2009 03:01 PM
mrbean wrote:I see that this is a very old posting, however, it's now become relevant to me. I was wondering, you mention, "Note that the connection it will be closed after each response." How does the connection close after each reponse? Wouldn't it only it only close if I call the Close_TCP_Connection VI? I'm trying to talk to a radio and the first message after the open connection seems to be ok, but subsequent messages don't get a reply. I'm pretty sure that the http I'm sending is ill-formed. Regardless, can't I keep the connection open till done? I have a number of messages that I want to send back and forth and I didn't plan on closing the connection until the user wants to. Is that a problem?
Also, outside of the Internet Toolkit, are there any VIs that help construct well-formed http. I'm having to manually construct all of my headers/body, and this is prone to errors.
Default operation for a HTTP server is to close the socket after each HTTP transmission. So this means that trying to reuse a connection after a single send/receive operation is normally not possible. If you implement HTTP 1.1 on the client side and send a correct HTTP 1.1 header with the additional parameter "Connection: Keep-Alive", then you can continue to reuse the connection as long as the server responds with a header that states that it supports HTTP 1.1 or better.
10-26-2009 07:29 AM
I do use the "Connection: Keep Alive", so I should be ok there. In a related question, I'm using Stunnel to talk to this radio, and although my log says I'm binding to the IP addr, I'm seeing no data.
A different person told me, after examining my .conf and log files that he noticed that stunnel is using the SSL certificate from its own directory (C:\Program Files\stunnel\stunnel.pem), but should instead use the SSL certificate from the server, since each server has a different SSL cert.
Is the location of the server's SSL certificate something I should know?
10-29-2009 11:03 AM
I (ultimately) have a question about Stunned. I've been manually constructing the http messages that I have to send to the radio based on what I'm seeing go across (in a non-secure mode) using a sniffer program called WireShark. Here's a sample of the data I see going across, and that I'm trying to emulate.
GET /setupRfData.asp HTTP/1.1\r\n
[truncated] Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/
Referer: http://10.4.30.1/\r\n
Accept-Language: en-us\r\n
Accept-Encoding: gzip, deflate\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 3.0.04506.30; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)\r\n
Host: 10.4.32.1\r\n
Connection: Keep-Alive\r\n
Authorization: Basic YWRtaWtcoirldOvcmQx\r\n
Credentials: admin:Paxxword1
\r\n
A lot of the information in the GET above is standard (I'm told), but I also do POST commands where I have to insert actual data. By 'Standard', I mean that, I guess, Internet Explorer takes care of when it establishes a link. Right now, the GET/POST messages I send are entirely produced (headers/data/footers) by me and sent via TCP-Write (currently in a non-secure fashion, but ultimately (I pray) securely using Stunnel). Does Stunnel take care of header/footer details or does it simply (I don't think any of this is simple) establish the connection and take care of getting the message traffic from A to B?
I'm not sure what to do when I see '[truncated]'. Also, since I don't need to process the html coming back to me, I don't think I need to Accept all the applications listed. Similarly, with the User-Agent field - do I have to list all those things when I don't plan to process the html, just simply display it in a text form?
10-29-2009 11:04 AM
10-29-2009 11:34 AM
mrbean wrote:I (ultimately) have a question about Stunned. I've been manually constructing the http messages that I have to send to the radio based on what I'm seeing go across (in a non-secure mode) using a sniffer program called WireShark. Here's a sample of the data I see going across, and that I'm trying to emulate.
GET /setupRfData.asp HTTP/1.1\r\n
stunnel will only look at this line. Because it needs to know to which server to send the information you do provide in the GET command a fully qulified URL with the server address prepended to the path. Basically stunnel acts as HTTP proxy, in the process of proxying it does however also encrypt the non encrypted stream into an SSL encrypted stream and vice versa.
I have been working on a replacement library for the TCP/Ip functions a little more, and it seems I'm getting somewhere with the TCP/IP functionality mostly working as the LabVIEW functions do, but with the additional feature to support IP6 and hopefully SSL. I even got a first connection to a HTTPS server established to get some data from it, but have still a few stability problems with that. So don't hold your breath for this.
10-29-2009 01:40 PM
10-29-2009 04:50 PM - edited 10-29-2009 04:51 PM
That is at least how I did it. You probably can get stunnel to contact a specific server always, but it is of course much more practical to have stunnel take the address from the GET command (and possibly POST too but I never tried that).
The way your absolute URI command would look is something like this:
GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1\r\n
while for a non proxy request it would be:
GET /pub/WWW/TheProject.html HTTP/1.1\r\n
In theory every HTTP server can also work as proxy but in practice it is not usually common to do that, and some servers might disable that to limit bandwith usage.
10-30-2009 06:33 AM
I have an IP address instead of a URI, so I assume my call would look like this
GET 10.4.32.1 HTTP/1.1\r\n
One question, you said ...
"but it is of course much more practical to have stunnel take the address from the GET command"
I'm not sure how stunnel "takes" the address from the GET command. I thought stunnel looked at what you had in the stunnel.conf in the [https] accept. Is that not correct?
[https]
connect = 80
accept = 10.4.32.1:443
TIMEOUTclose = 0