Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3962f54
Author: Uma Annamalai <uannamalai@newrelic.com>
Date:   Thu Jan 4 12:50:58 2024 -0800

    Remove case sensitive check in ASGIBrowserMiddleware check. (#1017)

    * Remove case sensitive check in should_insert_html.

    * [Mega-Linter] Apply linters fixes

    * Remove header decoding.

    ---------

    Co-authored-by: umaannamalai <umaannamalai@users.noreply.github.com>

commit c3314ae
Author: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>
Date:   Tue Jan 2 17:17:20 2024 -0800

    Temporarily pin hypercorn version in tests (#1021)

    * Temporarily pin hypercorn to <0.16

    * Temporarily pin hypercorn to <0.16

    * Add comment to tox.ini

    ---------

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 1357145
Author: Uma Annamalai <uannamalai@newrelic.com>
Date:   Tue Jan 2 16:17:08 2024 -0800

    Drop py27 from memcache testing. (#1018)

commit 23f969f
Author: Timothy Pansino <11214426+TimPansino@users.noreply.github.com>
Date:   Wed Dec 20 17:01:50 2023 -0800

    Nonced CSP Support (#998)

    * Add nonce to CSP in browser agent

    * Adjust nonce position

    * Add testing for browser timing nonces
  • Loading branch information
TimPansino committed Jan 5, 2024
1 parent 6b3a0d3 commit 7322d9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion newrelic/api/asgi_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def should_insert_html(self, headers):
content_type = None

for header_name, header_value in headers:
# assume header names are lower cased in accordance with ASGI spec
# ASGI spec (https://asgi.readthedocs.io/en/latest/specs/www.html#http) states
# header names should be lower cased, but not required
header_name = header_name.lower()
if header_name == b"content-type":
content_type = header_value
elif header_name == b"content-encoding":
Expand Down
7 changes: 7 additions & 0 deletions newrelic/api/web_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ def _encode_nonce(nonce):
return ' nonce="%s"' % ensure_str(nonce) # Extra space intentional


def _encode_nonce(nonce):
if not nonce:
return ""
else:
return ' nonce="%s"' % ensure_str(nonce) # Extra space intentional


class WebTransaction(Transaction):
unicode_error_reported = False
QUEUE_TIME_HEADERS = ("x-request-start", "x-queue-start")
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ envlist =
kafka-messagebroker_kafkapython-{py27,py38}-kafkapython{020001,020000},
kafka-messagebroker_kafkapython-{pypy27,py27,py37,py38,pypy38}-kafkapythonlatest,
memcached-datastore_bmemcached-{pypy27,py27,py37,py38,py39,py310,py311,py312}-memcached030,
memcached-datastore_memcache-{py27,py37,py38,py39,py310,py311,py312,pypy27,pypy38}-memcached01,
memcached-datastore_memcache-{py37,py38,py39,py310,py311,py312,pypy38}-memcached01,
memcached-datastore_pylibmc-{py27,py37},
memcached-datastore_pymemcache-{py27,py37,py38,py39,py310,py311,py312,pypy27,pypy38},
mongodb-datastore_pymongo-{py27,py37,py38,py39,py310,py311,py312,pypy27}-pymongo03,
Expand Down Expand Up @@ -174,7 +174,8 @@ deps =
adapter_gunicorn-aiohttp03-py312: aiohttp==3.9.0rc0
adapter_gunicorn-gunicorn19: gunicorn<20
adapter_gunicorn-gunicornlatest: gunicorn
adapter_hypercorn-hypercornlatest: hypercorn
; Temporarily pinned. Needs to be addressed
adapter_hypercorn-hypercornlatest: hypercorn<0.16
adapter_hypercorn-hypercorn0013: hypercorn<0.14
adapter_hypercorn-hypercorn0012: hypercorn<0.13
adapter_hypercorn-hypercorn0011: hypercorn<0.12
Expand Down

0 comments on commit 7322d9a

Please sign in to comment.