File tree 2 files changed +6
-8
lines changed
httpbin/localstack_httpbin
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
2
from typing import Optional
3
3
4
- from localstack import config , constants
4
+ from localstack import config
5
5
from localstack .config import get_edge_url
6
6
from localstack .extensions .api import Extension , http
7
7
from localstack .utils .net import get_free_tcp_port
8
+ from localstack .utils .urls import localstack_host
8
9
9
10
from localstack_httpbin .server import HttpbinServer
10
11
@@ -28,15 +29,13 @@ def on_extension_load(self):
28
29
29
30
def on_platform_start (self ):
30
31
from localstack_httpbin .vendor .httpbin import core
31
- core .template ['host' ] = f"{ self .get_public_hostname ()} :{ config .get_edge_port_http ()} "
32
-
32
+ core .template ['host' ] = f"{ self .get_public_hostname ()} :{ localstack_host ().port } "
33
33
self .server = HttpbinServer (get_free_tcp_port ())
34
34
LOG .debug ("starting httpbin on %s" , self .server .url )
35
35
self .server .start ()
36
36
37
37
def get_public_hostname (self ) -> str :
38
- # FIXME: reconcile with LOCALSTACK_HOST, but this should be accessible via the host
39
- return f"{ self .hostname_prefix } { constants .LOCALHOST_HOSTNAME } "
38
+ return f"{ self .hostname_prefix } { localstack_host ().host } "
40
39
41
40
def on_platform_ready (self ):
42
41
LOG .info ("Serving httpbin on %s" , get_edge_url (localstack_hostname = self .get_public_hostname ()))
Original file line number Diff line number Diff line change 13
13
import time
14
14
import os
15
15
from hashlib import md5 , sha256 , sha512
16
- from werkzeug .http import parse_authorization_header
17
- from werkzeug .datastructures import WWWAuthenticate
16
+ from werkzeug .datastructures import WWWAuthenticate , Authorization
18
17
19
18
from flask import request , make_response
20
19
from six .moves .urllib .parse import urlparse , urlunparse
@@ -356,7 +355,7 @@ def check_digest_auth(user, passwd):
356
355
"""Check user authentication using HTTP Digest auth"""
357
356
358
357
if request .headers .get ('Authorization' ):
359
- credentials = parse_authorization_header (request .headers .get ('Authorization' ))
358
+ credentials = Authorization . from_header (request .headers .get ('Authorization' ))
360
359
if not credentials :
361
360
return
362
361
request_uri = request .script_root + request .path
You can’t perform that action at this time.
0 commit comments