cancel
Showing results for 
Search instead for 
Did you mean: 

Is nginx used for the SQL Anywhere 16.0.0.2419 built-in HTTP server?

Breck_Carter
Participant
0 Kudos
1,928

The "Server,nginx" attribute/value pair returned by a web client call seems to indicate so...

...and if so, perhaps the C:\\Program Files\\SQL Anywhere 16\\ThirdPartyLegal\\ SQLAnywhere16ThirdPartyLegal.txt needs updating because it claims Apache is used.

See NGINX vs. Apache.

The following slightly-obfuscated-code was run on Windows 7 to call a web service on a local SQL Anywhere 16.0.0.2419 database:

CREATE PROCEDURE blah_blah_blah ( 
   url_spec    LONG VARCHAR )
RESULT (
   attribute   LONG VARCHAR,
   value       LONG VARCHAR )
URL '!url_spec'
HEADER 'ASA-Id' 
TYPE 'HTTP:GET';

SELECT *
  FROM blah_blah_blah ( 'http://localhost/blah blah blah' )
 ORDER BY attribute;

attribute,value
Body,<html>blah blah blah</html>
Cache-Control,no-cache
Connection,close
Content-Type,text/html
Date,Wed, 12 Apr 2017 14:38:35 GMT
Expires,Wed, 12 Apr 2017 14:38:34 GMT
Server,nginx
Status,HTTP/1.1 200 OK
Vary,Accept-Encoding
Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

I haven't found the string "nginx" in the all SA17 binary files. This is not an answer, just a comment 🙂

Former Member
0 Kudos

That should report the server for the specified URL.

When I browse to my database -xs listener that http response is

<--     Server: SQLAnywhere/16.0.0.2344
 {Nope haven't tried it with latest yet}

using lopt=all,headers (or ALL,reshdrs) but if I specify my local IIS server (port 80) that correctly comes back with

attribute,   value
Server,      Microsoft-IIS/10.0

So I would be willing to bet your URL is pointing to a nginx (type | based) server.

O/W I do not see any evidence of a switch in our code to nginx (yet)

Do let me know if this illusion persists ...

Breck_Carter
Participant
0 Kudos

> So I would be willing to bet your URL is pointing to a nginx (type | based) server.

The URL is localhost which is Foxhound which is running inside a SQL Anywhere 16 database.

I should put together a compleat repro... sigh 🙂

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

I would like to see the repro :) you know this IT world already.

Breck_Carter
Participant
0 Kudos

OK, here goes... with my luck, the repro will simply reveal my computer is haunted :)... stay tuned.

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

At first glance, "haunted" is as good an answer as any 🙂

On further study...

The problem was caused because an underscore was used in a web client substitution parameter name; see Substitution parameters used for clause values:

All parameters used for substitution must be alphanumeric. Underscores are not allowed.

Here is a reproducible using two separate SQL Anywhere databases, one as a web server, and one as a web client...

Webserver database

"%SQLANY16%\\bin64\\dbspawn.exe"^
  -f "%SQLANY16%\\bin64\\dbsrv16.exe"^
  -o dbsrv16_log_webserver.txt^
  -oe dbsrv16_log_fatal_webserver.txt^
  -xs "http(port=12345")^
  webserver.db

CREATE SERVICE s 
   TYPE 'RAW' AUTHORIZATION OFF USER DBA
   AS CALL p();

CREATE PROCEDURE p()
RESULT ( html_string LONG VARCHAR )
BEGIN

CALL dbo.sa_set_http_header( 'Content-Type', 'text/html' );

SELECT STRING ( 
   '<html><body> ',
   PROPERTY ( 'ProductName' ),
   ' ', 
   PROPERTY ( 'ProductVersion' ),
   ' </body></html>' );

END;

Webclient database with bad URL '!url_spec' clause returns strange result set

"%SQLANY16%\\bin64\\dbspawn.exe"^
  -f "%SQLANY16%\\bin64\\dbsrv16.exe"^
  -o dbsrv16_log_webclient.txt^
  -oe dbsrv16_log_fatal_webclient.txt^
  webclient.db

CREATE PROCEDURE c ( 
   url_spec    LONG VARCHAR )
RESULT (
   attribute   LONG VARCHAR,
   value       LONG VARCHAR )
URL '!url_spec'
TYPE 'HTTP:GET';

SELECT *
  FROM c ( 'http://localhost:12345/s ' )
 ORDER BY attribute;

attribute,value
Body,<html><head><meta http-equiv="refresh" content="0;url=http://search.centurylink.com/index.php
   ?origURL=http://_spec/&bc="/></head>
   <body><script type="text/javascript">window.location="http://search.centurylink.com/index.php
   ?origURL="+escape(window.location)
   +"&r="+escape(document.referrer)+"&bc=";</script></body></html>
Cache-Control,no-cache
Connection,close
Content-Type,text/html
Date,Fri, 14 Apr 2017 13:03:10 GMT
Expires,Fri, 14 Apr 2017 13:03:09 GMT
Server,nginx
Status,HTTP/1.1 200 OK
Vary,Accept-Encoding

Webclient database with good URL '!urlspec' clause returns expected result set

CREATE PROCEDURE c ( 
   urlspec    LONG VARCHAR )
RESULT (
   attribute   LONG VARCHAR,
   value       LONG VARCHAR )
URL '!urlspec'
TYPE 'HTTP:GET';

SELECT *
  FROM c ( 'http://localhost:12345/s ' )
 ORDER BY attribute;

attribute,value
Body,<HTML><BODY> SQL Anywhere 16.0.0.2419 </BODY></HTML>
Connection,close
Content-Type,text/html
Date,Fri, 14 Apr 2017 13:10:12 GMT
Expires,Fri, 14 Apr 2017 13:10:12 GMT
Server,SQLAnywhere/16.0.0.2419
Status,HTTP/1.1 200 OK
Breck_Carter
Participant
0 Kudos

I could grok an error message, even an empty result set, but some random web page from the ISP (CenturyLink)?