Understanding URL Syntax (and Arguments to Http.SynchronousRequest)

URL’s have this general format:

<scheme>://<domain>:<port>/<path>?<query_string>#<fragment_id>

The URL parts are summarized below.  Comments about how each part relates to the SynchronousRequest method are included.  The SynchronousRequest method has the following signature (C# syntax)

HttpResponse SynchronousRequest(string domain, int port, bool ssl, HttpRequest req);

The URL parts:

  • scheme:  This can be “http” or “https”.   If “https”, then SSL/TLS is used and the “ssl” argument to SynchronousRequest should be set to true.
  • domain:  The domain name or dotted IP address of the web server hosting the resource.  This is the domain argument to SynchronousRequest
  • port: The port number on which the server is listening.  If not explicitly specified, the default for non-SSL is 80, the default for SSL/TLS is 443.  This value must be explicitly passed in the port argument to SynchronousRequest.
  • path:  The local name for the resource on the server.  In SynchronousRequest, the path is passed in the Path property of the HttpRequest object (which is the last argument to SynchronousRequest).
  • query_string:  It may contain name/value pairs separated by ampersands, for example first_name=John&last_name=Doe.  If SynchronousRequest is sending a GET request (where the HttpRequest.HttpVerb = “GET”, then the HttpRequest.Path property should contain the entire path + query string.
  • fragment_id:  A name for a piece or part of the resource.  The fragment_id is never passed to the server and is only used by the client (i.e. the browser).  Typically, it’s to automatically navigate to a specific anchor within the HTML page.