FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
49 stars 40 forks source link

Notification Host Header is missing Port. #1532

Open jason-fox opened 5 months ago

jason-fox commented 5 months ago

Orion-LD 1.5.0

I create a Subscription on a tenant as shown:

curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'Content-Type: application/ld+json' \
-H 'NGSILD-Tenant: openiot' \
--data-raw '{
  "description": "Notify me of all feedstock changes",
  "type": "Subscription",
  "entities": [{"type": "FillingLevelSensor"}],
  "watchedAttributes": ["filling"],
  "notification": {
    "attributes": ["filling", "location"],
    "format": "normalized",
    "endpoint": {
      "uri": "http://tutorial:3000/subscription/low-stock-farm001",
      "accept": "application/json",
      "receiverInfo": [
        {
          "key": "fiware-service",
          "value": "openiot"
        }
      ]
    }
  },
   "@context": "http://context/ngsi-context.jsonld"
}'

I then trigger the subscription using the following upsert.

curl -L -X POST 'http://localhost:9090/ngsi-ld/v1/entityOperations/upsert/?options=update' \
-H 'Content-Type: application/ld+json' \
-H 'NGSILD-Tenant: openiot' \
--data-raw '[
        {
            "@context": "http://context/ngsi-context.jsonld",
            "id": "urn:ngsi-ld:Device:filling002",
            "type": "FillingLevelSensor",
            "filling": {
                "type": "Property",
                "value": 0.96,
                "unitCode": "C62",
                "accuracy": {
                    "type": "Property",
                    "value": 0.05
                },
                "observedAt": "2024-01-12T13:28:33.867Z"
            }
        }
    ]'

I have found a minor issue on notifications headers. For the notification I get the following Host header:

This is incorrect, it is missing the port. It should be:

According to the definition of the Host Header:

The Host request header specifies the host and port number of the server to which the request is being sent.

If no port is included, the default port for the service requested is implied (e.g., 443 for an HTTPS URL, and 80 for an HTTP URL).

kzangeli commented 5 months ago

ok, thanks! Easy fix, will do it asap